On Not | Mo Chit

January 20, 2005

Python Propaganda Here's printable Python Propaganda PDF (from someone who has too much free time) for my favorite programming language, Python. If you don't like Python, then you're unpatriotic and evil.
Posted by Dudley at 07:12 PM

January 10, 2005

Mississippi leading the US in moral values So it seems that Mississippi has banned Jon Stewart's book. It's a good thing that they did ban the book, because a book like Jon Stewart's could easily undo the delicate social and moral fabric of the great state of Mississippi. If they had not banned the book, the people of Mississippi may start reading, divorce their sisters, and stop listening to country music. The horror.

You almost have to feel bad for Mississippi. All you hear from there is news about books being banned, civil rights mishaps, a new swamp swimming record, and of course their colorful religious nut cases. Why can't they be more like California? Why can't they produce anything that the rest of the U.S. actually gives a damn about.
Posted by Dudley at 10:31 AM

January 05, 2005

Strange bug A very nasty bug had been plaguing me for the last week. Initially, I ignored it because it only happen on Wes' machine. However, today my machine caught the same bug (it's the flu season), and so I finally had to get to the bottom of it. Initially my machine would only cough violently every 1 out of 15 executions. I finally put in some print debug statements, and the bugger started happening every single time. After that it was just matter of stomping around for a little while until this little bugger was squashed.

The problem was that I was relying on Python's id function to generate unique ids, but I was accidentally throwing away the original object after I had made a deep copy of it. I technically didn't need the original object because I had the deep copy, but the ids weren't guaranteed to be unique anymore.

The reason why that can't be guaranteed to be unique is that Python uses the objects memory address for it's id. So, when the bug cropped up, what had happened was that the another object I was tracking had the same id as a previous object. The bug only showed up once in a while because the garbage collector had to reclaim and reuse that space for the bug to show up.

What's interesting is that inserting the print statements allowed the bug to reoccur every single time. I can only assume that by putting in the print statements, the garbage collector had enough time to reclaim the recently freed memory, and then give me another object that I was tracking at the exact same memory address.

I've got to make a unit test for this bad boy. I won't be repeating this mistake.
Posted by Dudley at 06:58 PM
New Year's Resolution I don't usually do new year's resolutions, but this year I've decided to blog less. I know, the bar is already pretty low. Two things can come of this, either I blog less and fulfill my new year's resolution, or I blog more breaking my resolution but possibly entertaining some hapless souls. It's really a win-win situation.
Posted by Dudley at 06:25 PM

Creative Commons License
This site is licensed under a
Creative Commons License