Wednesday, April 29, 2009

Pride Vs Shame

Hi,

Today there are few moments where i felt proud about my country at the same time felt ashamed.

Pride: I was working out in gym as usual. In the change room, i heard a background music compsed by our ARR in his slumdog millionaire. It was quite unusual for me to hear a song which is so familiar to me in the gym amidst the normal akon, justin timberlake, beyonce songs. This just gave me a feel good feeling but what made me to feel proud was one foreigner humming that background music on his way for shower. 

ARR - you made me (or rather us) feel proud. Miles to go!!

PRIDE



The other incident - Once i had my shower i was leisurely reading daily mail paper kept in leisure area of gym. There, i saw a photo of autorickshaw carrying loads of coconut fibres in a way that it entirely hides the autorickshaw itself. The comment on the photo was mockery. The below is the photo taken in our own mysore. 

SHAME



All the pride i had about my country few days before just vanished like passing clouds.

Thursday, April 16, 2009

One line find and replace string command in Linux/Unix.

Hi,

One of my friend was in urgent need for a find and replace command in set of files of some specific extension and asked me if i have one.

I gave him the following: Hope this is useful for you.

find . -name "*.extension" -exec sed -i s/strtofind/strtoreplace/g '{}' \;

where,
extension- extension of the file names where you want to find and replace.
strtofind- string to be found in those files.
strtoreplace- string to be replaced in those files.

Note: Please take caution when you want to find and replace strings having "/". You may need to use \\/ to make sure that "/" is treated as string by the sed command.

Thursday, April 09, 2009

Cleared SCJP 1.5 - 09/March/2009

Hi All,

Forgot to update you guys. I cleared SCJP1.5 exam on March 9,2009 with 87%. So here are few tips that i would like to suggest for future test takers.
  • Planning - minimum 2 hours per day for 3 weeks needs to be spent (42 person hours). 2 Weeks (28 person hours) for reading book and 1 week (14 person hours) for giving practise exams.
  • Book - Kathy Sierra.
  • Forums - www.javaranch.com
  • Mock Test - All mock exams listed in http://faq.javaranch.com/java/ScjpMockTests
  • Special mock test - Devaka Cooray (Exam Lab) mock test - listed as 46 in the above said mock test link.
  • Extra materials - To have a good understanding about Auto-boxing concepts and the generics concept along with examples, i purchased the materials from www.javabeat.com. The concepts explained in their material are very simple and intutive.
  • Scoring pattern - I was able to clear all the mock exams in the link mentioned above with score around 85%. Devaka Cooray is exception where i got only 51%,55%,57% and 60% in the assessment, first mock, second mock and final mock respectively. So dont get scared if you get low scores in Devaka's Exam Lab. Infact, the questions in the real exam were much more simpler than Devaka's Exam Lab.
If you need any further information, please mail me at thoppae.saravanan@gmail.com

Thursday, March 26, 2009

Recursive Listing of Files - Java code.

Hi,

Here is a small program that i have written to list directories recursively and also the count of files in each directory and output the same to console or to a file as per user preferences.

Usage: java ListFiles directory_to_scan [outputfile]

You can use this code if you really like and i dont impose any license restriction or something :)

