marcus welz

Happy Turkey Day

Posted on November 24, 2005

Thanksgiving SnowHappy Thanksgiving, y'all. And, today we had our first snow. Well sort of. It did snow a few weeks ago, but it didn't stick. First time we're making a larger Turkey dinner for the family as well. Usually it was us who were invited to someone elses house. Now it's our turn. Scary.

Been dabbling with Need for Speed: Most Wanted today. It's fun, but I doubt it'll last for more than a few days.

Print This Post Print This Post

Another drive bites the dust

Posted on November 17, 2005

Not sure what to think anymore. A number of years ago Western Digital drives kept dying on me. I was rather sick of it, so I bought Maxtor instead and they lasted. I bought 20GB, 40GB, 160GB, 200GB and finally 300GB drives all from Maxtor and now the 200GB drives are crapping out on me. Not just one either, but two at the same time, followed by a third one a couple days later. 2 out of those had been out of warranty since over a year ago, but the DiamondMax Plus 10 drive was manufactured in March 2005. I RMA'd it and got the replacement in today — a refurb. Bleh. On the other hand, as I read the their agreement, this drive is now going to have a warranty of 90 days or whatever was left on the old drive, whichever is longer. And the DiamondMax Plus 10 had a three-year warranty. What ever that's all about, since usually Maxtor drives just have a one year warranty.

Either way the warranty doesn't help me recover any data, but I run all my drives in RAID-1, anyhow. As long as I didn't just jinx it. I can already see myself having drives fail on me in pairs. Greaaat.

Print This Post Print This Post

Indexes in PostgreSQL

Posted on November 2, 2005

One thing that most people don't have to worry about in MySQL is case-sensitivity. Unless you're trying to authenticate a user against a database password and don't use MD5 (like you should!), in which case the password is not case sensitive by default.

In PostgreSQL everything is case sensitive. That means that if you have a user "Bob", and you run a query such as:

SELECT * FROM users WHERE username = 'bob';

you won't get a match. You can get around that by using:

SELECT * FROM users WHERE LOWER(username) = LOWER('bob');

However, now PostgreSQL will ignore your regular index on the username column. Fortunately, PostgreSQL will let you create indexes based on expressions. In this case you'd want to use the following index:

CREATE UNIQUE INDEX myindex ON users((LOWER(username));

Cheers!

Print This Post Print This Post