Iterator Design Pattern

Iterator Pattern is a Behavioural Design Pattern. The intent of Interator pattern is to provide a way to sequentially taverse over a data structure without exposing underlying data structure. Java’s Iterator is a good implementation of this pattern and allows us to traverse over underlying collection in a sequential way. A collection creates an Iterator […]

, ,

Leave a comment

Builder Design Pattern

Builder Design pattern is a creational pattern. It is used to build a complex object step-by-step and final step would return complete constructed object. Builder pattern gives us more control over construction of object and makes client code more readable. It helps us eleminate problems like Telescoping Constructors and setter methods. You may also create […]

, , ,

Leave a comment

ArrayBlockingQueue

ArrayBlockingQueue implements BlockingQueue interface. ArrayBlockingQueue is a bounded blocking queue that stores it’s elements in an array internally. Queue orders elements in FIFO (first-in-first-out) order. The head of the array contains element that has been in the queue for the longest time and tail of the queue contains elements that have been in the queue […]

Leave a comment

BlockingQueue

A BlockingQueue is a concurrent data structure that extends Queue interface and supports additional operations with following characteristics: Wait for space to be available when an insert is attempted and queue is full Wait for element to be available when the queue is empty. Usage Scenario BlockingQueue is useful in producer-consumer type of scenarios. One […]

Leave a comment

Reading InputStream Into String With Java 8

Example below shows use of streaming with java 8.

Leave a comment

VI Editor Command Reference

Note: Commands below are case sensitive and may not work on all versions of VI editor. General Commands To use VI vi filename to open file ZZ or :wq To exit vi and save changes :q! To exit vi without saving changes [esc] To enter vi command mode Cursor Movement Commands h move left (backspace) […]

Leave a comment

Exchanger

Java concurrency API provides a synchronization utility java.util.concurrent.Exchanger that allows two threads to exchange data. Exchanger provides a common point where two threads arrive and exchange data between them such that data of first thread goes to the second thread and data of second thread goes to first. Exchanger basically creates a barrier at which […]

, , ,

Leave a comment

Raspberry pi : Installing Tomcat

Well I think raspberry pi 3 (Model B) is a very capable machine and can very well be used as a server for hosting some lightweight web application. I would certainly not want to run an expensive desktop server 24 X 7 and pay huge electric bills just for running a web application for limited […]

, ,

Leave a comment

Raspberry pi : Installing Citrix Receiver

I have been using raspberry pi 3, Model B as my primary computer for a few days now. I have installed Raspbian Jessie on it. Through this series of posts i plan to share details of how i set it up for my everyday use. First requirement for using it as my personal computer was […]

, ,

Leave a comment

Batch Processing using JDBC

,

Leave a comment

Using local thread variables

Shared data is one of the most critical aspect of concurrent programming. When you create an instance of a class that implements Runnable interface or extends Thread class and use same object to create multiple Threads then all the threads share same attributes. This means if you change any attribute in one thread, all threads […]

, , ,

Leave a comment

Removing border from primefaces <p:layout>

Primefaces provides an excellent component <p:layout> to lay structure your website, but it has an annoying border which makes everything look cluttered. Here is how you can get rid of that (at least for now) I know it is bad, but i am no CSS guru! Just figured out that this works!

, ,

1 Comment

Get source JARs and Javadoc from Maven repository

Sometimes you may want to use Javadoc feature of your eclipse IDE so that you may be able to refer the source code and javadoc while using some API. Option 1 Following maven commands come in handy for these purposes: First command attempts to download *-source.jar files for the dependencies listed in your pom.xml and […]

Leave a comment

Find running processes in Oracle

Use following query to find running processing in Oracle. The output shows Process id of the running process, Status whether it is ACTIVE or INACTIVE, username, Schema Name and the SQL query that is running under current process. Running following query gives a handful of useful information.

,

Leave a comment

SQL Index

Index in SQL is created on existing tables and is a way to boost up the data retrieval performance of table. Index should be created on the columns that are frequently used for searching data. An Index is an ordered list of contents of a column ( or a group of columns) of a table. […]

,

Leave a comment