But i will appreciate if you just send me a mail that you are benefitted by this simple piece of code.

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.FilenameFilter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class ListFiles {
private static List filesList = new ArrayList();
public static void main(String args[]) {
if(args.length ==0) {
System.out.println("Usage: ListFiles directory [outputfile]");
System.exit(-1);
}
String directoryName = args[0];
String outputFile = null;
if(args.length == 2) {
outputFile = args[1];
}
if(directoryName != null && !directoryName.isEmpty()) {
File directory = new File(directoryName);
if(directory.isDirectory()) {
File[] files = directory.listFiles();
int fileCount = directory.listFiles(new DirectoryNameFilter()).length;
filesList.add(directory.getAbsolutePath() + " = " + fileCount);
getFilesCount(directory);
}
if(outputFile != null) {
File output = new File(outputFile);
BufferedWriter bufWriter = null;
try {
bufWriter = new BufferedWriter(new FileWriter(output));
for(String fileName: filesList) {
bufWriter.write(fileName + "\n");
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
if(bufWriter != null) {
try {
bufWriter.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
} else {
for(String fileName: filesList) {
System.out.println(fileName);
}
}
}
}
private static List getFiles(File directory) {
List fileList = new ArrayList();
File files[] = null;
if(directory.isDirectory()) {
files = directory.listFiles();
for(File file:files) {
if(file.isDirectory()) {
fileList=getFiles(file);
} else {
filesList.add(file.getAbsolutePath());
}
}
}
return fileList;
}
private static void getFilesCount(File directory) {
File files[] = null;
int fileCount = 0;
if(directory.isDirectory()) {
files = directory.listFiles();
for(File file:files) {
if(file.isDirectory()) {
fileCount = file.listFiles(new DirectoryNameFilter()).length;
filesList.add(file.getAbsolutePath() + " = " + fileCount);
getFilesCount(file);
}
}
}

}

class DirectoryNameFilter implements FilenameFilter {

@Override
public boolean accept(File dir, String name) {
if(!new File(dir,name).isDirectory()) {
return true;
} else {
return false;
}
}
}

Tuesday, January 06, 2009

Leeds Castle - 03/Jan/2009















It has been a long time i visited some place outside london. Also since dostana1 (if you dont know who is dostana1 please read Mahindra City Memories - Part I) was here during the new year holidays, i thought it will be mutually beneficial if i go along with him to some place outside london. I then decided to go (rather take him) to Leeds Castle. Along with us, my roomie - Sri joined.

This leeds castle is in Kent county - south east part of England. To reach leeds we took a train to Bearsted station (which costs just 10.55 pounds - return ticket inclusive) from London victoria. There are two stations we can consider to reach this place. One is this bearsted station and the other one is maidstone station. But since bearsted station is closer to leeds castle and as it is the station that was mentioned in the leeds-castle.com site we took train going via this station.

Planning went for toss as usual. We planned to start by 10 AM atleast, but then by the time we boarded the train from east croydon it was almost 11.20 AM. Our journey plan was something like this.

East croydon - London Victoria - Bearsted station - Leeds Castle.

Breakfast?? - my money saving mind worked again. If we buy a croissant in some of the shops like upper crest, Delice de france, caffe nero it will cost around 1.5 pounds per croissant. But if the same purchased in some super market stores like somerfield, tesco or sainsbury it will cost only 40 pence. So I purchased a pack (which contains 4 croissant) of croissant from somerfield super market near east croydon and also got chai latte from caffe nero. We finished our breakfast during our travel from East croydon to london victoria.


We had a train from London Victoria to Bearsted station around 12.15pm and we reached Bearsted station around 1.15 pm. Once we reached the station we asked station keeper how to go to leeds castle from there. He informed us that there will be a bus in another 5 minutes, so we rushed to the bus stop which was just outside the station. To our dismay we did not find any buses going that way. A cab driver came to rescue us (some other indian friends were also waiting for the bus) offering drive till leeds castle. Dostana1 said that it should be free of cost but i know for sure that he was trying to indulge himself in joking mood which he can never ever do that. To prove my point the cab driver collected 10 pounds for the whole drive (We are totally 8 so it just costs 3 pound for 3 for us).

Once we got down i took out my samsung omnia phone (as we did not carry any other good cameras ;)) and starting shooting our Dostana1 and Sri.


The landscape around the castle was too good and we got to see goose, peacock and black swan (believe me it is really black swan !!!) roaming freely.
Also we saw that air balloons carrying people to have a panaromic view of leeds castle (costs 15 pounds per head :) - so obviously he he he)

After giving poses in various scenic areas, we got into the castle and awestruck the way it was built. I got to know little bit history of this castle. To get a good idea about the history of the castle please read it from wikipedia - http://en.wikipedia.org/wiki/Leeds_Castle

Oh yeah, you need to purchase entrance ticket to get in leeds castle but yet there is a way to enter for free!!!! I let you to find out how to do that.



Once our visit of castle is over, we again started taking snaps. But at this moment the temperature was getting down drastically that we are not able to stand without shivering. To add to this shiver, we found that no cab was available from the leeds castle towards bearsted station and also came to know that the public service bus is available only once in a hour. To make sure that the train availability/frequency is good, i used my samsung omnia to connect to internet (i really got to know the power of my mobile at these crucial times :)) and found that there is a train in another 30 minutes. So i asked Sri/Dostana1 to inquire about the cabs in the nearby souveneir shops. They did inquire about this and a lady helped us by calling a local cab driver. Cab driver arrived on time (Thanks to Sri who found out that the cab driver was waiting for us without even giving us a hint that he is a cab driver :)) and helped us to reach the bearsted station just 2 minutes before the train arrival. We had to shell extra of 4 pounds for this than we had spent for the cab earlier.



Once we got into the train we found out that we are in a compartment where there was no heater. You could imagine what was the state of Dostana1 and Sri in this case.

To summarize and to give some useful information from the above trip:
1) Take train to bearsted and from there take cab to leeds castle. Cab will be standing in the bearsted station itself.
2) Check if you can visit the castle for free of cost.
3) Go for air balloon ride (I will go once i become rich ;))
4) If you dont get cab to return to bearsted station - dont look any where else, just go to souveneir shop and ask for help.

Saturday, December 27, 2008

Mahindra City Memories - Part I

Pals,

As i had mentioned in my updates post, i was working in Mahindra City, Chengalpet for about 6 months starting from Jan till June 2008.

To describe in short about the place of work, well it is JUST 50 kilometres away from the Chennai city. Three modes of commute is possible as far as i know and they are:

1) By bike - if you really want to get retire soon citing back pain reasons - go ahead with this option.
2) Company bus - if you dont mind losing your morning sleep, sitting like tamarind sack (literal translation of puzhli mootai in tamil) in jam packed company bus, dont mind spending much for travel expense and last but not the least having enough patience to bear with the traffic during return journey - go ahead with this option.
3) Metro train - if you want to enjoy the early morning fresh air, least commute time and cheaper fare for travel - go ahead with this option.

As you might have guessed i chose option 3. I would really love to post the pros and cons of each and every transport mode but i think that will take one full post. So i think i will place these "travel"pros and cons in my forthcoming postings about my mcity experiences.

Having said about the mode of commute to the office, i should mention something about the campus. The campus is huge with some buildings under construction but neverthless it cannot be compared to the mysore master piece building. As i have already seen such huge buildings i was not awestruck at this.

Enough the intro of work place. If you are really interested in knowing about this work place then we will take it offline (this is the most commonly used business phrase when something which is not of significant importance will be discussed among the participants at later time - and i am sure in most of the cases they wont discuss :) )

Now i will just spell out the names of my friends (and their frequently used phrase) who are the very reason for me to write this post.

Rakka
  • Basically i am an introvert.
  • SOORAKADI (Heights of frustration - Meaning of this tamil word SOORAKADI). Actually this phrase is copy righted by Rama - note the third bullet in rama section.
SaBa
  • He he he he
  • Pottu kadala, Nela kadala, Ver kadala..... (Though i can give you the english equivalent it will be meaningless for you at the moment. I will post what this really means when i say more about this character)
Maanik
  • What is there in that tu (This sentence can be interprted for "n" number of context in "n" number of meaning. Thats where Maanik. "tu" is some kind of prefix he attaches after every word in sentence. That tu is due to the region of origin problem :) )
Naasar
  • Kambam illama kodi eradhunga..(Without pole the flag will not be hoisted - Again no meaning for the moment, but will come to know shortly).
Sri
  • Ennanga saravanan...Neengale ipdi pesalama (What saravanan...how can you talk like this)
Villa
  • Usually i wont talk much (and believe me he doesn't !!!)
Raghav
  • When i was in dublin....
  • How much calories this stuff has? How much saturated/unsaturated fat this stuff has?
  • Ping as many networks as possible.
Some of the above dialogs may impact his future life so i will not be telling the rationale/history behind each of this dialog in detail.

He is considered to be as both role model and model for many people in my company. Hope now you are curious to see him but in reality it is not that easy though. Just to give you an idea how he looks you can watch this video.

SRP
  • hehehehehe
  • Chup (shut up)
  • oh goddddddddddd
  • Yakkkkkkkkkkkk (with vomiting sensation)
Dostana1
  • Actually i am quite busy these days (but really he is not!!)
Rama
  • Kumdhalakkara kumma idha vangi kada summa..
  • Athala kali paduthkaali vaada en thakkali...
  • Soola karuppan adi da idha sollikitu pudida.
  • Vada en machi..vazhakka bajji...On odamba pichi....Potruven bajji..
Actually these are trademark dialogs of our beloved VTR. See these dialogs here delivered by our VTR. But it seems somehow rama got some copy rights.

Please digest these names and their favourite dialogs so that you can insert these dialogs when ever these people say something in my subsequent posts :)

Updates

Hi All,

Its very very long time i wrote some updates about me. After my one year and 2 months stay in india, i have taken assignment in London, England. So here is a short overview about my whereabouts.

1 Jan 2008 till July 11 2008 - In India working out of Mahindra City, Chengalpet.
12 July 2008 till date - In united kingdom working out of Canary wharf, London.

I have much to say about my stay in london and i will post them in my next subsequent blogs. I hope i mastered a bit about managing my time and hence should be able to post something or the other very frequently.

Cheers!!, Salute ;)

Sunday, April 13, 2008

Simple UML Tool

Hi All,

Recently i was assigned a task to create a UML diagram. Downloading tools like rational rose, smartdraw, visio etc will usually take long time and mostly will be a trial version blocking most of the important features. So I was looking for a simple, elegant UML tool covering all the basic UML diagrams and i found this UML tool called UMLet. This is a plugin for eclipse IDE and can be downloaded from http://www.umlet.com/

Thought this would be a useful information to some of you and hence posted. Download this and explore it - it is really nice.