A performance lesson on Django QuerySets

Seek Nuance

At work, we’ve contracted with PostgreSQL Experts to help us improve our Postgres performance. After analyzing our system, one of their consultants, Christophe Pettus, found glaring problems in how some of my code accessed our database.

I consider myself well-informed about good database access practices in Django, and in general. I might not exactly hit the bull’s-eye, but I’m sufficiently savvy to avoid making a “WTF” mistake, right?


View original post 506 more words

effects of vipassana


Disclaimer: Despite using effect in the title, i don’t propose or argue a cause-effect relationship. It’s just observation of some subjectively observed correlations.

Some of the behavioural changes/effects i have observed in me after i took up the 10 day experiment in vipassana meditation.

  1. In conversation, i notice it quick when they heat up. i.e: when shouting begins and am tempted to start shouting louder(thereby escalating the irrationality and transcending it into a debate).

  2. I have started using the breath-monitoring to regain my rationality.i.e: whenever i notice am getting agitated/excited.

  3. I have become more aware of the difference between visceral reactions/changes. i.e: when i react to some decision or news with physiological symptoms.

  4. My auditory senses seem to have become more sensitive than they were. I always thought myself as just a visual person, but now realizing/discovering new auditory distinctions i didn’t know i could perceive.

anand jeyahar

python interpreter vs lisp interpreter

I recently remember reading python is not similar enough to lisp, because the intrepreter doesn’t give you the internal data structure but strings. While this was a theoretical idea at the moment ran across today.

>>>from django_auth_ldap.config import LDAPSearch

I am basically poking around this django_auth_ldap module to figure out how to get it to work with my django app. right now it’s throwing an operation error: need to perform bind before this operation(cn lookup).

Here i import this class and test some functionality of this django_auth_ldap module and see how it works for me..

At this point, am sick of searching for the error message on google and getting meaningless results that don’t solve my problem..Also nobody currently on the #django irc channel seem to know or are interested.

Time to Read the source. Ok let me see where’s the codebase in my unix directory structure..(Yeah, i don’t follow one single way of getting packages installed, just do whatever works.. i know bad practice yada yada… but hey, am lazy and haven’t crossed the tipping point to find this behaviour more work than the recommended best practice :-))

>>> LDAPSearch.__file__
Traceback (most recent call last):
File "", line 1, in
AttributeError: type object 'LDAPSearch' has no attribute '__file__'

Uh.. oh LDAPSearch is a class not a module

>>> help(LDAPSearch)

>>> LDAPSearch.__module__

Ok, i can get the module using this let me see… if i can get the file from it too.

Traceback (most recent call last):
File "", line 1, in
AttributeError: 'str' object has no attribute '__file__'

Oh.. crap… the .__module__ returns a string and not a module object.. If only..

Well.. this probably won’t work.. still it’s only a couple of keystrokes away… No point trusting when you can test easily(empircist)

>>> eval(LDAPSearch.__module__).__file__
Traceback (most recent call last):
File "", line 1, in
File "", line 1, in
NameError: name 'django_auth_ldap' is not defined

Ah…. now i want python to be more like lisp*… i don’t want just the module name as string i want the module object to be accessible….

*– even though i don’t know lisp :-P