Tuesday, December 29, 2009

Your weakness could be your real strength!

A 10-year-old boy decided to study judo despite the fact that he had lost his left arm in a devastating car accident. The boy began lessons with an old Japanese judo master. The boy was doing well, so he couldn't understand why, after three months of training the master had taught him only one move.

"Sensei," the boy finally said, "Shouldn't I be learning more moves?"
"This is the only move you know, but this is the only move you'll ever need to know," the sensei replied.

Not quite understanding, but believing in his teacher, the boy kept training. Several months later, the sensei took the boy to his first tournament.

Surprising himself, the boy easily won his first two matches.
The third match proved to be more difficult, but after some time, his opponent became impatient and charged; the boy deftly used his one move to win the match.

Still amazed by his success, the boy was now in the finals. This time, his opponent was bigger, stronger, and more experienced. For a while, the boy appeared to be overmatched. Concerned that the boy might get hurt, the referee called a time-out. He was about to stop the match when the sensei intervened. "No," the sensei insisted, "Let him continue."

Soon after the match resumed, his opponent made a critical mistake: he dropped his guard. Instantly, the boy used his move to pin him. The boy had won the match and the tournament. He was the champion. On the way home, the boy and sensei reviewed every move in each and every match. Then the boy summoned the courage to ask what was really on his mind.

"Sensei, how did I win the tournament with only one move?"
"You won for two reasons," the sensei answered. "First, you've almost mastered one of the most difficult throws in all of judo. And second, the only known defense for that move is for your opponent to grab your left arm."

The boy's biggest weakness had become his biggest strength.

"Sometimes we feel that we have certain weaknesses and we blame god, the circumstances and our self for it but we never know that our weakness can become our strength one day. Each of us is special and important, so never think you have any weakness, never think of pride or pain, just live your life to its fullest and extract the best out of it!"

The Mayonnaise Jar and 2 Cups of Coffee

When things in your lives seem almost too much to handle, when 24 hours in a day are not enough, remember the mayonnaise jar and the 2 cups of coffee.

A professor stood before his philosophy class and had some items in front of him. When the class began, he wordlessly picked up a very large and empty mayonnaise jar and proceeded to fill it with golf balls. He then asked the students if the jar was full. They agreed that it was.

The professor then picked up a box of pebbles and poured them into the jar. He shook the jar lightly. The pebbles rolled into the open areas between the golf balls. He then asked the students again if the jar was full. They agreed it was.

The professor next picked up a box of sand and poured it into the jar. Of course, the sand filled up everything else. He asked once more if the jar was full. The students responded with a unanimous "yes."

The professor then produced two cups of coffee from under the table and poured the entire contents into the jar effectively filling the empty space between the sand.

The students laughed.

"Now," said the professor as the laughter subsided,"I want you to recognize that this jar represents your life. The golf balls are the important things - your family, your children, your health, your friends and your favorite passions - and if everything else was lost and only they remained, your life would still be full.

The pebbles are the other things that matter like your job, your house and your car.

The sand is everything else - the small stuff. "If you put the sand into the jar first," he continued, "there is no room for the pebbles or the golf balls. The same goes for life. If you spend all your time and energy on the small stuff you will never have room for the things that are important to you. "Pay attention to the things that are critical to your happiness. Play with your children. Take time to get medical checkups. Take your spouse out to dinner. Play another 18.

There will always be time to clean the house and fix the disposal. Take care of the golf balls first-the things that really matter. Set your priorities. The rest is just sand."

One of the students raised her hand and inquired what the coffee represented. The professor smiled. "I'm glad you asked. It just goes to show you that no matter how full your life may seem, there's always room for a couple of cups of coffee with a friend."

Why It Is So Hard To Let Go

The cheerful girl with bouncy golden curls was almost five. Waiting
with her mother at the checkout stand, she saw them: a circle of
glistening white pearls in a pink foil box.

"Oh please, Mommy. Can I have them? Please, Mommy, please?" Quickly
the mother checked the back of the little foil box and then looked back
into the pleading blue eyes of her little girl's upturned face. "A
dollar ninety-five. That's almost $2.00. If you really want them, I'll
think of some extra chores for you and in no time you can save enough
money to buy them for yourself. Your birthday's only a week away and you
might get another crisp dollar bill from Grandma."

As soon as Jenny got home, she emptied her penny bank and counted out
17 pennies. After dinner, she did more than her share of chores and she
went to the neighbor and asked Mrs. McJames if she could pick dandelions
for ten cents.

On her birthday, Grandma did give her another new dollar bill and at
last she had enough money to buy the necklace.
Jenny loved her pearls. They made her feel dressed up and grown up.
She wore them everywhere - Sunday school, kindergarten, even to bed. The
only time she took them off was when she went swimming or had a bubble
bath. Mother said if they got wet, they might turn her neck green.

Jenny had a very loving daddy and every night when she was ready for
bed, he would stop whatever he was doing and come upstairs to read her a
story. One night when he finished the story, he asked Jenny, "Do you
love me?" "Oh yes, Daddy. You know that I love you." "Then
give me your pearls." "Oh, Daddy, not my pearls. But you can have Princess - the
white horse from my collection. The one with the pink tail. Remember,
Daddy? The one you gave me. She's my favorite." "That's okay, Honey.
Daddy loves you. Good night." And he brushed her cheek with a kiss.

About a week later, after the story time, Jenny's daddy asked again,
"Do you love me?" "Daddy, you know I love you." "Then give me your
pearls." "Oh Daddy, not my pearls. But you can have my baby doll. The
brand new one I got for my birthday. She is so beautiful and you can
have the yellow blanket that matches her sleeper." "That's okay. Sleep
well. God bless you, little one. Daddy loves you" And as always, he
brushed her cheek with a gentle kiss.

A few nights later when her daddy came in, Jenny was sitting on her
bed with her legs crossed Indian-style. As he came close, he noticed
her chin was trembling and one silent tear rolled down her cheek. "What is
it, Jenny? What's the matter?" Jenny didn't say anything but lifted her
little hand up to her daddy. And when she opened it, there was her
little pearl necklace. With a little quiver, she finally said, "Here,
Daddy. It's for you."

With tears gathering in his own eyes, Jenny's kind daddy reached out
with one hand to take the dime-store necklace, and with the other hand
he reached into his pocket and pulled out a blue velvet case with a
strand of genuine pearls and gave them to Jenny. He had them all the
time. He was just waiting for her to give up the dime-store stuff so he
could give her genuine treasure.

So it is with our Heavenly Father. He is waiting for us to give up the
cheap things in our lives so that he can give us beautiful treasure.

Isn't God good?

Are you holding onto things which God wants you to let go of. Are you
holding on to harmful or unnecessary relationships, habits and
activities which you have come so attached to that it seems impossible
to let go? Sometimes it is so hard to see what is in the other hand but
do believe this one thing.............

God will never take away something without giving you something better

Anger and Love have no limits

While a man was washing his new car, his 4 year old son picked stone & scratched lines on the side of the car.

In anger, the man took the child's hand & hit it many times, not realizing he was using a wrench.

At the hospital, the child lost all his fingers due to multiple fractures. When the child saw his father....with painful eyes he asked 'Dad when will my fingers grow back?'

Man was so hurt and speechless. He went back to car and kicked it a lot of times.

Devastated by his own actions..... . sitting in front of that car he looked at the scratches, child had written 'LOVE YOU DAD'.

The next day that man committed suicide. . .

Anger and Love have no limits, Choose the later to have a beautiful & lovely life....

Things are to be used and people are to be loved, But the problem in today's world is that People are used and things are loved.......

You are important for others

One day a teacher asked her students to list the names of the
other students in the room on two sheets of paper, leaving a
space between each name.

Then she told them to think of the nicest thing they could say about
each of their classmates and write it down.

It took the remainder of the class period to finish their assignment,
and as the students left the room, each one handed in the papers.

That Saturday, the teacher wrote down the name of each
student on a separate sheet of paper, and listed what everyone
else had said about that individual.

On Monday she gave each student his or her list. Before long, the
entire class was smiling. 'Really?' she heard whispered. 'I
never knew that I meant anything to anyone!' and, 'I didn't
know others liked me so much,' were most of the comments.

