Of digital cameras and photography

In our house, we had two polaroid cameras. Brother and I, being young, were never allowed to touch them, but we saw parents use them often. On every birthday party, every gathering, we’d have a lot of pictures taken and then developed — you know how it used to be and is with polariod cameras.

Then one miserable day when I was still in school, some miscreants broke into our house and stole the cameras. Ever since, we have been deprived of cameras.

We do have digital cameras in our cell phones now. Brother is obsessed with taking pictures of himself with his cell phone all the time, while dad enjoys snapping cats when they aren’t looking. And mine’s just not good enough (at slightly more than 0.3 Mpx (mega pixels), you can hardly dream about becoming a photographer). But, that’s the conundrum: these cameras are just not up to the task. Granted, I could probably invest in a sophisticated cell phone equipped with a better camera that might cost me an arm and a leg, but cell phones don’t appeal to me. Furthermore, if you are from around here, you already know the perils of keeping an expensive cell phone. And, it is not like you can separate out the camera from the cell phone without decapitating it completely.

All these years I have waited for occasions where friends would bring their cameras, to take snaps of myself. That may probably paint me as desperate, come to think of it. I have also been to some exotic places and wished dearly that I had had a cam.

Finally, last week I decided to reach out on a limb and buy a proper, standalone digital camera. A friend from Down Under, Grant, helped narrow down the choices of cameras, constraint by my self-imposed budget, to the Canon PowerShot A580, and the Nikon Coolpix L16. I nearly went for the A580, but on the day I was going to place an order for it, I had a reeking afternoon (which I may if I feel up to it blather about another time), and decided to settle on the Nikon L16, overkill features and therefore price being the reasons for turning down the A580.

I have been playing with the Nikon L16 since the last week. I am no seasoned camera owner or photographer to be able to expertly judge how well the camera fares, but I find it satisfactory. The product page is here, so you can check out the features of the camera without having to rely on my words. I have been playing with different shooting modes, exposure settings, flash settings, and whatnot. These are all novel to me, and I am enthralled by what something so small as this camera is capable of. The fruits of my toying with the camera are on display on my flickr account. The camera works seamlessly with the MacBook. The installation CD that came with the camera has a Nikon Transfer utility and a copy of Panorama Maker 4 for OS X.

As an aside, people who frequent my blog will have have noticed instantly that I have reverted back to the simple, clean theme for the blog. The previous theme was neat, if you can put it that way, and I have tried some other themes too, but I always find myself at home coming back to this theme.

Stay safe, folks!

A guide to configuring two different Django versions for development

Django 0.9x and Django 1.x branches are so far apart that a project built on top of the former, not least when it has been rolled off into production, that porting it to the 1.x branch of Django can easily escalate into a nightmare. If you have to maintain a legacy Django project — I choose to call projects built on anything before 1.x legacy –, you will find that it is easier if you maintain two different versions of Django on your development environment. How do you do that, is the quagmire this post revolves around.

I prefer Apache with mod_python to Django’s simplistic development web-server for Django projects. Initially, the task of setting up mod_python and Apache to your tastes may seem daunting. However, once you get around its not so steep curve, the difficult task becomes second nature.

I am working with Python 2.5 on a project with Django 1.0.2. Django is deployed on the system in the site-wide default directory for third-party Python modules and applications. I also have to support development for a legacy application built on Django 0.97 (a trunk snapshot from a time long ago). My requirement is simple: I want to be able to run both projects simultaneously without having to muck around tweaking configurations besides the one time when I set the projects up.

A garden-variety solution is to change the default Django directory in the Python path to point to the specific Django that is the need of the moment. This approach puts upfront a limitation of not being able to run both projects side by side. It also is annoying because it requires tap-dancing around Django directories when switching between the two versions. It is not a considerable blow to productivity, but if it can be avoided for a better, more efficient solution, there is no reason not to.

The solution I am proposing involves having the recent Django set up as the default, with the legacy Django installed in a different directory—after all, the legacy Django is the odd item of the group. I develop on an OS X environment, where I have the two Django versions set up thus:

/Library/Python/2.5/site-packages/django
/Library/Python/2.5/site-packages/django-0.97/django

You can probably tell which is which.

I have both projects deployed as virtual hosts on Apache, each running off of the root of the web-server without stepping on the feet of the other. They can easily instead be set up to, instead of the root of the web-server, serve from under a unique sub-URL path. That is mostly a matter of preference.

