Hadoop Version in AWS Map Reduce

posted under , , , by prasanna
Creating job flows using AWS MapReduce's GUI is pretty simple and very straight forward. But i wanted to use Java SDK to create/run jobs in MapReduce. I could successfully able set up the job and configured all the parameters except for a weird error.

java.lang.NoSuchMethodError: org.apache.hadoop.mapred.JobConf.setBooleanIfUnset(Ljava/lang/String;Z)V

I was constantly getting this error while running the job. Initially i had no idea why this error occurs and none of the forum talks about it either. Then i figured out that the default Hadoop version used by the Ec2 instances was 0.18 and i was expecting 0.20. Interestingly i didn't face this issue when i did it through GUI.

As a solution i need to explicitly set the version number as 0.20 to the Instances object so that it will use the same while running the job.

JobFlowInstancesConfig instances = new JobFlowInstancesConfig();
instances.setHadoopVersion("0.20");

Install Custom JAR files in Samsung Corby Pro

posted under , by prasanna
Installing jar applications using Corby Pro is not straightforward. I tried multiple ways and finally found an easy solution !!!

In your PC.
* Download a jar ( Check whether it will work with Smasung Corby)
* Create a HTML file as mentioned below.


* Now transfer both these files to your mobile phone. (Make sure you have both these files in the same location/folder)

In your Mobile:
* Navigate to your HTML file and click to open it on your browser.
* You can see a link on your browser with the Jar Name you specified in the HTML.
* Click on the link and you are done !!!

SAX parser characters() method.

posted under , by prasanna
Was playing around SAX parsing some Gigs of XML file :) Here are few leanings from the game.

My intention was to read values between a corresponding tag. I initially went after using characters() in SAX parser which actually worked fine for initial feeds. But as i keep increasing the size of the XMLs and if the size of the tagContent was large the problem arises. characters() function not always gives back the entire value in a single shot. It may return the value in multiple chunks. So need to be careful in assigning and using the values from characters() method.

So the better way to use characters() method is to keep appending all the values to a buffer and use the value in the corresponding end tag section. Also need to make sure that the buffer has to be flushed in the corresponding start element.

Sample Xml:



Sample SAX handler code to print the Names:

Initial Code: (Works fine for small values & small files)


Final Code:

FTP Client (Ubuntu)

posted under by prasanna
Today was about to download multiple files from an authenticated FTP server. The native ftp client of Ubuntu didn't help me as expected. I was trying to log into the FTP server and was constantly getting disconnected when trying to perform some operation. When browsed for some alternative found this ncftp client. This actually worked instantly and was pretty easy in installing.

Install NCFTP:
sudo apt-get install ncftp

Log into FTP server: 
ncftp -u username hostname -p


it will prompt for password enter it. Type '?' in the terminal for the list of commands and there you go :)

Check out the NCFTP client for other platforms.

Stop halting at Assertions

posted under , by prasanna
When i was writing functional tests i stepped into a scenario where i have to continue with the test even after an assertion failure. The idea here is that you find an assertion failing, still you may need to go ahead and check out all the assertions as these tests generally take long time to complete. At the end of the test it will be good to have the summary of all the failures along with the stack trace. I was looking for some testing framework to help out with this functionality but unfortunately cant find any.

Finally using TestNg i implemented this feature. All you need is to write a listener that listens whenever a test fails and simply logs the stack trace without failing the test. There is a neat step by step tutorial given here 

Though this example has some specific information for Selenium based tests, it works fine with normal functional tests too.

Happy Testing :)

Send your mail later

posted under , , by prasanna

Gmail has provided a lot of features through labs and one important feature it lacks will be "Send Mail Later" option. This kind of feature helps me a lot to send birthday wishes to my pals. As i tend to remember their birthdays on the previous day and miserably forgets on their birthday. So i was in a hunt to get this functionality but felt bitter when knew that Gmail did not and will not come up such feature as many feel this as a unwanted feature and may be misused.

But to my rescue comes 'www.lettermelater.com" . All I need to do was that register with them with the email id from which i wish to send the mail . I need not want to login to their site every time when i want to send a mail. All i want to do is just address the mail to "me@lettermelater.com" with some parameters. The parameters include the recipient address and the time at which the mail has to be sent. It was super cool as i did a lot of testing by changing the parameter values. Worked perfectly well. They also have this functionality packed as a widget so that one can fit into their site/blog. Their only concern is that it is not possible to send a mail with attachment which we can expect in their future releases. 

Printing multiple divs in a page.

posted under , by prasanna
I stumbled upon a situation where i have to print multiple sections of a page into a single document. I actually tried out my own javascript to render only the required divs into an iframe and then the idea is to print that iframe calling window.print() in that iframe.

Having limited Javascript knowledge the above mentioned task was a bit tedious to me , then i sat upon googling to get a ready made plugin that implements this feature and my search ended upon Jqprint. Jqprint is a plugin written in Jquery and it does the same that i mentioned above. Using this jqprint was really very easy. what all you need to do is that just mark all the divs that you want to print with a specific class name or with id. If your classname is printdiv then all you need to do is just call  $(".printdiv").jqprint();

top