No one ever mentioned those papers in class again. She
never knew if they discussed them after class or with their
parents, but it didn't matter. The exercise had accomplished
its purpose. The students were happy with themselves and one
another. That group of students moved on.

Several years later, one of the students was killed in Vietnam and
his teacher attended the funeral of that special student.
She had never seen a serviceman in a military coffin before. He looked so handsome,
so mature.

The church was packed with his friends. One
by one those who loved him took a last walk by the coffin. The
teacher was the last one to bless the coffin.

As she stood there, one of the soldiers who acted as pallbearer
came up to her. 'Were you Mark's math teacher?' he asked. She
nodded: 'yes.' Then he said: 'Mark talked about you a

After the funeral, most of Mark's former classmates went together
to a luncheon. Mark's mother and father were there, obviously
waiting to speak with his teacher.

'We want to show you something,' his father said, taking a wallet
out of his pocket 'They found this on Mark when he was
killed. We thought you might recognize it.'

Opening the billfold, he carefully removed two worn pieces of
notebook paper that had obviously been taped, folded and
refolded many times. The teacher knew without looking that
the papers were the ones on which she had listed all the good
things each of Mark's classmates had said about him.

'Thank you so much for doing that,' Mark's mother said. 'As
you can see, Mark treasured it.'

All of Mark's former classmates started to gather around. Charlie
smiled rather sheepishly and said, 'I still have my list. It's
in the top drawer of my desk at home.'

Chuck's wife said, 'Chuck asked me to put his in our wedding

'I have mine too,' Marilyn said. 'It's in my

Then Vicki, another classmate, reached into her
pocketbook, took out her wallet and showed her worn and
frazzled list to the group. 'I carry this with me at all
times,' Vicki said and without batting an eyelash, she
continued: 'I think we all saved our lists'

That's when
the teacher finally sat down and cried. She cried for Mark and
for all his friends who would never see him again.

The density of people in society is so thick that we forget that
life will end one day. And we don't know when that one day
will be. So please, tell the people you love and care for,
that they are special and important. Tell them, before it is
too late.

Saturday, December 19, 2009

A simple illustration on Boost::any

#include <iostream>
#include <vector>

#include <boost/any.hpp>

using namespace
using namespace


vector<any> v1, v2;






