Firefox Download Button

Pages

splittar 0.2

I’ve finally finished version 0.2 of splittar. In addition to some bug fixes, I’ve added a few new features:

  • Generate files with more consistent file sizes
  • Keep multiple files open so that smaller files can be added to archives with a bit of room left
  • Ability to tweak how splittar estimates how well a file will compress. This is a weighted average between the actual file size, and the file size multiplied by the current compression ratio

WordPress RFE – preview changes to an existing page

With the upcoming changes in WordPress to enable more CMS-like features (including draft pages!), something else I’d like to have is the ability to preview my changes to an existing post / page.

Right now it seems like there’s no way to do that; since the post / page is live then as soon as I save my changes, the changes are made live as well.

I didn’t find this in the WordPress Trac, so I thought I’d mention it here.

Harry’s Spring Run Off

I’ve just registered for Harry’s Spring Run Off 8km run. The run is on April 8th in High Park. I’m really looking forward to it, it’s a beautiful area of the city!

I hope that with this 8km run in early April, and the 10km run in early May, that I’ll be well on my way to being in shape for a half-marathon later in the year!

Python Warts, part 1 – pointless modules

Ian Bicking has inspired me to start keeping track of the little things in Python annoy me a little bit whenever I run into them. They don’t really get in the way of development, but it would be nice if I didn’t have to deal with them at all :)

Maybe I’m just slow, but I didn’t know about the os.statvfs() method until just yesterday. Up until then I’ve been parsing the output of ‘df -k /mnt/drive’ to find out how much free space a drive has!

Of course, os.statvfs() is pretty much useless by itself. Try it out:
import os
os.statvfs(".")
(4096, 4096, 19107656L, 2773425L, 1802799L,
9715712L, 8529635L, 8529635L, 0, 255)

Great. What does that mean? Oh, I need the import the statvfs module to be able to usefully interpret this data. This module contains nothing other than a set of constants that index into the above tuple. So to get the free disk space, I would do something like:
import os, statvfs
s = os.statvfs(".")
freebytes = s[statvfs.F_BSIZE] * s[statvfs.F_BAVAIL]

Note that I’m not sure if statvfs.F_BSIZE or statvfs.F_FRSIZE is the proper entry to use. And the python documentation doesn’t clear it up for me.

There are really two things that bug me about this. The first is that the only reason for the statvfs module’s existence is to make the os.statvfs() function useful. I would prefer that os.statvfs() returned a dictionary with meaningful keys, or an object with meaningful attributes. The stat module is another violator; it exists to make os.stat() useful.

The second thing that bothers me is that I don’t really think something like os.statvfs() is the best way to be calculating the free disk space in Python. Maybe I’ll rant about this more in a future post, but functions and modules in Python that exactly mirror the underlying C library bug me. Sure, there may be times when you need access to the raw system call, but I can imagine that many people just want to know how much free space there is in a certain directory. Something along the lines of os.freespace(dir) would be a welcome addition to the standard library.

The things we take for granted

Friends of Melissa and I are currently in Malawi working for Canadian Physicians for Aid and Relief (CPAR). Tess’s recent post about the state of medicine in Malawi is pretty scary.

We are very very very blessed here in Canada where we do not have to worry about diseases like malaria, where our children have excellent chances of living past their fifth birthday, and the average person can expect to live into his 70′s.

We live in a society of abundance, of plenty; sometimes of over-abundance and excess. Testimonies like Tess’ remind me that I really need to be more generous to those less fortunate.

WordPress 2.0.1 released…

… with a few bug fixes. But what I’d really like to see is the ability to save a page (as opposed to a post) as a draft. I never get things right the first time so I like to write something, then come back to it a bit later.

Luckily I’m not the only one who thinks this way! See WordPress bugs #2194 and #1820