New thoughs…

I am not getting enough sleep and not able to concentrate on any thing. My mind is completely filled with a strong feeling. Why I need to work for other organization and why I cannot have a my own organization. I have a strong feeling to have my own startup company. Nothing is impossible, I will definatetly a start a new company. – Ramesh

Advertisements

Vacobulary:Learning new words

I have very poor english vacobulory. Today I decided that I want to improve my vacobulary. When I encountered a new word then I will post that in this blog and will see howmany new words I going to learn…

Today I found two words that I am familar with
1) Eloped – esacaping with someone in order to marry ( Telugulo lechipovadam :))
2) bedlam – chaos, forming crowd with lot of noise like marriage party or any strike;

Algorithm:Lowest Common Ancestor

Today I am working on the famous problem Lowest Common Ancestor (LCA) to get familiar with all the algorthms related it. I faced this question in Microsoft interview held on Dec 2005, but that time I am not mature enough to anwer complex algorithms. But today I want to get familiar with this, after that only I will move to other algorithms. Very first step, instead of googling, I will refer my favourite topcoder algorithm tutorials. Lets go for defination first

LCA(u,v) – given nodes u,v in tree T, returns the node furthest from the root that is an ancestor of both u and v.

Unix: how can I split large files into a number of smaller files?

To split large files into smaller files in Unix, use the split command. At the Unix prompt, enter:

  split [options] filename prefix 

Replace filename with the name of the large file you wish to split. Replace prefix with the name you wish to give the small output files. You can exclude [options], or replace it with either of the following:

  -l linenumber
  -b bytes 

If you use the -l (a lowercase L) option, replace linenumber with the number of lines you’d like in each of the smaller files (the default is 1,000). If you use the -b option, replace bytes with the number of bytes you’d like in each of the smaller files.

The split command will give each output file it creates the name prefix with an extension tacked to the end that indicates its order. By default, the split command adds aa to the first output file, proceeding through the alphabet to zz for subsequent files. If you do not specify a prefix, most systems use x .

Examples
In this simple example, assume myfile is 3,000 lines long:

  
split myfile 

This will output three 1000-line files: xaa, xab, and xac.

Working on the same file, this next example is more complex:

 
 split -l 500 myfile segment 

This will output six 500-line files: segmentaa, segmentab, segmentac, segmentad, segmentae, and segmentaf.

Finally, assume myfile is a 160KB file:

 
 split -b 40k myfile segment 

This will output four 40KB files: segmentaa, segmentab, segmentac, and segmentad

SQL: return only non-matching rows

Question: Is there a way of joining two tables to return only non-matching rows? For example, Table1 and Table2 have an identical structure and contain only two columns:  

Table1
ID   Name
1    John
2    Philip

Table2
ID   Name
1    John
3    Andy

The query should return only the following rows:

ID   Name
2    Philip
3    Andy

Is there another way otherthan Unions and NOT IN clause?

Ans:

select coalesce(Table1.ID,Table2.ID) as ID
     , coalesce(Table1.Name,Table2.Name) as Name
  from Table1
full outer
  join Table2
    on Table2.ID = Table1.ID
where Table1.ID is null
    or Table2.ID is null

Get Inspiration…

Today is Vinayaka chavithi. I am happy to see that every one is working hard, with so fun, to get the Ganesh idol and decorating the place where the idol has to be placed. Really I amazed that even small kid also involving in that with same enthusiasm. These people are enjoying in this activities. I noticed that different idols are placed within 100 meters difference and the groups are working competitively in decorating. The most interesting part is the different idols itself created with creativity. 

After seeing all these, I feel that we Indians built strong worshiping culture. But the point is why this is limited to only worshiping the Gods? We all need to work in same for many other areas where our India is facing the problems. Why all these people are enjoying on this Vinayaka Chavithi? Because they have seen, inspired, taught and finally involved from their childhood. But the same way we are seeing poverty, illiteracy and bad politics from our childhood.  Why we are not educating ourselves in removing all these?  We all Indians have the same power as every other country had. But why we failed in inspiring others? This is the high time to change our attitudes by educating ourselves. We all need to work to make India number one. Going forward our blood cells has to grow with attitudes. That’s what my wish is. Happy Vianayaka chavithi again.

PERL: Display immediate 10 lines after search pattern

Here is the PERL script for displaying the immediate lines after search pattern. This will be very useful in analyzing in trace or LOG files. I am now looking at how we can do this using AWK.

[mingle]/home/rjanagam/perl% cat disp10Lines.pl
#!/usr/bin/perl
use strict;
use warnings;
my $lines = 10;
my $pattern= "NVL.ACCESS_RANGE_EXPR_DT,.99999999.. > :4";
open(F, "file.txt") or die "CANNOT READ FILE";
while(<F>) {
  if (/$pattern/)  {
      print scalar <F> for (1..$lines);
      #last;
  }
}
close(F);

Here is the AWK command:

awk '/pattern/{c=11}c-->0{print;if(c==0){print "======"}}' file

Independence Day

Today we had lot of activities in the Convergys but I didn’t get any prize in any of the competition :(.
independencedayindiakz8
Prize winning quotes:

1) “from khadi to tie and coat
this is no copy paste but an original quote wouldn’t know what we can do
from slumdog to millionaire
from footwear to software
we have leave a “print” everywhere
from aryabhatt to chandrayaan
from yoga to vedic gyaan
from the victories of ’47,’65,’71 to operation vijay and 11/26
from triumphs of ’83 to medals in olympics
from amitabh to mangeshkar
from gavaskar to tendulka from himalaya to the Thar
from kaveri to the ganges
from satyam to convergys
from cincinnati to hyderabad
inkalab zindabad
from kashmir to andaman
mera bharat hain mahan” – Niranjan

 2) He likes hindi songs.Just Like You.hates injections.
He’s been in love once or twice.Just Like You.
He’ll bleed when you cut him.Just Like You.
He loves rain on sun scorched earth.Just Like You.
He cheered India at OldTrafford.Just Like You.
He’s gone to die for a stranger.And that stranger is you.

BIG salute to the Indian Armed Forces” – Sandeep

Finally mines

“Rembering and celebrating the I’Day will not keep the pride of those who died for it. But it depends on how one follows their aims”  -Ramesh

Men would be Men

 

 A young man walked into a jeweler store one Friday evening with a beautiful young girl at his side.

He told the jeweler he was looking for a special ring for his girlfriend. The jeweler looked through his stock and brought out a $5,000 ring and showed it to him.

The young man said, “I don’t think you understand, I want something very special.”

At that statement, the jeweler went to his special stock and brought another ring over. “Here’s a stunning ring at only $40,000, “the jeweler said.

The young lady’s eyes sparkled and her whole body trembled with excitement.

The young man seeing this said, “We’ll take it.”

The jeweler asked how payment would be made and the young man stated, “By cheque.”

“I know you need to make sure my cheque is good, so I’ll write it now and you can call the bank Monday to verify the funds and I’ll pick the ring up Monday afternoon. “

Monday morning, a very teed-off jeweler phoned the young man.”There’s no money in that account.”

“I know “, said the young man, “but can you imagine the weekend I had?”