1. Fun with Context Managers

    Sometimes I need a simple stop watch in my Python scripts to find out how expensive my code is in wall clock time. The problem is trivial to solve, but I thought I'd give it a try using Python's with statement and a context manager.

    Previously, my code looked like …

    read more
  2. Eee PC Wireless Troubles

    Half a year ago, I bought an Asus Eee PC 1000HE netbook. The first thing I did was wiping Windows XP off the disk and installing Ubuntu Jaunty Netbook Remix. When I bought the netbook, I knew support for the wireless chip (AR928X, according to lspci) was limited, but things …

    read more
  3. A Template for Python Unix Utilities

    One of the most often read postings on this blog is the one about my getopts-enabled shell script template. So I figured, a similar template in Python would also be useful. Like the shell script, it's quite trivial, but it might still save some time.

    The template is an example …

    read more
  4. Map/Reduce in Python

    My interest in Grid Computing over the last weeks begins to show. After reading the Google MapReduce paper, I tried my fingers on a client side toy problem.

    For formatting purposes, I was interested in the size of the longest string in a sequence. There are lots of ways to …

    read more
  5. Parsing Command Line Options in Shell Scripts

    In programs written in C, command line argument parsing has always been done using the getopt(3) library function. This function has set the standards Linux/Unix users have come to expect from command line interfaces. Fortunately, there's a getopt(3) equivalent for almost every programming language and the shell …

    read more
  6. Controlling Firefox via Command Line

    Mozilla-based browsers like Firefox have inherited a useful feature from the good old Netscape Navigator: Controlling a running browser instance via the command line. Using command line options, you can open URLs or files inside your browser window without having to enter them in the address bar.

    Suppose you're working …

    read more
  7. Using D-Bus Introspection

    To control a D-Bus-enabled application, you need the interface definition to find out which methods are offered and which parameters they expect.

    Of course, you can get the relevant interface definition from the application's source distribution. But there's an easier way: Ask the object in question via D-Bus to …

    read more
  8. Controlling Rhythmbox using D-Bus

    On GNOME desktops, the D-Bus IPC standard has superseded the CORBA-based approach. Using D-Bus, the operating system can notify the desktop about hardware changes and applications can communicate with each other in a standardized, simple manner. Using signals it is also possible to get a notification in case there are …

    read more