December 30, 2009

Being Energy Efficient: Avoid Giving "Google It!" as an Answer

"Google It!" or many a times simply "Google!" (well only a few of us say Yahoo with an exclamation, even when it has an ! in its name). This phrase is most heard when one asks a question to a friend or a colleague these days. For all mortals who are yet to understand the true meaning of this phrase, it means, search for it on, or, or For example,

Q: What does ... mean?
A: Google It!

Q: I would also like to buy it, How much did you pay for it on ... ?
A: Gooooogle!

The question can be the most silliest, however, are we being energy efficient by saying Google It. One might say, after listening to the answer, there is high probability that the listener will Google. However, one must not forget a few golden words of wisdom can reduce the number of searches. Now lets see if we are being GREEN and energy efficient we are by saying Google It, compared to saying a few words that can avoid if not reduce the searches.

According to the official Google blog, each query consumes about 1 kJ of energy. Also the time required to consume this energy is about 0.2 seconds; note that this does not account for the number of CPU cycles consumed in your machine, and those in the intermediate routers and firewalls [People in India and China, consume more given the current state of the internet in these countries]. Further, according to the same blog, a human being takes about 10 seconds to burn the same 1 kJ. I am sure, simulating your little grey cells during the complex tasks such as Farming and Animal Husbandry consumes far less energy.

So, after being bombarded by a silly question, I request each one of you to take about 10 seconds of your time to come up with an optimum answer that shall avoid if not minimize the subsequent Google searches. However, if you believe that your body is in the highest state of energy and even a small disturbance can cause turmoil on this planet, then you may answer, "Google It!"

PS: In any case please refrain from doing this.
Q: Another Silly Question?
A: The-most-brilliant-answer

Q: How do you spell "The-most-brilliant-answer"?
A: Google It!

Wishing you happy random walks after Google It's :)..

December 29, 2009

The Great Indian Tamasha: गल्लीत गोंधळ दिल्लीत मुजरा

I am really glad that I saw the movie गल्लीत गोंधळ दिल्लीत मुजरा. This movie, along with मी शिवाजी राजे भोसले बोलतोय, are currently among the best movies based around the Indian Elections.

Lately, the political activities of the Bharatiya Janata Party (BJP), which was at one time considered to be an alternative to the Indian National Congress (INC), have shown that the above movies should remove their disclaimer of being works of fiction. I believe Gadkari is sweating to prove that one cannot swim against the wave of being myopic and greedy; he has thus given the finishing touches of his mutation into a person who is completely different from what he was during his stint as PWD minister of Maharashtra. The decision of joining hands with Shibu Soren is perfect case of गोंधळ and मुजरा, as it was the BJP that disrupted the proceedings in both houses of parliament while seeking Sorens arrest. Such double standards are nothing but a miscarriage of the electoral process and democracy. The demon who is responsible for the plight of the tribals in the mineral rich state of India, the very demon whose orders are followed by the coal mafia, has now been officially chosen by the majority of the people to solve the problems created by goons hired by his fellow demons. Time will only tell how much fuel this decision shall add to the Naxal and Maoist movements in this region.

On the other side of the country, when the people of Andra are dancing to the tune of diversity in unity and not मिले सुर मेरा तुम्हारा, the CM of its neighboring state is performing a मुजरा by sleeping with the enemy. While the candles are being burnt to jail Rathore, the CM is ensuring that a religious extremist and a sex tainted representative of the people is being rewarded with a chair in the state cabinet. Well this shows that we Indians are not different from chimps; the alpha male is still important in the Indian society and is best suited as a ruler.

Are such governments in in any way close to the राम राज्य (Ram Rajya), that Gandhi visioned? The above problems are a clear indicator of India's problems: lack of education, and growing intolerance motivated by religious extremism; these two snakes are choking the future of this wonderful country by their loop of mating which is producing the eggs of high fertility rates. Sadly, according to democracy, the vote of a pimp who leeches on the flesh of minors is considered to be equal to the vote from a person like Gandhi. At one point of time Vajpayee followed by Manmohan Singh were expected to be answer at least some of these problems, but as of now no political party, is worthy of being the representative of the people. I am slowly getting a feeling that the end of democracy is inching closer with each election in India.

December 28, 2009

The Sour Fruits of Delayed Justice

Well call it coincidence or stars deciding to expose the cream of the sleazy administrators in India. First it was Rathore and as the candles of protest were burning, the media found another fodder for their TRPs, the 84 year old governor of AP who seems to be testing his virility like King David.

Here are a few thought that crossed my mind regarding the case of Rathore:

