Thursday, July 07, 2011

Chronology problem

Airtel's got some serious chronology problems, look at the two messages I received this morning (check the time stamps).

Message from 121
07-07-2011 8:32AM

We wish to confirm the receipt of your payment for Rs. 276.85.  Please note cheque/ECS payments are subject to realization.  View/Pay your bills at


Message from 121
07-07-2011 9:47AM

Your Airtel Mobile Bill dated 03-Jul-2011 for Rs. 276.85 has been generated.  It will reach you by 14-Jul-2011.  Due date: 21-Jul-2011. Dial *121*13# for bill details.

Wednesday, July 06, 2011

Vim basics

The drive for this article is mainly my developer teammates who keep struggling to edit and browse code in Linux environment, everybody wants a Linux version of Source Insight but unfortunately it's not there.  So in this article I'm gonna key in some basic commands that I typically use during my code analysis / development / browsing.  Of course there are innumerable tutorials on the net to browse through, this one's limited to commands that I use...

Code browsing:
For effective code browsing, I use combination of vim, ctags and cscope.  Goto the top level source tree and execute the following commands to create the symbol database.
$ cd kernel
$ ctags -RV * && ocs

The above commands take a while depending on the size of your project and create 3 files: tags (contain the tags which vim will use to jump to), cscope.out and cscope.tmpls (these two files will contain cross references to symbols which cscope will use to find a particular symbol) which you don't need to worry about.  It'll be used by vim and cscope and anyway cleaned during clean build.  I usually use two terminals when I'm browsing the code, one always runs cscope and the other vim.  

To open a particular file do this from the directory where you created the tag file.
$ vim arch/arm/mach-omap2/control.c

ctrl+] : Jump to definition of a particular function or a macro or a symbol, place the cursor on that press.

:tsel : If you have multiple definitions of the same symbol, you this command to choose the symbol of your interest.

ctrl+t : Will navigate you back to the place where you jumped to a particular symbol

gf : If you want to jump to a particular file (e.g. a header file), place the cursor on that line and press gf to switch to that file.

ctrl+6 : Will return you back to the file from where you jumped to using gf.

:buffers : If you have made multiple jumps using gf, this command will list you all the buffers (locations).

:buf n : With the list of buffers from the above command, you can jump to a particular buffer  (location) using this command.  n is the number which the above command displays.

/string :  Forward search a string

?string : Reverse search a string

n/N :  Find next (find again) in the forward/reverse direction

* : When you keep the cursor on a particular word and press asterisk (*) it finds the next instance of the string.

# : When you keep the cursor on a particular word and press hash (#) it finds the previous instance of the string.

% : Match braces and also #if and corresponding #else or #endif

:g/ :  This is a very useful command, it lists all the lines containing string in the entire file.

:g/string/d : Deletes all the lines containing string in the entire file.

:g/string/t$ : Copies all the lines containing string to the end of file

ctrl+v  : You can select column using this option, yet another very useful command.

yy : Yank line (copy line)

dd : Delete (cut) line

ndd : Delete n lines

x : Delete (cut) a letter

nx : Delete (cut) n letters

p :  Paste

yl : Yank a letter

ynl : Yank n letters

yw/dw: Yank/delete word on right

yb/db : Yank/delete word on left

ynw/dnw : Yank/delete n words on right

ynb/dnb : Yank/delete n words on left

. : Repeat the recent command

ctrl+f : Page down

ctrl+b : Page up

u : Undo

ctrl+r : Redo

J : Join two lines

^ : Goto the beginning of the line

$ : Goto end of line

gg : Go to the beginning of the file

G : Go to the end of file

H : Go to the first line of the page

L : Go to the last line of the page

M : Go to the middle line of the page 

o/O : Insert new line below/above the current line and enter edit mode 

A : Edit at the end of the line

I : Edit at the beginning of the line

C : Delete from the cursor location to end of line and enter insert mode

S : Delete the current line and enter edit mode

d$ : Same as C but will not enter insert mode

split : Splits the file in two windows horizontally

vsplit : Splits the file in two windows vertically

! : Execute a shell command without quitting vim

My .vimrc file (which usually resides in home directory and contains all the vim settings looks like this)

set nocompatible
set autowrite
set backspace=2
set backup
set backupdir=~/.VIM,~/tmp
set cindent
set filetype=make
set hlsearch
set history=50
set ignorecase
set incsearch
set laststatus=2
set matchpairs=(:),{:},[:],<:>
set matchtime=7
set ruler
set shiftwidth=8
set softtabstop=8
set showfulltag
set showmatch
set smarttab
set smartcase
set smartindent
set syntax=make
set title
set viminfo='50,\"50,%,n~/VIM/viminfo
set visualbell
set whichwrap=b,s,h,l<,>,[,]
set wildmenu
set nowrap
set notitle
set background=dark
set background=light
set ic
set nu

