Ian Lewis
Oct. 19, 2010
For a recent project I recently I have been using appengine's cron feature to aggregate data and perform maintenance tasks. However, since cron is a simple web request, if a user accesses that url then the cron job will run. In order to prevent [...]
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. 20, 2009
Yesterday I ran into an interesting quirk with Django's QueryDict object and the normal dictionary update() method. Normally the update method will allow you to merge two dictionary or dictionary like objects but because the QueryDict internally[...]
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[...]