1. He is a fully decorated officer and was promoted when there was case of sexual abuse against him. Further, he had allegedly molested a minor. Now how could a man be promoted if he has such cases against him?
A simple answer is that the laws in India assume a person to be innocent until proven guilty. Now even a child can tell that this gives a loop hole which can be used by people like Rathore to delay the justice; thus justifying his broad smile after hearing the verdict of Rs 1000 fine for molesting a girl 19 years ago.

2. What about the school that expelled the girl on flimsy ground. Did it succumb to pressure? Who were the ones who put pressure on the school and who from the school put pressure on the child? Aren't they equally responsible for the death of a child?

3. Now even if Rathore was promoted, how come medals were awarded to him. Why didn't the media protest when a tainted cop was being honoured?

4. Why weren't candles lit and protest marches held when this cop was continuing to harass the family of girl who killed herself because she couldn't stand the torture unleashed by this demon?

5. Why did the IAS/IPS seniors who recommend these medals turn a blind eye to this case?
These guys who were responsible for Rathores promotion are equally guilty as they ensured delay of justice. They along with the cops who were acting as contract criminals should be tried along with Rathore.

6. Rathore is 67 years old. If he had died before this verdict, he would have died as a fully decorated officer. May be he would have been recommended for a Presidential medal or had a few busts erected in his home town. This case would have been closed, and this case would have been written off by the media as case aimed at maligning people holding key positions. Now even if he dies tomorrow he would have lived the life of king. He was about 50 years when the case first came up, so he has enjoyed a life of watching his kids grow, which sadly the parents of the girl could not. So is the statement, अंत मै जीत सत्य कि होती हैं (In the end the truth prevails), is any good. It just says, there exists an end, and the end the truth prevails when this event called end occurs. However, it does not specify how much time is there till the end, and how much agony to suffer till this end comes. And what is there after the end. Is it a life of happiness. If Rathore dies today, the truth has come out but what about the 19 years of agony?

Now to the second case, N.D Tiwari trying to mimic King David.

1. A potential prime minister, a person who was the CM in 2 states, and while the public property is burning in AP, a potential ruler of a state during Presidential rule. This 84 year old pimp, was caught in a comatose position with young girls from his home state of Uttaranchal. The girls were allegedly brought to him by a lady who was promised some crap if the delivery was made. Sadly, the lady wanted more, so this sleaze came up. This guy is 84 years old. As in the case of Rathore if would have died before these clips were made public, the media would have had articles of his greatness, courtesy the publicity department of the political party to which he would have been affiliated at the time of his death.

2. Now if this guy at 84 years has such a strong libido, just imagine the number of girls whose lives he has destroyed during his rise in the sleaze of politics. What about those cases. If he had done such stuff when he was 30-40? How many cases were hushed by the cops? How many suicides did take place because of this sleaze. Will those people get justice?

The above two cases draw a picture similar to the one portrayed here. The society can be viewed as a tree with the fruits representing the justice. The men in power, which include the rich, politicians, and the social elite, are fat monkeys sitting on the top of the tree enjoying the fruits. There are a some good fat monkeys however, they are powerless compared to most of the other fat monkeys. A good number of the police are the monkeys hired by these evil fat monkey to sit on the branches of the tree and protect the evil fat monkeys. A few good monkeys who are in the Police, are never let to climb higher in the tree to become strong and kick the bad fat monkeys from the tree. The general public, is the one sitting on the bottom of the tree waiting for the fruits to ripen and fall down. Sadly the fruits of justice usually turn sour as they ripen and reach the general masses.

December 5, 2009

Minaret Ban - Why all the fuss?

Last week the Swiss decided to impose a ban on new minarets and this resulted in a huge hue and cry. I am not able to understand the reason for the attention given to such issues. Every country has a right to decide or impose some restrictions within its territory. Why are Islamic nations making such a hue and cry? Rather they should set examples on how such issues need to be handled. Before pointing out fingers to other nations one must look deep inside to see if similar problems exists in their own countries. Take the example of churches in Saudi Arabia, or restrictions to non Muslims during Ramadan in Dubai . Now if your country has a right to impose restrictions then one should allow others one to impose restrictions.

I would like to conclude with a slight digression considering the Demographics of India . Turbans are banned in France, however this has not stopped Manmohan Singh (a Sikh) from holding talks with Sarkozy on this issue and most importantly on other issues which concern Europe and India.

November 23, 2009

Words of wisdom: Shortcomings of democracy

