Posts

Showing posts from 2005

Eclipse Startup Issue: java.lang.ClassNotFoundException: javax.xml.parsers.SAXParserFactory

Today when I started my Eclipse, it simply refused to!!! It simply flashed an alert asking to look into log file. And log file simply said:


!SESSION Dec 31, 2005 10:50:19.810 ---------------------------------------------
eclipse.buildId=I200406251208
java.version=1.3.1_01
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US

!ENTRY org.eclipse.osgi Dec 31, 2005 10:50:19.810
!MESSAGE Error registering XML parser services.
!STACK 0
java.lang.ClassNotFoundException: javax.xml.parsers.SAXParserFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.eclipse.core.runtime.adaptor.EclipseAdaptor.registerEnd…

Useless Facts

It is impossible to lick your elbow.A crocodile can’t stick it’s tongue out.A shrimp’s heart is in their head.A pregnant goldfish is called a twit.On average, a human being will have sex more than 3,000 times and spend two weeks kissing in their lifetime.Rats and horses can’t vomit.If you sneeze too hard, you can fracture a rib. If you try to suppress a sneeze, you can rupture a blood vessel in your head or neck and die. If you keep your eyes open by force, they can pop out.Rats multiply so quickly that in 18 months, two rats could have over million descendants.Wearing headphones for just an hour will increase the bacteria in your ear by 700 times.If the government has no knowledge of aliens, then why does Title 14, Section 1211 of the Code of Federal Regulations of US, implemented on July 16, 1969, make it illegal for U.S. citizens to have any contact with extraterrestrials or their vehicles?The cigarette lighter was invented before the match.Thirty-five percent of the people who use…

Feedster

Google Search: Hello Microsoft World

Using AJAX with Java Technology

Remote Debugging with Eclipse

toString() Generator plugin for Eclipse

While working in my latest project, I came across a situation where I needed a toString method for my TO (Transfer Object) classes. Instead of using reflection, I simply downloaded Eclipse Plugin for toString generation. Restart the Eclipse and it is ready to be used. For any class that require a toString(), switch to Package Explorer, and right click on the class name. Select 'Generate toString' from the context menu, select the fields, and the method is there in the class!

I had this plugin for quite some time, and had actually forgotton that its not the part of Eclipse. So, in my current project, when I failed to see 'toString generator', I realized it a plugin :)

Besides toString, if you like to see equals() and hashCode() methods as well, use Commonclipse plugin.

What Matters Most is how U See Yourself

Image
[Received in an email]

[Humor] Excerpts from HER & HIS Diaries

HER DIARY

I asked him what was wrong - he said, "Nothing." I asked him if it was my fault that he was upset. He said it had nothing to do with me and not to worry.
On the way home, I told him that I loved him, but he simply smiled and kept driving.
I can't explain his behavior; I don't know why he didn't say, "I love you too."

When we got home, I felt as if I had lost him, as if he wanted nothing to do with me anymore. He just sat there and watched TV; he seemed distant and absent.

Finally, I decided to go to bed. About 10 minutes later he came to bed.

I decided that I could not take it anymore, so I decided to confront him with the situation but he had fallen asleep. I started crying and cried until I fell asleep.
I do not know what to do. I'm almost sure that his thoughts are with someone else.

My life is a disaster.
















HIS DIARY


























Today India lost the cricket match again. DAMM IT.

Google Analytics

Image
Added Google Analytics (formerly known as urchin), the new Web Analysis Software Tool acquired by Google, and unlike Urchin, it is free to be used. Results are pretty cool and quite graphical in nature.

[Humor] Call Centre Jobs

Call Centre Jobs: People often wonder why they are paid so much...for just being on the phone. Take a look...Tech Support: "I need you to right-click on the Open Desktop."
Customer "Ok."
Tech Support: "Did you get a pop-up menu?"
Customer: "No."
Tech Support: "Ok. Right click again. Do you see a pop-up menu?"
Customer "No."
Tech Support:: "Ok, si r. Can you tell me what you have done up until
this point?"
Customer: "Sure, you told me to write 'click' and I wrote 'click'."
Customer: "I received the software update you sent, but I am still getting the same error message."
Tech Support:: "Did you install the update?"
Customer: "No. Oh, am I supposed to install it to get it to work?"
Customer:: "I'm having trouble installing Microsoft Word."
Tech Support:: "Tell me what you've done."
Customer: "I typed 'A:SETUP'."!
Tech Support:: &quo…

JDBC Performance Pointers

Here are a few of the JDBC Performance pointers. Hopefully, there are a lot more, which you may be aware of, but not mentioned here. Care to share them as well?Get database connection from connection pool rather than getting it directly
Use batch transactions. Choose right isolation level as per your requirement. TRANSACTION_READ_UNCOMMITED gives best performance for concurrent transaction based applications. TRANSACTION_NONE gives best performance for non-concurrent transaction based applications. Your database server may not support all isolation levels, be aware of your database server features.Use PreparedStatement when you execute the same statement more than once. Use CallableStatement when you want result from multiple and complex statements for a single request. Use batch update facility available in Statements. Use batch retrieval facility available in Statements or ResultSet. Set up proper direction for processing rows. Use proper getXXX() methods. Close ResultSet, Statement …

[Humor] Always give your 100% to work

Image
Always give your 100% to work... :)



[received in an email]

Flock is here (Developer Review Release)

Image
Have just installed Flock, the new Firefox based browser. Too early for any review, it is still deep in the 'developer review'. Download and check it out yourself. Actually, I got the invitation to check it from Flock guys. They even sent me a userid/password, but I didnt require it to download it :))


[Humor] Outsource to India

Image
Receive this interesting pic in an email :))

Google Home page in 2084

Srinivas has published an image of the 'purposed' Google Home Page in 2084. Check it out :: A Java Geek's Diary : Weblog

Spam Comments

In the past few days, some of my posts have been receiving 'spam comments'. Therefore, I have enabled the word-verification option to discourage the spammers. Hope, it wont discourage the people who really want to share the experiences.

Smile Test

I got a link to Smile Test all thanx to Srinivas's JRoller Blog.
Take this smile test to test your ability in identifying the genuine, fake smiles. Smile will appear only once and you have to decide in the mean time.

http://www.bbc.co.uk/science/humanbody/mind/surveys/smiles/

I could get only 10 out of 20 :(

Seralizing a Singleton - More on readResolve method

This refers to my earlier post on Sep 21 regarding Serializing a Singleton. Here are a few more pointers for readResolve method:
Use a readResolve method to protect the 'instance-control invariants' of singletons and other instance-controlled classes. Consider the following Singelton class

public class Elvis {
private Elvis() {
...
}
... // Remainder omitted
}

This class would no longer be a singleton if the words “implements Serializable” were added to its declaration.If the Elvis class is made to implement Serializable, the following readResolve method suffices to guarantee the singleton property:

private Object readResolve() throws ObjectStreamException {
// Return the one true Elvis and let the garbage collector
// take care of the Elvis impersonator.
return INSTANCE;
}

A readResolve method is necessary not only for singletons, but for all other instance controlled classes.A second use for the readResolve method is as a conservative alternative to the defensive readObjec…

The Evolution of a Programmer

I am just checking my pst. It still brings a few smiles.

High School/Jr.High

10 PRINT "HELLO WORLD"
20 END

First year in College
program Hello(input, output)
begin
writeln('Hello World')
end.

Senior year in College
(defun hello
(print
(cons 'Hello (list 'World))))

New professional
#include
void main(void)
{
char *message[] = {"Hello ", "World"};
int i;

for(i = 0; i < 2; ++i)
printf("%s", message[i]);
printf("\n");
}


Seasoned professional
#include
#include

class string
{
private:
int size;
char *ptr;

public:
string() : size(0), ptr(new char('\0')) {}

string(const string &s) : size(s.size)
{
ptr = new char[size + 1];
strcpy(ptr, s.ptr);
}

[Humor] What is inheritance?

Interviewer: Mr. Singh, Can u tell me, what is inheritance.

Sardaar : (Embarrassed by this simple que.) When U make love to ur wife and she bears a child, that is Inheritance.

Interviewer was a thorough professional and was not disturbed by Sardaar's reply. But he wanted to have some fun.

Interviewer: Then what is Multiple Inheritance?
Sardaar : When U and ur neighbour make love with ur wife and ur wife bears a single child, that is multiple inheritance.

Interviewer: What is Virtual Function?
Sardaar: When ur neighbour makes love with ur wife and u assume that, the child is urs.

Interviewer: What is Pure Virtual Function?
Sardaar: When u r impotent and still ur wife bears a child.

This was too much for the interviewer; so he got angry and got up. but the sardarjee was very cool. He said immediately, "no problem, just assume that ur wife is an abstract base class and allow her to be derived as many times as possible.

A few Nice Quotes

Regular naps prevent old age... especially if you take them while driving.Having one child makes you a parent; having two makes you a referee..."Marriage is a relationship in which one person is always right and the other is the Wife!"I believe we should all pay our tax with a smile. I tried but they Wanted cash...A child's greatest period of growth is the month after you've purchased New school uniforms.Don't marry the person you want to live with, marry the one you cannot live without... but whatever you do, you'll regret it later.You can't buy love, but you pay heavily for it...True friends stab you in the frontLaziness is nothing more than the habit of resting before you get tired.My wife and I always compromise. I admit I'm wrong and she agrees with me.Those who can't laugh at themselves leave the job to others.They call our language the mother tongue because the father seldom gets to speak.

[Humor] Born Programmer

Image
Received the pic in an email :)

Programmers to Testers

Top 20 replies by Programmers to Testers when their programs don't work:


20. "That's weird..."
19. "It's never done that before."
18. "It worked yesterday."
17. "How is that possible?"
16. "It must be a hardware problem."
15. "What did you type in wrong to get it to crash?"
14. "There is something funky in your data."
13. "I haven't touched that module in weeks!"
12. "You must have the wrong version."
11. "It's just some unlucky coincidence."
10. "I can't test everything!"
9. "THIS can't be the source of THAT."
8. "It works, but it hasn't been tested."
7. "Somebody must have changed my code."
6. "Did you check for a virus on your system?"
5. "Even though it doesn't work, how does it feel?
4. "You can't use that version on your system."
3. "Why do you want to do it that way?"
2. "Where we…

Serializing a Singleton

I have been forwarded some study material on Core Java related stuff from The Training Group in my Organization to prepare for a forthcoming training program. While going thro it, I came across an interesting point of which I was unaware earlier. It relates to Singleton classes. While dicussing Singleton classes, it says that To make a singleton class serializable provide a readResolve method. Otherwise, each deserialization of a serialized instance will result in the creation of a new instance.

public class CacheMgr {
public static final CacheMgr INSTANCE = new CacheMgr();

private CacheMgr() {
// ...
}

// ... // Remainder omitted

// readResolve method to preserve singleton property
private Object readResolve() throws ObjectStreamException {
/*
* Return the one true CacheMgr and let the garbage collector
* take care of the CacheMgr impersonator.
*/
return INSTANCE;
}

public static void main(String[] args) {
S…

Installing Bugzilla on Windows

Bugzilla is the Bugs/Issues Tracking Tool from The Mozilla Organization. Version 2.18 is the latest stable release. There are couple of resources which guide a User installing Bugzilla on a Unix/linux machine. However, this entry describes a way to install Bugzilla on a Windows machine (W2K to be precise). This document guides you step by step through the installation process.
First, get Administrative access to the machine on which you want to install Bugzilla. It should be a simple step. Usually, Users are given Administrative rights on Windows machine. However, if you dont have, contact your Administrator.

Get Bugzilla
Then download the Bugzilla from http://bugzilla.org/download.html. There are two ways of gettng it - through CVS or direct downloading the tar file. Remember there are no Zip files. However, any zip utility should be able to untar the Bugzilla. I download the tar file and untarred it using WinZip. I placed the untarred 'bugzilla' directory in my c: drive. So, th…

Bugzilla Installation Issue :: Help Required

I am trying to install on a Linux machine (Fedora). Facing a couple of issues(I, being a Windows guy, was to face those issues :(...



Anyway, I was able to install Apache successfully on this machine...tested.
MySQL 4.1 installation failed for some dependency issues. Got it resolved by pointing to MySQL DB on a W2K machine :)
All required Perl packages installed successfully...tested
Trying to access Bugzilla home page...failing repeatedly.


My Apache 2.0.5x is in /usr/local/apache2.
My Bugzilla 2.18.3 is in /var/www/html/bugzilla.

I have carried out the installation and configuration as per the Bugzilla manual (I hope I did it correct), but I cant access Bugzilla still. When I try to access bugzill home, it shows Internal Server Error in the browser and in the Apache log file, following message is recorded:

[Mon Sep 12 12:54:05 2005] [debug] prefork.c(956): AcceptMutex: sysvsem (default: sysvsem)
[Mon Sep 12 12:54:13 2005] [error] [client 127.0.0.1] Can't locate Bugzilla/Constants.pm in @IN…

Client does not support authentication protocol requested by server; consider upgrading MySQL client

Recently I installed MySQL 4.1 on my W2K machine and tried to connect to it. But could not. It threw the error Client does not support authentication protocol requested by server; consider upgrading MySQL client
Well, I was least expecting such an error to occur. Actually, this error has revisited me. Long back, when I installed MySQL 4.1 on my previous workstation, I had encountered this error. So, the solution was easy. Just change MySQL's password hashing algorithm for your password. So, how how u do that?

mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd') WHERE Host = 'some_host' AND User = 'some_user';
mysql> FLUSH PRIVILEGES;

Thats it :-)
Actually, MySQL offers a reason for the same
MySQL 4.1 and up uses an authentication protocol based on a password hashing algorithm that is incompatible with that used by older clients.

To solve this problem, you should use one of the following approaches: Upgrade all client programs to use a 4.1.1 or newe…

SELECT COUNT(*) Vs SELECT COUNT(COLUMN_NAME)

I have been assigned to prepare a checklist for my project. So, while compiling a checklist for SQLs, I suggested to use
SELECT COUNT(COLUMN_NAME) FROM TABLE [COLUMN_NAME is NOTNULL column] instead of SELECT COUNT(*) FROM TABLE My impression was that while for COUNT(*), DB has to do a complete scan of the table, for COUNT(COLUMN_NAME), it require to scan the COLUMN only. But then, I dont know why, I just decided to google it. And I came across this AskTom Entry where it says it is just a myth that COUNT(COLUMN_NAME) is faster than COUNT(*).

I dont know how different DBs behave in this matter?

What u guys think of it? What are ur experiences?

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:


http://geourl.org/ping/?p=http://rgarg.blogspot.com/


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?

What is XMLHTTP

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.

Source: Webopedia.com
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

Image
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.

Aryan

Image
Image025.jpg
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

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

I just adore the pic...

What is a Transaction?

To illustrate the concept, let us assume that you want to transfer money from a savings account into a current account. In this scenario, it is critical that both the accounts are changed from a successful transaction and neither is affected from an unsuccessful one. You just cannot afford to have your money vaporize if crediting your current account fails for any reason after the debit on your savings account! Therefore, the most important concept that one has to be aware of when dealing with enterprise applications is the concept of a transaction. To a user, a transaction is a single change event that either happens or doesn't happen. Although this may sound like a fairly straightforward and simple requirement, it is hard to make this work in a distributed system without deploying some form of transaction control - computers can fail and messages can be easily lost.
Transactions provide a way to bundle a set of operations into an atomic execution unit. This atomic "all-or-no…

Do you have BRAIN?

Who Said English is easy?

Fill in the following blank with Yes or No -

______ I don't have a BRAIN.

;)

GNU utilities for Win32

I have been using a W2K machine for the devlopment activities. However, sometime back I came acroos this set of tools that port some of the GNU Utilities to Win32 platform. Since then, I have been using them for various activities. Just check it out at http://unxutils.sourceforge.net/.

What is P3P?

P3P is the Platform for Privacy Preferences Project. It was developed by the W3C, (World Wide Web Consortium) as a protocol for providing automated privacy information to the end user, giving them more control over their own personal information at the web sites they visit.

P3P websites offer privacy information in a machine-readable format and P3P enabled browsers can read this and compare it to their own privacy standards. This protocol provides a standardization of privacy statements and presents it in a format that allows surfers to act on the information they are provided with.

The two main goals of implemented P3P policies are:

* To enable Web sites to present their data-collection practices in a standardized, computer-readable, easy-to-locate manner
* To enable Web users to understand what data will be collected by sites, how that data will be used, and what data and uses they may "opt-out" of or "opt-in" to.

How is it useful?

Web Applications usually uses cookie…

Common UNIX Commands

I just decied to look for a few commonly used UNIX command. A quick Google produces a lot more, but here are a list of more useful commands.

cd - Change Directory. (Just like in dos)mkdir - Make Directory.rmdir - Removes a Directory that is empty!ls - List directory. (Like dir in Windows)cat – Short for concatenate. It was used to concatenate two filestogether via cat file1 file2 >file3 Didn‘t know that did you. Theechoing out to standard out gave cat a whole new meaning to the users.more - Just like less. It pages output to the screen.mv - Move. For moving files and directories aroundrm Remove a file. Also rm rf for removing a folder and it‘scontent.grep - Used to search for text within a stream or files. (man regex)vi – A text based editor. You‘ll find that it‘s really a symboliclink to vim now a days.rlogin - Remote login. I hope your admins disabled this!passwd - Used to change your password.ps - Used to processes.nice - Run a program with lower priority so you don't hog CPU…

What are the different type of JDBC drivers?

There are four types of JDBC database driver:

The JDBC/ODBC bridge driver (Type 1)A piece of native C-code that translates a JDBC call to an ODBC call. Use this driver for development, not for industrial-strength application environments. Note that you have to have an ODBC database driver manager + an ODBC database driver installed on the server in addition to the JDBC/ODBC bridge. Though useful for learning JDBC and quick testing, bridging solutions are rarely appropriate for production environments.

Native API partly java driver (Type 2)A piece of native C-code that translates a java JDBC call to a native database call level API. Use this driver for development and deployment. Due to its native code, this driver can only be used by Java Applications with full computer access (i.e. not Applets). Type 2 drivers generally provide the best performance, but they require the installation of native libraries on clients that need to access the database. Applications using Type 2 drivers have …

What’s the difference between Primary Key and Unique Key?

Both Primary & Unique keys are Indexes.

Index - An index is a structure in a table that orders the data. It allows the database to access data quickly (In MySQL its implemented using B-tree algorithms).

Primary Key - This is an index that cannot be NULL, Primary Keys are used in building relationships between tables in a database. (an index is automatically created on the primary key). The difference between primary and ordinary keys is that there can be multiple keys, but only one primary key.

Unique Key - Unique and Index are same, the difference is, in Unique, duplicate are not allowed in any circumstances and that is enforced by database server. Primary key(s) qualify to be Unique on basis of their uniqueness.
In case, your table has 2 primary keys means that the 2 fields together form one unique key. Each field by itself may have repeating values, but both primary keys combined together must be unique.

EMail Validation using Regular Expressions

Using Regular Expressions in Java, we can validate where the given email-id string is of the valid format. Here is a sample.

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public static boolean validateEmailId(String astrEmailId) {
//Set the email pattern string
Pattern p = Pattern.compile(".+@.+\\.[a-z]+");
//Match the given string with the pattern
Matcher m = p.matcher(astrEmailId);
//check whether match is found
return m.matches();
}

RegExp can also be used in JavaScriptto validate EMail ID

function isEmail(str) {
// are regular expressions supported?
var supported = 0;
if (window.RegExp) {
var tempStr = "a";
var tempReg = new RegExp(tempStr);
if (tempReg.test(tempStr)) {
supported = 1;
}
}
if (!supported) {
return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}
var r1 = new RegExp("(@.*@)(\\.\\.)(@\\.)(^\\.)");
var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.

Shivam

Here are a few of the pics of newly born nephew Shivam Garg, the youngest member of the Garg Family :)

How old are the daughters?

Two MIT math graduates bump into each other at Fairway on the upper west side. They hadn't seen each other in over 20 years.
The first grad says to the second: "how have you been?"
Second: "Great! I got married and I have three daughters now"
First: "Really? how old are they?"
Second: "Well, the product of their ages is 72, and the sum of their ages is the same as the number on that building over there.."
First: "Right, ok.. oh wait.. hmmmm.., I still don't know"
second: "Oh sorry, the oldest one just started to play the piano"
First: "Wonderful! my oldest is the same age!" Problem: How old are the daughters?

Improve the quality of your JMeter scripts

Javaworld.com has published an article on improving the quality of a JMeter Test Script. Just in case you are unaware, JMeter is an Open Source Load-Testing Tool from Apache. It has an excellent UI and various parameters and elements can be drag-and-dropped. [http://jakarta.apache.org/jmeter/index.html] http://www.javaworld.com/javaworld/jw-07-2005/jw-0711-jmeter.html

Patterns: Inversion of Control

How do I make Tomcat startup faster?

These are a few of the options u can try to make your Tomcat Server startup faster:
Get a faster computer (:D) Make sure your code is not doing slow things. (Use a profiler like JProbe)Remove any jar files you don't need. When searching for classes every JAR file needs to be examined to find the needed class. Also during webapp startup, jar files are searched for TLD files. If the jar file is not there - there is nothing to search. Remove any webapps you don't need. (So remove the all the webapps installed with tomcat) Tweak memory parameters - Google is your friend. Trim the config files as much as possible. XML parsing is not cheap. The less there is to parse - the faster things will go.

How can I prevent my public JSP page from appearing within the search engine

There are two ways of achieving it: You can add a meta tag to the generated HTML content indicating that the page must not be indexed by the search engine's spider. <head>
<meta name="robots" content="noindex">
...
</head>put a file robots.txt at the root of your site, that is /robots.txt. In that file you can configure certain sections of your site to be skipped by crawling bots:# All robots will spider the domain
User-agent: *
Disallow: /path/of/files/or/documents/to/deny