Ian Lewis
Oct. 3, 2010
In Python you sometimes want to dynamically add methods to classes or class instances (objects). In Python code, the most obvious way to accomplish this might be something like the following but it has one caveat, class MyObj(object): [...]
June 15, 2010
Google docs wouldn't let me share the presentation publicly with people outside our company's domain and it gave me an error when I tried to download it as a Powerpoint file or PDF so I was forced to recreate my presentation locally. Anyway, I p[...]
March 21, 2010
I started a project today to implement an interface for the open-vcdiff using Cython. I'm not a C++ master and the Python C libraries are pretty new to me but I managed to expose and implement a few methods of the VCDiffEncoder class. The hardes[...]
Sept. 21, 2009
Recently I needed to be able to parse out attachments and body from multipart emails and use the resulting data to post to a service. So I wrote the code below to parse out text and html portions of the email and also parse out attachments. The[...]
March 19, 2009
The way to store data on Appengine is with Google's BigTable Datastore which has support for transactions. However, the transactions are quite limited in that, 1. You can only execute callables inside transactions. Which means you basically c[...]
March 14, 2009
I wanted to impove a Google Appengine application that a friend of mine created (ほぼ汎用イベント管理ツール(jp)) and noticed that he was redirecting directly to urls. He is using Werkzeug to handle url routing so I wondered if there was a method for generati[...]
Feb. 4, 2009
One of the neat things making it's way into Django 1.1 is F object queries. The F object is kind of like the Q object as it can be used it queries but it represents a database field on the right hand side of an equality/inequality. For the exam[...]
Dec. 19, 2008
I couldn't find something that gave me quite what I wanted so I created a simple Python generator to give me the dates between two datetimes. def datetimeIterator(from_date, to_date): from datetime import timedelta if f[...]
 
Dec. 15, 2008
Today my copy of Introduction to Algorithms came in the mail (a gift from the family). I've decided, mostly inspired by Peteris Krumins to revisit classic algorithms as it's been a while since I've taken a look at them. I have decided to also t[...]
Nov. 18, 2008
Using the Django sitemap framework is so easy it's almost no work at all. Just make a sitemap object and add it to the sitemap in urls.py. The sitemap framework calls items() in your Sitemap to get the list of objects to put in the sitemap and t[...]