this is aaronland

mostly plumbing

Snakes on a Plane

In August 2006, I was asked to do a lunchtime talk about the work I had been doing developing Series60 applications for Nokia phones.

from java import acronyms

  • If it's smaller than your laptop
  • And more powerful than a calculator
  • And going to ship with an interpreted language
  • It will probably be Python.

Series 60 Python awesomeness

  • It speaks PIM
  • It speaks Internets
  • That includes Bluetooth and GSM
  • And SSL
  • It speaks camera
  • Racoon (aka mod_python)

Series 60 Python suckage

  • No built-in XML classes
  • Threading is basically useless
  • Debugging hurts
  • Incomplete content handler support
  • Symbian 9 security model (hates freedom)

An example : Is there anybody out there?

import httplib
import urllib
import location
from elementtree.ElementTree import XML
from pdis.xpath import compile

(mcc, mcc, lac, cellid) = location.gsm_location()

params = {'cellid':cellid, 'lac':lac, 'mnc':mnc, 'mcc':mcc, 'usertoken':usertoken, 'apptoken':apptoken, 'results':results}
url    = "%s?%s" % (zonetag_endpoint, urllib.urlencode(params))

conn = httplib.HTTPConnection(zonetag_host)
conn.request('GET', url)
res = conn.getresponse()
xml = XML(res.read())

xp = compile("/rsp/Location")
results = []

for loc in xp.evaluate(xml) :
    data = {}
    
    if loc.find('Zipcode') != None :

        for item in ['Country', 'State', 'City', 'Zipcode'] :
            value = loc.find(item)
            data[item.lower()] = value.text

        results.append(data)

An example : Where am I?

for place in results :
    addr = "%s %s %s %s" % (place['city'], place['state'], place['country'], place['zipcode'])

    params = urllib.urlencode({"appid":"restobook", "location":addr})
    req    = "%s?%s" % (geocoder_endpoint, params)

    conn = httplib.HTTPConnection(geocoder_host)
    conn.request('GET', req)
    
    res = conn.getresponse()
    content = res.read()

    xml = XML(content)
    res = xml.find("{urn:yahoo:maps}Result")

    if res != None :
        lat = res.find("{urn:yahoo:maps}Latitude")
        lon = res.find("{urn:yahoo:maps}Longitude")    

        print "lat: %s long: %s" % (lat.text, lon.text)

nwtracker

Fladdressbook

  • Fetch and merge Flickr account data for an address book contact.
  • Mostly plumbing for other more interesting applications.

Restobook

  • Fetch and merge del.icio.us links tagged restobook with your address book.
  • Bare bones posting and local search.
  • More plumbing.

Restobook

Upcalendar

  • Sync your upcoming watchlist with your calendar.
  • Yes, you could also use .ics files — if that's all you wanted to do.

Why?

  • Because the address book is still the center of everything.
  • The network will never be always on.
  • Information wants to be fre... in your pocket.