Blog: August 2007 Archive

This is the inaugural post to Code Shorts. It is a weekend project gone a bit out of control. I could say that I wrote Code Shorts in Python using Django, but that is like saying that I built a table when I really just assembled one that I bought at Ikea.

I treated Code Shorts as a pedagogical exercise. My goal was to learn a bit about Django and bone-up on database-backed web development. I was pretty up on CGI scripting in the day, but the generation following it (to which J2EE belonged) was not really for the weekend warrior. Django and others like Ruby on Rails and Turbo Gears have really put the fun back in web app development.

In the end, I got a bit carried away. I did all of the blog HTML and CSS by hand. I had been meaning to get a better grip on CSS. Whether, I achieved that is debatable, but the results are better than anything I've done before. The logo was done in Maya of course (see the about page to understand why I say "of course").

Other nice fiddly bits include hooking up tags, comments, and RSS feeds. And I even added on an XMLRPC interface so that I could blog from TextMate, the best editor I have run across to date.

This is the story of how I learned that it is a good idea to plan the deployment of your web projects ahead of time, and then match up your development environment with your chosen deployment environment as much as possible.

When developing this blog, I decided to use Python 2.5 for development because I wanted to use Sqlite which comes with Python 2.5. I liked the idea of being able to nuke the database by deleting a file.

When I went to deploy, I did so on a Linux box that was running mod_python hooked up to version 2.4 of Python. Rather than trying to rebuilt mod_python and whatnot, I decided to just back port my code.

It turned out to be non-trivial. And, problems are a lot harder to diagnose on a remote server.

The main problem turned out to be my XMLRPC code. It would appear that xmlrpclib got a big upgrade in Python 2.5. Which is good, unless you are back porting...

The first problem is that they changed SimpleXMLRPCDispatcher to take constructor arguments in 2.5 to deal with string encoding issues. That was pretty easy to find and fix.

# In Python 2.4 
dispatcher = SimpleXMLRPCDispatcher()

# In Python 2.5 
dispatcher = SimpleXMLRPCDispatcher(False,'UTF-8')

Next, came the hard part. I was getting an obscure error about an argument requiring a float. Over XMLRPC you only get the final error message and not a complete stack trace. I eventually tracked this down to xmlrpclib.DataTime. After digging through the Python source I figured out that the constructor for xmlrpclib.DataTime was extended in Python 2.5 to allow initializing with a Python datetime.datetime object, such as the ones Django returns. It seemed pretty logical that xmlrpclib.DataTime would support that, so it took me a while to figure out that it didn't support it in Python 2.4.

Anyway, for anyone still interested, here's the fix:

# In Python 2.4 (Note that I stole the strftime format string right from 
# Python 2.5's xmlrpclib source)
datetime = xmlrpclib.DateTime( post.date.strftime("%Y%m%dT%H:%M:%S") )

# In Python 2.5 
datetime = xmlrpclib.DateTime( post.date )

About three months ago I made a hard decision and left the Maya development team at Autodesk. It was a hard decision because I'd been part of the Maya team since January 1994, when I started as a student intern. The main reason I left is that I had been working on the same piece of software for thirteen years, which is an eternity in the software industry. The Maya team is a great group of people and they've got lots of big plans for Maya stretching off for years into the future. But for me, its time for a change.

My new gig is Side Effects Software, makers of the Houdini 3D animation software. While Autodesk is the fifth largest software company in the world, Side Effects is at least in the top five makers of software named after famous escape artists. That is too say, they are a much smaller shop. For a developer, that means a less overhead and more connection to the customers.

For anyone who's written Houdini off as a niche product should have a look at the Houdini 9 Public Beta. There are some great things happening in Houdini.

Now that I've gotten this post out of the way, I hope to get back to writing up bits and bobs that I come across, probably unrelated to my daily work for the most part.

Disclaimer: The above statements and opinions are my own and do not represent those of my employer.