Monday, September 26, 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.

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 readObject method.
  • Following readResolve method can be used in lieu of the defensive readObject method:


// The defensive readResolve idiom
private Object readResolve() throws ObjectStreamException {
return new Period(start, end);
}

  • The accessibility of the readResolve method is significant.
    • A readResolve method on a final class, such as a singleton, it should be private.
    • For a readResolve method on a non final class, consider its accessibility. If it is private, it will not apply to any subclasses. If it is package-private, it will apply only to subclasses in the same package. If it is protected or public, it will apply to all subclasses that do not override it.

Friday, September 23, 2005

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);
}

~string()
{
delete [] ptr;
}

friend ostream &operator <<(ostream &, const string &);
string &operator=(const char *);
};

ostream &operator<<(ostream &stream, const string &s)
{
return(stream << s.ptr);
}

string &string::operator=(const char *chrs)
{
if (this != &chrs)
{
delete [] ptr;
size = strlen(chrs);
ptr = new char[size + 1];
strcpy(ptr, chrs);
}
return(*this);
}

int main()
{
string str;

str = "Hello World";
cout << str << endl;

return(0);
}

Master Programmer
[
uuid(2573F8F4-CFEE-101A-9A9F-00AA00342820)
]
library LHello
{
// bring in the master library
importlib("actimp.tlb");
importlib("actexp.tlb");

// bring in my interfaces
#include "pshlo.idl"

[
uuid(2573F8F5-CFEE-101A-9A9F-00AA00342820)
]
cotype THello
{
interface IHello;
interface IPersistFile;
};
};

[
exe,
uuid(2573F890-CFEE-101A-9A9F-00AA00342820)
]
module CHelloLib
{

// some code related header files
importheader();
importheader();
importheader();
importheader("pshlo.h");
importheader("shlo.hxx");
importheader("mycls.hxx");

// needed typelibs
importlib("actimp.tlb");
importlib("actexp.tlb");
importlib("thlo.tlb");

[
uuid(2573F891-CFEE-101A-9A9F-00AA00342820),
aggregatable
]
coclass CHello
{
cotype THello;
};
};

#include "ipfix.hxx"

extern HANDLE hEvent;

class CHello : public CHelloBase
{
public:
IPFIX(CLSID_CHello);

CHello(IUnknown *pUnk);
~CHello();

HRESULT __stdcall PrintSz(LPWSTR pwszString);

private:
static int cObjRef;
};

#include
#include
#include
#include
#include "thlo.h"
#include "pshlo.h"
#include "shlo.hxx"
#include "mycls.hxx"

int CHello::cObjRef = 0;

CHello::CHello(IUnknown *pUnk) : CHelloBase(pUnk)
{
cObjRef++;
return;
}

HRESULT __stdcall CHello::PrintSz(LPWSTR pwszString)
{
printf("%ws\n", pwszString);
return(ResultFromScode(S_OK));
}

CHello::~CHello(void)
{

// when the object count goes to zero, stop the server
cObjRef--;
if( cObjRef == 0 )
PulseEvent(hEvent);

return;
}

#include
#include
#include "pshlo.h"
#include "shlo.hxx"
#include "mycls.hxx"

HANDLE hEvent;

int _cdecl main(
int argc,
char * argv[]
) {
ULONG ulRef;
DWORD dwRegistration;
CHelloCF *pCF = new CHelloCF();

hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);

// Initialize the OLE libraries
CoInitializeEx(NULL, COINIT_MULTITHREADED);

CoRegisterClassObject(CLSID_CHello, pCF, CLSCTX_LOCAL_SERVER,
REGCLS_MULTIPLEUSE, &dwRegistration);

// wait on an event to stop
WaitForSingleObject(hEvent, INFINITE);

// revoke and release the class object
CoRevokeClassObject(dwRegistration);
ulRef = pCF->Release();

// Tell OLE we are going away.
CoUninitialize();

return(0);
}

extern CLSID CLSID_CHello;
extern UUID LIBID_CHelloLib;

