Pages Navigation Menu

Coding is much easier than you think

RECENT POSTS

Comparable vs Comparator

Posted by in Core Java, Java | 2 comments

Comparable vs Comparator

  One of the common asked interview question “What are differences between Comparator and Comparable”? Or “How will you sort collection of employee objects by its id or name”.   For this we can use two interfaces, Comparator and Comparable. Before we actually see differences, let me give you brief introduction of both.   Comparable interface:   Comparable is an interface from java.lang package. It includes only one abstract method compareTo() that is to be overridden by the programmer with his ordering...

read more

Is Java Pass by Reference or Pass by Value?

Posted by in Core Java, Java

Is Java Pass by Reference or Pass by Value?

  This post will give you some insights of how Java really works to the point that in your next discussion about Java passing by reference or passing by value you’ll just smile :-)   Consider the following program:   public class Main { public static void main(String[] args) { Foo f = new Foo("f"); // It won't change the reference! changeReference(f); // It will modify the object that the reference variable "f" refers to! modifyReference(f); } public static void...

read more

Compare two files by content in Java

Posted by in Java

Compare two files by content in Java

In this tutorial, we will provide a simplified approach to compare two files in Java by content. We will use Apache Commons IO library to perform this comparison, and run this against some test files we prepare to see the results. Before start download and add the following library in your classpath.   Download It – commons-io-2.4.jar    We will use the contentEquals() method of the FileUtils class of the above library to compare the file content.   The Java program to compare two files by content...

read more

Eclipse Shortcuts for fast coding

Posted by in Eclipse | 1 comment

  List of some Shortcuts for fast coding. Traverse below and improve your coding speed by utilizing Eclipse Shortcuts. Download It – eclipse.pdf   File navigation  Short cuts   Short cuts  Description Alt + Shift + n Use this shortcut key to open an new menu. Ctrl + n   Use this  shortcut key to create a new file Ctrl+H If you want to search in your program and work space use this short cut . CTRL + SHIFT + R Open a resource. You need not know the path and just part of the file name is...

read more

Splitting PDF File Using Java iText API

Posted by in Java, Java PDF

Splitting PDF File Using Java iText API

  Previously I wrote a tutorial about how to merge two or more PDF files. This tutorial we will learn about splitting a PDF with multiple pages into multiple PDFs using the Java iText API.   Before start, Please download below library.   itext-2.1.4.jar   package com.simplecode.util; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import com.lowagie.text.Document; import com.lowagie.text.pdf.PdfContentByte; import...

read more

Scheduling a time delay in Java

Posted by in Java

Scheduling a time delay in Java

  A simple timer schedule can be used to create a time delay in your java program. You can make use of the class Timer from java.util package. Timer is capable of scheduling an initial time delay after which the task starts executing AND the time gap for the consecutive execution of the same tasks.   The syntax for the time schedule can be understood as timer.schedule(<task>,<initialTimeGap>,<consecutiveTimeGaps>); Note : The time gaps are in milli Seconds Below is a simple java program that makes use of...

read more

Web Services

Posted by in Soap-UI, Web technology | 1 comment

Web Services

‘Web services’ is the name given to a technology for providing loosely coupled and interoperable communications between computer systems over a network. Applications of this technology include enterprise application integration, enabling communications between distributed systems and interoperability with partners or other businesses. The major benefits of using web services are platform independence, flexibility and ease of maintenance, which are the result of the open standards employed and the simplified underlying request-response...

read more

Merge PDF files using java iText

Posted by in Java, Java PDF

Merge PDF files using java iText

  Before start, Please download below library.     itext-2.1.4.jar package com.simplecode.util; //Please include the itext-2.1.4.jar in the classpath import java.util.List; import java.util.Iterator; import java.util.ArrayList; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.FileInputStream; import java.io.FileOutputStream; import com.lowagie.text.Document; import com.lowagie.text.pdf.BaseFont; import...

read more

How to create a udcx file for Main Data Connection in infopath?

Posted by in Infopath 2010, SharePoint

How to create a udcx file for Main Data Connection in infopath?

  For create a UDCX file for Main data connection, you may follow these steps as: Open your InfoPath form and clik on “Manage Data Connection…” under the Fields in the InfoPath form, and then in new pop up window, select your Main Connection and click on “Convert to Connection file” as: and then give your Data connection library’s path (on SharePoint site) in the textbox as: for example: http://sharepoint_site/DataConnectionLibrary/ABC_Main_Connection.UDCX and click on OK. After this you can see...

read more

SQL Injection€“ How to Test Web Applications against SQL Injection Attacks???

Posted by in Security, SQL Injection

SQL Injection€“ How to Test Web Applications against SQL Injection Attacks???

  Many applications use some type of a database. An application under test might have a user interface that accepts user input that is used to perform the following tasks: 1.Show the relevant stored data to the user e.g. the application checks the credentials of the user using the log in information entered by the user and exposes only the relevant functionality and data to the user 2.Save the data entered by the user to the database e.g. once the user fills up a form and submits it, the application proceeds to save the data to the...

read more