Civic Duty Alberta: 2008
I decided on a whim to vote in the provincial election yesterday.
The voting process was rather quaint; mark an X in the church basement and give your paper to the nice old lady. Edmonton-Strathcona is a University riding, so almost nobody at the polling station was registered (including myself) - students move too often.
I have little faith in representative democracy's ability to be either representative or democratic at the best of times. I have even less faith in it in this province, which has had the same party in power for the past 37 years.
Election results confirm my disaffection; another huge majority for the Progressive Conservative party. 88% of the seats with only 53% of the popular vote; first past the post is a marvellous thing. (I especially like the part where the people with the power to change the system have the most to gain from the status quo.)
The Wildrose Alliance came in (a distant) second in Whitecourt-Ste. Anne, my parents' riding. The candidate? Link Byfield, of Alberta Report fame. I cannot begin to express my distaste.
Once I'm done my degree, I'm out of here.
PushPin 2.0
I've rewritten PushPin, my Atom Publishing Protocol client. I've moved from Camping to Rails, giving the application some much-needed structure.
Major new features:
- stored passwords are encrypted with AES
- media collections
- service document autodiscovery
- AuthSub (I'm not sure if RFC 5023 support has been pushed onto mainline Blogger yet, though)
The UI should be much more polished, too (although there's still lots of room for improvement).
Since I've got this this blog's comments coming in via AtomPub, they'll be broken until I implement OAuth.
In Vancouver, the crocuses are budding. Here in Edmonton, it's just become warm enough to make snowmen.
Celebrating the New Year with Shoes

A bit late for most of the world, but I'll post it anyways.
Finished cleaning the apartment and waiting for guests to arrive, I thought I'd play around a bit with Shoes. Turns out it's a lot of fun!
require "time"
midnights = [ [ 5, 'Rio de Janeiro' ],
[ 4, 'Santiago' ],
[ 3.5, "St. John's" ],
[ 3, 'Halifax' ],
[ 2, 'Montréal' ],
[ 1, 'Winnipeg' ],
[ 0, 'Edmonton' ],
[ -1, 'Vancouver' ],
[ -2, 'Anchorage' ],
[ -3, 'Honolulu' ],
[ -4, 'Auckland' ] ]
new_year = Time.parse "2008-01-01"
Shoes.app do
background rgb(0,0,0)
stack do
seconds_left = (new_year - Time.now).to_i
midnight_ps = midnights.map do |offset,place|
para "#{place}: #{seconds_left - offset * 3600}", :stroke => white
end
animate(1) do |i|
seconds_left = (new_year - Time.now).to_i
midnight_ps.each_with_index do |p,i|
offset, place = midnights[i]
s = seconds_left - offset * 3600
stroke = s > 0 ? white : gray(90)
if s.abs < 500
size = 200
else
size = 100_000 / s.abs
end
p.replace "#{place}: #{s}", :font => "Arial #{size}px", :stroke => stroke
end
end
end
end
New Ruby Atom Library
A new Ruby Atom format/Publishing Protocol library, atomutil has just been released. I haven't had a chance to look at it deeply yet (thanks to final exams), but it's well documented, and it looks like it has good support for extensions elements (much better than atom-tools has at the moment).
University Wireless Service and Linux
The University of Alberta is replacing the old, horribly unreliable wireless system with a new University Wireless Service. If you connect without having set it up, any HTTP request is helpfully redirected to a tutorial on connecting to UWS. OS X and Windows XP+ only, of course.
Somebody at a forum for Asus' new Eee PC has posted how to get it working under Linux:
ctrl_interface_group=0
eapol_version=1
ap_scan=1
fast_reauth=1
network={
ssid="UWS"
scan_ssid=1
key_mgmt=WPA-EAP
eap=PEAP
identity="your CCID"
password="your-password"
phase1="peaplabel=0"
phase2="auth=MSCHAPV2"
priority=1
}
Putting that in my /etc/wpa_supplicant/wpa_supplicant.conf and setting up Gentoo to use wpa_supplicant instead of wireless-tools has got UWS working beautifully (and solved some problems I was having with DHCP, too).
The new network is pretty nice. They've upgraded from 802.11b to g, there's good coverage, it doesn't randomly drop my connection and there's less firewalling - I don't have to tunnel my XMPP connections through SSH anymore.
Programming Pedagogy
A friend of mine finishing up his education degree at the University of Alberta is taking an introductory computer science course.
Right now he's learning how to implement bubble sort in C++. How much more frustrating and pointless can you get?
If they're teaching algorithms, then C++ is a terrible choice of language. If they're teaching practical programming skills, then implementing a bubble sort is a complete waste of time. It makes me wonder how much uselessness I'm being taught.
GSoC Finis: Advice on Implementing ESessions
(I've written about the non-technical aspect of my work this summer previously.)
It took me 3 or 4 weeks to get a basic, functioning XEP-0217 implementation. You can probably do this much faster; you have an existing implementation to look at*, and you don't have to write a general-purpose test suite at the same time.
* (the test suite is under the MIT license; if that's too restrictive for you, I'd be happy to release it under something else)
Follow XEP-0218
When I wrote my SoC application I spent a lot of time thinking about the proper order to implement things in. XEP-0218 answers that question for you, and gives a good overview of the various specs involved.
Choose a good crypto library
There's probably at least one for whatever language you're working in. The minimum needed to implement XEP-0217:
- a cryptographically strong pseudo-random number generator
- HMAC
- SHA256
- AES-128 (CTR mode)
Good documentation is always a plus.
XEP-0116's only mandatory difference from XEP-0217 is RSA public key signatures and verification. XEP-0116's Mandatory to Implement Technologies gives an overview of what other options are available.
I ended up using the Python Cryptography Toolkit. It doesn't support some of XEP-0116's options (the Twofish and Serpent ciphers and the Whirlpool hash algorithm), but I've been happy with it otherwise.
Sessions :(
Easily the trickiest part was getting XEP-0201 sessions working with Gajim's existing architecture. Sessions are an integral part of XMPP—<thread/> is one of the basic elements provided in the XMPP IM RFC—but there's little (if any) support for them.
My implementation isn't great; Gajim can only have one session between two Full JIDs at a time, and will silently drop an existing session if the remote client starts a new one. To do it any other way would have required a massive refactoring of Gajim's message handling.
This is a bug, it only works because no other clients (that I'm aware of) have any support for sessions, and it will probably poison the well and make it more difficult for other clients to implement sessions properly. I'm not proud of it, and I will fix it if I can manage the refactoring required to do it properly.
I have no advice here; if your client wasn't designed with client-to-client sessions from the beginning, they will probably cause you pain. Hack through it.
Use my test suite
I've found it very useful, as an autoresponding dummy to test the basics against, and as an actual test suite to verify compliance. Documentation is on the way.
Don't let the crypto scare you
You don't need to be a cryptography expert. The specs are very complete, and will guide you around most security pitfalls. As long as you have a general idea of how the whole thing works and what you need to avoid exposing, you'll be fine. It's fun stuff!
RFC 5023
The Atom Publishing Protocol is finally an RFC. It's been more that 4 years since work started on what was then called the Atom API, so it's good to see it out the door.
I guess I'd better get atom-tools 1.0 cleaned up and out the door.
atom-tools, darcs, trac
After far too long, the atom-tools trac is back up.
I've moved from bzr to darcs (thanks to tailor), because I've been using darcs for everything else. bzr is slow, and cherry-picking is irresistible. The new repository is at http://darcs.necronomicorp.com/atom-tools. Some bugfixes and updates for the almost-final version of AtomPub have been checked in, and a release is forthcoming.
Unfortunately the Trac darcs plugin is a pain to get working. The instructions for installing it as a builtin work, but it's a bit of a mess.