Monthly Archives: January 2009

A mistake while programming in Python.

I’m working on clustering Web People-Search results. So I have the results and snippets for one query in an XML file, and my program reads that and writes the clusters into another XML file.

I have thirty such XML files to process, and hence in the main program, called the clustering function multiple times.

What I noticed was that the size of the output files and processing times were growing linearly – 4 KB, 8 KB, 12 KB…. and I wondered what had gone wrong with my code. On opening the output files, I saw there were an insane number of clusters; not at all what was expected. Oh, and the number of clusters were growing linearly too.

I wondered what the matter was… and went through my code multiple times.

Then it hit me.

I had a global dictionary and set of vectors on which the clustering function was called. Bad programming practice, I know… I swear to god I’ll never repeat it again.

Now when I was calling the clustering function multiple times, the global data remained the same, so input1 proceeded fine, but input2 processed the data of both input1 and input2, input3 processed input1, input2, input3….. oh hell!

And why this post? So that I’ll never repeat this error again, for one thing. And so that other noobs like me who read this will also keep this in mind. With Python, you can easily switch between OOP and scripting… and it’s too easy to screw up on that.

If you have global data, and want to run the code multiple times, don’t be too lazy to write a shellscript to call the program on each input.

Advertisements

Bacn for Gmail

Guess all of us are used to deleting those news alerts, Orkut/Facebook alerts, stuff from mailing lists… in order to keep a clean and relevant mailbox.

I often wondered why Gmail didn’t provide an option for ‘Friendly Spam’ – stuff that you don’t want marked spam totally, but stuff you don’t want cluttering your inbox.

Apparently, there’s a term to describe such mail – Bacn.

So.. what do we do with bacn? How do we deal with it? We need a holding mechanism for it… a folder or something, whose contents autodelete after you’ve seen it once? What else can we do with bacn?

Hello world!

I already have an up-and-running blog. But I felt the need to store all the geek stuff I came across everyday, and connect with the sort of audience such a blog would attract. And not mix it up with my friends and family who read my general blog. Just the same way I wanted to disconnect the jokes I read and the pics I clicked,  from the stuff I wrote.

Hence this blog.

And the title… well… I wanted a nice techie punsome title. Started with Naive Babes, but found that grossly inappropriate. So now you have Total Recall – in keeping with my interest in Information Retrieval. And the URL – irjejune – I wanted something that rhymes with IR Baboon. For the IR in it. Jejune means something ‘insipid’. Which hopefully I’ll grow away from.

According to Wiktionary as of today, 17.6.09, Jejune also means:

  1. Naive; simplistic.
    • 1702: I have often wondered why some late Writers should sensure Tully’s Letters for being too naked and jejune, when that to his Friend Lucceius, which the Reader will find in this Collection, is a plain Demonstration to the contrary? — Thomas Brown, Select Epistles or Letters out of M. Tullius Cicero; and the best Roman, Greek and French Authors both Ancient and Modern
    • 1917: This renders the recognition of alternatives a paramount necessity for a logic of discovery, which can no longer dismiss them with a jejune chapter on ‘disjunctive propositions’. — Charles Joseph Singer, Studies in the History and Method of Science
    • 1955 : Doubtless, too, both grammarians and philosophers have been aware that it is by no means easy to distinguish even questions, commands, and so on from statements by means of the few and jejune grammatical marks available, such as word order, mood, and the like : though perhaps it has not been usual to dwell on the difficulties which this fact obviously raises. – J.L. Austin, How To Do Things With Words
    • 1962: Gradus had long been a member of all sorts of jejune leftist organizations. — Vladimir Nabokov, Pale Fire
    • 1975: Sonja (Diane Keaton): “That is incredibly jejune“. Boris (Woody Allen): That’s jejune? You have the temerity to say that I’m talking to you out of jejunosity? I am one of the most june people in all of the Russias!” – Woody Allen, Love And Death
    • 1993: I went to the cinema not for entertainment, but for cinematography. For it was only by studying the precise rake of extra-long pans, the trajectory of tracking shots and the jejune emotional appeal of the jump-cut, that I could add to the repertoire of my own internal shoots. — Will Self, My Idea of Fun
%d bloggers like this: