Wednesday, January 18, 2012

Thoughts on my recent trip to India

India is a land of many cultures and many languages. One of the biggest challenges for India is to handle problem of scale. In general, problem of scale is handled by breaking down into small pieces. In India, the divide and conquer rule is thrown out of the window since the population has exploded beyond control. This is similar to the problem of what happens when there are too many rats in the house.

In my recent trip, I traveled to North India for the first time(being a South Indian) with trips to Delhi, Agra and Jaipur(within 5 days) and realized that of all the places I had been ....Bangalore is comparatively so clean and is universally recognized as one of the best places to live in India. I must admit that I was amazed at how big the roads were in New Delhi and came away impressed with the nation's capital. On our way to Connaught Place, we happened to see the Delhi Metro looks great.

Our highest expectations were on Taj Mahal and the town of Agra . I was impressed with the Taj Mahal but not pleases with what the town of Agra had to offer. Agra is by far the dirtiest place I have seen in my life. I was also surprised that lot of folks there were out to hoodwink us rather than treat us like inquisitive visitors. By contrast, I loved the city of Jaipur especially with the impressive forts - Amer fort, Jal Mahal, Hawa Mahal etc and also the people.

I also got the taste of East India during this trip when I visited the city of temples - Bhuvaneshwar. The beaches near Konark and Puri are a sight to behold and so are the temples. The Puri Jaganath temple is probably one of the most crowded temples I have been to. Interestingly the Sun temple of Konark offered a strange insight of how advanced our artists and culture was in the 10th century.

Our trip was filled with lots of travelling and fun. India has by far the best places to eat varieties of food but quality food does come at a price these days. The biggest disappointment of the whole trip was the traffic in Bangalore. The Garden City does not have the same charm anymore. Bustling with malls and active night life, the city is enticing for the youth but very hard place to travel around. Here is hoping "Namma Metro" will solve majority of the problems by its connectivity.

Friday, January 13, 2012

Python-MySQL-Windows

One of the best parts of programming is you are always learning something new. I happened to build a simple statistics application with MySQL as the database. For practice , I decided to revert to Python since doing lot of coding in PHP and Perl. I was lazy enough to decide to add MySQL connectivity to Python on my Windows 7 (32-bit) box and found that I had a range of issues.

To cut the long story short...here is a summary for anyone who wants to use MySQLdb(Python MySQL driver) on windows.

I installed Python 2.7.1 on Windows which is a simple install from python.org. I installed MySQL Server 5.1 which is a simple msi file install.I then hit some snags with getting MySQLdb to work with Python. So this tutorial is truly for these versions.

  1. Install Python 2.7.1. I installed into "C:\Python27". Make sure you set yout "PATH" environment variable and compile Python with a simple "hello world!" program.
  2. Install MySQL Server5.x. Again make sure that MySQL can be accessed via command line by adding the MySQL Server bin folder to the "PATH" variable
  3. Do not download and compile the MySQL Python Drivers. You will waste time. Instead get precompiled executables from : http://www.lfd.uci.edu/~gohlke/pythonlibs/
  4. Double click on the exe after download and choose the python folder which was "C:\Python27" in my case. This will install the MySQLdb connector
  5. Start Python IDLE(GUI editor) and type "import MySQLdb". If you dont see any errors, you are ready to use the MySQL connector.
It is important to have the Path variables set correctly which makes the big difference. I spent couple of hours on this with missing libraries and changes in site.cfg and found this as the quickest way and hope my fellow coders dont waste time on trivial stuff like these.