The Month of September 1752 A.D.

This is the right month to add this post in my blog…. Have you ever seen the month September of 1752 ?…. You may say that… ‘what a silly question this man is asking?’ and if you ask me the question…‘what so special about the month September of 1752…?’ My answer would be … Yes it is a special month of year 1752. If you look into the calendar of the year 1752 and concentrate on the month September, you find that some days are missing in that month.

I got these strange phenomena, while reading the complete manual of ‘date’ command in Linux… If you are working in Unix, please try this out. At $ prompt, type: cal 9 1752 – Surprised???? Why the year 1752 is like this …? A month with whole of eleven days missing. This was the time England shifted from Roman Julian Calendar to the Gregorian Calendar, and the king of England ordered those 11 days to be wiped off the face of the month of September of 1752. (What couldn’t a King do in those days?!) And yes, the workers worked for 11 days less, but got paid for the entire 30 days. And that’s how “Paid Leave” was born. Hail the King!!!

Fact about ‘April First’ as Fools Day

Before that April is the first Month of the year. Even then people didn’t agree to use the Roman Julian Calendar and celebrated 1st April as a New Year then the King announced that, those who celebrate April as the New Year are fools… (thats why it is April fools day)

Interesting fact isn’t it?

PyCon India 2009

I was lucky enough to be the part of PyCon India 2009, a community conference by the Python developer community. The Conference was held on 26th and 27th September, 2009 at Indian Institute of Science (IISC) Bengaluru. I attended the conference with Nithin Kamath. In this post, I am going to share my experiences in the conference.

Day 1 , 26 September 2009

The day was started off with the registration and a introductory keynote by Mr. Prabhu Ramachandran, professor at the department of Aerospace engineering, IIT Bombay. In his talk, he spoke about his personal experiences using Python. (mainly in scientific computing). He also gave a introduction to Mayavi/TVTK tool, which is used for the interactive data analysis. The talk was impressive and stressed on the point that Python can be learned by anyone.. no programming knowledge is essential for it.

The second talk I attended was ‘Buildout for Development and Deployment’ by Baiju Muthukadan. The talk gave a knowledge on python-based build system for creating, assembling and deploying applications. The talk basically included a demo of deploying the application in the production environment, building applications using multiple software components with different configurations.. etc.

‘Waffle – A schema-less data storage on top of RDBMS’ was the third talk I attended, The talk was given by Mr Srinivasan R. The talk gave a introduction to the Project Waffel. Waffle is a project to create an open source implementation of Friendfeed’s “schema-less” storage system on top of a RDMBS using SQLAlchemy. This talk explained about the design, code and usage of waffle.

The forth talk was interesting, ‘Test Driven Development in Python’ by Mr Siddharta Govindaraj. The talk stressed on the practice of writing the test then write the code to pass the test. He also spoke about the Python Testing Framework (unittest, py.test and nose).

The fifth talk was on ‘Automated Testing of Web Applications’ by Sai Venkatakrishnan. The talk focused on the popular web application testing tools available in Python.Tools discussed in this talk include. Windmill, a cross browser and cross platform based testing framework. Twill, a headless browser testing tool which uses Mechanize to emulate a browser and known for its incredible speed. Pylot, a performance testing tool written in python to load and stress test web applications.

Three speakers, Lakshman Prasad,Chandrashekar Jayaraman,Thejaswi Puthraya gave a talk on ‘Django: A blessed webframework for perfectionists with deadlines’. A basic talk running through the features of the django web framework. The talk is concluded with live demo of how django site can be created in a minutes.

Last but not the least for the first day, ‘National Mission on Education through ICT & Python’ by Asokan Pichai and Prabhu Ramachandran. The talk focused on the adoption of Open Source Software in Science and Engineering Education and minimizing the use of commercial tools in Indian science and engineering education at the college level.

Day 2 , 27 September 2009

Second day, Mr. Keerthi Shankar Sekar gave a talk on ‘Python and .NET’, the talk was an introduction to IronPython – a Python interpreter for the Microsoft .NET platform. Mr Keethi gave a demo on setting up IronPython for application development and explained some of the major behind-the-scene differences between CPython and IronPython.

Next session, I was introduced to NLTK by G Jaganadh. NLTK is a Free and Open Source Python package for Natural Language Processing(NLP). The presentation talked about the introduction and demonstration features/functions in NLTK.

The PyCon-09 had some Lightning Talks by various people, to name some them, Mr Arun Ravindran, gave a talk on Pyglet-an object-oriented programming interface for developing games and other visually-rich applications for Windows, Mac OS X and Linux. Mr Dinesh – a social worker of NGO, gave a beautiful talk on how python (open source) can be used for the welfare of the society by developing softwares for the community.

To conclude the post, it was amazing to be the part of such a big conference. I got chance to meet the python programmers. The conference focused on sharing and pooling the knowledge of python among the developers. The conference was attended by good number of college students. It shows the popularity of Python among the college students. Finally the IIS’s environment is awesome…

How to speed-up the internet in Linux Mint

Few days after the installation of Linux Mint, I realized that the internet is not up to the mark in terms of speed. It is giving reasonable speed in WinXp. I am using BSNL NIC Card (CDMA 1x, which offers 144 k bps speed). A simple question irritating me…. ‘why net is slow in Mint? ‘ I stated to investigate in google and other technology blogs. Finally I found 2 reasons for this problem.

The Problem (Opportunity :-))

A] IPv6 is enabled in browser (Firefox) level and system level
Internet currently uses the IPv4.The gennext (Internet 2) are to use IPv6 (higher). IPv6 will solve many problems endemic to IPv4 (number of IP address, security, quality of service, etc.). Most of the current operating systems (Windows Vista, Linux …) are already perfectly capable of working in IPv6. IPv6 is “better” than IPv4, as both are available, then logical step to take is to firstly use IPv6. And that’s what most software does: They will first try to use IPv6 (if present in the operating system), then back to IPv4 if their application fails to use IPv6. (This additional process will sucks the time). This need to be disable in System level as well as Browser level

B] Firefox security Issue.
The second reason, is that the Firefox employs a technique to identify phishing sites. Firefox contacts Google.com for every http request and then it saves the results into ‘urlclassifier3.sqlite’ in your profile. If file grows more than 50MB, it leads to heavy drive thrashing and slow operation. (I am using Firefox 3)

Now the Solution Part

I] To disable the ‘IPv6’ in Firefox, try out the following steps

1. Open Firefox,
2. Type in the address bar: ‘about: config’
3. In the filter, type: ipv6. Find the variable network.dns.disableIPv6
4 Change value to true to disable IPv6 support in Firefox.

II] To disable the ‘IPv6’ in System level (Linux Mint), try out the following steps

1. Edit the file /etc/modprobe.d/blacklist using any of the text editor (I used Emacs)
sudo emacs -nw /etc/modprobe.d/blacklist
2. Add at the end of file the line:
blacklist ipv6

III] To solve the thrashing problem I tried out the following steps

1. Open Firefox and go to ‘Preferences’ which could be in Tools menu or Edit Menu.
2. Open the ‘Security’ tab, you will find the 2 check box captioned in
a] “Tell me if the site I’m visiting is a suspected Attack site”
b] “Tell me if the site I’m visiting is a suspected forgery”
3. Turn off these two check boxes
4. Delete the following ‘sqlite’ frile from your profle using rm command.
rm .mozilla/firefox/*/urlclassifier3.sqlite
5. Restart the Firefox.

Now I cannot compare the net speed in WinXP and Mint. Both working fine for me

Installing Linux Mint using Flash Drive.

The other day My friend had a problem with his Windows OS. Actually he was not able to connect with our office WiFi (because of VIRUS issues). I suggested him to go for Linux (because it is VIRUS free and no need to install any anti-virus softwares.) I demonstrated the Linux Mint, which was installed in my Lapi. Being fascinated by the looks and functionalities, he told me to go for it.

Its always Opportunity not the Problem…..

He had a problem (oh sorry its Opportunity for me). His CD/DVD ROM is not detecting the media. We tried a lot for it. But the DVD Drive is not ready to read the Mint CD. He said “It is BIG PROBLEM BOSS…. what to do now?”. I said, “Its Always Opportunity… not the Problem. Problem will always gives you the Opportunity to do the things in Different way.” So Problem=Opportunity.

USB came into Picture

So I went with the usb drive to load the “Linux Mint” in his laptop. First I googled and found a way to do it. I am going to explain the procedure. For this we require a USB, which is more having 2.0 GB Memory, Mint ISO CD and a LINUX machine

The procedure

1. Take Linux Machine and Insert the Linux Mint CD and a 2 GB USB Device into the Slot…
2. Type the following command.

sudo su
apt-get install usb-creator

sudo su The sudo command is a program for Unix-like computer operating systems that allows users to run programs with the security privileges of another user (normally the superuser, a.k.a. root). (Wiki)

USB Creator The USB Creator (usb-creator) is an official tool to create Live USBs Mint from the Live CD or from an iso image.

3. After Installing the USB Creator. Run the application (USB Creator). Normally it appears in “Application” in Main Menu. The steps I performed in my laptop is (a) Click Menu, (b) From the filter box, type usb creator, (c) Click Create a USB startup disk.

4. Make sure that the USB and the Linux Mint CD is already inserted into their respective slot and drive. The USB Creator automatically detects the CD and the USB device. If you are having the ISO image in Disk please specify the exact location of the ISO image. (Click on ‘Other’ button. It will give a dialog box to select the location). Make sure to select the radio button captioned “Stored in reserved extra space” before hitting “Make Start Up Disk”.

Finally the USB Boot Device is ready. I just Inserted the USB in friends Laptop(which was having problem with DVD ROM) and restarted the laptop. (Please make sure that the initial boot device is USB Drive not Hard drive or DVD/CD ROM.)

Configuring BSNL NIC Internet Card in Felicia (Linux Mint)

Recently I purchased BSNL NIC card for my browsing needs. The modem BSNL uses is Huwaei EC325. Along with the device they provide drivers in a Mini CD. The driver is for WIndows… not for Linux. Since I using Linux for my computing needs, I have to find a way to Configure it in MINT.

The configuration steps:

1 Let us start by Installing ‘wvdial’. ‘wvdial’ is a intelligent PPP(Point-to-Point Protocol) dialer. In simple, it dials a modem and starts PPP in order to connect to the Internet. Just type the following command in your terminal (Use apt-cdrom, because the net is not configured yet)

sudo aptitude install wvdial gnome-ppp

2 Setup the ‘wvdial’. Edit the wvdial configuration file, which reside in /etc/ folder. You can use any editor for editing the configuration file. I used ’emacs’ editor. The Configuration file looks like…

harish@hbm ~ $ sudo emacs -nw /etc/wvdial.conf
[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Stupid Mode = 1
Modem Type = USB Modem
ISDN = 0
Phone = #777
New PPPD = yes
Modem = /dev/ttyUSB0
Username = Your BSNL username here
Password = Your BSNL Password
Baud = 460800

Note :The username and the paswword is your BSNL WLL number
Then Save the File.

3.Finally run the following command in a terminal. You can write a shell script and place it in ‘.bashrc’ file for automatic start up

sudo wvdial

4 Open the browser and visit the site to check it is working.

The configuration file ‘wvdial’ must be running in the command line.

This is simple way to connect the BSNL modem… Actually Mint automatically detects the Huwawei Modem, and it also provides GUI for configuration, but unfortunately it was not working for me.

Finally I found Felicia….

My search for the best Linux Disto has come to an end after a year. Yes it took me almost a year to decide and select the perfect OS for my Laptop. Finally I satisfied with the Mint. The version I installed in my laptop is ‘Linux Mint 6’. I have chosen Mint mainly because it includes media codecs. Along with the media codecs, it also supports browser plugins, DVD playback, Java and other components.

Being originated from Ireland, Linux Mint is an Ubuntu-based distribution whose goal is to provide a more complete out-of-the-box experience. I use Ubuntu 8.04 as an official distro but it does not provide the audio codecs, which supports my laptops hardware configuration. Finally I ended up with the ‘Felicia’ (Codename of Linux Mint 6), which has the necessary drivers for my Laptop.

Some Useful links

1. The Home Page of the official Site Linux Mint Home Page
2. Download Linux Mint
3. Tutorials, documentation and even roadmaps are published on the Linux Mint Wiki
4 Blogs dedicated or related to Linux Mint can be read from the Linux Mint Planet
5 Linux Mint on Wikipedia Wikipeida Mint
6 DistroWatch.com Linux Mint
7 Users chat online via IRC on irc.spotchat.org/#linuxmint

Think Diffierent … Think Simple

I was reading a management case study yesterday. The basic principle of the case is KISS (Keep It Simple and Stupid). The case goes like this way

1. When NASA began launching astronauts into Space, they found out that the astronauts’ pens wouldn’t work at zero gravity (ink wouldn’t flow down to the writing surface). It took them one decade and $12 million to solve this problem. They developed a pen that worked at zero gravity, upside down, underwater, on practically any surface including crystal, and at temperatures ranging from below freezing to over 300 degrees Celcius. And what did the Russians do? The Russians used a pencil.;-)

2. One of the most memorable case studies on Japanese management techniques was the case of the empty soap box, which occurred in one of Japan’s biggest cosmetics companies. The company received a complaint that a consumer had bought a soap box that was empty. Immediately the authorities isolated the problem to the assembly line, which transported all the packaged boxes of soap to the delivery department. For some reason, one soap box went through the assembly line empty. Management asked its engineers to solve the problem. Post-haste, the engineers worked hard to devise an X-ray machine with high-resolution monitors manned by two people to watch all the soap boxes that passed through the line, to make sure they were not empty. No doubt, they worked hard and they worked fast but they spent whoopee amount of time and money to do so. But when a rank-and-file employee in a small company was posed with the Same problem, he did not get into the complications of X-rays, etc but instead came out with another solution. He bought a strong industrial electric fan and pointed it at the assembly line. He switched the fan on, and as each soap box passed the fan, it simply blew the empty boxes out of the line.

Another case which I read from my mail inbox is as follows

A 50 feet long trailer having 48″ wheels got stuck while entering a midtown tunnel in New York because it was approximately 2.5 feet taller than the height of the tunnel. The fire department and the state department of transportation spent the whole day searching for a solution, to no avail. Then a child, aged about 9 years, asked his father, “Why can’t they take out the air from the tyre tubes? The height will automatically come down.”

If you look at what you do not have in life, you don’t have anything. If you look at what you have in life, you have
Everything.

So simple isn’t it…… 🙂

Why I am using Python….?

 I thought, it would be better to include a post in My Blog,  as many of my friends  asked me this question.  So I am here with some reasons Why I am using Pyhton, as a main Programming Language for the development(both system as well as application side).

One and half year ago, I  Fell in LOVE with Python.  It was “Love in first Program” 🙂  I wrote famous program “Hello World”. It was amazing… I included only a line to do that.. yes “print ‘Hello World’.  The program gave the output on the screen “Hello World”.

Now coming back to the title of the post, Why I am using Python. There are lot of reasons for this question. Python helped in my day-today coding  activities. I solved lot of problems of programming within the short span of time. For strart-up companies like ours, python is God’s gift.

Besides the Python Features,  I would like to share my views on Python.

 

Best for Application/System Programming:

Being an interpreted, interactive, object-oriented programming language that combines remarkable power with very clear syntax. Python can be used to solve the many issues related with System Administrations. Challenges like, Release Management of the Application Software. Taking the Back-up of the Disk, Managing Users, can be programmed in Python without any difficulties. Now coming to Application Side Programming, lot of tools, web frameworks, libraries are available in Python which can used for the Application development. I use a web framework called Django, (Webframework developed using Pyhton)in most of the Web application. The other python web framework are PylonsTurboGears,  Zope,  web2py

A huge collection of Libraries

Unlike the Perl’s CPAN, Python’s standard library is very extensive. The library contains built-in modules (written in C) that provide access to system functionality such as file I/O that would otherwise be inaccessible to Python programmers, as well as modules written in Python that provide standardized solutions for many problems that occur in everyday programming. Some of these modules are explicitly designed to encourage and enhance the portability of Python programs by abstracting away platform-specifics into platform-neutral APIs.In addition to the standard library, there is a growing collection of several thousand components (from individual programs and modules to packages and entire application development frameworks),

Interfaces

Python provides interfaces to many commercial as well as open source databases. It also has interface for COM, DCOM and ODBC. The programs written in Python can be used in C, C++ and Java. Python is extremely portable with UNIX, Windows, Mac OS/2, BeOS and Cray. It is also feature of Automatic Memory Management.

Supports High-Level Data Types

Along with Standard data types, Python supports high level data types such as List Tuple and Dictionaries. The List, Tuple and Dictionaries are highly useful data types in Python and it is very easy to handle. The powerful feature of Python is Regular Expression. It is one of the awesome feature of Python. The other data types are binary data, introspections. It is also possible to define the new ‘built-in’ datatypes.

Supports Meta-programming

According to Wikipedia Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at runtime that would otherwise be done at compile time. Not all meta-programming involves generative programming. If programs are modifiable at runtime or if an incremental compilation is available then techniques can be used to perform meta-programming without actually generating source code. It is possible to meta-program in python using Python Decorators. I don’t have much knowledge in Meta-programming .

These are my thoughts on Python Programming Language.

Django – Validator to check the emptyness of file field

The other day My Team had some problem in the validation of the file field, the requirement was simple, they had to check whether the file field is empty or not. The problem sounds somewhat simple. I said just go with a simple ‘if’ and that’s the end of the problem.

But they were unable to do that.. and finally I had to sit with them to solve the problem. It wasn’t that simple as I had realized. We are using a custom validator, which takes two argument- a ‘field_data’ and ‘all_data’. The ‘all_data’ is python dictionary which includes all the fields of the form.

The problem I faced was, non-availability of the file field in the ‘all_data’ dictionary. After fighting with the code, I found a solution. The code looks like this (I am pasting only custom validator code snippet):

Let’s assume that the file field name (model name ) is ‘pdfFile’. We can use python dictionary’s method called ‘has_key ‘. The output of the ‘has_key’ method is boolean. (True or False)


def validatorsName(field_data, all_data):
if all_data.has_key('pdfFile') and all_data['pdfFile'] != "" :
pass
elif not all_data.has_key("pdfFile_file"):
raise validators.ValidationError("The pdf file field is empty")

Let me explain above python code (sorry about the indentation ). The first ‘if’ statement is to check whether the file field already has link or not. If the file field is not empty, ‘all_data’ dictionary includes one key called ‘pdfFile_file’ (‘pdfFile’ key includes the existing link and ‘pdfFile_file’ includes the currently entered link). If the second condition fails it means that the file field is empty.

A Round of Siddara Betta

It is my fourth visit to Tumkur. Everytime I traveled through the National Highway No. 4 (Bangalore-Pune NH) road, I always used to wonder about rocky mountains on either side of the road. Being a nature lover, I always wanted to visit each and every rock personally. But practically speaking it is not possible. So I have chosen some of the famous Rocks of Tumkur. My aim is to treck some of the rocks of Tumkur.

There are lot of such rockiest places in Tumkur district. To name some of them, Devarayanadurag, Shivagange, Madhugiri, Chennarayana Durga.. and many unknown ones. In this post, I share my experience of Siddara Betta. One of the famous rocks of Tumkur district.

It has been said that many hermits had performed the meditation in the caves of Siddara Betta. Siddara Betta is rich in natural beauty. It is paradise for nature lovers. It has rare species of herbal plants.

Situated in Koratagere taluk, Siddara Betta is approximately 97 Kms away from Benagaluru. It is ideal place for cave exploration and trecking. The KSRTC provides bus services till Koratagere. From there private buses will take you to the Siddara Betta.

Information

Total Distance From Bengaluru 97 Kms
Koratagere (Nearest point) from Bengauru 75 Kms
From Koratagere to Siddara Betta 18 Kms
Nearest Food point Koratagere (Udupi Hotel)
From Tumkur to Siddra Betta 35 Kms (aprox)
Cellular Service AirTel, CellOne and Reliance

The journey began from Bangalore. I and my friend started from Majestic. It was totally an unplanned journey. After we reached the KSRTC bus depo, we planned to visit Tumkur first, and from there to Siddra Betta. But, luckily we could catch a bus which goes to Korategere. The journey was quite ok. We collected as many information as possible from the passengers and the bus conductor about the place. After two and half hours of journey, we reached the Koratagere taluk.

Koratagere is a small village. As soon as we reached there, we decided to have a break-fast. We saw one Udupi Hotel and we broke our past at around 12 noon. While having the break-fast, I collected as many information as possible from the owner of the hotel. He recognized me as Mangalorian by listening to my Kannada. According to the hotel owner, in every hour there wil be a private bus which goes to Tumkur via Siddara Betta.

We caught one private bus and spent 45 minutes with the bus standing idle. I hate private buses (but there was no choice). Last time when I went to Shivagange, I traveled in a “Noicy Box” (In Bangalore every private bus is equipped with a small ‘Bus Theatre System’ and they usually play some movie with a high volume). It was one of my worst private bus journeys ever.

Finally, the bus started to move. We have enjoyed the scenic beauty of the nature while traveling. We also got a chance to see the Chennarayana Durga. The weather was awesome. It was drizzling frequently and the a mild fog covered most of the rocks. As we were leading towards the top place, we could sense the drop in the temperature. When we reached the destination the rain also increased its intensity. The whole Siddara Betta view was covered by the clouds and fog.

We had hardly two hours of time to treck the Rock. We decided to treck till cave template. We started off quickly towards the Rock. We had to walk a distance of half kilometre to get the foot of the Siddara Betta. It was raining as we reached the foot of the Siddara Betta. We were in dilemma as to treck or not. Finally we decided to treck as much as possible. (Because trecking is risky during the rain, the chance of slipping is more). It was hard for me to treck the initial 25 steps. The wind blowing was so cold that I felt it is difficult to breath the chilled air. Very quickly, I adjusted to the atmospheric condition.

As we were moving further, the weather became more violent. The whole Siddara Betta was covered by thick fog. It was very difficult to watch ahead. I am sure that the scenery from the Betta is beautiful but the cover of thick fog did not allowed us to enjoy the awesome view. It was very difficult for us to treck. As we climbed up, the temperature stated to drop. We were not prepared at all to face this situation. We didn’t have proper accessories to deal with this kind of weather. But still we managed to move ahead.

There are stairs which will take you to the cave temple. In the middle, the stairs are not carved properly. So we had to take double precaution while treckking.(doubble, because of rain). It was disastrous to treck with chappals or with the plain shoes. Either we need to have special treck shoes or we have to walk bare footed.

Even though the atmosphere was rough, it was wonderful. It was a memorable experience to treck in this situation. We successfully captured some of the glimpses of the nature. Siddara Betta is filled with variety of vegetation. The natural spring on the hillock is known for its medicinal value. A wide variety of medicinal plants are grown in this rock. The fresh air of this betta is natural remedy for respiratory related problems such as astma, bronchitics etc. It also has mythological significance. It was the same betta where Lord Hanuman had collected sanjeevani to save Lakshmana during Ramyan war in Treta Yuga. The betta is filled with the nature wonders. Various species of birds can be seen in this region and it is the natural habitat of the yellow throated Bulbul bird.

After trecking for about 45- 50 minutes, we managed to reach the cave temple. Here Shiva is called by the name Siddeshwara Swami. We did not plan to go into the cave and explore it. We just visited the temple. Here the temple was not built; but it is a natural cave temple. It is dark inside; there are lights, but as usual, no power. There is a theerth (water source) inside the temple. It has been said that, the theerth has got medicinal values. As we headed out of the cave, we started to ask the localite about the cave. According to the localite, the cave is wast and confusing, the chances of getting lost inside is high. The cave has connecting route between Shivagange and Bangalore (it will join the Gavi Gangadhareshwara Temple of Bengaluru). The cave temple is situated in the middle of the hill. We were interested to treck further, but the time and the weather didn’t allow us. So we decided to start our journey back.

Every expedition will emerge as an experience. It was an memorable experience for us. We enjoyed every moment of the time that we spent in Siddara Betta. At the end of the day the journey was incomplete, we didn’t experience the top, nor the thrilling dark caves of Siddara Betta, but still we enjoyed ‘the day’ in our life.