Archives for September 2007

Fun letter

I know someone that got a hand-written letter in blue ink that says:

Dear (name)
My name is David, my wife is Jennifer. We would like to buy your house at (address). Please call me @ 408-772-0507.

David Jan

My friend thought this was strange and did a Google search for 408-772-0507 and came across this page on David Jan. Several other people report getting similar notes. They speculate that it’s a property flipper looking for cheap houses without having to compete against other house buyers, because 4-5 other people mention that they’ve gotten these hand-written letters as well.

One difference is that the other earlier letter refers to “my assistant Jennifer” instead of “my wife Jennifer.” Did David Jan marry his assistant? Or maybe his wife is his assistant?

I like that Google can help with stuff like this. Someone gets a handwritten letter in the mail that sounds like a personal offer, but a quick search uncovers that this David Jan fellow has probably sent a bunch of these letters.

Useful Google feature: better date search

If you didn’t see this post about better date-based searching by Ionut Alex Chitu, I highly recommend that you check it out. As Google has gotten fresher, our advanced search page started showing more useful options for restricting searches by date. The shortest time frame used to be something like three months; now you can look for things that are less than 24 hours old.

What GoogleOS noticed is that the advanced date search affects a url parameter called “as_qdr” and Chitu figured out some of the possible values:

The nice thing is that you can change the value of as_qdr to custom intervals. Here are all the possible values of the as_qdr parameter:

d[number] – past number of days (e.g.: d10)
w[number] – past number of weeks
y[number] – past number of years

This little tweak is as handy as “&strip=1” on cache: queries and “&filter=0” on site: queries. Why? It’s an easy way to see new urls that Google has just discovered in the last few days.

For example, there’s been a lot of fast progress on iphone stuff recently. A query such as would show all the new urls for the query [iphone source code] within the last day, because d1 stands for 1 day.

Suppose you wanted to see all the new urls that Google found on your site within the last 7 days. For the domain, I’d use a query such as to find those urls (remember, “d” stands for days and “7” stands for, well, 7). Previously, you could check whether Google had indexed a new url by (say) searching for content from that url, so this isn’t completely new, but it still simplifies life for site owners.

I’m already using this parameter in my power searching all the time. If you need a way to remember the parameter name, I think of as_qdr as “advanced search — query date range,” although I haven’t checked if that’s what the letters actually stand for. 🙂

Back from Pennsylvania

I was out of town this weekend for my brother’s wedding. All went well and he’s now a happily married man. It ended up as a big family reunion, with the added bonus of cool, new relatives from the bride’s side of the family. 🙂

I’m trying to catch up, but apologies for not posting for a little while. I’ve also got 1-2 projects that I’m chugging on (more logistical than directly webspam), so expect lighter-than-average posting this month.

Google Reader adds search!

Google Reader just added search! Yay! Suppose you remembered that someone did a cool post comparing PageRank to Play-Doh. Just do a search and you’ll remember that it was Rhea writing on Search Engine Journal:

Search for play-doh

I’m going to be using Google Reader’s new search a lot. 🙂 What are some of the things you’ll do with Reader’s ability to search your feeds?

Hack your iPhone: toolchains and cross-compilers

The iPhone can run “web apps” very easily. These web apps are really just specially-crafted web pages that take advantage of the iPhone’s built-in web browser. Such web apps can be very cool, but they don’t provide the full functionality that you can get from an actual executable program running on the iPhone. A “native app” that runs on the iPhone can read the iPhone’s built-in accelerometer, for example.

So lots of people want to write independent/third-party native apps that run on the iPhone. The problem is that while Apple hasn’t squashed the development of native apps, they haven’t helped, either. For example, Apple hasn’t provided a toolchain to compile programs for the iPhone.

What is a toolchain?

Yeah, I know, it’s been I while since I had my compiler class too. Here’s a rough diagram of what happens when you compile source code into a program:

Compilation process: compiler to assembler to linker

Here’s the process as I recall it. You write code in high-level computer languages such as C, C++, or Objective-C. That gets piped through a compiler (“gcc” in this diagram), which creates assembly code targeted for a certain type of machine architecture such as Intel x86, PowerPC (PPC), or ARM. Most desktop machines, including newer Apple computers, use Intel or Intel-compatible chips. Older Apple computers use PowerPC chips. ARM chips are embedded in lots of popular consumer electronics devices (e.g. the iPod and iPhone).

Now you’ve got assembly code for a particular type of computer chip. That code is processed through an assembler (“as” in this diagram), which spits out actual machine code (also called “object code”) of zeros and ones. In some cases that code can be executed directly. However, usually you have multiple files of object code to combine, or you need to link in built-in functions from system libraries. A linker (“ld” in this diagram) pulls all the object code into one executable program that a user can run.

So what is a toolchain? Roughly, a toolchain is a set of programs that allow you to compile source code into a program. It can include the programs that I just mentioned, plus a host of other programs such as “make” or a debugger that make compiling programs easier.

What is a cross-compiler?

Look back at the diagram above. Typically someone on (say) a newer Apple computer would have an Intel chip inside. So gcc would output assembly code for an Intel chip, and that assembly code would eventually be transformed into an executable program that runs on a Intel chip. That lets you compile and run programs on your own computer.

But nothing in the diagram above says that you have to output assembly code for the same type of computer chip as the machine that you’re running. For example, an Intel-based Apple computer could translate source code into assembly code for an ARM-based machine architecture. That’s called “cross-compiling,” because you’re compiling your code across for a different type of chip.

Why would you want to cross-compile anything? Well, iPods and iPhones are based on ARM chips. Can you imagine trying to compile source code on one of those little devices? It would be a real pain. Cross-compiling solves that problem: you can compile code on a desktop machine for (say) the iPhone, then figure out how to copy your executable program over to the iPhone, and figure out some way to run your program.

What does this have to do with the iPhone?

It’s possible (but currently difficult) to make a working toolchain for Apple computers that cross-compiles code so that the iPhone can run it. Once you have a cross-compiling toolchain, you can write code that runs on the iPhone.

Unfortunately, Apple hasn’t provided any documentation on the application programming interface (API) or system libraries that would allow people to write native applications for the iPhone. Luckily, dedicated people have helped to produce not only a toolchain but also to fill in documentation on the system APIs that the iPhone supports. In the same way that Apple desktop machines have a framework called AppKit, the iPhone has a user-interface (UI) framework called UIKit.

More reading about toolchains/cross-compiling

If you dig deeper into nearly anything I just said about toolchains or cross-compiling, you’ll discover that it’s more complicated than I just laid out. For example, libraries of built-in system functions don’t have to be statically combined into a program. It’s possible to wait until the program is being loaded to execute before linking in a library. And so-called “binutils” provide lots of functionality other than compilation. For an overview of the compilation process, see the book Running Linux for a good description. To learn about linking vs. loading, I enjoyed this Linux Journal article. You can read more about GCC or binutils on the official GNU site. And of course Wikipedia provides a variety of strong articles about the GNU tool chain, linkers, and crosscompiling.