Thursday, December 31, 2009

Issues while starting mysql server

I have installed mysql server again in my local machine and I was trying to start the same using /etc/init.d/mysqld start and I was getting error saying "Timeout" and when I looked into /var/log/mysqld.log, it is giving error as the db is corrupted or not shutdown properly previously. And after doing some other fixes, I was getting "Can't open and lock privilege tables: Table 'mysql.host' doesn't exist" So to resolve this, I have removed the datadir altogether and have executed below commands:

/usr/bin/mysql_install_db --user=mysql --ldata=/new-data-location
and once that is succeeded, I tried to start with
mysqld_safe --datadir=/new-data-location --user=mysql &
and I got below error saying it couldn't create .pid file in /new-data-location/mysqld. So, I had to manually create mysqld directory in new-data-location and change ownership to mysql and re executed above command and everything went fine.

Now, I changed the root password using the secure installation script(mysql_secure_installation) available in bin folder and everything is fine now.

Refreshing all IMAP folders in Thunderbird

Continuing my work towards configuring my desktop for checking mails, I was irritated with thunderbird configuration as it wasn't refreshing all folders and I had to manually click on each folder for new mail. So, I was wondering what to do and then I remembered what my husband said which I effectively use in my day-to-day work. He said below quote.

"Remember, when you are facing a problem, don't think you are the only one and there are many who might have faced this earlier. So, before rushing to solve the problem, try to search over the net if there is a solution already. No need to reinvent the wheel"

There I go again, I searched and got below solution for refreshing all folders in Thunderbird.

Go to Edit ->Preferences -> Advanced -> Config Editor and toggle the following parameter available in the list.
"mail.check_all_imap_folders_for_new" which toggles value from false to true and you are done. Now, I don't need to refresh each folder separately.

Reference for above solution:
http://alexlurthu.wordpress.com/2007/07/22/thunderbird-config-to-refresh-all-imap-folders/

Thursday, December 24, 2009

The only Active President of India so far

None other than great Dr. APJ Abdul Kalam ji. Though, President don't have much power to do, he was not wasting government money for useless travels and was inspiring young generation where ever he went to give a talk/chat with people. I remember the discussions that were happening while electing the next President when Dr APJ Abdul Kalam and other lady (don't remember her name) were contending for it. Now, I feel what would have happened if the lady was selected, we would have missed such a great president.

Just now heard that our current President of India,Prathibha Patil, brought her 3 dozen relatives along with her while travelling to some other place. We, the poor tax payers continue to pay taxes to let the politicians enjoy with our money. :-)

Monday, December 21, 2009

To start mplayer in shuffle and repeat mode

mplayer -shuffle -loop 0

Plugin for reading telugu news paper in mozilla firefox in linux

With changes in my cab routes and so change in my daily scheduled walk to catch cab, I was getting backpain (I rush in the last minute to catch the cab, so you can imagine how fast I need to walk) due to the heavy weight on my back on the name of "Laptop". So, I decided to configure my desktop for everything that I would need laptop for. Only thing that left was to read telugu news paper (yeah. I am addicted to "Eenadu" since my childhood when I was in 2nd or 3rd Std). So, I came across this plug in which would install the dynamic fonts needed for these news papers. Reference: http://www.adminbytes.com/2008/08/reading-malayalam-newspapers-using.html

Friday, December 11, 2009

Installing Maven in fc9 and maven plugin for eclipse

for maven plugin - install the below plugin
http://www.eclipse.org/iam/
and the respective installation instructions are available at http://code.google.com/p/q4e/wiki/Installation
and once it is installed successfully, select maven by right clicking the project and then build is done using maven rather ant.


And, for installing maven in fc9, yum is showing maven2.0.4 which is old and doesn't work with latest maven pom.xml. So, in order to install latest version of maven, get the latest version from apache site http://maven.apache.org/download.html and download it. Once downloaded, specify the bin path in your PATH variable. Reference: http://beans.seartipy.com/page/2/

Tuesday, December 08, 2009

Ilayaraja rocks

We watched "Paa" in Solapur. It was nice as it was unexpected. We reached Solapur early and there was nothing to do as there was a gap of 5 hours for the train which we have to take. So, we planned to go for some movie and we found this theater where there were three options

