Geocoded Autocomplete Using jQuery UI 1.8 and Google Maps v3

I’ve spent the last few days wrestling with building a custom geocoder using Google map data. I wanted something that would extend the native autocomplete functionality in the new jQuery UI library.

I’ve never written a jQuery plugin before and first I tried to learn by deconstruction. Since I just recently started programming Javascript again (after not touching it for 4 years), this was a pretty painful process. I finally had the good sense to find a simple jQuery plugin tutorial.  That made things a lot easier and helped me understand how the basic template architecture works.

Most of the geocoding plugins I found either used the Google Maps API v2 or used the old deprecated jQuery autocomplete plugin.  Also, I really wanted a live map in the actual autocomplete widget so that users can visually confirm that the address they’re about to select is indeed that address that they want.  The closest solution I found offered Google geocoded results, but the map was not part of the drop down menu.  I ended up using this as inspiration for my own version.

The plugin is completely customizable through CSS.  It’ll take any string that you give it and return Google geocoded data.  The map in the suggestion menu updates as you scroll over the suggestions.  Check out the demo and get the source code on github.

Deconstructing Amazon

I’ve always admired Amazon.com as a pioneering company. Not only did Jeff Bezos create the best e-commerce experience on the planet, he also had the audacity to transform Amazon’s infrastructure into a platform that is used by nearly every start up I’ve encountered.

Recently I came across Jeff’s 1997 letter to shareholders.  I’m particularly impressed by how Jeff managed to firmly set expectations while also framing Amazon’s business as something more than just selling books.

I thought it would be fun to deconstruct a few key passages. Here goes…

“Amazon.com passed many milestones in 1997: by year-end, we had served more than 1.5 million customers, yielding 838% revenue growth to $147.8 million, and extended our market leadership despite aggressive competitive entry.”

WOW.  That’s a hell of a way to start any message.

“But this is Day 1 for the Internet and, if we execute well, for Amazon.com. Today, online commerce saves customers money and precious time. Tomorrow, through personalization, online commerce will accelerate the very process of discovery. Amazon.com uses the Internet to create real value for its customers and, by doing so, hopes to create an enduring franchise, even in established and large markets.”

This is one of the most interesting paragraphs in the document.  He’s not talking about selling books.  He’s selling a vision: Amazon.com will change the face of online commerce by helping you automatically discover the things you want. He’s framing the company’s purpose as something much more than just selling product.

“We first measure ourselves in terms of the metrics most indicative of our market leadership: customer and revenue growth, the degree to which our customers continue to purchase from us on a repeat basis, and the strength of our brand.”

Clearly articulating the baseline metrics by which to measure their success.  This is key if they’re making decisions at the expense of short term revenue.  For example, free shipping on orders over $25 might impact short term revenue, but leads to an increase in returning customers and a stronger brand.

“Because of our emphasis on the long term, we may make decisions and weigh tradeoffs differently than some companies. Accordingly, we want to share with you our fundamental management and decision-making approach so that you, our shareholders, may confirm that it is consistent with your investment philosophy.”

This might be my favorite line in the whole letter.  He’s very politely telling investors, “Hey, if you’re not interested in the way we do things, take your money elsewhere.”  Not only does this put him in a position of psychological dominance, it actually serves to increase the desirability of the investment.  If someone doesn’t need your money, you probably what to invest that much more.

“We will continue to make investment decisions in light of long-term market leadership considerations rather than short-term profitability considerations or short-term Wall Street reactions.”

Just in case you didn’t get the message: Wall Street, I’m talking to you.

“We will continue to measure our programs and the effectiveness of our investments analytically, to jettison those that do not provide acceptable returns, and to step up our investment in those that work best. We will continue to learn from both our successes and our failures.”

We have a process for this madness.  Even if we look like we’re failing, we’re scientifically figuring out what works and what doesn’t.

“We will make bold rather than timid investment decisions where we see a sufficient probability of gaining market leadership advantages. Some of these investments will pay off, others will not, and we will have learned another valuable lesson in either case.”

We’re going to make mistakes that will lose money, but we’ll learn a lot in the process.

“When forced to choose between optimizing the appearance of our GAAP accounting and maximizing the present value of future cash flows, we’ll take the cash flows.”

Hello Wall Street.

“We set out to offer customers something they simply could not get any other way, and began serving them with books. We brought them much more selection than was possible in a physical store (our store would now occupy 6 football fields), and presented it in a useful, easy-to- search, and easy-to-browse format in a store open 365 days a year, 24 hours a day.”

Extremely clear value proposition.  Also, hints that selling books is only the beginning.

“It’s not easy to work here (when I interview people I tell them, ‘You can work long, hard, or smart, but at Amazon.com you can’t choose two out of three’), but we are working to build something important, something that matters to our customers, something that we can all tell our grandchildren about. Such things aren’t meant to be easy. We are incredibly fortunate to have this group of dedicated employees whose sacrifices and passion build Amazon.com.”

This is about more than just selling books.  Amazon is building an amazing team to build an amazing service that makes a difference in other people’s lives and that employees will want to tell their grandchildren about.  Wow.