Posted on April 21, 2009 at 7:13 pm

Counting bloom filters in python and javascript

Continuing the theme of implementing simple datastructures in python and javascript, here’s a simple counting bloom filter implementation in python and javascript which I’d written for Tagz. I’d almost forgotten about this, until a thread today on compsci.reddit reminded me of it. With this implementation, you can build a bloom filter in python and add/remove/lookup elements. You [...]

Posted on April 11, 2009 at 9:07 am

Tries and Ternary Search Trees in Python and Javascript

There are a couple of places in which Tagz, where I needed efficient prefix matching. The most obvious way to do this is to use a Trie or a Ternary Search Tree. So, I ended up implementing both in Python. I’ve had this stuff lying around in my mercurial repo for Tagz for quite some [...]

Posted on April 6, 2009 at 5:04 pm

Using redis

I’ve been using memcached for all the caching on Tagz. Redis is a relatively new key value database which covers a superset of memcached’s functionality. One of the biggest problems I’ve had with memcached (actually it has nothing to do with memcached) is that whenever I store a large datastructure on memcached, deserializing (unpickling) it takes [...]

Posted on December 12, 2008 at 4:59 am

Playing with Django Querysets

I use base36 for all most object ids in tagz. I previously used to manually convert all base36 values into integers before doing the lookups. Yesterday it dawned to me that I could subclass QuerySets and remove a lot of boilerplate code. The idea here is that I can do something like Model.objects.get(pk_base36=’2kk’) instead of something like [...]

Posted on November 4, 2008 at 12:00 pm

Looking for a Job

Due to various reasons beyond the scope of this blog, I’ve had to quit my current job as a Programming Specialist at Position2. So, if you’re looking for a python / django hacker in Bangalore (although telecommuting certainly is an option I’d consider), drop me a line.

Posted on August 29, 2008 at 5:59 pm

It is true

My dear brother Thilak met with a minor accident this afternoon, and in the confusion the ensued, he’s spilt the beans on Tagz. It must’ve been painful to singlehandedly type the 228 word post (He’s got a cast on his right hand, because of the accident). The UI is kinda crude, but functional. Actually a [...]

Posted on June 26, 2008 at 1:47 pm

Fun with mercurial precommit hooks

I use Mercurial for all my coding projects. Today I hit upon the idea of using mercurial precommit hooks to run django tests before committing. I didn’t really expect it to be so easy I use postgresql on the server, but I found that on win32, running tests with postgresql is excruciatingly slow. For comparison, [...]

Posted on May 31, 2008 at 2:16 pm

Building Python Extensions on Win32 with MS VC++ 2008 Express

These days, I’m mostly working on linux and I haven’t had to use the Microsoft dev tools for a long time. I’m using Vista on my new laptop. Yesterday, I had to install pycrypto from source on Windows. The only compiler I had was MinGW, which doesn’t quite cut it with distutils. I figured that [...]

Posted on May 28, 2008 at 11:53 am

Embedding a Python shell scripts

Everybody knows “import pdb; pdb.set_trace()”, that’s probably the first thing anyone would do when you’re trying to hunt for a bug or hit an exception (“pdb.pm()” ?). Its just as easy to embed IPython or a plain old Python shell in a python script. The IPython manual covers this in detail. Another way would be [...]