Dreams of Thought

Are dreams thoughts… or are thoughts dreams..

RSS Feed

Installing PostGIS on Ubuntu 13.04 Raring Ringtail


It's as simple as
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get install postgresql-9.1-postgis-2.0-scripts

You might see alternate instructions asking you to install Sharpie's PPA, but it works only for Ubuntu Precise. The instructions in the PostGIS trac wiki is also broken ‐ you will get an error like so :
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 postgis : Depends: libgdal1h (>= 1.9.0) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
This problem has been raised and a solution found in the PostGIS Trac Issue tracker. The first two lines are what needs to be done.
Filed under code

ForeignKey to custom user model in Django


Came across this problem when running a syncdb in Django (>=1.5) :

CommandError: One or more models did not validate:
APP.ModelName: 'user' defines a relation with the model 'auth.User', which has been swapped out. Update the relation to point at settings.AUTH_USER_MODEL.

So you define a custom user model and add the appropriate line to the settings.py file. Then you add a ForeignKey from a model in your app the way the Django doc tells you to. And then you see this (the one above) error when you run a syncdb.

We hit upon this problem. The reason this happened was that the AUTH_USER_MODEL setting was below the INSTALLED_APPS in the settings.py file. Django will not handle forward referencing in this case. The solution is to simply move the AUTH_USER_MODEL setting above the INSTALLED_APPS settting.

Filed under django

Breaking : IRCTC introduces lottery system for tatkal tickets

1 Comment

Railway minister Pawan Kumar Bansal has announced a lottery system for tatkal booking from December 1 this year. Travellers can start applying for tatkal ticket an year before the journey date. 3 hours before the train starts from the originating station, there will be a lucky draw to select the tickets for the tatkal quota. Announcing this at a press conference Mr Bansal said, "The ticket draw will be televised live over Doordarshan. We hope to cross the TRP ratings of IPL with this event". The programme is tentatively titled "Kaun Banega Tatkal Yatri". Mr Bansal further announced that the programme will be hosted by Amitabh Bachchan.

Explaining the rationale behind the decision the minister explained, "Booking tatkal on IRCTC is anyway like a lottery. Why not have some fun with it too?". Many heads nodded in agreement. Bivin George, a software engineer from Bangalore, says "I think we should have cheer girls cheering each time a ticket is picked. After all it's a once in a lifetime experience". Concurring with Bivin, Babhay Prabhakaran added in thick Thrissur accent, "The tickets should be carried and delivered by decked up elephants".

The additional revenue from the gameshow is expected to bring in much relief to the railways who are undergoing a financial crisis. The minister said that the much needed revenue will be promptly used for important things like frontpage ads featuring Sonia Gandhi, Mr. Rahul Gandhi and the minister himself. TV spots are also being planned.

Andrew Souza, an entirely made up software engineer who is a figment of my imagination explained, "Till now I was forced to book tickets for all my roommates and get beaten up by them when I couldn't. Now I can ask them to book the tickets themselves.". The relieved Mr. Souza has already planned to not plan his journeys 4 months in advance.

Not all is fair and rosy, dissenting voices have risen from the East. Ms. Mamata Bannerjee complained that the UPA had once again stolen an idea from her. She said, "This is all a communist conspiracy. The UPA is implementing policies I had thought of and now trying to take credit for them". Ms. Bannerjee went into a rage and promptly called up her Principal Secretary to arrest some random person on the road and charge him with a defamation suit. This reporter, meanwhile, felt it prudent to leave immediately to prevent a dangerous situation.


ps : err.. in case it's not clear, this is a satirical piece.

Filed under misc


1 Comment

50 years of Bond, what can one say! The trailers and the reviews leading upto the film have built a lot of buzz and expectation. The director, Sam Mendes, had his work cut out for him and he hasn't let us down. Skyfall is easily one of the best Bond movies of all time and certainly one of the best movies of the year.

The film has all that you would expect from a Bond flick. Guns, fights, chics, brilliant opening sequence .. you name it. What the writers and the director have also added is depth to the characters. Since Daniel Craig donned the role we have seen Bond not as a merciless killing machine- womaniser, but as a human being. Skyfall brings out the depth of Bond's character. Not satisfied, the writers have brought up Judi Dench's M on a pedestal. This isn't just a Bond movie, it's also an M film. Jane Martinson at the Guardian called Skyfall the least sexist Bond film, and she's right. M will leave your jaw dropping, the writers have fleshed out her character from all the hints they've left to her character in the previous movies. The tough, no - nonsense, do-whatever-is-necessary M has been beautifully essayed by the inimitable Dame Judi Dench.

A while into the film you start thinking the trailer has let out too much. Not to worry though, there's plenty to come ;-) If you've seen the trailer, then you pretty much know the first few minutes.

But there's plenty of material left to enjoy. Javier Bardem does well as the Bond villain. His backstory is well woven, I thought.

A piece of advice before you rush to the nearest theatre - watch this in a good theatre! The cinematography by Roger Deakins is simply superb. I especially enjoyed the scenes in Scotland. The huge mountains and the deserted plains have been captured so well.

tl;dr - Must watch

Filed under review

How to recognise a mallu


The recent imports from our land come into this great city with the expectation that the place would be creeping and crawling with kannadigas. "How laughable that is. Sho thamaasha thamaasha", would say the seasoned veteran. From his many experiences in bakeries and the malayali capital of Forum Mall, the seasoned veteran has come to realise that Bangalore - particularly the region known as Madivala - is in the state of Karnataka just for namesake. The newbie often ends up making mistakes like this -
noob enters bakery
noob : Ondhu chaaya. Ondu puffs maadu beku.
bakery guy stares at noob. Analysis complete, he shouts to his colleague.
bakery guy : Zahire, ഓന് ഒരു puffs-ഉം ചായയും കൊട് .

To avoid such potential pitfalls I hereby bring you the malayali's guide to recognising a malayali. Recognising a malayali is very easy. Like changampuzha once said -
"You can take the malayali out of kerala, but you can't take the kerala out of a malayali".

1. Bakery = malayali
There are 2 kinds of bakeries in Bangalore. One is the "Iyengar Bakery". These are very easy to recognise. They're often called just that. Occasionally they have the full name of its founding father, for eg. Madhu Iyengar Bakery. The Iyengar bakeries are few in number. The majority of the bakeries in Bangalore belong to the "Malayali bakery" category. If you feel like having some puffs, fear not and head to the nearest bakery. Brush up your best malabar malayalam and shoot.

2. Look at the name of the shop
Before you enter a shop read the name. Typical malayali names are often given to these shops. Examples include "Top in Town", "Star", "Royal", "MAS". If you see a shop like this, fret not. Forget your near-non-existent kannada and happily converse in your mother tongue.

3. Check the area you are in
You are in madivala. You enter a shop. Any random shop. There's a 99% chance that it's a malayali shop. Same goes for many other malayali areas like Thippasandra or GM Palaya.

4. Freak Style
Imagine you're inside the Forum Mall. I pause for a moment to give you time to take in the sight. Now see that freak guy over there. Yes, that one. The dark guy with a french beard, coloured/straightened hair, piercings in various parts of the body and an exaggerated swagger. Go there and tell him "Enthokke ondadey vishesham". Chances are he'll tell you "Oh, ingane okke jeevichu ponu aliyaa". 50% of the freaks/yo-yos in Bangalore are malayalis. Rest are chinkies.

5. Coconut Oil plastered hair
His/her hair reminds you of the banana chips your mother used to make. ഒട്ടും പേടിക്കണ്ടാ .. അത് മലയാളിയാ .

6. Watch out for the accent
You find a group of people in a professional setting. The malayali immediately advertises his roots when he opens his mouth to speak in English. Yes, you hash-bush guy - you too. Even your hash-bush English sounds like Malayalam.

7. When it rains
A proper rain is a rare event in Bangalore. Look out in such a situation and you'll find some people with umbrellas and others soaking wet. The ones with the umbrellas have a "ithreye ollo ivdathe mazha" expression. Needless to say they're malayalis.

There are many other traits that you learn to recognise with experience. Too much info, too little space. Share your thoughts - പച്ച തെറി is also welcome


Note : This was originally written for the alumni newsletter of our alma mater, "The xMECian".

Filed under misc

Installing Jetty on CentOS


Step 1 : Enable the jpackage repo Download the jpackage.repo file to your /etc/yum.repos.d/ directory.
# cd /etc/yum.repos.d/
# wget http://jpackage.org/jpackage50.repo

Step 2 : Install the jetty package you want
# yum search jetty
will show you a list of jetty packages you want to install. At the time of writing you get 2 options - jetty 5 and jetty 6. We installed jetty 6.
# yum install jetty6

Filed under Linux

Django 1.4 on CentOS 5.8


The default python version (2.4.3) on Centos 5.8 is not supported for Django 1.4 . Here's how to get Django 1.4 running on Centos 5.8 . Steps here are probably useful for future/different versions.

Step 1 : Enable EPEL

EPEL has newer version of Python available in it's repo. The first step is to enable it. The command you need to enable the EPEL repo is :
# rpm -ivh http://mirror.chpc.utah.edu/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
Once you install the package you've enabled EPEL.

Step 2 : Install Python 2.6 and easy_install

#yum install python26-distribute
This will install python 2.6 and easy_install

Step 3 : Install pip

#easy_install-2.6 pip
Now that you've pip installed, we can get started on install virtualenv and virtualenvwrapper.

Step 4 : virtualenv and virtualenvwrapper

#pip install virtualenvwrapper
will install virtualenvwrapper and virtualenv. Now you need to add some lines to your .bashrc
export WORKON_HOME=~/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python26
source /usr/bin/virtualenvwrapper.sh

(Make sure to create the ~/.virtualenvs directory if it isn't already created.)
Now activate the changes to your bashrc by doing
#source ~/.bashrc

Step 5 : Create a virtual environment for your Django project

You can do this by running
# mkvirtualenv my-env
Once you run this you will automatically switch to the new virtualenv. Your shell prompt will be prefixed with (my-venv)

Step 6 : Install Django

Change to the directory you want to install Django in. Then run :
(my-venv)#pip install Django


1. Installing MySQL-python :

First install
#yum install mysql-devel
and then install MySQL-python (my-venv)#pip install MySQL-python

2. Installing Gunicorn

(my-venv)#pip install gunicorn

3. requirements.txt

It's often easier to just have a list of pip packages to install for a particular project in a file. Conventionally, it's named requirements.txt
(my-venv)#pip install -r requirements.txt
will install all the packages given in the requirements.txt
(my-venv)#pip freeze
Will show you a list of packages installed by pip currently. Something like this :

You can take this list directly and put it into the requirements.txt
(my-env)# pip freeze > requirements.txt

Filed under django, Linux

Carnage (2011)


Carnage is Roman Polanski’s caricature of the modern life. The movie, save for a couple of scenes, takes place within a house. There isn’t much of a plot in this movie, it is the characters who shine through. The film is as such simple and humorous in a dark fashion.

The setting is provided by a fight between 2 kids. Their parents – Penelope (Jodie Foster) and Michael Longstreet (John C Reilly)  as well as Nancy (Kate Winslet) and Alan Cowan (Christoph Waltz) – meet up to discuss what they need to do about their children’s fight. Alan is a high flying lawyer whereas Michael is a “mediocre” salesman. Penelope is the “liberal” type and Nancy tries to be mature and conciliatory. The discussion that the four have veers away from the children and offers us a perspective into the lives of these individuals. Alan is wedded to his work and his cellphone, frequently interrupting the conversation to take calls. Nancy is fed up with this behaviour. Penelope has strong ideas about being civilized and does not like or understand violence. Michael tries his best to conciliate and bring about an understanding between the couples. Things slowly start degenerating and the conversation takes a turn for the worse when Nancy vomits.

The direct and brutal Alan can’t stand the almost naive point of view of Penelope. While Alan maintains that kids will be kids, Penelope talks about understanding and violence. Michael is fed up of trying to be conciliatory and blows his top. He provides his (excellent) Scotch to Alan and they start agreeing with each other. The otherwise cool and calm Alan’s weakness is reveled when the drunk Nancy drops Alan’s phone on water. Alan is distraught with his non-functioning “toy”, as Nancy puts it. As the credits roll the boys, who started off all this trouble, are shown to have re-conciliated and become friends.

The movie is adapted from the play “God of Carnage” by Yasmina Reza, who co-wrote the screenplay along with Polanski. The simple setting provides ample room for the characters to display themselves to the viewer. Their absurdities and follies are held up for view and we see glimpses of what is wrong with our society. You will likely relate to one of the characters. The actors are superb, offering performances which are sublime. Christoph’s beautiful essaying of Alan proves that Hans Landa was not a flash in the pan. Jodie Foster’s portrayal of the liberal, and towards the end hysterical, Nancy is brilliant. This is one of Reilly’s more outstanding roles and neither does Kate Winslet let us down.

Worth the watch.

Filed under review

Extrapulmonary Tuberculosis : patient’s perspective


When you hear about Tuberculosis you immediately think of a guy coughing blood and slowly dying. OK, maybe not dying. You wouldn’t be wrong either, most of the time. However there are situations where the Mycobacterium tuberculosis (the bacterium which causes TB) does not affect the lungs. The bacterium is actually not all that picky and you can get TB pretty much anywhere in your body, except maybe the heart. When it’s outside of your lungs it’s called Extrapulmonary Tuberculosis or EPTB. Yes, I didn’t know this either. Until I got diagnosed with it myself, that is.

Here is what it looks like from the perspective of a guy who has the damn thing.

Extrapulmonary Tuberculosis symptoms or how I was diagnosed with it

EPTB does not have a lot of symptoms. My version of EPTB affected my lymph nodes. EPTB does not cause coughing.

I had a swelling in my underarm. This was a big solid mass. I showed the doc and the doc told me it was an Abscess. I waited more than I should’ve before seeing the doc and it had swollen up really big and deep inside. The doc then proceeded to cut a hole there and drained out the stuff. I was told to take antibiotics for 5 days and told to make sure I dressed the surgery wound properly until it healed. This involved cleaning the wound with saline and gauze, and then closing it with a gauze pad and micropore.

Unfortunately, the wound didn’t come around to healing fully. After a few months a second swelling appeared one or two centimeters from the wound. The swelling had burst and hurt. I consulted the surgeon again. The doc then cut the wound a bit more and took some sample to be sent for biopsy. The biopsy result showed that there was some chronic issue. He mentioned some name which I didn’t catch, but the essence of the matter is that it would keep appearing. So I had another procedure and the surgeon removed the second abscess. While removing it they found an enlarged lymph node. The lymph node is vital to the body’s defence and is an immune organ. Basically it’s a storehouse. They removed that too and sent it for biopsy. I was told that the most likely cause for something like this in India was TB. The biopsy confirmed it.


I was referred to the pulmonary department. I had to take a chest X-Ray to make sure I didn’t have pulmonary TB (I didn’t). I was prescribed 3 medicines – Rifampicin + Isoniazid (before food), Ethambutol and Pyrazinamide. I have to take medicines regularly for 6 months. I have been asked to see the doc again after 2 months. I have also been asked to take a Liver Function Test (S Bilirubin, SGOT and SGPT) every 2 weeks for 2 months. This is because the medicines I take can have an adverse effect on my liver. The tests will indicate if something is going wrong. Other possible side – effects include nausea and vomiting. The sinus may swell as well. Urine will turn dark because of the medicines. No adverse effects so far from the medications. Touch wood!

If you have TB, don’t panic. Make sure to take the medicines regularly and all will be fine. Get well soon!

Update : After 2 months of medication the doc dropped 2 medicines off my list. Now I’m only on Rifampicin.

Update 2 : A touching and interesting story of a person who lost his memory due to Tubercular Meningitis. An excerpt :

Tuberculosis is a bacterial disease passed from person to person through the air, but the majority of people carrying the germs never actually develop the disease. Instead, it lurks, waiting until it’s agitated by a weakened immune system; some can harbor it more than 30 years before it’s activated, others can stave it off forever.

Disclaimer : I’m not a health professional. Heck, I didn’t even study biology after class 10. Do not consider this post as anything vaguely, remotely related to medical advice. Consult a doctor immediately if you think you have TB. The materials contained here are not intended to be used for the diagnosis or treatment of a health problem or as a substitute for consulting a licensed medical professional. Health information should always be carefully reviewed with your health care provider. I will not be held responsible for misuse of information or any adverse effects of recommendations stated here.

Filed under health

The Internet must die so the Internet can live


We are used to the idea of the Internet being free – free as in Freedom, though not always in price. It is difficult to accept government control over something we have so carefully guarded. But it is coming whether we like it or not. You may be in a democracy (the United States, India) or you may be in a dictatorship (China). Governments everywhere are trying to take control. Along with the government, powerful organisations (MPAA and RIAA, for eg.) will also get control. We do our best to prevent our loss of control, but over time those with power will win. We have to accept this fact.

Having accepted the fact what can we do about it? Rewrite. It is time we moved towards the new Internet. The new Internet will have many challenges to solve. Censorship is only one of the many challenges. Connectivity is another. While average Internet speeds have increased over the years, we still haven’t seen the huge jumps promised by the next big improvement (TM). Connections are unreliable – be it in the skyscrapers of New York or the villages of Africa. The are many technical challenges to solve.

While those with power have many weapons at hand – court orders to new laws – we have one weapon they don’t have. We are smart. We know science. Before it’s too late, before they take away the Internet from us, we must fight back. The new Internet needs to grapple with all these issues. It must be deliberately decentralised so that any attempt at censorship would be technically infeasible. We are taking baby steps, but we have light years to go before we sleep.

Filed under technology