Using custom delimiter while reading and writing batch file

In all previous Spring Batch posts, the DelimitedLineAggregator(which creates String format of java objects) and DelimitedLineTokenizer (which extracts fields from each record) assume ‘,’ as delimiter as shown below EMP_ID0,EMP_NAME0,EMP_STATUS0,0EMP_ID1,EMP_NAME1,EMP_STATUS1,1EMP_ID2,EMP_NAME2,EMP_STATUS2,2EMP_ID3,EMP_NAME3,EMP_STATUS3,3 We can use other symbols as delimiter and inform DelimitedLineAggregator and DelimitedLineTokenizer about this. At the time of reading and writing, the default delimiter is…… Continue reading Using custom delimiter while reading and writing batch file

Saving a transient object

In this post of Hibernate ORM, I will explain how to save a transient object with an example. A transient object exists only in memory, no representation of it exists in database. Hibernate runtime doesn’t manage (ie., automatically update or sync up with database representation) the transient object. The object’s identifier property value will be…… Continue reading Saving a transient object

eq(), first() and last() JQuery functions

In this post of JQuery, I will explain the three functions eq(), first(), and last() functions with a example. Below is the complete code for reference 1 <html> 2 <head> 3 <a href=”https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js”>https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js</a&gt; 4 </head> 5 <body> 6 7 function selectElement() { 8 var $elements = $(‘a’); 9 10 var $indexedElement = $elements.eq(0); 11 alert($indexedElement.length);…… Continue reading eq(), first() and last() JQuery functions

Selecting elements by their attributes

In this post of JQuery, I will show how to select elements using their attributes. Below is the complete html code that will be used as an example 1 <html> 2 <head> 3 <a href=”https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js”>https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js</a&gt; 4 </head> 5 <body> 6 7 function selectElement() { 8 var $element = $(‘a[href]’); 9 $(‘#input1’).val($element.length); 10 11 $element =…… Continue reading Selecting elements by their attributes

Unzipping a jar file programmatically

In this post, I will explain how to unzip a jar file. Below is the complete code to unzipping a jar file programmatically Main code 1 package jar; 2 3 import java.io.File; 4 import java.io.FileOutputStream; 5 import java.io.IOException; 6 import java.io.InputStream; 7 import java.util.Enumeration; 8 import java.util.jar.JarEntry; 9 import java.util.jar.JarFile; 10 11 public class JarDemo2…… Continue reading Unzipping a jar file programmatically

Function functional interface

In this post, with an example I will show how to use Function functional interface. Function interface is a functional interface that takes an input and produces an output. This is achieved by its “apply” method. Below is an example Main Code 1 package function; 2 3 import java.util.ArrayList; 4 import java.util.List; 5 import java.util.function.Function;…… Continue reading Function functional interface