Democracy assumes/gives all citizens of a nation a power (and duty) to decide on its leader. However, one of the biggest shortcoming of it is the assumption that all those who vote love their country in equal quantities, which intuitively is false. Azharuddin's rise to power is one such example of how such a democracy can go horribly wrong. Further, it is by far one of the best real life examples of villains one gets to see in the movies.

The mentors of Azhar, the breed of goons turned politicians, kidnaps girls, make them whores, use them with liquor during elections, and get voted to power. Now with armour of a filthy interpretation of the constitution to protect them they relish on the money and muscle power (including the police) to kidnap more girls and sustain this self feeding cycle of lust and power. The modus operandi is simple, once voted to power cleanse the sins legally and become a new messiah. Sadly this works because most of us have become short-sighted. Further, the press is filled with celebrity orgies, and socialites burning candles; events bombarded at people ensuring these so called celebrities are not forgotten in this world filled with people with limited and hence short term memory. Short sighted behaviour has been studied and the scary part is that such systems are sensitive to external behaviour (a villian from another land trying to destabilise the nation). A stark reminder that freedom which is an ongoing process that can be lost!

November 22, 2009

Words of Wisdom: Be wary of what you wish for. It may come true in a manner you never imagined

Something happened today. When I tried to analyse it, it was exactly what I wished for. My boon had been granted, however, the event was not exactly how I wished for it to happen. I had read stories about the devas and asura's being granted boons -- with a conditions apply tag ;) -- from the essence of the universe to enable them perform their tasks better. When they misused their powers obtained from the boon, their nemesis, a manifestation of their conditions apply tag would be unleashed to annihilate them. I am not sure how this would happen in my case as it was a simple thing as 'let my code run' :). However, the results produced just put light on a problem I had never imagined would be encountered. Enough of the digression, the beautiful part was the dream I had when I went to sleep.

The animals of a jungle were sick and tired of their constant games. They wanted ever lasting peace and harmony in the forest. They worshipped the lord of the jungle. When the lord appeared, they wished for ever lasting peace and a messiah who would guide them to this peace. Their wish was granted and a human babies was placed before them.

Moral of the story: Be wary of what you wish for. It may come true in a manner you never imagined.

November 13, 2009

Did someone win a patent for sudo command?

Here are a few patents about elevating user rights.

Of these patents, the patent going by the name Rights Elevator is receiving a lot of attention these days especially because of this xkcd comic.

I am not sure if someone has been able to patent the sudo command, however, they are pretty close onto something which can prove to be really nasty in the long run as the brief history of sudo shows that sudo seems be present from a time when this someone was in its infancy.

PS: I am using someone as I do not wish to add a disclaimer about rights and trademarks and I do not like using *doze ;).

November 4, 2009

Tips and Tricks: Scheduling Jobs Without Cron in Linux: An Example on using the at command (or batch command)

Cron is one of the most widely used job schedulers in the *nix systems such as Linux. However one needs to add jobs in the crontab file to schedule the jobs and this is not possible (typically) for users without super user privileges (In my case I needed to schedule an scp from a remote machine at 03:00 from a machine in which I did not have super user priviliges).

For such users job scheduling is possible with the help of the at/batch command or (batch command).

An example for using the at command to schedule the executing of the file present at /tmp/ is as follows:

Create a file /tmp/ by executing the following command

#> echo "touch /tmp/abc.text" > /tmp/

#> chmod +x /tmp/

Make sure that the atd deamon is running, which is the daemon process that is responsible for scheduling the jobs.

#> ps -ef | grep atd

Now schedule the job at say 03:00 tomorrow

#> at -f /tmp/ 03:00 tomorrow

The output will be something like

job 1 at 2009-11-05 03:00

The process will execute /tmp/ at the given time. Do a 'man at' for a glimpse of the complex time specifications the batch/at command allows.

October 21, 2009

Google Maps -- Double Standards

I am not very political but at least I know one thing, double standard sucks big time.

Arunachal is shown as a disputed territory for the rest of the world.

View Larger Map

And for the Chinese it is being shown as a part of China.


I am very disappointed and all I can say is that it shows Google turning into a very filthy organization.

Note --

Moral of the story is Google succumbs to pressure for a silly reason. It is a map to show where a place is on this globe, (location on earth with one of the names with which the place is called) and not a Political Map (no boundaries and one world). I guess one can show these places without political boundaries which will be consistent throughout the world? So will the usefulness of Google Maps or any such software diminish if it does not show political boundaries

October 14, 2009

Python tips and tricks: Flushing stdout

Many a times I need to redirect the output of a program to a file. For example

#> python > outfile

However, the problem with this is that stdout is not flushed on each print command and some of the statements can still be in the buffer which can be painful at times based on the level of anxiety :).