(vector<any>::size_type i = 0; i < v1.size(); i++){

(char * pc = any_cast<char>(&v1[i])) cout << *pc << endl;

else if
(int * pi = any_cast<int>(&v1[i])) cout << *pi << endl;

else if
(string * ps = any_cast<string>(&v1[i])) cout << *ps << endl;

Sunday, October 25, 2009

sound in dell studio 1550 (Ubuntu 9.04)

Struggled a lot with sound play back in dell studio 1550 with ubuntu 9.04. Finally it was solved with just one line in the /etc/modprobe.d/alsa-base.conf

options snd-hda-intel model=dell-m6.

How to make skype working?

Read the link http://www.pulseaudio.org/wiki/PerfectSetup

Sunday, July 5, 2009

Recursively removing empty directories using python

import os
from os.path import join
def remEmptyDir(mypath):
for root, dirs, files in os.walk(mypath,topdown=False):
for name in dirs:
fname = join(root,name)
if not os.listdir(fname): #to check wither the dir is empty
print fname


Wednesday, March 25, 2009

Some LaTeX tips

1. How to typeset Exercise questions and answers in LaTeX?

Use the exercise package. It is available in texlive package in Ubuntu. The following customizations were done by me for typesetting it like a faq. The following would remove unnecessary frills from the typeset document.



2. How to include multiple authors in bibtex author field?

Use "and" between author names. For example,

author = {Elias M. Stein and Rami Shakarchi},
title = {Real Analysis},
publisher = {Princeton University Press},
year = {2005}

3. Using svn, svn-multi and eclipse

The documentation given in

is excellent but one should be careful of the following:
  1. When you use the 'svn propset' command as mentioned, if you cut and paste from the pdf file be careful. The commas may not translate properly into the text terminal and I had to waste a lot of time in identifying this.
  2. The fink package that comes with ubuntu 8.04 is outdated. You may have to get the latest ones from say CTAN.
  3. If you do commit within eclipse, it does not work (unfortunate :( ). I had to commit from command line.
  4. Be careful to use \svnfilerev,\svnfileday,\svnfilemonth,\svnfileyear,\svnhour,\svnfileminute etc if you want the svn revision data belonging to each file to appear. If you omit the file keyword in the above commands you will only get the latest revision number and date, considering all your files together. If you want the details regarding the revision of each file to be kept (say as footer or so) use the commands with 'file' present in them.

    4. Referencing
I have been using fancyref. But I think cleveref is a much better package. The package and documentation are available from CTAN

Wednesday, February 18, 2009

Directory size listing

The following python code lists the subdirectories and files of the given directory in the descending order of their size.

import os

# this function returns the size of the given directory or file.

def getDirectorySize(directory):
if os.path.isfile(directory):
return os.path.getsize(directory)
dir_size = 0
for (path, dirs, files) in os.walk(directory):
for file in files:
filename = os.path.join(path, file)
dir_size += os.path.getsize(filename)
except OSError:
pass #to manage for exampling a missing link etc
return dir_size

#this function lists the directory contents of the
#given directory by calling getDirectorySize(directory)
#to get the size of each directories

def getDirectorySizeListing(directory):
filesize = {}
dir = os.listdir(directory)
for item in dir:
sz = getDirectorySize(item)/2**20 #for converting into megabytes
if sz: filesize[item] = sz

#to sort the dictionary based on values
from operator import itemgetter
filesize = sorted(filesize.iteritems(),key=itemgetter(1),reverse=True)

return filesize

#application code
d = "/home/suresh/"
x = getDirectorySizeListing(d)
for i,val in enumerate(x):
print val

Monday, January 26, 2009

How to use Reliance Data Card (ZTE modem) in linux

Reliance provides the necessary driver for windows but could not get any help in using the data card in linux from reliance web site. Spending half a day with info from various blogs I could set it up.

My operating system : Ubuntu 8.04, Data Card: Reliance, zte modem


  • Make sure that the modem is detected by kernel.
  • Make sure that appropriate devices are created by the kernel
  • wvdialconf to get intial set up.
  • Additional commands to be inserted into the /etc/wvdial.conf file
  • You are done!

Is modem detected by kernel?

$ cat /proc/bus/usb/devices

You should get something like this:


T: Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 7 Spd=12 MxCh= 0
D: Ver= 1.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=16 #Cfgs= 1
P: Vendor=19d2 ProdID=fffd Rev= 0.00
S: Manufacturer=ZTE, Incorporated
S: Product=ZTE CDMA Tech
S: SerialNumber=Serial Number

C:* #Ifs= 3 Cfg#= 1 Atr=e0 MxPwr=100mA


If you do not get, this means that your modem is not recognised by linux.

If modem is not detected by linux kernel?

This section taken from Imtiaz Shabuz

sudo gedit /etc/init.d/mountdevsubfs.sh

and uncomment following lines from this file.

# Magic to make /proc/bus/usb work
mkdir -p /dev/bus/usb/.usbfs
domount usbfs “” /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
ln -s .usbfs/devices /dev/bus/usb/devices
mount –rbind /dev/bus/usb /proc/bus/usb

Now start the service

/etc/init.d/mountdevsubfs.sh start and reboot your pc.

Then check if the USB device is detected properly

cat /proc/bus/usb/devices

The above output should be shown.

Now probe for this USB device
modprobe usbserial vendor=0×19d2 product=0×fffd

Now you can type $dmesg command and see if devices are created. For me they were, /dev/ttyUSB0, /dev/ttyUSB1 and, /dev/ttyUSB.

You may better enter the following in your /etc/modules file and reboot the machine.

usbserial vendor=0×19d2 product=0×fffd

After rebooting connect the card, the devices would be present.

Modem is recognized and devices created, then?

use wvdialconf to create the initial /etc/wvdial.conf .

Edit the /etc/wvdial.conf file and fill in the following entries:

Phone = #777

Username = your_phone_number

Password = your_password

Stupid Mode = 1
(For me, it didnt work without adding Stupid Mode = 1. The reliance ppp server on the remote side does not give login prompt unless we start ppp on the local machine)

You are done!!! type wvdial and ppp interface would be ready now!!!