CLSID CLSID_CHello = { /* 2573F891-CFEE-101A-9A9F-00AA00342820 */
0x2573F891,
0xCFEE,
0x101A,
{ 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 }
};

UUID LIBID_CHelloLib = { /* 2573F890-CFEE-101A-9A9F-00AA00342820 */
0x2573F890,
0xCFEE,
0x101A,
{ 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 }
};

#include
#include
#include
#include
#include
#include "pshlo.h"
#include "shlo.hxx"
#include "clsid.h"

int _cdecl main(
int argc,
char * argv[]
) {
HRESULT hRslt;
IHello *pHello;
ULONG ulCnt;
IMoniker * pmk;
WCHAR wcsT[_MAX_PATH];
WCHAR wcsPath[2 * _MAX_PATH];

// get object path
wcsPath[0] = '\0';
wcsT[0] = '\0';
if( argc > 1) {
mbstowcs(wcsPath, argv[1], strlen(argv[1]) + 1);
wcsupr(wcsPath);
}
else {
fprintf(stderr, "Object path must be specified\n");
return(1);
}

// get print string
if(argc > 2)
mbstowcs(wcsT, argv[2], strlen(argv[2]) + 1);
else
wcscpy(wcsT, L"Hello World");

printf("Linking to object %ws\n", wcsPath);
printf("Text String %ws\n", wcsT);

// Initialize the OLE libraries
hRslt = CoInitializeEx(NULL, COINIT_MULTITHREADED);

if(SUCCEEDED(hRslt)) {

hRslt = CreateFileMoniker(wcsPath, &pmk);
if(SUCCEEDED(hRslt))
hRslt = BindMoniker(pmk, 0, IID_IHello, (void **)&pHello);

if(SUCCEEDED(hRslt)) {

// print a string out
pHello->PrintSz(wcsT);

Sleep(2000);
ulCnt = pHello->Release();
}
else
printf("Failure to connect, status: %lx", hRslt);

// Tell OLE we are going away.
CoUninitialize();
}

return(0);
}

Apprentice Hacker
#!/usr/local/bin/perl
$msg="Hello, world.\n";
if ($#ARGV >= 0) {
while(defined($arg=shift(@ARGV))) {
$outfilename = $arg;
open(FILE, ">" . $outfilename) || die "Can't write $arg: $!\n";
print (FILE $msg);
close(FILE) || die "Can't close $arg: $!\n";
}
} else {
print ($msg);
}
1;

Experienced Hacker
#include
#define S "Hello, World\n"
main(){exit(printf(S) == strlen(S) ? 0 : 1);}

Seasoned Hacker
% cc -o a.out ~/src/misc/hw/hw.c
% a.out

Guru Hacker
% cat
Hello, world.
^D

New Manager
10 PRINT "HELLO WORLD"
20 END

Middle Manager
mail -s "Hello, world." bob@b12
Bob, could you please write me a program that prints "Hello, world."?
I need it by tomorrow.
^D

Senior Manager
% zmail jim
I need a "Hello, world." program by this afternoon.

Chief Executive
% letter
letter: Command not found.
% mail
To: ^X ^F ^C
% help mail
help: Command not found.
% damn!
!: Event unrecognized
% logout

:-)

[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 front
  • Laziness 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 :)

Thursday, September 22, 2005

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 were you when the program blew up?"
And the Number One Reply by Programmers when their programs don't
work:


Guess.............





Guess..............







Guess.............





"It works on my machine" :)

Wednesday, September 21, 2005

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) {
System.out.println(CacheMgr.INSTANCE);
}
}


I have not thought of this aspect so far. So, obviously, I have no experience of it either. However, I am interesting to know if you know an idea on the subject. Any first hand experience?

Thursday, September 15, 2005

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, the location of bugzilla is c:\bugzilla.

Get MySQL

Get MySQL database. The latest production release is 4.1. Though MySQL 5.x is available under Beta, it is not recommended. Along with MySQL db, download one of the graphical client to connect to the DB Server. There are a couple of options - MySQL Control Center, My SQL Query Browser, Toad for MySQL...

