Home ::
::  About
::  Blog
::  Links
::  Photos
::  Contact me

[No comments] 2010 may 18 (tue) 8:21  ::  Django turns 1.2

The Django project released version 1.2, which brings along a slew of nifty new features including the ability to connect to multiple databases, and the "smart if tag", which any Djangonaut will appreciate.

In related news, one of my online homes Dreamhost, posted an entry to their blog yesterday announcing that they'd soon be upgrading to Django 1.2. A couple years ago I had such trouble getting Django to run on DreamHost that I left for SliceHost (and left them in turn for current host Linode). DreamHost is a huge player in the low-budget shared-hosting space, and it's really cool to see tem supporting Django along with Rails. A couple years ago CGI and PHP were the only real options in that world. On the other hand, DH's Python is still at version 2.4.4 so this is not all roses. But two steps forward one step back is still a step forward.

[No comments] 2009 may 4 (mon) 12:30  ::  Django broken after Ubuntu 9.04 upgrade

I recently updated my personal laptop to Ubuntu 9.04. Everything went well during the upgrade, and it's all smooth sailing on the desktop afterwards. It's not an earth-shatteringly different upgrade but it's nice and solid.

The only problem is that it broke my local Django dev installs. I kept getting "Internal Server Error"s from Apache, and the following weird error when running Django's local dev server:

$ ./manage.py runserver
Traceback (most recent call last):
  File "./manage.py", line 2, in <module>
    from django.core.management import execute_manager
ImportError: No module named django.core.management

After some searching I found this bug report on LaunchPad which basically says that with Ubuntu 9.04 Python2.6 no longer has /usr/local/lib/python2.6/site-packages in the path. You have to put your local code in /usr/local/lib/python2.6/dist-packages. Once I moved my code everything worked fine.

[No comments] 2008 jan 8 (tue) 13:39  ::  ASCII, Dammit!

I just discovered a little chunk of code that made me laugh out loud. Seriously, a coworker came over to ask what was going on and I had to explain it. In case you're wondering too, the chunk of code is called AsciiDammit.py.

One of the banes of a web programmer's existence is dealing with user input, which can come in almost any form. You have to allow for malicious hackers who try to crash your site using strangely-formatted text, sure, but you also have to allow for users who write text in Microsoft apps like Word, which can also crash your site.

Microsoft, for their own insidious reasons, uses non-standard codes to represent things like "smart quotes", short and long dashes, etc. These codes cause errors in other programs unless they are converted, so every web programmer who hasn't sold out to The Man has to scrub user input before doing anything else with it.

Bless Leonard Richardson! He wrote a little Python class that handles this chore (and perfectly captures my feelings about this whole chore) called "AsciiDammit.py". I love it! The class also has a function called htmlDammit(), that works one HTML with "smart quotes" in it. Genius!

P.S. If you're interesting in alternatives to Word, there were a couple good articles about cool alternatives the other day.

UPDATE (2008-2-6): I just figured out that the Leonard Richardson behind ASCII, Dammit! is the same Leonard Richardson who wrote RESTful Web Services and the most excellent HTML parsing lib BeautifulSoup, His site is chock full 'o interesting stuff, like a script that turns a ReST-formatted text into presentation slides. I wanna be like Leonard when I grow up. :)