Goodbye to Seattle

On March 10th, the day after my last day at Microsoft, I threw a party to celebrate all the good times I’ve had and people I’ve met over five great years in Seattle.
I’ve still got a lot more to say about Seattle, Microsoft, the last 5 years and the next 25 but for now I just wanted to get the photo album out there. As usual, the photos don’t really do the party justice. I was too busy having fun to take many photos.
To everyone who made it, thanks for coming! Take care and I hope to see you soon.

Goodbye to Seattle

Big Changes

Today, I did something crazy.
I announced that I’m leaving my job, a job that I really like and that others would kill to have, a job with a great team on a project I enjoy and helped start, a job for which I am well compensated and at a company that is probably unmatched in its ability to take on these kinds of hard problems. Who would do such a thing?

Even if every step of a path feels good, it’s important to pause every once in a while and look at where it leads and understand if that’s really where you want to be headed. Much as I love my job day-to-day, I look forward five or ten years and I think that there are some things I’d like to do in my life that my current path is not equipping me for. So, scary as it is, I’m stepping off this path and choosing a new one, even if the destination of the new path is much less clear than the old one and there are no guarantees that I’ll be happier with where it leads.
I’m taking six months off to travel and see the world and then in the fall I’m moving to Boston where I’ll be attending Harvard Business School to get an MBA. There are plenty of people telling me I’m crazy and they absolutely have a point. But I’ve thought about this long and hard and I believe in both following your dream and putting your money where your mouth is so I’ve decided to do both.

I’m trying to say my goodbyes privately, but if I miss you somehow, let me say it here. It’s been an amazing five years in Seattle and four years at Microsoft.  I lived in Seattle from the ages of 26-31 – some pretty critical years as far as figuring out who you are and what you want out of life and the people I’ve spent time with have changed me profoundly. I’ve grown to love this city in a way that I never suspected I would; so much so that I certainly wouldn’t rule out moving back here if the circumstances are right. So not goodbye then, but à bientôt.

Computing distances with Lat/Lon

Have you ever wanted to compute distances with latitude and longitude? At first it seems so simple. We all learned the pythagorean theorem in elementary school:
d=sqrt((x2 – x1)^2 + (y2 – y1)^2)
So if we have our two points (x1,y1) and (x2,y2) then we should be able to find (x2-x1,y2-y1) and find the distance using the Pythagorean theorem, right? Well, no.

The Pythagorean theorem finds the straight line distance between two points. However, for two points any appreciable distance from each other on earth, trying to get to your destination would involve a lot of digging. Assuming you want to travel overland, you must travel further than the linear distance to account for the curvature of the Earth.

A little further research yields the Haversine Formula which is useful for computing surface distances on a sphere and correctly accounts for points that are very close together:

Haversine Formula (from R.W. Sinnott, “Virtues of the Haversine”, Sky and Telescope, vol. 68, no. 2, 1984, p. 159):

dlon = lon2 – lon1
dlat = lat2 – lat1
a = sin2(dlat/2) + cos(lat1) * cos(lat2) * sin2(dlon/2)
c = 2 * arcsin(min(1,sqrt(a)))
d = R * c

But what is R, the radius of the Earth?

It turns out the Earth is not a sphere after all. The spinning motion compresses the planet so that the equitorial radius is considerably larger than the polar radius. The shape of the Earth is well approximated by an oblate spheroid with a polar radius of 6357 km and an equatorial radius of 6378 km.

R’ = a * (1 – e2) / (1 – e2 * sin2(lat))^(3/2)

where a is the equatorial radius, b is the polar radius, and
e is the eccentricity of the ellipsoid = (1 – b2/a2)^(1/2).

Wow! So there you have it.

Of course if you’re trying to compute these values in client side javascript, it may take a while. It turns out that for short-ish distances at latitutudes within the continental United States, just pretending the Earth is a sphere yields errors of roughly 20 meters. That’s good enough for me..

(All from Google and )

KML in Google Maps and the challenge of standards

The Google Maps API is generally a pleasure to work with. After more or less inventing the whole Web 2.0 thing, the people behind Google Maps have continued to innovate, recently adding a Geocoder to their API, allowing address information to be translated into coordinates in Latitude and Longitude. Naturally having this information expands considerably the number of things you can do with Google Maps. Even better, it doesn’t just return Coordinates for an address, it “normalizes” a query and returns the address in a structured way.
There’s no doubt that creating a global XML standard for addresses must have been a challenging thing to try and do. Some countries use street names in addresses others do not. Some nations use island names, others have no islands. Some (like America) has county names but do not use them in addresses. So Kudos to OASIS for creating a standard called xAL and kudos to Google for trying to use it in their Google Maps API. Unfortunately, the devil is always in the details.

Continue reading

The world needs only five computers

C|Net hosts an interesting interview with Greg Papadopoulos, CTO of Sun, where he articulates the Sun argument that there will only be a small number of companies in the world that can achieve the scale and efficiency of data center operations to compete and that everybody else will get squeezed out. I think this basic premise is correct – certainly running a huge datacenter is hard and expensive. Google has done better than anyone else at making the complements of good software – CPU time, disk space, bandwidth and programmer hours – relatively cheap and easier to deploy than any of their competitors. That superior execution is throwing off dividends.

Other software companies must look at that scale and infrastructure cost and be struck by a combination of jealousy and fear. Certainly Microsoft is and it’s started serious investment around datacenter scale.

