Author: Will

  • Add My Location in 4 Lines

    I’ve started using twitter as a very easy way to update this site, and since it integrates well with my iPhone I wanted to show off another cool feature. [Twitterific](http://iconfactory.com/software/twitterrific) Provides a feature to change your twitter location to that of your iphone. From this base, it becomes very easy to add a map showing your location.

    Requirements:

    • iPhone with twitterific
    • Twitter Account
    • Google Maps API Key ([free here](http://code.google.com/apis/maps/signup.html))

    See the Full Script

    Line one:

    $status = simplexml_load_file(“http://twitter.com/statuses/user_timeline/[userid].xml”);

    where [userid] is your twitter userid.
    This Line downloads and parses your recent tweets. The xml format serialized by twitter also includes your current location

    Line two:

    $loc = str_replace(“iPhone: “,””,$status->status[0]->user->location);

    This line extracts the location coordinates from the twitter response.

    Line three:

    $map = “http://maps.google.com/staticmap?center=”.$loc.
    “&zoom=15&size=300×250&format=jpg&key=[key]”;

    where [key] is your google maps api key.
    This is where you can fiddle around with the map to display. Google has an interactive [wizard](http://gmaps-samples.googlecode.com/svn/trunk/simplewizard/makestaticmap.html) to let you configure your options.

    Line four:

    imagejpeg(imagecreatefromjpeg($map),”loc.jpg”);

    this line saves the map locally, so you can serve it from your own server and keep it cached. Additionally you can add overlays or manipulate the image before saving.

    Some examples of what’s possible:

    ![Example 1](/twitterloc/example1.gif)
    ![Example 2](/twitterloc/example2.gif)

  • Project Ideas

    * IMDB API (Using SOAP). The only existing allows searching only a fraction of the database.
    * Songbird interfaced Web-Based Music Library. Allowing for quick access to a remote library, with last.fm support. Need to allow for playlists as the cake-icing.
    * Smart Ubiquity plugins for music and movie titles (the challenge is in natural language processing to determine what is a title)
    * Decent Course Scheduling Application. (to be useful, a significant amount of natural language is needed here to spider and parse a college catalog, which will vary in format, be password protected, and span multiple pages.)

  • New Blog

    In preparation for my upcoming travels, I am reviving this blog using a new interface which will actively combine many of my online presences. If all goes well, I’ll be quite happy.