PayPal Awards $100,000 Battle Hack Prize to Team Moscow for Donate Now

The Battle Hack world finals took place at the PayPal headquarters (San Jose) on November 16th, 17th. The global hackathon spanning six countries required the teams to code the best application they can within 24 hours utilizing the PayPal REST API along with other sponsor services which includes the Twilio, Nokia, Windows Azure and SendGrid. The first-ever inaugural marks the beginning of PayPal’s quest to find the best hackers across 10 cities on earth. The teams are judged based on the code/technology, the quality of the idea and the overall experience. The Director of PayPal Developer Network John Lunn announced that 2000 teams participated in the event and the team from Moscow emerged winner of Battle Hack grand prize $100,000 for the Donate Now application.

John Lunn, said “We truly believe that developers can help change the world. The goal of our Battle Hack program is to find the best and brightest developers across the globe that could do just that. The response from our inaugural Battle Hack competition has been overwhelming, with several cities selling out and bringing talented hackers.”



Donate Now app from Moscow (Grand Prize Winner)

This project resulted in an Android app that uses Bluetooth Low Energy (BLE) technology and PayPal to allow anyone to donate money instantly for causes like natural disasters, blood-drive.

RunPal from Tel Aviv (Second Place)

The team developed RunPal to help people stick to their fitness program. With this app, you are paired with a random user and form a monetary-based pact where each commit to a specifc running program and the person who fails to keep up will forfeit his share. This app uses RunKeeper’s health graph, PayPal API, Twilio’s SMS messaging while also building on top of Appcelerator’s Titanium platform

Kiva-like service from Miami (Third Place)

This team streamlines the loan process which allows a lender to lend funds without even coming in contact with the borrower. Interested lenders can use the app to input how much they can provide and the terms of the deal. If the terms match the credit score, those that need funds will select from those agreements. All payments are handled by PayPal. from Berlin (Finalist)

This team created an app called which enables to calculate wages for hourly/seasonal workers who work only for specific periods of time. It gives the capability to list the workers in a mobile app allowing administrators to manage the number of hours worked. The system calculates the pay based on the specific hourly wage of the worker and utilizes PayPal to process payments to each worker.

Get Trucked App from Washington DC (Finalist)

The Get Trucked app allows the mobile food vendors to find new locations and grow their customer base. Its like a kickstarter app for food trucks that lets the interested consumers to put down money to entice the vendors. Everyday they could monitor where the demand is and when the vendor selects the location, the money put in is committed, meaning they will be guaranteed a certain amount that day.

The customers get an email notification via SendGrid that the vendor is coming to their location and the transactions are managed through the Get Trucked’s Microsoft Azure instance.

Disaster relief app from Austin (Finalist)

Jeff Linwood developed a disaster relief fund raising platform that would help raise funds in the even of a disaster. He was inspired by the disaster that happened in Philippines and came up with the most utilitarian app that would help people post status, organize events and raise funds.

This app allows photos and YouTube videos to be embedded and can send SMS powered by Twilio. It uses Send Grid to allow people to communicate via email. These capabilities were implemented considering the fact that people in disaster can’t download an app- they just need help.

Skillfully Made from New York (Finalist)

This team created an app called Skillfully Made that will create new stores anywhere without having to worry about physical location. The iOS and Android app utilizes a QR code scanner that displays the product and enables customization to take place in real-time. The item can then be purchased through PayPal.

By Now from Barcelona (Finalist)

This group created By Now, an app that allows users to scan any product and purchase it. If you’re going to a store, but it closes right before you get there. You see the item in the window and want to know where else you can find it. By Now lets you snap a photo, then processes it to determine how much it costs, and a location.

TapIt from London (Finalist)

The service TapIt utlizes Near Field Communications (NFC) or Bluetooth Low Energy (BLE) stickers to scan information of a particular product and make a purchase right from the mobile phone

Xbox Kinect from Seattle (Finalist)

The team from seattle created an app centered around shopping for clothes using Xbox Kinect. The users can “virtually try on” the clothes while making customizations. They can take a photo using Kinect and share with their friends to help with the selection process. In the end, a QR code is displayed that users can scan using Windows phone device to make purchase using PayPal’s

Following the competition, PayPal’s Marcus said that the competition was all about finding the best hackers to help innovate the company’s platform. He had a vision for the company whereby the core product of the company will become the payment operating system for the technology of tomorrow.



EGIT – GIT in action within your Eclipse IDE

This article presents two simple steps to place your eclipse workspace under GIT. EGIT is a plugin that allows you to use GIT directly within the Eclipse IDE.

Step1: Installation of EGIT

Navigate to Help  –> Install New Software



Type the URL from which the EGIT could be downloaded. Then, click select all and next.



Then Deselect All and select only “Eclipse Egit” and click on next.


After installation of EGIT, we need to configure GIT on Eclipse


Step2:  Configure your Eclipse project to use GIT

Right click on your project in Eclipse. In the context menu, Choose Team –> Share Project



Then, select GIT in the Share Project menu


Then enter the name of your project and create a new GIT repository for the project


To view your project as a GIT repository within the Eclipse IDE, navigate to Windows –> Show View –> GIT –> GIT Repositories


Now you can see your project placed under GIT version control and apply all the GIT commands from your Eclipse IDE!

GIT merge conflict – commit your changes or stash them before you can merge

Here are the frequent GIT merge conflict horror stories one might encounter when one pulls the latest code changes or when the project code is rebased. If you are using GIT bash, its quite easy to configure the GIT environment with a visual GUI tool called DiffMerge that helps you clearly see the lines of code causing the conflict and resolve the merge conflict with a “single click”.


Merge conflicts while doing git pull
Output 1:

git pull
Enter passphrase for key '/c/Users/arvenkataraman/.ssh/id_rsa':
Auto-merging testSuite/sample.xml
CONFLICT (content): Merge conflict in testSuite/sample.xml
Automatic merge failed; fix conflicts and then commit the result.

Output 2:

git pull --rebase
U       testSuite/sample1.xml
U       testSuite/sample2.xml
U       testSuite/sample3.xml
M       testSuite/sample4.xml
U       testSuite/sample5.xml
U       testSuite/sample6.xml
U       testSuite/sample7.xml
M       testSuite/sample8.xml
M       testSuite/sample9.xml
Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm '
as appropriate to mark resolution, or use 'git commit -a'.

Output 3:

git pull
Falling back to patching base and 3-way merge...
Auto-merging testSuite/sample.xml
CONFLICT (content): Merge conflict in testSuite/ sample.xml 
Auto-merging testSuite/sample2.xml
CONFLICT (content): Merge conflict in testSuite/ sample2.xml 
Auto-merging testSuite/sample3.xml
CONFLICT (content): Merge conflict in testSuite/ sample3.xml
Failed to merge in the changes.
Patch failed at 0001 test changes


Step 1: Download DiffMerge tool

The SourceGear DiffMerge tool could be downloaded from the below location:

Step 2: Configure GIT to use DiffMerge tool

Open GIT Bash and navigate to the GIT repository. Then give the below commands to configure GIT with the downloaded DiffMerge tool

git config --global merge.tool diffmerge
git config --global mergetool.diffmerge.cmd "C:/\"Program Files\"/\"SourceGear\"/Common/DiffMerge/sgdm.exe --merge --result=\$MERGED \$LOCAL \$BASE \$REMOTE"
git config --global mergetool.diffmerge.trustExitCode true

Step 3: Invoke DiffMerge from GIT bash


If the git pull command doesn’t succeed due to merge conflict, please give the below command:

git difftool

The DiffMerge opens up as below with automatically selected merge conflict files for comparison

Step 4: Shift the highlighted piece of code to resolve the merge conflict

On the top of the DiffMerge tool there is an arrow to apply changes from the right to left:
step2 DiffMerge for merge conflict
The files are displayed side-by-side for comparision and the differential piece of code to be merged is highlighted in violet color:
step3 Merge changes
Select the piece of code highlighted and click on the “apply changes from the right” arrow at the top. After merge the code will look like below:
step4 After merge

Similarly we could resolve all the merge conflicts with a single click. It is a lot more easier since this is a visual tool for merge.

Code debugging with watch variables/expression using Eclipse IDE

Here are the steps to do extensive debugging of java code using Eclipse IDE with watch variables, expression and Inspect.

Step1: Enable breakpoint

Set the breakpoint at the line of code or point of method entry from where you would like to start debugging the code. Right click on the left margin of the editor next to the line of code and a context menu pops up. Select toggle breakpoint in the context menu as shown below:

Figure1: Toggle Breakpoint



Step2: Configure the breakpoint to stop execution

To start debugging, the execution should stop at the breakpoint specified. For this click on breakpoint properties (refer Figure1)  and do the following:

  1. Check Hit count
  2. Specify value as 1
  3. Select “Suspend thread” option

This will stop the execution when the program hits the breakpoint.



Step3: Switch to debug perspective

In Eclipse, select Window –>Open Perspective –> Debug as shown below:

Step4 switch to debug perspective


Step4: Run in debug mode

Now run the program in debug mode. Select Run –> Debug

Step5 Run in debug mode

Now the program starts running in debug mode and you would see the state of the thread as “running”

Step6 running thread

When the program hits the breakpoint the state of the thread changes from “running” to “suspended

Step7 suspend thread


Step5: Debugging the code with Expressions \Watch variables \ Inspect

Now the code stops at the breakpoint. You could use the watch variables / expression to monitor the current value of the debug variable.

Suppose you set the breakpoint at the variable named “counter” and the program stopped at counter variable as shown below:

step8 stops at code\

Add the expression with the variable name “counter” which allows you to monitor the value of the variable as you execute the program:

Step11 watch variableexpressions

You could also right click on the counter variable and select “Inspect” from the context menu

Step12 right click to inspectstepinto

If it is a method then, select the method name and click on “Step Into Selection“. This will allow you to monitor or debug the method execution line by line.


Step6: Use F6 key to step into the method

To “step into” the next executable line of code in the current method, press the “F6 Key”. This will pass the program control from the current line to the next executable line of code.

Step9 Press F6 key


Git – Permission denied (publickey)

This is a very common issue that most users face after installation of GIT.

Extensive troubleshooting of this GIT issue “Git – Permission denied (publickey)” can be done with the below command:

ssh -vT


OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Connecting to [] port 22.
debug1: Connection established.
debug1: identity file /c/Users/arvenkataraman/.ssh/identity type -1
debug1: identity file /c/Users/arvenkataraman/.ssh/id_rsa type -1
debug1: identity file /c/Users/arvenkataraman/.ssh/id_dsa type 2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.5p1 Debia
debug1: match: OpenSSH_5.5p1 Debian-6+squeeze1+github9 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
The authenticity of host ' (' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ',' (RSA) to the list of know
n hosts.
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /c/Users/arvenkataraman/.ssh/identity
debug1: Trying private key: /c/Users/arvenkataraman/.ssh/id_rsa
debug1: Offering public key: /c/Users/arvenkataraman/.ssh/id_dsa
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).



Step 1: Navigate to .ssh directory inside your home directory

         cd ~/.ssh

Step 2: Generate the public/private rsa key pair


Step 3: Copy the SSH key to the clipboard using the below command

         cat | clip

Step 4: Navigate to your GIT repository in

Step 5: Go to Account Settings


Step 6: Under Account Setting select SSH keys


Step 7:  Click on Add SSH key, paste the key copied to the clipboard (in Step 3) and store the key




TestNG – running tests in parallel

If you have several suites to be run, you could run them in parallel at the same time in different threads.

Parallel suites

In command line the ant task suiteThreadPoolSize can be used to run several suites in parallel using org.testng.TestNG as shown below:

java org.testng.TestNG -suiteThreadPoolSize 3 testng1.xml testng2.xml testng3.xml

This command runs the three suites in 3 different threads in parallel

Parallel methods, tests, classes

In testng.xml file, using the attribute parallel inside the suite tag instructs TestNG to runs tests in parallel in different threads. The attribute parallel accepts certain values as outlined below:

<suite name="mysuite" parallel="methods" thread-count="5">
<suite name="mysuite" parallel="tests" thread-count="5">
<suite name="mysuite" parallel="classes" thread-count="5">
<suite name="mysuite" parallel="instances" thread-count="5">

1. parallel=”methods”: TestNG will run all the test methods in parallel in different threads. The dependent methods will also run in different threads but would respect the order that was specified.
2. parallel=”tests”: TestNG will run all the methods in the same test in the same thread but each test will be run in separate threads. This allows to group the thread-safe classes in the same test so that they will run in the same thread while taking advantage of TestNG’s capability to run tests in several threads.
3. parallel=”classes”: TestNG will run all the test methods in the same class in the same thread and each class will be run in separate thread.
4. parallel=”instances”: TestNG will run all the test methods in the same instance in the same thread and each instance will be run in separate threads.

Also, the attribute threadPoolSize of the @Test annotation could be used to run tests in parallel as shown below.

@Test(threadPoolSize=5, invocation-count=10, timeout=10000)
public void testMethod()

This will invoke the method testMethod 10 times in 5 different threads. The timeout of 10 seconds ensures that the thread is not blocked for more than 10 seconds. The timout applies for both parallel and non-parallel mode.

TestNG groups using include/exclude

TestNG allows to perform groupings of test methods. The methods can be declared to belong to groups and TestNG can be invoked to include/exclude certain set of groups. This provides maximum flexibility to structure the tests in a more intuitive way.

Step1: Declare groups in java class

Suppose we would like to group the test methods into two categories functional and sanity. We declare the methods to belong to either of the two groups using the “groups” attribute of @Test annotation.

public class Test1
  public void testMethod1(){
  public void testMethod2(){
  public void testMethod3(){


Step2: Specify groups in TestNG.xml file

Suppose we would like to run the sanity tests alone. We specify the groups in the TestNG.xml file using the <groups> tag inside the <suite> or <test> tag as shown below:

<suite name="mySuite" verbose="1">
  <test name="Regression">
        <include name="sanity"/>
      <class name="sample.Test1"/>

TestNG.xml – A Quick Overview

TestNG is a testing framework designed to simplify the testing needs.


Quick overview of TestNG.xml file

  • A suite is an xml file represented by <suite> tag. The TestNG suite can contain one or more TestNG tests
  • A test is represented by the <test> tag. A TestNG test can contain one or more TestNG classes
  • A class is a java class having TestNG annotations. It is represented by the <class> tag. A TestNG class can contain one or more TestNG methods
  • A method is method configured with @Test annotation


Sample TestNG.xml file



Also, it is possible to use packages instead of classes in TestNG.xml file. For this package tag is used as shown below:


Getting started with Ruby on Rails

Video demonstration of ruby on rails application creation:

One of the many advantages of rails is that it immediately gets you from zero to a functional application. To get started lets create a directory for the rails project called “railsproject”.

mkdir railsproject

Now open the ruby command prompt and navigate to the directory that we just created. Run the rails new command to make your first rails application. Let us call our first rails application as “first”. The rails new command is a program that creates a skeleton rails application. It creates a standard file and directory structure that makes it easier than ever to organize and deploy files. All the rails application have a common file and directory structure making it easy to understand someone else’s code.

rails new first

After the file creation is done rails automatically runs the bundle install command which we will discuss later in this article. Upon successful execution of the rails new command, it will display the message “Your bundle is complete!”


Bundle install command


Now lets have a quick look into the files and directories that have just been created. I use Aptana studio, an IDE for windows users of Rails.

Rails application directory structure


Let’s learn more about the files that have been created.

  • app – This contains the Core application code including the models, views, controllers and helpers. The model, view and controller are very important parts of a rails architecture which we would learn in-depth in the later articles
  • script/rails -A script to generate code and start the local server
  • vendor – This contains third party code such as plugins and gems
  • Gemfile – This file contains the gem requirements of the application

The bundle install or the bundler command which we had seen in the beginning of this article installs the gems from the Gemfile. The bundler looks for the gems that needs to be installed from this file. Thus the Gemfil should contain the gems needed by your application.


source ''
gem 'rails', '3.2.8'
# Bundle edge Rails instead:
# gem 'rails', :git =&gt; 'git://'
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~&gt; 3.2.3'
  gem 'coffee-rails', '~&gt; 3.2.1'
  # See for more supported runtimes
  # gem 'therubyracer', :platforms =&gt; :ruby
  gem 'uglifier', '&gt;= 1.0.3'
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~&gt; 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'

Inside the gemfile, the rails gem is the gem for rails itself. “sqlite3″ is the gem for the ruby interface to the SQLite database. ”jquery-rails”  is for the jQuery javascript library. As you could notice there is a version 3.2.8 specified in the rails gem command. Unless the version is explicitly specified, rails automatically deploys the latest version of that gem.

Inheritance – the Ace of the Object Oriented Programming world

The code is just a junkyard if it is not designed for reuse. Re-usability is very simple if you understand inheritance, a very powerful principle of object oriented programming. For this reason I call inheritance the Ace of the object-oriented programming world.

Here, I explain inheritance with a simple illustration. From the figure below can you list the properties that are common to all the balloons?


The below properties are common to every balloon:

  1. Color
  2. Size
  3. Price and so on

These properties that are common to all classes of a given type say balloon is stored in a class called the base class or super class or parent class. Inheritance is a powerful object oriented programming feature that allows a class to reuse the properties and methods of an already existing class while adding its own functionality. It’s the process of creating a new class as an extension of an existing class primarily to enhance the code re-usability. The class that extends is called the derived / sub class and the class getting extended is called the super / base class.

Suppose there is a super class called superBalloon. There are different kinds of balloons such as birthday balloons, balloons that represent a theme like sports or Disneyland and so on. For class inheritance java uses the keyword extends. Now let’s write a small java program for the base class “superBalloon”.


package balloonInherit;
public class superBalloon
	 * The superBalloon class defines methods and variables common to all balloons such as
	 * size, color and price
	//commonly used fields in all balloons
	public int size;
        public String color;
	public double price;
	public int number_of_balloons_purchased;
	public double total_cost;
	public void purchase(double price, int number_of_balloons_purchased)
		total_cost = (price * number_of_balloons_purchased);

A derived class is more specific and can have additional functionality of its own apart from that of the base class. Thus a birthday balloon is a specialized version of the balloon class having a new field called decoration cost specific to it’s type to better suit the needs.

We can also override /replace the behavior of the base class in the derived class. Here, in the below example the birthday balloon inherits the superBalloon class and defines a new field called decoration cost specific to it’s kind. We use the super keyword to reuse the already existing properties of the base class.

package balloonInherit;
public class subPartyBalloon extends superBalloon
	 * Since this is a partyBalloon, an additional new field called decoration cost is added
	 * which is specific to this kind of balloon
	public static void main(String args[])
		//Create an object for subPartyBalloon class and invoke the purchase method
                subPartyBalloon bDayBalloon = new subPartyBalloon();
	public void purchase()
		//Additional property specific to the type partyBalloon
		double decoration_cost = 2.00;
		//Reuse the existing properties of the base class using super keyword
		super.size = 20;
		super.number_of_balloons_purchased = 3;
		super.color = "red";
		//These are the prices of the balloon depending on it's size
		switch (super.size)
			case 10:
				super.price = 5.00;
			case 20:
				super.price = 10.00;
			case 30:
				super.price = 15.00;
				System.out.println("Invalid size");
		//Invoke the the purchase methods of the super class to calculate the base_cost
		//Since it is a birthday party balloon the additional cost for decoration is added
		total_cost = total_cost + decoration_cost;
		System.out.format("The total cost of %d %s birthday balloons is %.2f", number_of_balloons_purchased,color,total_cost);

The switch-case control structure decides the price of the balloon based on the input size. Once a matching size is found it assigns value to the price variable and breaks the execution of the switch-case block. The total cost of the birthday balloons is calculated and the output is as below.


The total cost of 3 red birthday balloons is 32.00

Now let’s create a java program for another derived class called subThemeBalloon. A theme based balloon has theme and design as additional fields specific to it’s kind. For example to represent the theme of Disneyland, a balloon is designed with the theme Disneyland and with the shape Mickey mouse.

The subThemeBalloon class reuses the existing properties of the base class superBalloon using the super keyword. It also has three additional new fields viz. theme, design and decoration cost specific to it’s kind to better suit the needs.

package balloonInherit;
public class subThemeBalloon extends superBalloon
	 * A theme based balloon has theme and design as additional fields. For example to represent
	 * the theme of Disneyland a balloon is designed with the theme Disneyland and with
	 * the shape mickey mouse
	public static void main(String[] args)
                //Create an object of subThemeBalloon class and invoke the purchase method
                subThemeBalloon themeBalloon = new subThemeBalloon();
	public void purchase()
		//Declare three additional properties that are specific to the type themeBalloon
		String theme = "Disneyland";
		String design = "Mickey Mouse";
		int decoration_cost = 5;
		//Reuse the existing properties of the base class using super keyword
		super.number_of_balloons_purchased = 20;
		super.price = 15.00;
		//Invoke the purchase method of the base balloon class to calculate base cost using super keyword
		super.purchase(price, number_of_balloons_purchased);
		//Add the decoration cost for the balloon
		total_cost = total_cost + decoration_cost;
		//Print the total cost of the balloon
		System.out.format("The total cost of a %s %s balloon is %.2f", theme, design, total_cost);


The total cost of a Disneyland Mickey Mouse balloon is 305.00


This is all about inheritance. Feel free to post any comments /questions.