Iterating forward and backward using java ListIterator.

ListIterator can be effectively used to travel forward and backward in a List implementation.

Continue reading…

 

Characters Count

Problem: Suppose you are given a collection of strings like [swquiz,gkhive,testdriven ]. Each string shall have characters from ‘a’ to ‘z’, only lower case, there can be repetition of characters in a given string. Write a program for following 1) Count of characters that are available in all the input strings 2) Count of characters […]
Continue reading…

 

Eclipse – Auto complete for static import

To enable auto complete for static field and methods from a given type you can add that type into Favorites section in the eclipse preference. Go to windows > preferences > java > editor > content assist > favorites and click on the New Type button and type in the absolute class name. (ie org.junit.Assert.*)
Continue reading…

 

Downloading all maven dependencies to a directory

Use case: Tired of having unwanted jars? Tired of finding dependent jars? Maven shall help to download all the dependencies of the project into a folder. Solution: If you already have a pom.xml execute command “mvn dependency:copy-dependencies” and you will find target/dependencies folder filled with all the dependencies. Else you can create simple pom.xml

Continue reading…

 

Tomcat and Apache Web Server Integration with mod_proxy connector

Use case: I have only one public IP assigned to my hosting/private cloud, and I want to host multiple websites on a single machine. Scenario as given below. Site can be simple html or php or JSP/Servlet (Java). Prerequisites: Java, Tomcat, Apache, PHP installed. Steps to integrate Tomcat and Apache: Enable mod_proxy, mod_proxy_http, mod_proxy_ajp Configure virtual […]
Continue reading…

 

Spring Data Solr – Index and Find Documents

In today’s post I would share a sample program to index and find documents into/from Apache Lucene Solr using Spring Data Solr. If you don’t have Solr in your local machine please download and install Solr from official site. This program is tested against the Solr server running in localhost and in default port. (http://localhost:8983/solr/) […]
Continue reading…

 

Spring Data Mongo Pagination

In today’s post I would give you a sample program which loads data from MongoDb using Spring Data as page by page. This is useful when you load large data set into screen. The complete source code of this post can be found github. Libraries Use pom.xml

ProductRepository Source Code

Product Domain Object […]
Continue reading…