For each virtual host, I have assigned a domain name based off of the name of the project. I should emphatically point out that these domains are set up to resolve to localhost on my system. They may likely have real world twins that are routable over the Internet, but for all intents and purposes, they are local to my development environment. I have done it so, partly out of convenience, and partly because one of the projects hinges on subdomain-based user-to-account mapping (what this means, simply, is that registered users on the project are assigned different accounts that directly relate to subdomains, and can log in to the project only via their respective subdomains) for proper functioning. For the latter, the domain based approach was inevitable.

With that in mind, here are the virtual host settings for the two projects

<VirtualHost *:80>
   ServerAdmin root@localhost
   ServerName projectone.com
   <Location "/">
      SetHandler python-program
      PythonHandler django.core.handlers.modpython
      SetEnv DJANGO_SETTINGS_MODULE projectone.settings
      PythonPath "['/Users/ayaz/Work/',
            '/Users/ayaz/Work/projectone/'] + sys.path"
      PythonDebug On
   </Location>
</VirtualHost>

<VirtualHost *:80>
   ServerAdmin root@localhost
   ServerName legacyproject.com
   <Location "/">
      SetHandler python-program
      PythonHandler django.core.handlers.modpython
      SetEnv DJANGO_SETTINGS_MODULE legacyproject.settings
      PythonPath "['/Library/Python/2.5/site-packages/django-0.97',
            '/Users/ayaz/Work/', '/Users/ayaz/Work/legacyproject/'] + sys.path"
      PythonDebug On
        </Location>
</VirtualHost>

While each line of the above is important, the following is the highlight of this post:

   PythonPath "['/Library/Python/2.5/site-packages/django-0.97',
            '/Users/ayaz/Work/', '/Users/ayaz/Work/legacyproject/'] + sys.path"

I have effectively injected the path to Django 0.97 into Python path. What this helps achieve is that when mod_python loads the Python interpreter to serve an incoming request for the project, Python analyses its path, looking for a module named django. The first successful match is under the /django-0.97 directory, which, if I have not already lulled you into sleep, is where Django 0.97 lives.

For the curious, all possible mod_python directives are documented here.

All this is a one-time headache: you pop in a pill, and forget about it. I can now type in projectone.com or legacyproject.com in the browser to get to either project.

I should mention, still and all, that I have of late come to know of virtualenv, a Virtual Python Environment builder. It may be a more proper solution than what I have proposed, but I have not yet used it myself to say more.

I hope I was able to clearly explain what I had intended to.

Of bubbles and bitter experiences!

When it comes to procrastination (and therefore exaggeration), I stand unparalleled among the many circles I am known to be a part of. It has been a little over a year since my writing about the procedure to follow to disconnect PTCL DSL service and my undeniably firm resolve to sever off the connection, and I have only very recently finally managed to get around to getting my act together.

The exchange building, where I found the DSL office, was anything but a pleasant sight. Dilapidated, the inordinate building worn down through constant neglect over the years recalled similar sights of government offices that I had had the misfortune of being an audience to. Every wall, every floor, every desk and chair, and every roof mounted fan that appeared to be dysfunctional, I could lay my gaze on was layered with dirt and gunge, but what startled me the most was the sight of the two staffers in the small DSL room sitting on chairs that could fall apart any minute and working on two dust-covered computers lying on an old, worn-out desk. My heart sank. I was sweating from the already sizzling weather outside. The room felt hellish. A dusty, half torn portable standing fan was as close as it got to having any hope of relief in the heat. Throughout the ten minutes I had to sit in that room, except for the few moments I spent answering what was asked of me, I kept looking about, reflecting thoroughly.

It is easier if one can phase out and shield oneself from unsavoury, unpleasant circumstances, by maintaining a bubble around oneself. It is an uphill struggle keeping that bubble intact alone, for there are many places and many moments where the frailness of it becomes perceptible.

I digress. The steps I described in the post before remain the same for applying for discontinuation of service, with the exception that I did not have to surrender the equipment as it had been well over a year. Folks from their call centre called me twice the next day to enquire into my reasons for cancelling the connection.

Red Alert 2 multiplayer on Windows Vista

