-
posts
-
Dynamically Adding a Method to Classes or Class Instances in Python
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):
def __i...
-
Shady Harvard Puzzle Facebook App Disassembled
Today I got an email from a friend on Facebook that suggested that I try
out this application called “Only 4% of harvard grads can solve this
riddle..”.
Being curious I took a look at it.
The app starts out innocently enough, posing a riddle that...
-
Caching Permanent Redirects
Since I’ve started using Chrome as my main browser for surfing I have
noticed that some web applications seem to redirect to 404 pages. After
some investigation it seems that the browser caches 301 responses (they
are permanent after all) and when...
-
python-openvcdiff and Cython
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 hardest ...
-
Modipyd with Growl Notifications and Test Driven Development
Recently at work my coworker Shinya
Okano came across
Modipyd written by Takanori
Ishikawa. Modipyd is a module
dependency monitoring framework which can build module dependency trees
and monitor when modules have been changed. But most interestin...
-
'self' ForeignKeys always result in a JOIN
I came across a little annoyance in Django today. I found that a ForeignKey
that reference self, i.e. points to the same table, always results in a join
in a filter.
Take this normal foreign key reference.
class Customer(models.Models):
user...
-
Django template2pdf
This is cool Django application from Yasushi
Masuda which allows you to render data to
a pdf using trml2pdf.
template2pdf provides a
generic view called direct_to_pdf which will render a rml template
directly to pdf.
# coding: utf-8
from django...
-
How to be a 10x programmer
I recently read a blog post that is a satirical look at how to gain a
reputation as a guru programmer by converting code to your own code and
making it hard for other programmers to get their work done. It’s called
3 Simple Rules That Will Make Yo...
-
Writing Schema migrations for App Engine using the Mapper Class and the deferred Library
One thing that many people using App Engine know is that writing schema
migrations is hard. Improving performance on App Engine often revolves
around getting objects by key or key name rather than using filters,
however altering the makeup of an o...
-
Running django with daemontools
Running django fastcgi with daemontools is rather easy but getting it to run in the foreground with the proper user takes a bit of knowledge about how bash works and the tools in daemontools.
In order to run the fastcgi daemon in the foreground y...