ssh-agent-applet 0.1

I've finally managed to do the first release of ssh-agent-applet. I've actually been using it for some time on my own PC but it needed a bit of love and documentation to make it easier to install.

From the README:

ssh-agent-applet is a Gnome applet that allows you to conveniently keep your ssh key(s) on external media. This means that if your computer is cracked or stolen, the attacker will not have a copy of private ssh key(s).
Using ssh-agent-applet, your keys are loaded into ssh-agent as soon as you insert your "key drive" into a USB port. The drive is automatically unmounted once the key loaded so you can remove it from the USB port immediately.

For developers, ssh-agent-applet is a reasonable example of how to write Gnome applets in Python and how to interface with HAL from Python using DBUS. The HAL/DBUS interactions are non-trivial and go beyond what most documentation covers. It took a fair amount of experimentation to get some of this stuff working. Hopefully the applet or at least its' code is of use to other people.

ssh-agent-applet can be found on GitLab.

Snow in London

Today is the first time I've seen proper snow in London. Apparently it's been going since 3am and it's still coming down quite heavily now.

Here's what it looked like out our living room window when I got up this morning. (click for a larger version)

Found photos

I just stumbled across while looking for something completely different. It's a small collection of anonymous photos found discarded on the street. The site invites you to think about the possible histories and stories behind the pictures. Somewhat haunting. See the About page for more details.

Starting with Ruby

This excellent read from Arto Bendiken has inspired me to do 2 things:
  1. start learning Ruby
  2. keep going with learning Scheme which I haven't touched much since I started teaching myself on the plane to Australia