Finally, there’s a working patch available for Red Alert 2 that transforms the game to utilise the UDP protocol on LAN instead of IPX (which is no longer supported on Microsoft Windows Vista). The patch requires the modified file, wsock32.dll, to be moved into the root folder of the game. I can hazard a guess that the author of the patch ingeniously hacked the DLL file and overwrote the network routines to use UDP, and since the DLL is available in the same folder as the game binary, it is loaded instead of the original DLL.

I use the patch on Microsoft Windows Vista Home Basic to play Red Alert 2 with a friend on Microsoft Windows XP. He, too, has the patch deployed. Give or take a few not too bothersome glitches sometimes, the game works flawlessly. In our configuration, both the players have the patch deployed. I cannot vouch for whether a mix of UPD and IPX game clients will work.

The patch can be found here.

To toss a wrapper out the window

No matter how depressing a picture the newspaper paints every passing day without fail, despite to what alarming heights corruption in the country is reaching, notwithstanding the growing number of people who continue to die like cockroaches every day and fall pray to countless forms of acts of crimes and injustices, there is always a small fire of patriotism glowing somewhere deep within an individual. I know, and I admit, amidst all that has been happening, you can only do so much to make a difference.

It is pitifully sad to find that we live in times where the motivation to do a good deed comes from what if any personal gains can be achieved as a result in the end. This puts the phrase, the means to an end, in a shady light: if the means is ignored for a bit, what constitutes the end? The personal gains which ultimately drive the means to achieve the end, or the ideal end for which the pristine means were acted out?

Patriotism, even if a wee, is too much to ask for in the times we live. I give you that. But being responsible is not something you can opt out of. I staunchly believe that every individual should do their part in being responsible humans. But, then, I am repeatedly told that the ends do not justify the means?

Need they?

Change can only begin from within you. If you can bring yourself to justify a good deed when there is nothing in there for you in the end, that is where you start to become responsible. That is where you start to embrace change. Keeping that wrapper or empty pack of juice in your pocket and disposing off in a waste bin later on, instead of pulling down your window and throwing it out on the road, may not get you anything in return. But what you would be doing is playing your part, as a responsible citizen and good human. And playing your part is after all your moral responsibility.

I’ve long given up on talking this into people’s minds. It is almost completely hopeless. Even if I can get in, I can’t drive the point anywhere except out across the other side. However, I do have found little success in leading by example. By playing my part, and by hinting ever so slightly, I can get people to notice and to think about it. The end is marginally different from before, but even if it isn’t, I could not care less. I merely try to play my part alone, in my capacity and when and where ever I can. If only more people would think alike.

URL rewriting and WordPress

You may have noticed that WordPress by default creates and uses “Search Engine Optimized or Friendly” URLs. The raw URLs, which refer to the file on disk followed up by a train of grotesque-looking keywords and equals-signs and ampersands and question marks, are hidden from view. For WordPress, the magic comes from what is popularly known as URL rewriting. By sketching out simple or complex yet powerful rules to define what and how to rewrite, you can force the web server to completely transform URLs into clean, beautiful, search engine friendly forms.

Apache, a web server that can commonly be found to be the choice for deployment of WordPress, delegates the entire responsibility of URL rewriting to a module named mod_rewrite. URL rewriting rules can be defined globally, or on a per directory basis, which are interpreted and acted upon by mod_rewrite. In order for rules to be interpreted on a per directory basis, for which these are defined in a special configuration file that can exist within any directory, the AllowOverride setting must be enabled within Apache globally. If it isn’t, rules defined per directory will quietly be ignored.

In order for WordPress to weave its magic, both mod_rewrite and the AllowOverride setting must be enabled within Apache. This realisation dawned upon me when Asim mentioned that the two need to be enabled on Apache. On a server on which I had recently deployed WordPress for a friend, I noticed that created pages beyond the home page would give a mysterious 404. The two, as Asim gratuitously told me, were not enabled on Apache on that server which in turn were causing the 404 to pop out. I am surprised I did not stumble upon these two gotchas documented within WordPress—I may have overlooked, I am not sure.

I hope this serves to help a lost soul fumbling along a similar path.

Symbian: AKNFEP 23 panic

In an earlier post, I touched upon a means to switch the language of the Symbian emulator, popularly known as Epoch. I wanted then, but forgot, to mention one slight issue that crops up unexpectedly after the emulator makes a language switch. The thing that rears its ugly head is called an AKNFEP 23 panic. You may find a trifle relief searching for anything against it on the web, but the official SDK documentation—at least the 3rd edition MR documentation–swears ignorance. For these reasons, and because I wrote a post describing what appears to be the source of this issue, I feel I should plug in the loose ends properly.

