Friday, September 25, 2009

Postgres 8.3 error: Internal account lookup failure: no mapping between account names and security IDs was done

If you have encountered this error on a Windows XP machine, check to see if your machine name in the 'Account Domain' field (in the PostgreSQL installer GUI) is correct.

If you are pulling up the GUI through the command line which has the servicedomain='' parameter, your 'Account Domain' field will be populated to have the value ''. This is obviously erroneous because of the single quotes in the value.

It would be best to not specify the servicedomain='' parameter. Postgres usually pre-fills the 'Account Domain' field correctly.

Monday, September 21, 2009

SimpleDateFormat parse error - from 12pm to 12am

I got this error today, only to find out that it was a very simple code error that I overlooked.

The Error
-----------

I have a SimpleDataFormat parser to parse a date string variable to a required format:

String time = "Mon Sep 21 2009 12:56:02";
SimpleDateFormat df= new SimpleDateFormat("EEE MMM dd yyyy hh:mm:ss");
Date parsedDate = sdf.parse(time);

However, a System.out.println("parsedDate = " + df.format(parsedDate )); gives me a 00:56:02 time and not a 12:56:02 time.


Reason for error
-----------------
In the SimpleDateFormat class, formatting hour in HH will return a hour between 00-23 (i.e. in 24 hour format) while formatting hour in hh will return a hour between 01-12 (12 hour format). - a good source code to look at is http://www.java-examples.com/formatting-hour-using-simpledateformat

Ensure that your SimpleDateFormat class has been instantiated this way:
SimpleDateFormat df= new SimpleDateFormat("EEE MMM dd yyyy HH:mm:ss");

Wednesday, September 16, 2009

What is a Windows lmhosts file?

lmhosts stands for LAN Manager Hosts file. This host file is called 'hosts' and can be found in C:\WINDOWS\system32\drivers\etc

To put it very simply, it is a file that maps IP addresses to the NetBIOS host names of the machines. For example, write this into your hosts file:
192.168.1.1 Test-Machine

Hence, when 'Test-Machine' is pinged, it will be translated to '192.168.1.1' without needing to check your DNS.