Cscope or the ocs does not need any description, as such.  Run ocs, look for the c symbol you want to find in the entire workspace and you can navigate to each of them.

Monday, July 04, 2011

UID aadhar

Went to Vijaynagar post office this morning for getting documents verified, photographed, retina & finger print scanned...I must tell you it was one hell of an entertainment.

First of all I don't understand why this was held at post-office...poor officials at the post-office were so damn disturbed and distressed by this.  There was no proper communication to the public too...the ones who had come for document verification bypassed the queue for the ones who had come for submission and that irked many of them and we heard things like 
"We're in the queue since 5 in the morning, how come you overtake us?"
"Boss...I've not come for submission, I've come for document verification.  It's different"
"What different, we're here since 5 in the morning"
"If you want to fight come out lets fight"
"I don't want to fight, I'm trying to be your friend.  I've come for document verification it's a different queue"
"I came here at 5, you go after me"
I heard one lady telling the officer in Kannada which verbatim translates "Saar you just take the application now...document is coming from home in 10 minutes.  Vonly 10 minutes saar"
Then there were people whose family members were delayed, this guy was getting his thumb impressions and he saw his wife entering post office...he yelled at her looking out of the closed window "Le illi baare...yaake isht lateagi bandh saaytya?"  (Ley come here...why die by come so late?)...the lady at the counter went haywire when she saw the thumb impressions appear and vanish in a second.
Then there was this poor old man who kept complaining nobody responded to his questions.  Finally one lady asked him what's his problem, he says "Nobody is listening to me".  She asked what does he want, he said "I'm old man, I can't stand in the queue, I need token now".  She just looked at her laptop and said to the next person in queue - "your turn" and with all due respect ignored the poor old man.  The old man whined as he walked out.
Then this man yelled at the same lady "Yesterday you asked me to come at 10 and I came exactly at 10.  Now you say you don't have any applications".   She answered with her coolest self "Sorry saar, forms got over by 9:15 only, you come tomorrow at 10".   I swear he would have gone at 10 the next day!!!  He'll be the last person in India to get his UID. 
This Marwadi guy who was totally in a hurry got all his things done and just when the lady pressed "save data" button the Windows crashed and he had to redo everything.  "Kya computer laga rakkhe hain yaha pe...hang hogaya saala...yeh government ka jo be item hota hain aisa hi hota hain!!!".  (What computer they've hanged...all these government items will be like this!!! - as though Indian government made Dell laptops). There were a shower of cuss words by the people in queue.  I did curse too...damned Windows!!!  I so wished to see all those computers running Ubuntu!
This lady submitted her document for verification, the officer asked her if she had driving license, she nodded negatively.  Then he asked if she had ration card, she said no.  Passport? No! Election card? No!  10th marks card? No!  Pan card? No!  The expression in his face said "Why the f#*@ are you here then?" but in a very polite way he said you're not eligible for UID card unless you have any one of the documents listed out in the poster outside.
Then there was an over optimistic old man next to me.  My token number was 6 and his was 20.  I told him it may take well about 2 hours for his turn so he can relax outside.  With a toothless grin he told me "If there is nobody between 6 and 20, I can go immediately after you saar".  I said to myself "Hope is a good thing!"
Then came another old pale lady with a hunch asking for application, the lady at the counter told another officer "Saar she has come here for application, it's over what to do?"  The officer without even looking at who's asking for it told her "Alle internet inda download maadkolakk helri!" (Ask her to download from internet).  The granny got out her Mac book air from her knapsack, plugged in her internet dongle, downloaded the application in a jiffy and fired the print through bluetooth to her super-slim printer..."NOT!!!"
A housewife was asked to hold the biometric retina camera to get a shot of her retina.  Somehow she reckoned it to be a binocular or something and she held it pressed to her eyes and started looking through it.  The lady said "Madam adu binocular alla...kanninda swalpa doora itkond kann doddaagi bidi"  (Madam it's not binocular...keep it little away from your eyes and open your eyes wide)
The data entering lady got confused with one of the forms and asked the person "Is it near Marenahalli or opposite to Marenahalli?".  The person said "anything madam, both are ok".   "How can it be OK ri?  Near is near and opposite is opposite".  "Ok madam nimge yen beko haaki, yella onde" (OK madam...whatever you prefer you's all the same).

My one and half hour wait there never bored me even a little.