XML+XQuery+Google Voice+Python=WIN!

Volume 12, Issue 27; 01 Sep 2009; last modified 08 Oct 2010

It's finally possible to put all the pieces together.

I've been storing my PIM data (contacts, appointments, etc.) in XML for ages (and I do mean ages!). Since my Palm days, I've been translating whatever native format my PIM supports into XML. Where necessary (i.e. everywhere), I've used an RDF/N3-like annotation mechanism to support additional metadata.

For example, the “notes” field for the XProc telcon looks like this:

p:class telcon
p:access public
p:phone #w3c-zakim
p:code 97762#

That gets parsed into the obvious XML by the conversion process:


(The phone number “#w3c-zakim” means that there's an entry in my address book with the ID “w3c-zakim”. Why do none of the PIM applications understand that appointments and contacts are related!?)

I've been doing this for years because it's The Right Thing™, even though I've only been able to wring small (er, tiny, perhaps miniscule) amounts of practical value from it.

But no more!

The XML data is stored in my own MarkLogic Server instance (moving from a collection of Perl hacks to the server was one of my first personal projects after I joined Mark Logic). I now have a Google Voice number. And Scott Hillman’s Python scripts finally let me connect all the dotsWell, technically, reconnect, but for all it's coolness, I never got much use out of the DTMF auto dialer. !

A little Python hacking, a quick XQuery module, and I can make calls from a shell window.

$ call xproc
W3C XProc WG
+1-617-761-6200 97762#

Dialing +1-617-761-6200...

The call query searches both the appointments on today's calendar and the address book. That means “call seth” works equally well, and calls my boss. For contacts with more than one phone number, I can add “-phone” on the end: “call ndw@nwalsh.com -home” would call me at home, should I ever want to do that.

It's a tiny little thing, but it feels great.

I'm easily amused, I know.

Hmm. I should add an option to send SMS messages, too…


Offtopic: Y'know, the white title is hard to read against the background of sky. You might want to adjust title colors based on the background image.

—Posted by John Cowan on 01 Sep 2009 @ 03:56 UTC #