Right Here. RightNahoo!
Over the weekend, some of the Realmac team (Dan, Nik, Danny and Keith) headed up to London for Yahoo's OpenHackLondon event. The idea is to show up on Saturday morning, learn about some Yahoo technologies and APIs (such as Maps, Flickr and Fire Eagle) and then spend 24 hours hacking on something related to the APIs which you then demo to a panel of judges on Sunday afternoon.
This was the first time that any of us attended a Hackday, however we're super pleased with our hack: a location-aware desktop application that uses a tonne of APIs to show information near you. One of our goals was to have our 'location browser' available as a download shortly after Hackday finished, so to accompany the release of an experimental build of the application, we've gone through the whole process of building RightYahoo, reflecting on our sleepless 24 hours of hacking to get the application written.

How did we dream up this idea up?
Right from the get-go we were keen to explore ways in which we could build something location aware on the desktop. On mobile devices, location awareness is a great way to improve the user experience: no longer do you need to tell an application where you are. But on the desktop location awareness is in its infancy. So we built an application that locates you and then displays relevant nearby information. Some of the sources are Yahoo! services such as Maps, Flickr and Upcoming, but we also threw in some others such as Last.fm (which has location-based APIs for Gigs) and a search using The Guardian's API to show news articles mentioning your location.
Let's Get Designing!
Whilst getting the data and displaying on screen is neat, we really wanted the application to have as much polish as we possibly could. Dan spent a significant amount of time mocking up the look and feel of the application, eventually coming up with this 'final' design of tabs across the bottom with the location bar taking the place of a URL field in a standard browser. Whilst the design may make the application look like all of the UI elements are done in a browser with javascript effects, this isn't the case. Once the Photoshop design document was finalised Danny and Keith got to work at building a native Cocoa application from it and didn't stop until noon on Sunday. (We're also making the design document available via our OpenHackLondon page).

How did we get the location data?
Use our application as a location browser and enter your address.
We translate human-readable addresses into raw GPS co-ordinates using Yahoo! Geoplanet (just to be sure) and then query services.
Yahoo! Fire Eagle
We had hoped to build in Fire Eagle support, but pulled it at the last minute as we simply ran out of time to ensure the application authenticated with the Fire Eagle servers. However. If Fire Eagle had made the cut, we'd have used your location on Fire Eagle (updated by the likes of Dopplr) and used it to find information.
The iPhone Shaker
Of course, the best way to get accurate GPS location data is to use a GPS-enabled device like the iPhone. So we wrote a tiny little application for the iPhone that uses Core Location to obtain a GPS fix. When the iPhone is shaken it broadcasts that location to the desktop application which is listening for the information using Bonjour. An animation shows that the iPhone's location has been received and then the application gets to work. (Fun fact: if you've got multiple copies of RightNahoo! running on the same network, they'll all receive the iPhone's shake notification and animate the map - something that entertained us a fair bit at 3am on Sunday morning!).
See Me In Action Right Nahoooooooo!
What do we do on the desktop?
Once RightNahoo! knows where you are and you select a service along the bottom of the window, that's when we go about doing lots of Cocoa goodness. We utilise the raw GPS co-ordinates depending on what service you are currently viewing as everything is loaded on the fly. Each service gets the latitude and longitude of our current, known position as a parameter to the API calls we use. Everything, that is, except the Guardian. As the Guardian's API does not have any form of location awareness we had to be a bit cleverer. We call the Flickr API to get the name of the nearest city/town for the latitude and longitude and then do a search on the Guardian API for that name. Limiting the date and sorting the results produces local news in that area.
What we do with this location-based data then differs slightly depending, again, on what you are viewing in the App. By default you are looking at the map view. The map itself is an image pulled from Yahoo! Maps' image tile API. Once we have the image we forward it to a Quartz Composition created by the Big Chief. This then applies a nice pulsating dot indicating your position.
For Flickr photos we use an IKImageBrowserView (like that used in LittleSnapper and iPhoto) to display the image thumbnails which we pull down from URLs provided to us by Flickr. We use NSOperationQueue and NSOperation to ensure all of this is done smoothly in the background to ensure it doesn't bother the user. For good measure we display a holding picture (of our gorgeous Flickr icon) while we are downloading each image.
Upcoming, LastFM and the Guardian all use a similar system. We parse the XML sent back to us from the APIs and change it into HTML. We then use a WebView to display it along with some fancy CSS and Javascript to make them look nice and fancy.
For the XML parsing we use XPath to quickly query the large amounts of XML that we receive from the web services. This hugely cut down the time it took for us to write XML parsing code. Development time happened to influence many decisions, as it would with a 24 deadline, including what we used each service for. Avoiding any authentication was our number one priority as it would mean a lot of additional code and design for our team to work through it also largely explains the feature set of the application.
Buzzword Fever
If you're curious, here's a list of all the technologies we're using: on the web side there's Yahoo! Maps, Yahoo! Geoplanet, Yahoo! Flickr, Yahoo! Upcoming, Last.fm, and The Guardian; on the desktop we're making use of Xpath, Bonjour, Core Location (on the iPhone), Quartz Composer, Image Kit, WebKit and Core Animation and XMPP. Excluding dependent frameworks and the like, RightNahoo! is about 6,000 lines of code - all of it written without sleep during our 24 hour hackathon!

Download the Application & Source
As mentioned above, we really wanted to get a downloadable application out for those brave enough to use it - and we're very pleased to make the application (and its source) available to everyone. You can get your hands RightNahoo! by downloading the desktop app. To download the source of both the desktop and iPhone app, visit our RightNahoo! webpage.
The released copy of RightNahoo! will have bugs, and is an entirely-unsupported experimental pre-beta build. We don't currently foresee any continued development of the application (at least, not as an official supported Realmac product) however the source is available to download under a Realmac Software BSD licence so you're free to use code from the application so long as you mention Realmac Software if you do so.
Check out the Photos
No Realmac event would be complete without some photos of Hackday, so be sure to check Flickr for photosets from both Dan and Nik.