While Google, Microsoft,, Sun, and Amazon are all attempting to build the common platform that everybody writes their apps against, Amazon’s EC2 effort has some uniquely interesting attributes not mentioned in the article: While and Sun both make you write code to their proprietary API (and Google and Microsoft won’t run your code at all) Amazon sells access to their grid the “CPU Hour” where the “API” is just a bootable linux disk image. As a potential consumer of these services, this is immensely attractive to me. Much as Open Source software gives me the at-least-conceptual threat that I might take my existing software to another vendor, Amazon’s design gives me confidence that if they ever get too pricey or just go away entirely, I can always go throw my own boxes into a datacenter and run the machines myself. Who wants to make the same bet that the Sun API or Salesforce API will still be around in 5 years or they won’t jack up the prices? What’s in it for Amazon? Amazon gets to achieve scale on the backs of other people’s companies, driving down prices for their own needs.
Of course a raw Linux disk image is a pretty primitive construct to start building massively parallel and reliable systems. Code needs to be written to decide when to spool up new CPUs, for splitting and joining work like Google’s MapReduce and so on. This seems like some complementary software that Amazon should write to spur adoption of EC2.

Google Maps style UX comes to Leopard

At the WWDC last summer, Steve Jobs made a big deal about how he was keeping a few features in the next release of OS X (Leopard) secret because he didn’t want the folks in Redmond (ahem) to “start their photocopiers too early”. Although the whole photocopiers angle is an obvious jab (and not even plausibly realistic) I do think there are some interesting features that still haven’t been announced in Leopard.  There’s been a fair bit of speculation as to what Steve Jobs still has up his sleeves, but to my eye, nobody has quite nailed it.

I think the well known work to make OS X resolution independent will be applied to creating a “google maps style” interface for the desktop UX. Imagine a desktop that is a variable number of pixels across. Dragging a window so that it sits partially offscreen causes the viewport to smoothly zoom out and everything is visible, just scaled down. In this context, Expose is just a zoom out, instead of tiling programs in a flat grid with no relation to how they were laid out on screen. Naturally you can zoom in too or do the google-eque “drag” which is really just panning the viewport across a large area.

What’s my reasoning?

  • It just makes sense as a feature. You’ve always got more stuff running than you can deal with. It is much more natural and makes a hell of a lot more sense than multiple desktops, spinning cubes or Flip 3D
  • This feature doesn’t affect developers lives at all. They don’t even need to know about it so keeping it secret is possible.
  • It is indeed difficult for others to copy. Nobody else has done the resolution independence work that Apple has. (512*512 icons? Wow.)
  • It can have some super snazzy sounding name which Jobs loves so much. Time Travel?

I’ve read a fair number of the Apple blogs and haven’t seen this prediction anywhere else, but I’m not a regular so it’s possible I’ve missed something obvious. Personally I’m going to be shelling down for a new Vista laptop with a snazzy SideShow display, but I’m definitely pretty impressed by the Apple stuff.

The Dilbert Blog: Atheists: The New Gays

The always insightful Scott Adams has a hillarious new blog post: Atheists: The New Gays

While I think many Atheists have an unfortunate tendency to be evangelical about their non-belief, I do think that recent events have made atheism more publicly acceptable in America than ever, even if it’s unfortunate that it’s at the expense of Muslims. I personally very much doubt that Bill Gates will ever run for president and I think it would be easy to go overboard with the “Billionaire as benevolent dictator” meme. Think, what if it were Larry Ellison?

Election Hangover

It’s 6am the morning after the election and the democrats have done it. They’ve taken control of the house and the Senate is still up for grabs. Montana and Virginia are too close to call. If the democrats take both of those, they’ll have control of the Senate too, 51:49.
While I’m very pleased with this result, I’m afraid that the Democrats will get the wrong message, that the people of America somehow voted for them. They did not. This election was about turfing out the incumbents and the Democrats were the available alternative. The Republicans are smart. They will re-think and re-tool and in 2008 they will be back with a vengeance. If the Democrats don’t have an actual leadership plan (as opposed to just opposing the Republicans) all those hard fought gains will be lost.

I was pretty inspired by the speech Arnold Schwarzennegger gave at the 2004 Republican convention where he described why he is a Republican and why he thought everyone else should be too. The funny thing is I can imagine how if your initiation to politics is watching Jimmy Carter vs. Ronald Reagan, you’d make that decision too.

The Democrats need to decide the list of things they’re for and then be behind those things even if it means siding with Republicans.
I see three key areas that matter to me. The party that is for these things is the party I will vote for:

  1. Fair, Reality-Based and Success-Driven
  2. Socially Non-Interfering
  3. Sustainable

Continue reading

The joys of screenscraping

A while back, I ran across a great HackDiary entry extolling the virtues of using TagSoup and XPATH to do screenscraping from the web. TagSoup is a library that coerces all the ugly nasty HTML you find out in the wild into well-formed (although not necessarily valid) XML. While there’s no guarantee that the results are semantically the same as the input, it lets you use all your nice XML tools like XPATH to extract data. The entry does a great job of showing you how to use TagSoup with Xalan. However, the JDK has been updated with it’s own XPATH parser so it’s no longer necessary to import the Xalan library. Below is a code sample for using TagSoup and the default XPATH parser to retrieve the stock price of Google from Google Finance. Note that the whole “MutableNamespaceContext” implementation is just a workaround for a missing JDK method as documented in JDK Bug 5101859. If that bug gets fixed, the code could be simplified substantially.

The usual disclaimers apply about this all being sample quality code. All error handling has been punted to keep the example length short, but you’d never really want to do that. Also, I’m having trouble preserving indenting in this HTML View, I’ll work on that. This code assumes JDK 1.5. Click through for the code itself.

Does this code support the argument that Java is WAY too verbose? Absolutely.
Continue reading