Offered

Thanks to the recent purchase of a EOS 20D, I have a good condition fully boxed Canon EOS 300D (that's a digital SLR camera) with the kit 18-55mm lens, all of the accesories, a UV filter and 1GB CF card to sell. I'll be hitting eBay in a few days with this, but I thought I'd see if there is anyone out there who wants it first. I'm thinking that £250 is a reasonable price.

Interested? Email me.

22:33 Monday, 18 Sep 2006 [#] [life] (0 comments)

Python Decorators

Decorators in Python are just fantastic. Here are a few I've used in Postr. Update: the wonderful James Hensbridge expanded the decorators, so I've updated this post.

def threaded(f):
    def wrapper(*args, **kwargs):
        t = threading.Thread(target=f, args=args, kwargs=kwargs)
        t.setDaemon(True)
        t.start()
    wrapper.__name__ = f.__name__
    return wrapper

This decorator (stolen from O'Reilly) calls the method in a new thread, so execution returns straight away. I use this for long-running tasks that cannot be handled in an asynchronous manner (such as the photo uploading in Postr, which currently uses urllib). The main thread returns straight away so the interface doesn't block, and the uploads continue in the background.

Of course this new thread cannot just call GTK+ methods, as GTK+ itself isn't threadsafe. So, I have another decorator that causes a method to be always executed in the main loop by scheduling an idle handler that calls it.

def as_idle(f):
    def wrapper(*args, **kwargs):
        event = threading.Event()
        ret = []
        def task():
            ret.append(f(*args, **kwargs))
            event.set()
            return False
        gobject.idle_add(task)
        event.wait()
        return ret[0]
    wrapper.__name__ = f.__name__
    return wrapper

Erich Schubert requested return values, so James added those too. The calling function will block until the idle handler has called the decorated function. I've split the decorators out into a separate file in Postr, so you can view the latest version online.

Magic stuff!

21:30 Monday, 11 Sep 2006 [#] [computers] (0 comments)

Python Challenge

Here is a quick challenge for any Python gurus out there. Go and grab the Postr source (you'll need bzr) and run src/postr.py. Marvel at how simple it makes uploading images to Flickr, and how well it works.

Then run python setup.py install --prefix=prefix and run prefix/bin/postr. Try to upload an image and note how it hangs. A little debugging reveals that it is hanging on mimetools.choose_boundary(), and I have no idea why. I've probably made a stupid typo somewhere, can anyone spot the problem?

23:10 Thursday, 07 Sep 2006 [#] [computers] (0 comments)

Sound Juicer "Hollywood Sending Signals Of Destruction" 2.16.0

Sound Juicer "Hollywood Sending Signals Of Destruction" 2.16.0 is out. Tarballs are available on burtonini.com, or from the GNOME FTP servers.

There are not a lot of interesting features in this compared to 2.14, sorry!

21:09 Monday, 04 Sep 2006 [#] [computers/sound-juicer] (0 comments)

Poseable Action Figures

Last Friday was Vicky's last day at the OU, as next month she hopes to be accepted onto a teacher training course for A-level Psychology. On Friday her desk was covered in fairy lights, cards and presents, including a Teacher Startup Kit: pain killers, an apple, a diary, and a poseable action figure of Sigmund Freud.

Freud

I'm not sure what worries me more: that someone at the OU found a poseable action figure of Freud, or that somewhere in Cambridge there is a store that sells Freud action figures, and probably more...

NP: Piss Frond, Dead Voices on Air

12:00 Monday, 04 Sep 2006 [#] [life] (0 comments)

Bansky

Banksy Is My Hero.

17:10 Sunday, 03 Sep 2006 [#] [life] (0 comments)