Install and Configure MySQL

Complete the default installation (i.e. Typical) of MySQL db.
Create a User for database. Lets name the created user as bugs_user with password 'bugs_pass'.
Create a database. Lets name the created DB as 'bugsdb'.
Grant all access rights to user 'bugs_user' for the database 'bugsdb'.

If you are running MySQL 4.1, you may encounter the Client does not support authentication protocol requested by server error message. To fix this, once the user has been created you will have to reset the password using OLD_PASSWORD. See this blog entry.

Get Perl

Next, you need to install Perl on the machine. I installed Perl 5.8.7 from ActiveState.
http://activestate.com/Products/Download/Download.plex?id=ActivePerl

Install Perl

Install Perl in the root directory. Mine is in C:\perl Plz take care that Perl is not installed in Program Files directory as it may break Perl's Template-Toolkit installer.
Create a temp directory in root.(c:\temp). If you find issues in running Bugzilla, plz see that temp is located in c:\ only.

Install Perl Modules

Next we need to install perl modules. Following are the mandatory modules:
AppConfig
CGI
Data::Dumper
Date::Format
DBI
DBD::mysql
File::Spec
File::Temp
Template
Text::Wrap

Following are the optional modules:
GD
Chart::Base
XML::Parser
GD::Graph
GD::Text::Align
PatchReader

Though these are not required, you may install them for creating report charts.

There are two ways to install these modules.
Go to http://landfill.bugzilla.org/ppm/ and download bugzilla-bundle.zip file and unzip it to a location of your choice. Open a console window, go to the unzipped directory, and run the following commands sequencely
X:\>ppm install AppConfig.ppd
X:\>ppm install TimeDate.ppd
X:\>ppm install DBI.ppd
X:\>ppm install DBD-mysql.ppd
X:\>ppm install Template-Toolkit.ppd
X:\>ppm install GD.ppd
X:\>ppm install Chart.ppd
X:\>ppm install GDGraph.ppd
X:\>ppm install PatchReader.ppd

If you need to uninstall any module, use the following command:
X:\>ppm uninstall PatchReader.ppd

Get a Web Server

We need a Web Server to serve bugzilla pages. I have used Apache Web Server. You may use any other web server also, including IIS. Following steps are required to install Apache and configure it to serve bugzilla.

Get Apache

Download the latest stable Apache release from http://httpd.apache.org/download.cgi.

Install Apache

Installing Apache on Windows is again a smooth process. Just follow the instructions. Make sure you Install it for All Users. Apache always install itself in Apache2 directory. On my machine, apache is in C:\Program Files\Apache Group\Apache2.

Configure Apache

Edit C:\Program Files\Apache Group\Apache2\conf\httpd.conf with your favourite text editor.


# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
#Listen 12.34.56.78:80
Listen 80

Change the DocumentRoot setting to point to C:\Bugzilla. Note there are two locations in httpd.conf that need to be updated.

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "C:/Bugzilla"

#
# This should be changed to whatever you set DocumentRoot to.
#



Enable CGI support in Apache by uncommenting the AddHandler cgi-script .cgi line.

#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
AddHandler cgi-script .cgi

And allow .cgi scripts in the Bugzilla directory by adding the ExecCGI option. We also need to allow Bugzilla's .htaccess file to restrict access to sensitive documents by allowing it to override the defaults. This involves changing AllowOverride None to AllowOverride All.

Apache also needs to know to use Perl to execute .cgi files, via the ScriptInterpreterSource directive.

#
# This should be changed to whatever you set DocumentRoot to.
#


#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs-2.0/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks ExecCGI

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all

#
# Tell Apache to use Perl to execute .cgi
#
ScriptInterpreterSource Registry-Strict




You also should add index.cgi to the DirectoryIndex list.

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
# The index.html.var file (a type-map) is used to deliver content-
# negotiated documents. The MultiViews Option can be used for the
# same purpose, but it is much slower.
#
DirectoryIndex index.html index.html.var index.cgi


