Posts

Implementing Spellchecker in Solr

A common need in search applications is suggesting correct word/ phrase for a misspelled word / phrase. These suggestions may come from a dictionary that is based upon some field or upon any other arbitrary dictionary.  Implementing a spell-check suggester in Apace Solr is a piece of cake. All you need is to follow the given steps and you are done. Step 1: Open <SOLR_HOME>/example/solr/conf/solrconfig.xml and search for  <lst name=" spellchecker " >   under this tag make changes to  <str name=" field " > name </str>  in place of    name   define your field which will be referred for spell checking Now we have to update the spell requestHandler settings, to do so search for  <requestHandler name="/ spell " class=" solr.SearchHandler " startup=" lazy " > and under this tag make changes to <str name=" df " > text </str>  in place of    ...

Importing / Indexing MySQL data into Solr

Apache Solr is a fast, full featured, open-source Java search server. It enables you to easily create search engines which index, search & analyze data from websites, databases or files. Before we proceed further I presume that you have already configured Solr server without data or refer to Solr in 5 minutes tutorial to configure your Solr server first. Configure your Solr server Step 1: To index your data firstly you need to define schema by editing file called  schema.xml  present at  <SOLR_HOME>/example/solr/conf/ Schema.xml in solr serves the similar purpose that table does in mysql In schema.xml file you have to define the Fields with there field type Field which should be used as unique key Which fields are required, indexed Default search field (deprecated in new versions) Default search operator (AND | OR deprecated in new versions) ​ **indexed fields are fields which undergo an analysis phase, ...

serialVerionUID in Java Object Serialization

What is serialVersionUID? The purpose of the " serialVersionUID "  is to keep track of different versions of a class in order to perform valid deserialization of objects. This SUID should be unique to a certain version of a class, and should be changed when there are any details change to the class, such as a new field, which would affect the structure of the serialized object. The serialization process associates a serialVersionUID (default if not explicitly defined) with each serialized instance of a class. This serialVersionUID is validated at the time of deserialization from the loaded class serialVersionUID, and in case of a mismatch InvalidClassException is thrown. Default serialVersionUID If a serializable class does not define serialVersionUID explicitly  then the serialization process automatically calculates a default serialVersionUID (by invoking  computeDefaultSUID()  method of  java.io.ObjectStreamClass...

Serialization in Java

Serialization is the process of converting an object's state into byte sequence ( to persist it on to a file ), and to rebuild ( deserialize ) those bytes into an object. To make an object serializable, the object should implement java.io.Serializable interface. Lets take an example to understand Serialization in Java. Firstly lets define a serializable object ############################################################### package learn.java.serialization; import java.io.Serializable; public class SerializableObject implements Serializable { private String message; public SerializableObject(){ } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } } ############################################################### As you must have noticed the only special thing that we have done  to the class is implement Serializable. The java.io.Serializable ...

Pin It Button

Image
A Pin It Button is very similar to your Like or Tweet button. It allows user to share/bookmark ( or Pin in Pinterest's language) a web page. It's very easy to add a Pin It button on your site  Get you Pint It button here . Although after adding the Pin It button on a website I came across the following bugs URL of the image to be pinned is mandatory: If not done Pin It button will be displayed as normal but  user won't be able to Pin It. The worst part is Pinterest never gave any error in this case, leaving you in the puzzled state. Count Bubble was not rendering As you can notice the code generated by Pinterest has encoded the URLs' that I entered but unfortunately if you copy paste in your web page the count bubble will not be displayed. To show the count button edit the code generated by replacing the encoded URL from normal decoded URL. After this you will be able to see the Pint It count Happy Pinning :)

Factors that make a software developer stick to a company

Although we cannot stop any employee from switch but yes if a company can provide/fulfill the listed points then definitely the attrition rate can diminish. For a software engineer and many other jobs following things are very important Work Quality - The type of work/job one is doing. How will it help him/her in future as far as his/her career is concerned. Pressure - A seasonal work pressure is always good for an employee  but yes a constant work pressure could be a reason for an employee to think for a change Environment - How well the the team communicates and co-ordinates? The company should work on team building activities to keep team bonding intact.  Hours - Employees feel more comfortable in working in a flexible working window environment rather than a fixed working environment Recognize, Appreciate and Reward   An employee is hungry for recognition, appreciation and rewards. If someone is getting all of these th...

Configuring Apace Server to run PERL scripts

Follow following steps to run PERL script on Apace Server Step 1:   Open <APACHE_HOME>/conf/httpd.conf file httpd.conf - is the main configuration file for Apache HTTP Server Step 2:   Search for " ScriptAlias /cgi-bin/ " uncomment i.e. remove ' # ' if commented. You may need to adjust the path to run your script successfully ScriptAlias - Provides the location for CGI programs. This should be two parts, separated by whitespace. The first part is the part used in URL that triggers execution of a CGI program; the second part is the path where those CGI programs are stored in the real filesystem Step 3: Search for " AddHandler cgi-script " in the document, uncomment it, if committed and append " .pl " after " .cgi " Step 4:   Modify your PERL Script. If your script is Windows executable it does't means that it will run on Apache Server as well 'coz script relies on PERL interpreter, so we have to modi...