enough water makes all rocks round


More Praise for “Expert Python Programming”

The kind folks at Packt Publishing contacted me two weeks ago and asked if I would review Expert Python Programmingin exchange for a free copy. I enjoy free things, especially beer, even if there’s a bit of work involved, so I agreed. The book arrived a few days later as promised.


ProfitPy Does Windows

New release coming soon. And it now runs on Microsoft(r) Windows(tm)! I like pretty pictures:

See all the screenshots here.

Release seems close. I think 0.2 will be ready within a few weeks (read: 3-4 months). The project has a new home, too: here.

Automated Translation of Java to Python

I’ve written a tool to automatically translate Java source code to Python source code. The tool is useful, and it’s already working for me as I intended. It’s called java2python (clever, no?) and you can download it here.

Let me back up a bit and explain the motivation behind this. I’m the author and sole maintainer of the Python port of the Interactive Brokers API (IbPy). IB provides a default/reference Java implementation for UNIX and MacOS. This reference implementation is straight forward: it contains a Thread subclass that reads from a socket, an associated class for writing to the socket, plus a few other support classes. Conceptually pretty simple, and the initial port was actually easy (once I figured out the difference between writing data to a socket in Java and writing data to a socket in Python).


KBerylSettings – Beryl Settings for KDE

Yo, ho, ho and a bucket of prawns! There’s a Beryl Settings manager for KDE in the Beryl Project SVN repository. A picture is worth a
thousand words:

And another thousand:


The New PyKDE Sampler

Python is Goodness. KDE is Goodness. Put together, they become PyKDE, the Grand Supreme Goodness of desktop environment language bindings.

But there’s a grain of sand in the jelly. Between the three, there’s plenty of documentation but very little example code for PyKDE. Enter the new sampler application. Check it out:


Clever Harold – The Shocking First Exclusive!

Clever Harold was once an ambitious sheep, caring so much for his
fellow ovis that he tried to teach them to fly free of their
life of grazing before eventually being eaten.

His prospects ruined from the inevitable demise of his beloved ram
brothers and ewe sisters, Clever Harold claims to have escaped and
started grazing down a different road. Now he claims to be a web
framework, one written in Python.

And we have the the incredible first interview. Read on dear reader,
but brace yourself for graphic dialog.

PythonDoc Wiki Macro for Trac (Update)

Big updates for a small module. The TracPythonDoc wiki macro now has enough features for real use.

PythonDoc Wiki Macro for Trac

In a time long, long ago in a cubicle far, far away, I once wrote a wiki macro for Trac to generate documentation from python modules in a Subversion repository using PythonDoc.

SELECT Surprise

While experimenting with unicode values in Python, PostgreSQL and pyscopg2, I ran a little query like this:

>>> cur.execute("SELECT (note_id, body) FROM troy.morenotes")
>>> cur.fetchall()
[('(1,"The rain in Spain falls mainly in the plains.")',),
('(2,"Twenty dwarves did handstands on the carpet.")',),


Automatic Pickle Serialization and Deserialization with PostgreSQL

Building on the earlier success of creating a pickle data type in PostgreSQL, I’ve come up with this small and comfortable way of automatically serializing and de-serializing python pickles with PostgreSQL and psycopg2.


Cheat Sheet for Kid Templates

Kid Templates rock! In an effort to learn and memorize the syntax, I created a cheatsheet for it using Inkscape.
Attached is the PNG export and the SVG source. Enjoy!

(I’ve removed the SVG source because WP won’t allow the attachment – troy 24 jan 2010)

A Tale of PostgreSQL Types and Python

Thinking of integrating user-defined types in PostgreSQL and psycopg2? Here’s the path I walked, hopefully you can avoid the same pitfalls.

I was after a PostgreSQL data type for storing Python pickles. This seemed simple enough because the database facility for aliasing a type already exists. So the first thing I tried was a CREATE DOMAIN statement in PG, like so: