Showing posts from September, 2005

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.

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

20 END

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

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

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

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

Seasoned professional

class string
int size;
char *ptr;

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

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) {

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 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] Can't locate Bugzilla/ 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';

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…


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?