We can generate a bar code image by using the itext jar.
Itext jar : http://sourceforge.net/projects/itext/
Download jar : http://sourceforge.net/projects/itext/files/latest/download
sample code
import com.itextpdf.text.pdf.BarcodePDF417;
import java.awt.Color;
import java.awt.image.BufferedImage;
import...
Monday, March 30, 2015
Regular expression to extract the src tag details from given image tag or html source text
By using the regular expression we can extract the any data from the given input, here we are trying to get the src attribute value from the given image tag or html text data.
Image 'src' attribute extract Regx:
<img[^>]*src=[\\\"']([^\\\"^']*)
sample code:
import java.util.regex.Matcher;
import...
Compare images are same by java
We can compare the given images are same or not by comparing the buffer data of the image.
1. Compare the image sizes are same or not.
2. Compare the binary data of two images are same or not.
sample code :
import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
import java.io.File;
import...
Saturday, March 28, 2015
Reverse elements in Array
Reverse all elements in array, traditional way how we use to do is get the array and iterate through the for loop and use swap logic to move to temporary array and get the result.
But from > jdk 1.5 introduced reverse() in java.util.Collections which will reverse the order of the elements, all we...
find character uppercase/lowercase count from given text
Find the character upper/lower case occurrence count with simple single line code without iteration in java.
int counta = text.split("(?=[a])").length - 1;
This simple code will find all the lowercase character 'a' from the given text, change the regx for the uppercase . ex 'A'.
sample test code
/**
...
Monday, March 23, 2015
Get all files from parent/sub folders along with file size
In Java, you can use the File.length() method to get the file size in bytes and folder.listFiles() method to get all file/folders.
sample code
This file contains bidirectional Unicode text that may be interpreted or compiled...
Thursday, March 19, 2015
Jfreechart servelt example

Prerequisites
JDK 1.5 and above
Jfreechart jar
mysql connector jar
To generate charts we can use jfrecharts which is open source and free. In this example i will show how to generate the jfreechart...
Tuesday, March 3, 2015
Generate PDF report for selenium/testng test cases.

Use Open source pdfngreport plugin to generate the pdf report for the selenium/testng test cases execution.
It's Opensource and in maven repository
<dependency>
<groupId>com.uttesh</groupId>
...
Monday, March 2, 2015
5 Step to host static website/Project Pages site on github

5 Steps to host a static page or project page on github
Create Github account and verify the email id
Add your repository/project to github
Create static pages for you application
Create gh-page branch
Live...
Generate PDF page as image
We can generate the image of pdf page by using the Pdf-renderer
Simple class which generate the images file of given pdf file.
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the...
Spring + JPA + Hibernate Sample

IntroductionStand-alone Spring application sample, Spring framework supports the persistence layer to be fully implemented through JPA. Simple example of configure the Spring needed components to perform...