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.
New release coming soon. And it now runs on Microsoft(r) Windows(tm)! I like pretty pictures:
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.
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).
And another thousand:
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 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.
Big updates for a small module. The TracPythonDoc wiki macro now has enough features for real use.
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.
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")
[('(1,"The rain in Spain falls mainly in the plains.")',),
('(2,"Twenty dwarves did handstands on the carpet.")',),
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.
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: