Showing posts from August, 2005

Make others find your blog by location

Today I found an interesting website - GeoURL, all thanx to this blog. It is a location-to-URL reverse directory and allows you to find URLs by their proximity to a given location.

It is very easy to get a "GeoURL".

Find the longitude and latitude of the blogs location
Insert some metatags in the head of your webpage, my metatags is as following

<meta name="ICBM" content="28.662, 77.106"/>
<meta name="DC.title" content="Raj Blogs"/>
<meta name="geo.position" content="28.662, 77.106"/>

Register with GeoURL by using its ping form or a GET query something like this:

Finally insert the HTML code generated by GeoURL into your webpage.
Find your neighbor's blog :-)

Google Desktop 2 and Talk

I have just installed Google Desktop 2 on my office workstation and hope to install it on my home machine later in the evening.
After installation, it is indexing the files. The 'sidebar' feature seems quite good, but Weather and Share Market info is meant only for those in US :( A big disappointment for us non-US people.
What u say of it? Any reviews?

Also, I plan to install Talk on my home machine. How it it. Has anybody used it so far? Any reviews?


XMLHTTP is Extensible Markup Language Hypertext Transfer Protocol. It is a set ofAPIs that enables XML, HTML or binary data to be transmitted to and fromWeb servers over the Internet using HTTP.
An advantage of XMLHTTP is that when files that are User Interface programs (e.g. JSPs, ASPs or CGI programs) are queried from the server, theXMLHTTP object continuously queries the server transparently to retrievethe latest information without the user having to repeatedly refresh thebrowser. XMLHTTP enables streamed content through DHMTL rather than ActiveXcontrols or Java applets.

Userful Links: Define XMLHTTPGoogle XMLHTTP

Blog Subscription by Email

I have introduced email based subscription for the Blog, all thanx to Bloglet. The subscription option is available in the left sidebar :-)

JSP Model 1, Model 2 Architectures and MVC Pattern

JSP Model 1, Model 2 Architectures and MVC Pattern
The early JSP specifications presented two approaches for building web applications using JSP technology. These two approaches were the JSP Model 1 and Model 2 architectures. The two JSP architectures differ in several key areas.
The major difference is in how and by which component the processing of a request is handled. With the Model 1 architecture, the JSP page handles all of the processing of the request and is responsible for displaying the output to the client. There is no extra servlet involved in the process. The client request is sent directly to a JSP page, which may communicate with JavaBeans or other services, but ultimately the JSP page selects the next page for the client. The next view is determined based on either the JSP selected or parameters within the client's request. In contrast, in the Model 2 architecture, the client request is first intercepted by a servlet, referred to as a controller servlet. This servlet…

JSP Performance Tips

Here are a few tips to improve JSP performance that I have been using. If you have your own listing of the tips, plz share.Disable JSP auto reloading feature.
Use thread pool for your JSP engine and define the size of thread pool as per application requirement.
Use jspInit() method to cache static data
Initialize the 'out' object (implicit object) with proper size in the page directive.
Set the content length
Give 'false' value to the session in the page directive to avoid session object creation.
Flush the data partly
Use StringBuffer rather than using + operator when you concatenate multiple strings
Use include directive instead of include action when you want to include the child page content in the translation phase.
Avoid giving unnecessary scope in the 'useBean' action.
Use print() method rather than println() method
Use ServletOutputStream instead of JSPWriter to send binary data
Minimize code in the synchronized block
Do not use custom tags if you do not have reusab…

[Updated] JDBC Drivers

I have updated my earlier post on JDBC Drivers. Updated version can be viewed here.

[Humor] Being an IT Consultant

Once upon a time there was a shepherd sitting on the side of a deserted road. Suddenly a brand new Porsche screeches to a halt. The driver, a man dressed in an Armani suit, Cerutti shoes, Ray-Ban sunglasses, TAG-Heuer wrist-watch, and a Pierre Cardin tie, gets out and asks the Shepherd: "If I can tell you how many sheep you have, will you give me one of them?"

The shepherd looks at the young man, and then looks at the large flock of grazing sheep and replies: "Okay."