There are two things that need to be told apart on the Symbian emulator. One is “changing the language of the emulator”, which changes the overall language of the simulator, a task that is akin to changing the language of a mobile device from English to Chinese for someone who only understands Chinese. The other is “selecting a writing language”. The writing language is what you write text in, say, for example, when you are composing an SMS message. It can be different from the language of the emulator or the phone, but it must be supported by the device—the latter condition being redundant as a device does not allow you to switch to writing languages it does not support.

You would ask, “Why is this distinction important?”. Often if not always, when you change the language of the emulator, you would also want to change the writing language, so that, for example, you may be able to write SMS messages in Chinese. Neither the emulator nor the phone is smart enough to automatically switch the writing language to the global language that is set. Whether it is a design decision or a feature not deemed necessary, I cannot say. However, on the emulator, when you change the language from English to a more exotic language like Chinese, and back, if the writing language is not also changed to reflect that language, you will confront an ugly AKNFEP 23 every time you try to open any of the applications.

Yes, the solution is that simple: Simply change the writing language. Here is a link to a discussion of the cause of AKNFEP 23 panic.

Internet outage: Undersea cables severed off again

As many as five undersea cables have been damaged AGAIN, affecting Internet and Telecom tubes of over fourteen countries. One has to wonder whether incidents like these are purely accidental in nature, or there is more to them than meets the eye. As Ansar pointed out in our discussion earlier today, of the thousand of kilometers the ocean spans, how is it that a ship manages to drop its anchor at the exact spot.

Whingingly yours

People who have worked with me know that I tend to whine a lot. I bitch about the smallest of things—not having a proper desk to work on, a comfortable chair to sit on, a powerful machine to work with, LCD to look at without straining my eyes, copious space to park my car, a peaceful ride to and from work, or even if ridiculously, continuous supply of power to do anything, etc.

I don’t complain for the heck of it, or because I am a disgruntled individual pissed at almost everything in life all the time. I want to be the best and most effective in what I do. To be that, I must somehow be productive. I can give way to productivity only when I am at peace with myself and everything around me to concentrate on the work at hand. And for that to be, I have to not worry about the desk on which I work being an inconvenience because perhaps it isn’t big enough to have half of what I need on it at any given time or wasn’t designed with ergonomics in mind, the chair on which I sit for the most part of the day to cause backache, the machine on which I work my finger to the bone to be sluggish and agonizing for that alone adds to your frustration more than any other single factor, the monitor to cause repeated headaches and eye-aches, circling the area outside round and round to find some place to park my car and finding subsequently that someone bumped your car at or the traffic police morons towed it away from the seemingly cramped up place you found to park it on because of lack of a proper parking spot, getting stuck in rush hour traffic for hours at ends amidst impatient idiot drivers honking and squeezing their cars where a bike won’t fit only to exacerbate the traffic jam thereby causing you to end up with almost no energy to do any work on top of carrying a frustrated mood, sitting in dark with no power, etc.

Did you lose track of what I started with?

Joel, in his article `The Development Abstraction Layer`, has it down an order of a magnitude more aptly and eloquently than I can ever myself.

DeltaCopy: rsync front-end for Windows – incremental file transfer

rsync is the first thing that pops in the mind when there is talk of fast incremental or differential backups or file transfers on and across Linux and Unix. With Cygwin, one may harness on Windows the power, flexibility and ease of incremental file transfers that rsync makes possible. There are no GUI front-ends to it for Windows as far as my knowledge stretches, and to be frank, I have never given rsync on Windows a jab.

However, now, there is DeltaCopy on Windows. Quoting straight from the website:

In general terms, DeltaCopy is an open source, fast incremental backup program …

In technical terms, DeltaCopy is a “Windows Friendly” wrapper around the Rsync program …

I cannot vouch for how well and reliably it works, and whether the interface is intuitive. Being hardly a Windows user, I have less of a reason to depend on GUI front-ends. However, if you are a Windows user and have been looking for an incremental backup solution or even a file transfer program that saves your precious time senselessly put to waste during file transfers, I do think DeltaCopy deserves at least one passing try.