Description: This will help to understands Iterables.frequency() method. This method will returns int that frequency of the given object in particular list. The comparision, whethet the objects are equals or not with the help of equals method of Entity class bank. import java.util.ArrayList; import java.util.List; import com.google.common.collect.Iterables; public class FindFrequencyOfOneJavaObjectInCollection { public static void main(String[] args) { Bank sbi = ...
Read More »Fastest way of Convertion One Java Object To Another
Description: Most of the time we need to convert one java object to another java object. To do this job, one of the best way by using com.google.common.collect.Iterables Class, we can achieve the task. Converting One Entity to another Entity. Example 1: How list of Bank object are converted to list bank names. import java.util.ArrayList; import java.util.List; import com.google.common.base.Function; import ...
Read More »Front Controller
Front Controller Description: The beauty of front control design pattern is single point of contact for all requests and responses. Why do we required: As a good application designer, we need to concentrate on few common things, 1) Application consistency we call as robustness 2) Less cost of application maintenance 3) Easy to extend (extend ability) 4) No code duplication ...
Read More »XSLT Vs CSS
1) CSS is for doing simple things, combined with power of XSL for doing complex things. 2) CSS is mainly used for rendering HTML, but it can also used for rendering XML directly, by defining the display characteristics of each XML element. 3) CSS has serious limitations, it can not reorder the elements in source document, can not add text ...
Read More »XSL, XSLT And XPath Basics
1) XSL (Extensible Stylesheet Language) is intended to define the formatting and presentation of XML documents for display on screen. 2) XSL processed the XML document in two stages, first is a structural transformation in which elements are grouped, selected and reordered. And then a formatting process in which the resulting elements are rendered as ink on paper, or pixels on ...
Read More »XSLT Version 1.0 Vs 2.0
What is new in XSLT 2.0 : Given any XML document, produce a list of the words that appear in its text. Giving the number of times each word appears, together with its’ frequency. frequency.xml <?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet type="text/xsl" href="frequency.xsl"?> <Sample> <TITLE>a a a a a</TITLE> <TITLE>1 1 1 1 1</TITLE> <TITLE>A A A A A</TITLE> <TITLE>! ! ! ...
Read More »My First XSLT Program running with Saxon-B Processor
Description: Sample program that helps to understand how XSLT converts XML to HTML page using Saxon-B Processor. Saxon-B Processor, is nothing but a jar file doing the conversion for U. Steps to be followed: 1) Download latest Saxon-B processor jar file from http://saxon.sourceforge.net/ 2) Unzip the folder & copy saxon9ee.jar file to c:saxon 3) hello.xml & hello.xsl files in directory ...
Read More »Event Notification to user by playing beep sound in Java Script
Description This is a common requirement from web application users. For some events, required beep sound. That helps the user to identify some event occurrence. Examples: 1) When new message push to the device. 2) When user transaction is completed. 3) When User attention is required for some critical action. This code works even for lower end devices also. Sample ...
Read More »Java Collections – Sorting Problem
One of my hot favorite topic is sorting. Description of the problem: 1) Imagine a line of containers which are going to be loaded onto the ship. Assume the desired loading sequence is 1,2,3 eg C1 C2 C3 C4 C5 C6 2) A Container class is has a sequence method .getSeq(). So lets say for C1, container.getSeq() == 1 For ...
Read More »JQuery to display simple timer on web page
This is a common requirement for most of the web sites. There are different ways to display digital clock on web pages. Most efficient way is useing JQuery. Even we can use Java Script, performence hit will be there in case. This solves even browser time zone difference problem as well. Code works fine with browsers like IE10, IE11, Firefox ...
Read More »