Monday, September 24, 2012

Lucene - Updating index files

Apache Lucene(TM) is a high-performance, full-featured text search engine library written entirely in Java. It is a technology suitable for nearly any application that requires full-text search, especially cross-platform.
Apache Lucene is an open source project available for free download. To know more about Lucene , click here.

In this example we will see how to append to an existing lucene index. We will see how we can update the existing index files with new data.

IndexWriter iwriter = new IndexWriter(directory, analyzer, false, MaxFieldLength.UNLIMITED);

Note the boolean variable - true to create the index or overwrite the existing one; false to append to the existing index. To know more about IndexWriter, see API.

About the example: We will create few text files. Then use our java program to create index and search. Then we will add a new file, update the index and search again.

First we will create few text files in a location lets say "C:\TestLucene\files"

Saturday, September 8, 2012

How to create a Jigsaw puzzle using JSP and Javasacript?

What is Jigsaw puzzle?
A Jigsaw puzzle is a tiling puzzle that requires the assembly of numerous small pieces. Each piece usually has a small part of a picture on it; when complete, a jigsaw puzzle produces a complete picture.

In this article we will see how to create a Jigsaw puzzle using javascript. Initially you will require to cut an image into various pieces, that can be done using a simple java program.

Please see the below Java program that will cut an image into number of pieces for a Jigsaw puzzle. Just provide the desire number of rows and column, it will automatically cut an image into that number of pieces.

Please see the self explanatory Java program below

More Panda and Penguin Updates Expected from Google

It's the high time for all the online business owners to fasten their seat belts and make some necessary improvements in their websites, as Google is planning to give them more jolts with its Panda and Penguin updates. Although recently Google has made updates in the Panda algorithm in the month of July 2012 to trace pages with the low quality web content. This update was minor in nature and no one in the online world noticed it. According to Google head Matt Cutts, ''These updates are majorly aimed at penalizing all the web sites which try to spam the search and try to take a credit for the information which is  completely copied and lacks credibility. In the SES  San Francisco conference on 15th August 2012, he further explained that the Penguin algorithm is still making adjustments and it will not allow sites to get rewarded for the spam as it used to happen in the previous years''. With the help of these updates, all the link exchange as well as linking tricks have now been caught by the the search engine and the sites which have been making  attempts to over optimize the sites will be recognized and punished by the spam fighting team.

Sunday, September 2, 2012

Java / JSP : Simple image cropping example

In this article we will see how to crop an image in Java. You are in this page then u might surely know what exactly the Image cropping is, it is nothing but removal of the outer parts of an image  to improve framing, to change aspect ratio etc.

Image cropping can be implemented easily using Java. First lets see the basic example of image cropping. In the below code we have used getSubimage() function of BufferedImage to achive image cropping feature. No need to add any Jar file directly you can run below code and see the output.

Please see the self explanatory java code below.