by Malcolm Rowe



As Matthew’s been telling me — almost every day, it seems! — this blog ≅ a tumbleweed lately. There are three primary reasons for that: one is work-related (I’ve been busy) and the other two are, well, slightly more important. And while it looks like Matthew’s been trying to make up for my slack himself (with posts on everything from C++ function overloading to DHCP debugging via BBC BASIC’s tokenised file format — good stuff!), the lack of content here is something I’d like to improve.

So here’s a small collection of ‘microposts’: things I’d like to have expanded upon had I had the time.


I’ve finally got around to properly trying to learn Python, after years of cargo-culting around with the Subversion test suite. I’ve been playing with Mark Pilgrim’s Universal Feed Parser and being amazed at how simple everything is.

For example: Parse a feed, sort the entries by ascending published date, then print out the latest five titles:

$ python
>>> import feedparser
>>> d = feedparser.parse("http://googleblog.blogspot.com/atom.xml")
>>> d.entries.sort(key=lambda o: o.published_parsed)
>>> [e.title for e in d.entries[-5:]]
[u'The CNN/YouTube Republican Debate',
u'Google Gadgets on your Dashboard',
u"Who's going to win the spectrum auction? Consumers.",
u'Tracking Santa, then and now',
u'Gmail <3 AIM']

It’s notable just how readable the result is. Okay, so you need to know about lambda functions and negative array indexing to get the complete picture, but it sure beats Perl’s “write-only” reputation by a mile.

Also, I always listen to advice from xkcd.

Indistinguishable from magic

I’m somewhat late with this, but the cell-tower-identification enabled version of Google Maps for Mobile was released last Wednesday (see the blog post). This allows you to find your approximate location by looking at the closest cell tower. Contrary to what some people are suggesting, I don’t think it’s doing anything as fancy as triangulation (or more correctly, trilateration), since at least on Windows Mobile, the obvious-looking function only returns information about the closest cell-tower.

Also, if I look at the Help⇒About menu option at work (on my Symbian phone), I see a line that reads myL: 234:30:1002:196739201. I’m fairly sure this is the GSM Cell Global Identifier (CGI) for my local cell — “234:30” is the Mobile Country Code / Mobile Network Code for T-Mobile UK, according to Wikipedia’s list of Mobile Network Codes, and I’m guessing that 1002 is the Location Area Code and the long number is the Cell Identity, as described in an old (1998) diploma I found (“A method for implementing Mobile Station Location in GSM”, by Svein Yngvar Willassen).

Location by cell tower is better than GPS because it doesn’t take any extra battery power, and because the time taken to do the lookup is a function of how quickly a server can lookup the location from the cell id rather than how quickly it takes to complete a GPS lock (usually at least 30 seconds in perfect conditions, if it’s less than five hours since the last fix, because of the need to identify and download ephemeris data from at least four satellites).

The downside, of course, is that the accuracy is much more limited — in my experience typically around 500 metres versus GPS’s 15. But for most purposes, that’ll do. What’s going to really help is the introduction of more phones supporting — and providing APIs for! — operator-assisted GPS (AGPS), where the phone and operator can collude to determine the phone’s location, based on a combination of cell-tower information and GPS data received by both parties.

Wikipedia has a good summary of AGPS, and there’s an article in GPS World that goes into more detail about one particular implementation.


While I haven’t been posting much here, I have been sharing interesting-looking posts via Google Reader, mostly because it’s so easy to do — even if I’m reading on a phone (now, if only I could add a comment when I shared an item…). I’m not going to list out everything again, but if you haven’t already seen these posts, I’d recommend taking a look:

Finally, I’d suggest reading everything on Stephen Fry’s blog.