In order for ScriptInterpreterSource Registry-Strict to work, you also need to add an entry to the Registry so Apache will use Perl to execute .cgi files.

Create a key HKEY_CLASSES_ROOT\.cgi\Shell\ExecCGI\Command with the default value of the full path of perl.exe with a -T parameter. For example C:\Perl\bin\perl.exe -T

Restart Apache

C:\>net stop apache2
The Apache2 service is stopping..
The Apache2 service was stopped successfully.

C:\>net start apache2
The Apache2 service is starting.
The Apache2 service was started successfully.

Bugzilla Configuration

Once all of the above steps are executed successfully, we are ready to test bugzilla installation.
On the console window, go to c:\bugzilla, and execute the following command:
c:\bugzilla>perl checksetup.pl

If it runs without error message,then congratulations,otherwise figure out what mighty be wrong according to the error message,it is very obvious.

Now, we are ready to configure bugzilla. Open a file called localconfig in your favourite text editor.

First, update the DB info:

$db_host = "localhost"; # where is the database?
$db_port = 3306; # which port to use
$db_name = "bugsdb"; # name of the MySQL database
$db_user = "bugs_user"; # user to attach to the MySQL database
$db_pass = 'bugs_pass';

Customize following variables according to your needs to initialize mysql database

@severities,the secerity level of the bug to be specified when creating a new bug
@priorities,the priority you can assign to the bug
@opsys,possible operating system of your test environment
@platforms,hardware platform your system is running on.


You can also update these variables any time after the installation and configuration is over.

Then run the above command again,this will initialize database and create required tables.
c:\bugzilla>perl checksetup.pl

If things go wrong during database setup,try to make sure you have edited database connect parameters correctly .
If you encounter the following error Client does not support authentication protocol ,that is because the newer version mysql use some new password encryption algorithm.

Now all we require is to configure email service. For this install a SendMail-compliant Mail Transfer Agent.

After all these steps,the bugzilla can be installed and accessed now if nothing goes wrong.

Open your favourite browser and go to http://localhost/ If all steps have had been successful, you would be at bugzilla home.

Monday, September 12, 2005

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 @INC (@INC contains: . /usr/lib/perl5/5.8.3/i386-linux-thread-multi
/usr/lib/perl5/5.8.3 /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.2/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.1/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.3
/usr/lib/perl5/site_perl/5.8.2
/usr/lib/perl5/site_perl/5.8.1
/usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.2/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.3
/usr/lib/perl5/vendor_perl/5.8.2
/usr/lib/perl5/vendor_perl/5.8.1
/usr/lib/perl5/vendor_perl/5.8.0
/usr/lib/perl5/vendor_perl) at /var/www/html/bugzilla/index.cgi line 40.
[Mon Sep 12 12:54:13 2005] [error] [client 127.0.0.1] BEGIN failed--compilation aborted at /var/www/html/bugzilla/index.cgi line 40.
[Mon Sep 12 12:54:13 2005] [error] [client 127.0.0.1] Premature end of script headers: index.cgi


I am unable to see its root cause of failure. The error seems to indicate that it cant locate Bugzilla/Constants.pm file (This file location is /var/www/html/bugzilla/Bugzilla/Constants.pm and it is present).

Can u plz help me?

Wednesday, September 7, 2005

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 newer client library.
  • When connecting to the server with a pre-4.1 client program, use an account that still has a pre-4.1-style password.
  • Reset the password to pre-4.1 style for each user that needs to use a pre-4.1 client program.
  • Tell the server to use the older password hashing algorithm
    Start mysqld with the --old-passwords option
    Assign an old-format password to each account that has had its password updated to the 4.1 format.

Friday, September 2, 2005

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?

Total Pageviews

Reading List - 05-Mar-23

Talking to #AI may be the most important job skill of this century ( JohnGoodPasture ) Role of account management over the years. It’s a ro...