Anshul Sharma


File Compression

Creating a zip file using AntBuilder. def ant = new AntBuilder() destfile: destPath, basedir: basePath, includes: includeFiles, // Comma seperated file names excludes: excludeFiles, // Comma seperated file names level: 9 ...



Posting messages on facebook wall using graph api

Firstly ,you need to connect with facebook. Once you have facebook access token you can post messages on the facebook wall using the below code. void postMessage(String facebookAccessToken, String message, String facebookId) { StringBuilder stringBuilder = new StringBuilder("access_token="); ...



Integrate java application with Facebook using graph api.

These are few basic steps which will help you to integrate your java application with facebook using facebook graph api. Steps : 1) Register your application at 2) Facebook will return Consumer Key and Consumer Secret for your application. 3) Create a login action: String...



Grails: execute sql script in Bootstrap

This blog might help you to speed up your bootstrap process, especially when you need to populate records in tables. Earlier we used populate our database table by reading line by line from a CSV file and creating Domain Class object ad Save. But this was taking a huge time. And in our case, this data (more like a static information) was...



Image comparison

In one of our projects, we need to compare images which comes from various sources and remove the duplicate one. The below algo helps us to remove the duplicate images. boolean compareImage(String firstPhotoUrl, String secondPhotoUrl) { boolean result = true; BufferedImage bi1 =



Integrating Java Application with Twitter

These are few basic steps which will help you to integrate your java application with twitter using twitter4j. Twitter4J is a Java library for the Twitter API. With Twitter4J, you can easily integrate your Java application with the Twitter. Steps : 1) Register your application at 2) Twitter will return...



Serializing objects to XML

XStream is a simple Java library to serialize objects to XML and back again. Suppose we have a Person class as follows: public class Person { private String name private int age private Address address } public class Address { private String street private String city private String state private String...