I hunted around for some Python to Ruby guides and comparisons and found the following useful links: Now I just have to make some time for all this. I still want to keep contributing to Yum and starting doing a Dutch language course as well (my Dutch isn't too bad but I want to get a let more proficient). Yoga is on the cards as well. I'm sure it can be done with a bit of planning and enthusiasm.

USB Sniffing / Optus 3G and Linux

I'm living at my brother's new place while I'm in Australia. He doesn't have an internet connection (no home computer) and doesn't have a home phone (just uses mobile). To work around this obvious lack of connectivity I've borrowed an Optus branded GlobeTrotter 3G Quad PCMCIA card. The card is supplied as part of the Optus Wireless Connect package.

The Windows drivers and software worked immediately on my laptop but I rarely use Windows so was keen to get it working under my Linux distro.

I spent many hours trying the configurations described at the PHARscape site (and others). PPP negotiation would start but an IP address would never be allocated. I figured there was something different about the Optus 3G network but was using the Optus Access Point Name (APN) documented on the net ("internet").

I ended up sniffing the USB traffic to and from the card under Windows by using the excellent SnoopyPro USB sniffer. I captured the URBs the Windows drivers sent to first serial port endpoint on the card and then used strings on the capture file under Linux. The AT commands used by the Windows drivers magically appeared.

It turns out that I was using the wrong APN; I should have been using "connect" instead of "internet". Once the pppd chat script was updated things started working. Fantastic!

More details on the specifics of the pppd configuration I'm using can be found on the wiki.

HTTP Auth and Selenium

I'm starting to look at Selenium-RC at work today. We're moving a lot of web based functional tests away from PBP.

I ran into a major problem straight away. Our web interface uses Basic HTTP Auth and Firefox insists on presenting a dialog to the (non-existent) user when you open a style URL. The tests would hang waiting for the Ok button click.

After a lot of searching I finally found the network.http.phishy-userpass-length. option. When set to 255 the authentication warning dialog box isn't shown.

Selenium creates a fresh Firefox profile every time it starts Firefox so modifying the option in about:config doesn't help. You need to edit firefox.js and add a line like pref("network.http.phishy-userpass-length", 255);. This ensures that the option is set in any new profile. On Windows firefox.js can probably be found at Program Files\Mozilla Firefox\defaults\prefs\firefox.js. It'll probably be at /usr/lib/firefox-*/defaults/pref/firefox.js on a Linux machine.

I wonder if Selenium-RC could set this option in profiles it creates itself? It already seems to set a bunch of other options.

GStreamer and Python experimentation

I recently played with GStreamer for the first time. I'd heard plenty of good stuff about the framework but had never spent any time developing with it.

In a nutshell, it's very powerful and very cool. Complex multimedia apps can be created with very little code. You link together small blocks to form a useful chain of functionality. The Python API is quite nice because the Python bindings are well supported by the developers.

The big problem is lack of documentation. The best starting point I found was Jono Bacon's excellent Getting Started with GStreamer with Python. After that, the C based docs and the gst-inspect tool are probably your best friends. They make sense once you get your head around the general architecture.

In the interest of expanding the amount of reference information available for GStreamer I've put the results of a few hours of messing around online. It's a simple program that illustrates some interesting stuff using GStreamer. Despite the low line-count, what it does is somewhat impressive; it takes 2 arbitrary audio files and plays them over the top of each mixing in real-time. More details and the download link can be found on my code page.

Martini Design Patterns?

Sometimes the random text to put off filters in spam emails is hilarious. This is an excerpt of one I received today (odd line breaks as per source):

In a way that lets you put principles will help the "Trading Spaces" show. support in your own code. so that you can spend You want to learn about the patterns that
to know how they you get to take same problems. the patterns that in between sips of a martini.

the patterns that or on the real relationship "secret language" Head First book, you know challenging. Something But you don't just
in between sips of a martini.
the next time you're Design Patterns, you'll avoid alone. At any given moment, used in the Java API deep understanding of why 
Looks like they randomised the words of some design patterns book, although I don't know where the martini references come from.

Scheming on the way to Oz

I arrived in Australia 2 days ago to sort out various passport related issues and to get some time in the office (it's been 6 months). Since the flight gave me a spare 24 hours to fill I decided it would be an excellent time to start learning Scheme. This is something I've been meaning to do for ages, just to stretch my programming mind in new ways, but also because I'm just curious about Scheme/Lisp.

Before I left I installed the Fred Bayer's excellent LispMe Scheme interpreter on my Palm. This is a relatively complete, almost standard, Scheme implementation which includes APIs for Palm graphics, databases and UI elements. Not that I got that far ... I'm definitely closer to the "Hello world" end of the spectrum when it comes to Scheme.

For documentation I downloaded Dorai Sitaram's excellent free tutorial Teach Yourself Scheme in Fixnum Days on to my Palm. It's freely available in HTML, a page per chapter. A bit of fiddling with Pyrite Publisher gave me a suprisingly readable Palm version, one document per chapter. The output wasn't perfect but completely useable. Given a little more preprocessing I reckon I could get the whole tutorial into one document.

Although I would have loved to, I didn't get the classic Scheme/Lisp text Structure and Interpretation of Computer Programs onto my Palm. It's damn big and I couldn't figure out a way to convert it nicely in the time I had to do it. I think it is doable though.

By setting up shortcuts in the Palm launcher I was able to quickly switch between the book and LispMe and happily spend the much of the flight(s) teaching myself the basics of Scheme. Some thoughts:

  • LispMe is cool! There wasn't anything that I covered in the tutorial that it couldn't do. Some of the demos programs are really impressive too, for example a 3D rotating cube!
  • Teach Yourself Scheme in Fixnum Days is a nice tutorial. It doesn't mess around much and gets into more difficult ground fairly quickly. It's probably a good introduction for programmers experienced in other languages.
  • I'd still like to go through SICP at some stage to get a more complete grounding in Scheme.
  • Entering Lisp-like code via the Palm graffiti input system requires a certain amount of dedication. There is a Palm hack that comes with LispMe to help with parentheses matching but unfortunately it doesn't work on more recent Palm's like my Tungsten.
  • I don't think I could see myself using Scheme for any major projects, not when I already find Python to be such a good fit for most things. That isn't really the point of this exercise though (and I should never say never).

I have a lot more to learn. I certainly didn't get through the whole tutorial but skipped ahead a bit to see what other stuff is covered. Continuations, the non-deterministic operator (amb) and macros look really interesting. The brain stretching really begins when you start getting on to these more advanced topics. Maybe for the flight back to the UK...