The young man parks the car, connects his laptop to the mobile-fax, enters a NASA Webster, scans the ground using his GPS, opens a database and 60 Excel tables filled with logarithms and pivot tables, then prints out a 150 page report on his high-tech mini-printer. He turns to the shepherd and says, "You have exactly 1,586 sheep here."

The shepherd cheers," That's correct, you can have your sheep."

The young man makes his pick and puts it in the back of his Porsche.

The shepherd look…

Servlets Vs Applets

There are some things to note to note about Servlets as opposed to Applets.

Firstly, the servlet and its environment is completely under the control of those deploying it. That is, you have control of which JVM is used and that this is independent of the browser used by the user. This is important as it removes concerns associated with the so-called “browser” wars.
Secondly, a servlet is not constrained by the applet sandbox. This means that a servlet can reside behind a firewall and can communicate with any and all systems that it needs to. For example, JavaIDL can be used to connected to a CORBA compliant Object Request Broker (ORB) or sockets to connect to legacy systems (for example implemented in C).
Thirdly, the client Web browser does not communicate directly with the servlet. Rather the browser communicates with the Web server, which in turn communicates with the servlet. Thus if the web server is secure behind a firewall, then the servlet is also secure.
Fourthly a single Servlet…

How Servlets work

Step 1: A user using a web browser requests some information from the web server via an http request.

Step 2: The web server receives the request. If the request is for a straightforward HTML page then the appropriate HTML file will be loaded. If the request is to a servlet, then the web container will load and initiate the servlet (unless it was already running). This is done by running the servlet on a Java virtual machine (JVM).

Step 3: The servlets’ init() method is then executed. This method is the equivalent of the init() method defined for applets. That is, it is executed only once, when the servlet is first created. It should be used in the same way as the init() method for applets. That is, as the servlets initialisation method (rather than defining a constructor). The init() method must complete before any requests are handled.

Step 4: The servlet will receive the HTTP request and perform some ty pe of process. Each request is handled by its own thread (lightweight Java process…

A slightly bigger 'Hello World'

The code is shown below is simplest that you can imagine and does very unusual thing!
It is slightly bigger than "Hello World!" program but does much more. Can you make a guess what the program outputs?

public class test{
public static void main(String args[]){
for (int i = 0;i < args.length; i++) {
System.out.println("File " + i + ":" + args[i]);
if (args.length<=0) {
System.out.println("No files!");

After compilation, if you run it like this:
java test *
it lists all files in the current directory on Windows or in any shell in UNIX.

If you do: java test .*
on UNIX it also shows all hidden files.

You can ask how can we get this list without any file handling functionality in the code?
Indeed looks mysterious...
But in reality everything is very simple.
When you type "*" (wildcard) OS (DOS, Windows, UNIX), not Java (!!!) sends the list of files in the current directory to your pr…

Two-phase commits

The two-phase commit protocol ensures that all the resource managers either commit a transaction or abort it. In the first phase, the JTS asks each resource manager if it is prepared to commit. If all the participants affirm, then in the second phase the JTS(Java Transaction Service) broadcasts a commit message to all of them. If any part of the transaction fails - for instance, if a resource manager fails to respond to the prepare request, or if a resource manager responds negatively, then the JTS notifies all of the resource managers that the transaction is aborted. This is the essence of the two-phase commit protocol.


Originally uploaded by rgarg. This is Aryan, my son. He is 2 1/2 yrs old now, and have just started attending a playschool.No Need to Click Here - I'm just claiming my feed at Feedster

[JSE 5.0] Performance Testing Example

Bruce Eckel had an interesting post on performance testing the collection classes. Basically, he is comparing the different classes, running a myriad of insertion and delete tests and then timing the operation. He uses System.nanoTime() and to quote him, “typically nanoTime() produces values with a granularity that is greater than one (and this granularity will vary with machines and operating systems)”.

A List of JDBC Drivers

Continuing from What are the different type of JDBC drivers?, here is a listing of some of the popular JDBC Drivers available.
I have so far used Oracle Thin driver, IDS Server, Hypersonic SQL, Sprinta Driver (for MS-SQL Server) and MM.MySQL Drivers beside JDBC ODBC Bridge, and I think your own list would also be somewhat similar. Or is it different?

Yawn of theTiger

A white tiger yawns as he lays in a pond at the New Delhi Zoological Park in New Delhi.

I just adore the pic...