AJAX calling in Play Framework
Java 8 Lambda expressions example
In this article we will cover Java 8 Lambda expressions. While implementing single method interfaces - often to be passed as a parameter to another function as callbacks - we often end up writing an anonymous class. Considering what we want to achieve, we may come up with something that is unnecessarily verbose.
Java 8 Predicates and Functions
Google Guava library users are already familiar with the concepts that we will cover in this article. Predicate and Function are a couple of useful Functional Interfaces introduced in Java 8 (more information about Functional Interfaces in the following article: Java 8 Lambda expressions example). Let us see which features each one of these interfaces provide.
Java 8 Streams
Java 8 introduced streams as way to perform functional operations over collections of elements, such as the traditional map-reduce transformations. In this article we will cover the most important features provided by Java 8 streams. One important feature of streams is the kind of operations one may execute against them. There are two kinds of operations: intermediate and terminal. Intermediate operations return the modified stream to the caller so one may call additional operations over the stream in a nested way. Terminal operations return a result of a given type and one may not execute any other streaming operations over the result.
Java 8 Consumer and Supplier
The Consumer and Supplier interfaces are a couple of Functional Interfaces that belong to the new Java 8 java.util.function package. As the package name states, these interfaces are meant to be used together with the new functional Java 8 features.
Java 8 Parallel Streams
As we have seen previously in Java 8 Streams, Java 8 introduced streams as way to perform functional operations over collections of elements. In this article we will see how we may take advantage of the parallel streams feature in order to implement parallel stream processing.
Java.lang.NoSuchFieldError – How to solve SuchFieldError
In this tutorial we will discuss about the NoSuchFieldError in Java. This exception is thrown to indicate that an application tries to access or modify an object’s field, but that field no longer exists. This error can only occur during runtime, if the definition of a class has incompatibly changed.
How to create XML in java using DOM parser
This tutorial covers about how to create a XML file using DOM Parser in Java and also covers that how to indent an XML using java . XML is made up of Elements . You can visit my earlier tutorial for more on XML and How to traverse / parse an XML. DOM allows a developer to create objects like root, child elements , comments and text nodes, etc. Document interface have the factory methods to create these objects. Elements are represented by Element interface , can have other elements , text, attributes . Document and Element interface inherit Node interface which is the primary datatype for the DOM.
DOM Parser to traverse / parse a XML file using recursion
How to use DOM Parser to traverse / parse a XML file using recursion in Java. Let us start with an example. The following is the sample XML document to represent the Books details.
Validation for Strong Password
Convert byte array to string & string to byte array
The following tutorial tells about how to convert a String to byte array and byte array to String with suitable examples. Byte array may be used as buffer in many programs to store the data in byte format .The following lines of code read data from the input stream to the buffer and the buffer gets printed as readable characters until end of stream.
Storing Date / Timestamp values in database
The following tutorial explains how the date value is stored in a date field of any database table (here DB2) using java code and also covers that how the timestamp value is stored in timestamp column. In DB2, Date value can be stored in a date column in db2 table by converting the date string to Java sql date. Also when a date string is directly stored in a date column, it is automatically converted to the date value represented by the string. Date string needs to be converted to JDBC date escape format (YYYY-MM-DD) which can be a input to java.sql.date.valueOf() method to convert to a Date value. Suppose If we accept the date format as DD/MM/YYYY as input string , then we have to convert to the date format YYYY-MM-DD using Java. For converting the date , following java code may be used.
Struts2 & Hibernate 4 integration
Before proceeding to this tutorial, you can go through my earlier tutorial how to start new struts2 application. In this tutorial we are going to see how to integrate hibernate with struts 2. Let us develop sample application for Adding / Deleting / Listing Items in Inventory using MySQL database with Hibernate support. Later on we can see how to migrate the same application to use DB2 database without changing any java code and query part. Switching to other SQL database requires few changes in Hibernate configuration file which is the main advantage of using Hibernate. Without using hibernate it is very difficult to switch over to any database especially at later stage.
Iterating ArrayList in JSP using Struts
Iterate tag is used to repeat the nested body content ( body content ) once for each element of the collection. The collection can be an 1. Array of Java objects or primitives (eg. int, long , etc..) 2. Implementation of java.util.Collection (ArrayList, Vector , etc..) 3.Implementation of java.util.Enumeration 4. Implementation of java.util.Iterator 5. Implementation of java.util.Map ( including HashMap, Hashtable, and TreeMap)
Java supports only Pass by Value
In Java, arguments are passed by value only because primitives are passed by value and object / array references are also passed as values. Let us see in detail. In Java all argument values that belong to one of basic types (primitives) are transferred to a method using pass by value mechanism. A copy is made for each argument value that is passed to a method. So any change in the argument in the method does not reflect in the variable of the calling function.
Double Exposure Effect
Learn how to create a double exposure effect in Photoshop, using two images, selection methods, layer masks, Adjustment Layers, and more!
Quick Photo Composition
In this video, you’ll learn how to quickly turn a plain photo shoot into a fantastic one. This technique uses the Quick Selection Tool, Refine Edge, and Adjustment Layers.
Creating Aboriginal Art
In this tutorial you have to learn how to create aboriginal art in illustrator CS3. In this we are applying photoshop and apply simple trace from live trace and also direct selection tool. After that you have wonderful aboriginal art in illustrator CS3.
Resizing the HTML5 Canvas Dynamically as the Browser Window is Resized
This recipe how to resize the HTML5 canvas dynamically when the size of the browser window changes. Weirdly, the HTML canvas element defaults to a fixed 300 pixels wide by 150 pixels high, and that won’t change for compatibility reasons.
Resizable HTML5 Canvas