Posts in March, 2009

Playing Possum

An Opposum

No reason, I just love this little guy. I think I will use a possum as a mascot for my next creation – whatever that may be!

I don't know why people don't like Possums. I wouldn't mind one for a pet.

Here is what Wikipedia has to say on the subject:

Didelphimorphia (pronounced /daɪ.dɛlf.ə.mɔə/) is the order of common opossums of the Western Hemisphere. They are commonly also called possums, though that term is also applied to Australian fauna of the suborder Phalangeriformes. The Virginia Opossum is the original animal named opossum. The word comes from Algonquian wapathemwa. Opossums probably diverged from the basic South American marsupials in the late Cretaceous or early Paleocene. A sister group is Paucituberculata (shrew opossums).

Full article from Wikipedia

Misleading ImportErrors in Django

I was debugging an issue with our Django app at work today; an file wasn't being picked up, and nothing was appearing in the admin pages. It turned that an ImportError was being thrown in the and Django was interpreting this as the file not existing.

I'm assuming that the reason for this is that Django uses __import__ to import the module, and catches ImportError's if the doesn't exist. The trouble with this is that if does exist, and throws an ImportError of its own, Django will also interpret that as a missing – which can be misleading. continue reading…

On Ego and Software Development

I've been thinking a lot about ego lately, and how it applies to software development. Writing software – like any other human endeavor – is influenced by the need to be recognized and hopefully praised for our work. I am no different; it is most likely ego that drives me to release open source software and to refine it even when there is no direct benefit to be had for that work. In this respect, ego is beneficial as it compels me to writer better code, but in the context of a day-job work, ego is a liability. continue reading…

Improving video player applications with an old-school feature

Dear video player application writers, there is a simple feature that would improve my movie watching experience greatly. A feature that I have never seen implemented – on Linux or Windows, and that is the ability to remember the position in a video file where I stopped watching. With current video players, if I want to finish watching a movie that I started watching the day before, I have to drag the slider around and to do a mental binary search to find the point where I left off. What I would like the player to do is to remember where I left off and start playing from that point when I open the file again.

Remember these? continue reading…

Micro-optimizing Minilight

Today I discovered a rather cool project via Reddit. MiniLight is a “minimal global illumination renderer” (it draws 3D scenes) with implementations in various languages.

The Cornell Box, rendered with Minilight

The Python version is a lot slower than the compiled languages – which is to be expected, number crunching like this is not Python's forte. All the same, I had a go at optimizing it. Using similar techniques I wrote about in a previous blog post I reduced the run-time for the test scene from 61.4 seconds to 53.2 seconds. Hardly stellar, and it's not going to change the comparisons, but it was an interesting exercise. continue reading…

Stop the world, I want to get off!

This morning was not a typical morning. After today I rather think I prefer typical mornings.

I woke up a little earlier than usual – at about half past seven – and rolled over in bed, only to be struck with a unpleasant sensation of dizziness. The only time I have felt similar, is when I had gotten drunk on vodka as a teenager.

The room was spinning when I opened my eyes, giving me waves of nausea. I staggered out of bed, only to flop down on the floor because I was afraid of losing my balance. After a few minutes I managed to focus and get back on my feet, only to hug the floor again when the dizziness returned a couple of minutes later. continue reading…

The low-down on Django-Techblog

I figured I would write-up some of the features of Django Techblog, the blogging application I wrote to power this site. It does most of what you would expect from a blogging app, but there are a few features that it does differently. The main difference is extended markup, but there are a couple of other features that worthy of note:

The code for Django-techblog is licensed under my politeware license, which means you can use it for any purpose you see fit, but I would appreciate a thank you! It shouldn't be too difficult to set-up if you have worked with Django, but I'd be happy to help if you experience any problems with it. See the Google Code page for the SVN url:

Nesting Instinct

I figured I'd start a series of Python challenges in my blog. Whenever I've posted questions such as these in the past, the discussion that follows is always very entertaining!

A discussion arose today at work about the best way to flatten a tuple consisting of values and other tuples (which may be nested arbitrarily). So the tuple (1, (1, 2, (1, 2, 3), 3)) would become (1, 1, 2, 1, 2, 3, 3). Now there was actually code implemented which was functional, efficient and easy to read – but where is the fun in that?

I figured I could re-write it in a more terse manner, and here is what I came up with:

This flatten function would actually work in the context of our app, but I would never use it in production code. My challenge today, is to tell me why this code should never be used!

I am a Billionaire!

This is what $50 billion looks like.

My little sister has returned from her travels in darkest Africa and has brought back great treasures indeed. Behold, the $50,000,000,000 note! And I didn't even need to help a Nigerian widow transfer the money out of the country.

I know what you are thinking – it's great to be wealthy, but what about all the begging letters? Well, I guess I can stop sending them now.

Live your life by the Tao of Python

As a Godless heathen, I have no scripture from which to guide me in my day-to-day life, and I must look for meaning elsewhere. I believe I have found that meaning in the most unlikely of places; the Python shell. If you enter import this in to the Python interpreter, it will reveal to you an ancient wisdom in the guise of a collection guidelines for the Python language.

I have studied these words for many years and have come to believe that they are in fact guidelines for living a fulfilling and successful life. continue reading…