1. De dana dan
2. Radio
3. Paa

And, we had this impression that Paa would be senti but we thought, that's ok. I don't want to go for Radio for sure.

But, Paa is not senti. And, Amitabh rocks as a child actor and Ilayaraja music rocks like anything. Vidya Balan looked much better than in Parineeta. Overall, I loved this movie and recommend to watch. :)

Thursday, November 26, 2009

Junit testing

After a long break, recently I came across junit testing. This was when I was helping my team member in writing junit tests and suggested where to start from. Then, there was an issue in running a TestSuite.

The code that I used before is something like below:

import junit.framework.Test;
import junit.framework.TestSuite;

public class AllTests {

public static Test suite() {
TestSuite suite = new TestSuite("Test for something");
suite.addTestSuite(SomeClass.class);
return suite;
}
}


But, when i tried to run, I got below error:
java.lang.Exception: No runnable methods

By the way, this is with junit-4. So, here is what we figured out -
In junit-4, they use annotations for TestSuite. So, the old syntax is not working. Here is working syntax

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses( { SomeClass.class})

public class AllTests {
}

So simple. Isn't it?
Also, download junit coverage plugin for eclipse using this update site http://update.eclemma.org/ . More details are here regarding eclemma

Wednesday, November 18, 2009

Handling "Ctrl+C" in Java

It is very simple. One just need to use addShutdownHook method and pass a thread where you can add code to do what ever you wanted to.
Sample code is here -

public class ShutdownHookDemo {

public static void main(String[] args)
{
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run()
{
System.out.println("Ctrl+C was pressed by some one and I am exiting now");
}
});

int i = 0;
while(true)
{
System.out.println("I value:" + i++);
System.out.println("Going to sleep now for 2 secs");
try{
Thread.currentThread().sleep(2000);
}
catch(InterruptedException ie)
{
System.out.println("Someone woke me up:("+ ie);
ie.printStackTrace();
}
}
}
}

So simple it is.. isn't it? and I just realized that hadoop used it to close files opened when some one press "ctrl+C". Just one sentence to describe it "Simple yet powerful."

Tuesday, November 10, 2009

Lesson-1

While replying to a mail,

taking a pause is MUST and re-read a mail thinking as the person inTO/CC is MUST and ensuring the purpose of the mail meets is MUST.

Monday, November 09, 2009

One year completion of our engagement

Last year, this day Rupesh and I got engaged. Rupesh gave a surprise by preparing a cake in the night (and I was happily sleeping) and we distributed it in our offices. Everyone in my office liked it a lot and were asking for recipe. Seriously, I should confess that it was yummy.

Also, we liked this sharing of our joy by distributing cake in office. :) And, we enjoyed/loved it a lot.

Friday, October 30, 2009

Regex for replacing all non-ascii characters in java

line.replaceAll("[^\\p{ASCII}]", "")

source:http://forums.sun.com/thread.jspa?threadID=5370865

Thursday, October 29, 2009

Fixing issues with "JavaHL not available" in eclipse

It is finally a big relief to me as I was able to fix this issue and thought I should note it down this in my blog. It can be useful for others and also for myself in future.

Here is the issue

I installed eclipse ganymede and installed subclipse using http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA .
I tried both 1.4 and 1.6. However, I could see javaHL not available in preferences ->team ->svn.
And snvkit was not working for me


Fix to the above problem:
1. I used 1.4 version from subclipse.tigirs.org
2. I installed subversion client from collabnet. which is available at
http://www.collab.net/downloads/subversion/redhat1.5.html
(Note: You can use latest versions, how ever, older version worked for me) . I took the first one specified in the list (file name:CollabNetSubversion-client-1.5.7-1.i386.rpm)
3. Once the above is installed, you need to add /opt/CollabNet_Subversion/lib/ to LD_LIBRARY_PATH and /opt/CollabNet_Subversion/bin/ to PATH
and
4. Restart eclipse

Tuesday, October 27, 2009

Books and Opensource softwares

there are lot of things to write and I always think, I should write this in blog and forget.
Few quick updates. probably I will detail later when I get time

1. For the first time in my life, I finished two novels in consecutive months (people can finish in a day), but this is the biggest achievement for me as I always used to love short stories and novels were boring to me. I have read 1. one night at call centre 2. Forrest Gump

Currently reading one Telugu book on Swami Vivekananda.

2. Started learning "R". It is very interesting. though I am still learning A,B,C,D of it. Will update more once I get. :)

Wednesday, September 23, 2009

Kids are amazing!!!!

Funny talks/things by our niece,nephews:

Scene-1: My niece(4+yrs Old) goes to my sister and suddenly says "I want a kid at home". For which, my sister replied "why do we need a kid when you are a kid already at home". For which, my niece replied "I don't know. I want a kid. that's it. if you don't bring, I will leave home by taking clothes". My sister is like "!!!!!!!!". After a while, she said "where will you go. who will take you?" . My niece quickly replies "I will go to tata's (grandpa's) place.

Scene-2: Rupesh's sister asks his nephew(3+yrs old) "Ojas, what do you say about inviting other kid at home? Will you share all your toys with him? You shouldn't quarrel with him". He said "No. No need. Rupesh mama's baby will be there na. I will share toys with him.". And then she asks "what should we name the baby then?". He promptly replies "Engine Number 9". She couldn't control her laugh and questions him "We will name the baby Tejas as your name is Ojas" . He will say "No. The name would be engine number 9".

Scene-3: Rupesh's other nephew who is 1+ yr old observes his parents dipping rusk (aka toast) in Tea and eating. After that, they left kitchen and were talking in hall and after a while, they were wondering how can he sit so calm in kitchen for this long. So, they went back and observed. He took a glass of water and a mobile phone and dipped mobile phone water and licking mobile as eating toast. :-)

Friday, September 18, 2009

Confused in Java

I had a code where I was using writeBytes() method of DataOutput for writing a string to file. And, it created some issues while reading. Then, I replaced the same with write(str.getBytes()). This went fine without causing any issue. Confused now on what is the difference between these two methods. Still exploring...

Tuesday, September 15, 2009

Parody of one Ad w.r.t. Swine Flu

Actual Ad:
A lady walks into the recruitment panel where many other people are waiting and few of her documents fell down. When she picks up everything, every one left.


Parody:
A lady walks into the recruitment panel and when she kept on sneezing. Every one leaves. :D

My future kid name by Rupesh's nephew

It is "Engine Engine 9". :) and Rupesh says "It's so unique. Isn't it?" . :))

Friday, July 03, 2009

Shreya Goshal -Superb singer

Recently, I started liking "Teri ore, Teri ore" song from Singh is King and thought of downloading it and found that this song is sung by Shreya Goshal. She is an amazing singer. Most of the songs I like are sung by her. No one have that sweetness that she has in her tone.

Monday, June 08, 2009

Dryrun in Pig for debugging purposes

It is hard to debug pig scripts as the debug mechanism is not friendly. To see the parameters that we are passing via command line or by executing another script (bash,perl) - we can use dryrun option. but, I always forget whether it is dry-run or dryrun. It is dryrun and the way to use it is

bin/pig -dryrun /scriptName

Friday, May 29, 2009

awesome

I just saw this new facility in blogger where I can write in any language

నేను తెలుగు లో రాయగలను , ಕನ್ನಡ ಗೊತ್ತಿಲ್ಲ . हिन्दी हमारा जातीय भाषा हैं। :)

Writing complex code

Ok. I came across one such complex code -

Requirement:
Given an output log from a process which contains temporal information. Based on this temporal information, data need to be split and kept it in temporal directory structure. So, essentially, you have the data which contains when each line is generated and the data needs to be split and kept in directory structure like year/month/day/hour/filename.1 for 15 mins filename.2 for 30 mins worth of data and so on.

here is complicated version:

Have three threads - one is main thread , second thread creates a file for every 15 mins in above structure and third closes files created by previous thread. And the main thread reads each line from input and call write method. the stream handler will be modified by second thread for every 15 mins to point to new file. and will move the previous handler to queue and that is taken by third thread and closes it!!!!

here is simpler version:

for each inputline
check out the date
if it is with in minute domain write to same file
else close the previous file if any opened and create a new one
write inputline to output

close finally if there is any opened stream handler

Wednesday, May 27, 2009

Getting lazy day by day-No more

After my parents had come to Bangalore, I am more relaxed and getting lazy. My mom thinks that I am working too hard and so she never let me cook anything when she is here. :) Yesterday my mom went to my brother's place and it became my brother's duty to get food for us. :) I am sure that I am getting lazy and It might take time to get adjusted again once they go back to my hometown. :(

Huh!!I don't know at what time I started writing this blog. I wrote the above lines on 27th. And just after that minute, I got lot of work from here and there and finally, there is no free time. But this time, it is office work!!

Wednesday, May 20, 2009

Two Birthdays in a year

Can it be possible for any one to have two birthdays a year. ok. Don't think too complex. It is possible. I have two. One is my actual birthday which is in January and one is official birthday which is today. :) And I always forget and I get mail from IITK Alumni wishing me then I realize "Oh. Today is my birthday. :)"

There is a long story behind this. In short, my DOB changed twice in my school once for writing some Govt entrance exam in 4th Std and once for writing 10th class exams. I am elder to myself if I compare my official birthday with my actual birthday.

Tuesday, May 19, 2009

Silly interviews

Some of older memories:

During Microsoft interview:

Interviewer: which operating system you like most
Me : Linux
:))

During Yahoo interview:

Interviewer: What is your dream company - this was not part of interview..this was some casual chat I had with a manager
Me: Google!! :)) :))

Define data mining expert

Studying data mining and Machine learning as one of my course in IIT, when some one says they are dataminig experts- I assume them that they are very good in coming up with trends using some of machine learning techniques. They know what Association Rule Mining, Clustering, Classification mean.

But, in some places where they are not exposed to above, they assume data mining expert mean doing ETL operations and database partitioning/sharding etc..etc..!!!
I feel like shouting at them that this is not what it meant!

Monday, March 16, 2009

installing mplayer in fedora 8

yum search mplayer didn't give me mplayer package to install.
Thanks to Vaiju for his help. and here are the instructions:

1. rpm -Uvh http://www.fedorafaq.org/f8/yum http://rpm.livna.org/livna-release-8.rpm
if it asks that yum-priorities are missing install yum-priorities by command
yum -y install yum-priorities
2. yum search mplayer gives you mplayer package

install it. :)

Source:http://www.fedorafaq.org/f8/#yumconf

Monday, February 09, 2009

Distributed copy from remote hdfs to local hdfs

The command DistCp works for copying from one hdfs cluster to other hdfs cluster. But, the problem is that it is not specified any where(As I aware of) what should be the source url and destination url.
Many places, it is specified that specify hdfs://namenode1:50070/path_to_file and many other places some other port number.
So, after a lot of debugging, I figured out that it should be
hadoop distcp hdfs://(fs.default.name)_property_specified_in_hadoop-site.xml/path_to_file

for ex:
hadoop distcp hdfs://remotehost:10000/opt/hadoop-name/foo/bar hdfs://localhost:54310/opt/hadoop-name/foo/bar

The important note here is the url should be picked up exactly how it is in fs.default.name in hadoop-site.xml in hadoop conf directory.

Wednesday, January 21, 2009

Way to get hdfc standard life insurance premium receipt

Important Step: Never ever call the customer care (toll free:1800 209 7777). They give all weird reasons every time.
1. According to their policies, they can't send it to a mail id but can Fax it!!!
2. The system is going for upgradation (day and night for two days!!) so need to call after few hours and when you call go to step(2)
3. send a mail to service@hdfcinsurance.com and they will send a soft copy to u with in 3 days!!!(for sending a soft copy, it takes 3 days!!!!) But, in realty, it never happens.

Working Step:
Call up ur local branch - Again, it may redirect you to some other customer service -so, keep on pressing 9 till u hear a voice from other side (not the automated one :) )
then, tell them that you need a premium receipt.
Also, send a mail to oobangalore@hdfcinsurance.com requesting a premium receipt.

It worked for me. So, if you face similar issues, follow the procedure.

Monday, January 05, 2009

Files starting with -

If you have problem in using files starting with - in command prompt, then the solution is to use ./ in front of it.
Courtesy is this