Wednesday, January 27, 2010

Exporting mysql query output to xml

I know there are ways to do this. But wasn't aware that it is very simple.
Exporting mysql query output to xml is:
mysql -u --xml -e''

Simple, isn't it?

Reference:http://dev.mysql.com/tech-resources/articles/xml-in-mysql5.1-6.0.html#xml-5.1-in-and-out

This article also talks about importing data from xml to mysql.

Monday, January 25, 2010

My struggle with Maven plugin for eclipse and mahout building

Somehow, my maven plugin stopped working in my eclipse (again!!!). I have already posted on maven plugin installation and everything earlier. However, this doesn't seem to work now. :-(. no idea though. So, I had to restart my "mission mvn". Finally after a lot of struggle on making the current mvn plugin to work, I looked for a new plugin and got this link
. I installed this plugin and I could see "mvn commands" populated in "Run as.. " section. My happiness couldn't last for long as I couldn't successfully build mahout codebase using this plugin.

mvn install is giving build error however mvn compile is successfully compiling. Should be able to resolve soon. Stay Tuned...

Finally, I figure out a way to avoid build errors in eclipse using maven. Following checks need to be made to see if everything is configured properly

Right click on Project -> select Properties -> Make sure under Java Build Path and libraries tab, whether Maven ClassPath container and maven dependancies are present
Right click on Project -> select Properties ->Make sure under builder, you have maven project builder and maven incremental builder and default Java builder are available

Right click on project - select properties - select maven at left hand side - check include modules.

Once all above are configured properly, right click on project and select build project. This should build without any issues.

Tuesday, January 12, 2010

Sound issue in Mozilla firefox in Fedora

There was a sound issue in Mozilla firefox in Fedora and to fix the same, one need to install libflashsupport. It worked for me.

Reference:http://www.derekhildreth.com/blog/guides-to-help-with-fedora-8-install/

Monday, January 11, 2010

Disabling Work Offline in Firefox

I have been facing this issue in my firefox that when I start it, "Work Offline" box is checked by default and I have to manually uncheck to start browsing internet. And, here is the solution to turn it off permanently.

1. type about:config in address field of browser
This gives a warning saying you are changing advanced settings. Once you press the button that "I'll be careful, I promise!"

2. type "networkmanager" in filter tab and toggle the parameter(toolkit.networkmanager.disable) that you get when you type the above value in filter tab.

Reference is:
http://ubuntuforums.org/showthread.php?t=851542

The reason given in above link is- The network manager is not well informed , especially in dial-up situations and so, lets the firefox assuming that no connection exists and there by forcing "Work Offline". However, in my case, I had some network issues while booting up and so a manual restart of network was needed. However, even after fixing that issue, I was facing the above problem and there is no other option for me other than disabling network manager.

Friday, January 08, 2010

Destiny

I thought of starting this year blog with something different. But couldn't control after seeing such a sad video in news channel and couldn't control expressing my emotions.

Insane People

While watching TV, I came across this news (http://www.dailychilli.com/news/1721-two-ministers-watch-as-cop-bleeds-to-death) where two ministers watch while cop dies.
I am not pressing at ministers but the whole group of people standing there and watching his death. Crows cry when other fellow crow is hurt. How can we being human beings watch other person dying?. The ugliest reasons they give are "We were waiting for Ambulance", "We thought the minister's convoy is attacked. So, we were thinking whether the attacked people still there and might attack if we reach near to the person". All I can say, they are insane. I don't treat them as human beings. Would you do the same thing if your family member is in that position?

Poor police office, who got double promotions for doing bravery tasks. He was part of "Operation Veerappan". Even, if he is not, he deserves help from the people around. And the way people were pouring drinking water over him, it looked like he is untouchable and they can't touch him. I felt sad and I couldn't do anything. :-(

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. :)