Posts

Showing posts from 2015

Lucene Highlighter Tutorial with Example

Image
The post explains how to implement search terms Highlighter using Apache Lucene 5.1 along with example code. When users search, they want to search in minimum time. So the techniques that facilitate users to search fast are important for better user search experience, highlighter is one of those techniques. HighLighter performs two functions: It makes the terms bold in search result which were part of user query, so that user can identiy and quickly review the result. If your document text is long, Highlighter also select best fragment of text that contains the search keywords, so that user could read 2-3 lines of document to decide whether exploring the link further would help. Using Google, you must have noticed, Google highlight the query keywords making them bold and also select a particular fragment of text from the description that is stored in Google about that articles. As show below: Notice, there are three query terms: java, inheritance and bitspedia. In re

How Domain Name is Resolved into an IP address of Hosting Server?

Image
When we register a domain, we provide the address of our Name Server (this is called authoritative name server of our domain). This NS has the info of our hosting server IP. Here is the process summarized by skipping unrelated details. When a user open a domain, the server ask its Hosting Server IP to our ISP DNS Resolver. If it has, the IP address is returned. Else ISP ask from her connection provider or directly from ROOT SERVERS. The root servers don't have the IP, but they always return the Name Server address of your website's TLD registry. Then our ISP ask same questions form that NS. It also don't know the IP but it know the Authoritative NS Address (that we configured when we purchased the domain and setup its NS), the address of authoritative NS is returned. Then our ISP ask same questions form our domains' authoritative NS which definitely has the IP address of hosting server. When its returned, our ISP's DNS Resolver cache it to serve other queries and re

What Information We Add in Name Server and Why we Associate NS When we Purchase a Domain

In Name Server (along with other info, the most important is) we define a mapping of Our Domain/Sub-Domain Name and Its Hosting Server IP Address What other info? Its usually include following things: The email server address... called MX records. Defining domain aliases. Configuring it to redirect to other domain. Adding some info provided by third parties to verify that we own the domain. Sometime we want our particular sub-domain to link to another DNS, who better knows the hosting server IP. we can also do that e.g. when we configure our domain to Blogger free sub-domains, we map our domain to google name server. etc. The rest is done by Google in their NS. But you don't need to bother all these details as far understanding basics is concern.

What is Difference Between a Library and Framework

If we skip architectural details of library and framework design.  The fundamental difference is: We call the library code. How? By initializing its components and calling methods that provide some utility to our app. e.g. Apache String Utils libs, Apa che Compression Library, etc.  But the framework calls our code. How? Because we write our code following some conventions dictated by the framework or we build our application components by extending or implementing the components already provided by the framework. e.g. Spring MVC, Laravel, Ruby on Rails. etc.

Tomcat Introduction and Purpose of Different Folders

Image
If you are planning to develop web application in Java. The Java EE technology used to develop web applications is Servlets. Servlets are java classes that process the web requests and deliver response to browser. Putting these classes directly in just JVM is not possible, nor it would start processing web requests. We need some server to receive the HTTP requests (HTTP is the protocol the browser and server talks in), convert it into an object oriented representation (from stream of bytes written on server socket into objects understandable by our java classes i.e. Servlet) and pass the request to our servlets. So that we don't have to deal with lower level details of network programming like programming HTTP protocol to receive the requests and sending response to user browser. But we could focus on building business logic of our projects. Tomcat Tomcat is a server that receive web requests over the network, converts them into refined object oriented representation and dispatch t