We shall now see one of the quickest way to ensure that stdout is flushed. I have not seen a case where it didn't work (at least in Linux) and do not know how one can verify if this works at all times.

For example if your file is as follows:
  • def test():
    • j = True
    • while j:
      • time.sleep(1)
      • print("Hello:"+str(j))
    • print "Bye"
  • if __name__ == "__main__":
    • func()

Just add the following line to your code
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)

This can be done as follows:
  • if __name__ == "__main__":
    • import os, sys
    • sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
    • func()

September 29, 2009

Quote: A general principle of Robustness

The general principle of robustness according to Jon Postel is as follows:

Be conservative in what you do, be liberal in what you accept from others.

It is a very captivating statement and I leave it up to you to the see the boundaries of its essence.

The quote is available in RFC 761 as follows:

2.10. Robustness Principle

TCP implementations should follow a general principle of robustness: be conservative in what you do, be liberal in what you accept from others."

September 18, 2009

Emacs tips and tricks: Whitespace removal

The artist mode of Emacs can be used to remove the whitespaces in an Emacs buffer. This can be done as follows:

1. Add the following lines of code to your .emacs file

(defun clean-whitespace()




Now bind this function to a keyboard shortcut of your choice. I personally chose f6, so in the case of f6 add the following lines to your .emacs file

(global-set-key [f6] 'clean-whitespace)

This shall be enabled the next time you run emacs.

If you wish to update it in your current session, then open the .emacs file. Select the lines of code added and execute M-x eval-region.

September 17, 2009

Python Tips and Tricks: Tab completion in Python Shell: How to enable Autocomplete in python shell

Autocompletion using readline libraries is really helpful while working in a shell environment. Python has a support for the readline library, hence it is possible to use readline for autocompletion in python shell.

The following steps need to be followed to enable autocompletion or tab completion in the python shell:

1. Create a file called .pyrc in your home directory (you can name is anything, however, I preferred to call this .pyrc). This can be done by executing the following command:

touch ~/.pyrc

2. Open this file using your favourite editor, such as emacs or vim and add the following lines in the ~/.pyrc file

import rlcompleter
import readline
readline.parse_and_bind("tab: complete")

3. Now to ensure that the above code is executed each time python starts, add the following lines to the ~/.bashrc file. This is assuming you are using the bash shell.

export PYTHONSTARTUP="[path to pyrc file]/.pyrc"

Once this is done, execute your .bashrc file by executing

#> source ~/.bashrc

Now you can test this. The output would be something similar to this

Python 2.5.2 (r252:60911, Sep 30 2008, 15:42:03)
[GCC 4.3.2 20080917 (Red Hat 4.3.2-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>> import os

>> os.

Display all 224 possibilities? (y or n)

September 11, 2009

Downloading youtube videos: abby and cclive

Another technique to download youtube videos and other sites such as dailymotion is a tool called cclive which has a front end called Abby. One can download this tool in fedora using the command

#> yum install cclive abby

Abby also acts as a front end for clive. Once installed, when running for the first time you are asked to add the path to clive or cclive and the folder where you wish to download the videos. The path to cclive and clive can be obtained by executing the command

#> which clive
#> which cclive

Once this is done, one needs to add the URL of the video (by clicking the + icon on the left and the download videos icon which is to the bottom right of the list of videos.


In case you wish to use the command prompt, the commands for cclive are similar to those of clive.

You can now view these videos even when you are not connected to the internet.

September 8, 2009

How to configure and synchronize Google Calendar in Thunderbird? : Use Lightning with CalDAV

There are a few Thunderbird Add-ons that help one use Google Calendar; however, one of the the simplest and the easiest way to access, synchronize, and hence use Google calendar in Thunderbird is by using CalDAV. I am not sure which features one misses out on using this technique compared to the Add-ons available, hence, I am not the best to compare this technique with those provided by the Add-ons. However, this technique has worked seamlessly for me.

The following steps need to be followed to enable Thunderbird you use your calendar at Google Calendar. The assumptions are: Thunderbird is installed with the Lightning Add-on, and you have a Google account and can access Google Calendar.

1. Open Thunderbird. Click on (in the menu) Go->Calendar (Ctrl+3).

2. Click (in the menu): Calendar->New Calendar. A new window will be open which asks you
to create a new calendar.

3. Select "On the Network" and Click "Next"

4. Select CalDav and in the Location Field enter: [ your Google Calendar ID ] /events

For your primary calendar your Google Calendar ID is your email address: For example, [ME] For specific calendars in google calendar one can use the technique provided here. PLEASE SELECT HTTPS and not http.

5. Assign it a name and other properties you wish to assign.

6. Once this is done, you will be prompted for your google id and password.

Voila!!! You can now synchronize your Google Calendar with Thunderbird. To check it add an event in Google Calendar from your web browser and see if that event shows up in Thunderbird and vice-versa. It will work, but I would advise you to try it.

July 23, 2009

Tuple unpacking in django templates

I was stuck for about an hour on getting the tuple unpacking in django templates right. If one has a list of tuples say

mylst = [(a, b, c), (x, y, z), (l, m, n)],

then the easiest way to unpack this list in the template file is as follows.
In my case I had a list of tuples which contained the URL, title, and summary of a document.

{\% for item in mylst \%}
{{ item.0 }} {{ item.1}} {{ item.2 }}
{\% endfor \%}

One need not follow complex steps as mentioned in

July 15, 2009

Online Text to Speech Converter

My neighbor, who is teaching me French, was not well for the last few days. She also requested me to continue with the lessons due to the shortage of time. The lessons were filled with new words and I did not know if I was pronouncing them correctly. Some of the new words for me were travailler, Est-ce que, pour, cher, etc. This motivated me to search for some online text to speech translators. I had to verify whether they were correct, and the best way was to check with commonly used words and sentences whose pronunciations were fresh in my mind, and that had some accents, for example, Bonjour Madame, Avez-vous , Bonne journée, and Je n'ai plus de croissant.

On searching on google, there were many tools that converted text to speech in english, however, only one gave me satisfactory results for French: the AT&T Text to Speech Converter. The demo version of this text to speech converter is available at the following link [AT&T Text to Speech Converter - Demo]. There are two voices available for French, Alain - the male voice, and Juliette - the female voice. One can try typing their names to confirm their pronunciations in French, the basic test which it had to pass ;).

I haven't tried using it for other languages, and hence cannot comment on its usefulness for other languages, however, I found it as a very useful French text to speech converter.

May 9, 2009

Download videos from youtube using clive

Clive is an open source tool that enables us to download the videos from sites such as youtube. No additional fancy plugins or browser extensions are needed. This is a really nice command line tool for downloading the videos. Executing apt-get using the command sudo apt-get install clive downloads the older python module. The tarball provided by sourceforge contains the newer perl based program.

Once clive is installed downloading the videos is as simple as viewing the videos on youtube. Once you are on the web-page on youtube that has the desired video.
1. Just open a terminal.
2. Change to the folder where the video is to be download.
3. Execute clive with the URL present in the web-browser

For example, the if the URL to view the video is, then execute the command clive with the URL as an argument.

ashwin@garuda:~/Videos/Lectures/LinearAlgebra$ clive

The response (of the older python based program) is

clive/0.4.3 (linux2; python/2.5.2; urlgrabber/3.1.0)
[log:on] [play:off] [encode:off] [throttle:off] [exists:skip]
status: 20KB 100% (1 of 1) []
status: checking file length... 94.323MB
queue: 1 (total: 94.323MB), failed: 0, skipped: 0.
write: /home/ashwin/Videos/Lectures/LinearAlgebra/Lec6MIT1806LinearAlgebraSpring2005.flv
transfer: 0.391MB

Depending on the bandwidth speed the video shall be downloaded in the desired folder. One shortcoming of this program is that if the download is interrupted then rerunning the program shall result in the downloading the whole file.

April 10, 2009

How to download contents of a site?

Sites such as have a vast resource of books and other online material which many a times is not accessible either because the servers are down or due to some other pathetic reasons. Further, many profs and teachers share their course material and other lecture notes online, for example, Clicking on each page requires patience which many of us including lil ol me lack, also I am not to comfortable with tools such as flashgot, a plugin for firefox. I prefer the good old wget. A simple way to mirror the contents of a site is to use wget -mk. This ensures that all the pages downloaded link back to the files downloaded. This ensures that you can view all the pages even when you are offline. However, many links can point back to the parent, for example, the prof might link back to the univ website which can create some loops in the download process. I am not sure if I am completely correct in this point but I avoid such problems by using the -np switch of wget that ensures that I do not fetch the pages which are the parents of the given page, i.e., I always traverse to the leaf nodes. So if you have to download notes from a particular site.
1. Open your favourite terminal
2. create a new folder to avoid a messy directory structure, e.g. mkdir -p /home/ashwin/Books/nios-notes
3. cd /home/ashwin/Books/nios-notes
4. wget -np -mk

Enjoy a few tom and jerry cartoons based on your internet bandwidth and voila, the notes are mirrored with all the links in the pages downloaded pointing to the files downloaded.