Redesign

21 December 2011

I recently redesigned this site with the primary goal of improving my photography portfolio. If you don’t care about web dev you can stop reading now and just go take a look at the photos. Let me know what you think.

Ok, so here are some tech notes on the implementation, though this is all pretty standard these days.

For the photos page I wanted to make use of the HTML5 History APIs. But rather than make the photo page standalone I decided to “Ajaxify” the whole site. The site dynamically loads content, avoiding full page loads, using similar patterns to the ones we employed in Gmail and Google+.

If you navigate directly to a certain page it will be rendered on the server. Once the page has loaded, the JavaScript will listen for clicks, intercept any links that can be handled client side, request the page contents via an XMLHttpRequest, update the UI, and change the browser location using history.pushState. For all pages except the photos page, the XHR simply requests the page with ?mode=body which tells the sever not to render the chrome.

This was made simpler by the fact that I’d already written a small library (Surface) that does all the heavy lifting and simplifies the management of single-page applications. The trickiest part was getting WordPress to work properly and unfortunately meant changes that will need to be reintegrated after every WordPress update.

The photos page is all rendered client-side and simply requests the photo data from the server. The photos are stored on Flickr and I actually use the Flickr API to get the list of photos for each album rather than hard coding them.

The top navigation uses Raleway from the Google Web Fonts archive.

The site works best in the latest Chrome and Firefox builds, but IE degrades to using full page navigations, though the photos page only works in IE9+.

Flixtractr

6 November 2011

If you look at my stream over on Google+, you may notice that I’ve been uploading a bunch of old photos recently.  They were all previously on Flickr, and while I plan to continue uploading single photos there, I prefer G+ as a venue for albums of photos.

The transition across wasn’t as simple as I would have liked.  Even though I keep a backup of all my photos, I haven’t been good about keeping titles, meta-data, and sets in sync over the years.  So I wanted a way to download a set of photos from Flickr and re-upload elsewhere.  There were a few existing ways to do this, but they were either hacky scripts, installable apps, or required plug-ins.  I wanted something web based.  So in the end I wrote my own tool.

The result is Flixtractr, a little web app for downloading sets of photos from Flickr as a zip file.

Since the original photos can end off being quite large doing the zip building server side would have required a large amount of transient storage for any moderate number of concurrent users.  I decided instead to build the zip on the client.  I tried several different paths, but ended off using the new Blob and BlobBuilder APIs available in the latest builds of Chrome and Firefox.

Using Chrome 16 I’ve managed to generate a 650MB zip file containing a set of 97-photos ranging in size from 3MB to 11MB (some older versions of Chrome are known to crash when the zip exceeds 128MB).  I’d probably recommend you avoid such big sets though :)

If you try it, let me know how it goes.  If there are problems or you have feature requests, post about it on the Google Group.

[Update: if Flickr says "oops" when you try to connect. Wait about 15s then refresh the flickr page. There seem to be some reasonably wide-spread problems with Flickr OAuth. There's a thread on the Flickr API group discussing the problem.]

PHP-Closure

26 February 2010

At the beginning of 2006 Erik and I started a 20% project to write a JS library for Google. Today it is used by many projects within Google and was recently open sourced.

On its own, the Closure Library isn’t very compelling for the average web developer. The dynamic loading is intended for unit tests and development, and using it in production would cause users to download masses of unused code.

Luckily for us, the Closure Compiler was open sourced at the same time. The compiler knows about a lot of the idioms used in the Closure Library and does a really good job of removing dead code and optimizing what remains. The team also launched a web service with a RESTful API so you don’t even have to run the compiler yourself.

Even with the web service, the development-debug cycle isn’t ideal. So when I found myself wanting to use some of the Closure Library for my new photo site I hacked together a PHP class that provides a convenient interface to the compiler web service, caches the optimized code, and recompiles when the sources have changed. Pretty basic, but quite useful I think.

I know PHP is looked down upon by many programmers, but it is easy, convenient, and widely available. If you have a PHP based site and want to use the Closure Library and/or the Compiler, it might be worth heading over to the project page and seeing if it might be useful.

[php-closure]

GeoTrace

7 May 2007

Post-Cinco-de-Mayo-tequilla-hangover == no skydiving. Instead I knocked together a little experiment for a geographical traceroute. Not polished or well coded.

Now with XML

14 November 2005

I’ve been meaning to add XML feeds for a while now, but was prompted recently by people at work to finally do it.

You can now get a feed for my log and also feeds for my photos (in ATOM format). The photos feed supports filtering, so for example you could get a feed for my latest travel photos or a feed with only photos of San Francisco.

For the non-techy people reading this: XML feeds such as these are used by third-party websites and applications to bring together content from multiple sources such as news sites and weblogs. This allows users to easily find posts and entries from all the sites they are interested in. Example services are Blog Lines and Google Reader.

Site Changes

11 October 2005

I thought it was about time I updated this site, so over the next few days I’ll be making some changes. If you have any comments or spot any problems let me know.