PostgreSQL: Determine if a column exists or not.

Here’s a quick query you can run to determine whether or not a particular column in a table exists or not:

SELECT attname FROM pg_attribute WHERE attrelid = (SELECT oid FROM pg_class WHERE relname = 'YOURTABLENAME') AND attname = 'YOURCOLUMNNAME';

Of course, replace YOURTABLENAME and YOURCOLUMNNAME with the proper values. If a row is returned, a column with that name exists, otherwise it does not.

Squirrelmail and Very Large (Big-Ass) Inboxes

We have an account with a VERY large inbox (over 80,000 emails), and when logging into Squirrelmail the main pane would not load. Instead we’d be prompted by the browser to download a right_main.php file. Accounts with smaller inboxes would load fine, so I figured it had something to do with system resources. This is an easy fix. Open up your php.ini file, and increase the memory_limit value to something larger than the default 8M. Restart Apache and try opening your big-ass inbox again. If it still doesn’t work, increase memory_limit again. Repeat until your inbox will load, but be careful if you have little RAM. I was able to load my 80,000+ inbox by setting memory_limit = 32M.

Sean Avery to the Rangers…

See you later Sean. We hardly knew you!

btw, I’m working on an Oliver Stone-style film based on the assassination attempt on Avery’s life that was perpetrated by snipers under the the direction of Jaromir Jagr. It was a horrible day that will live in infamy!

Below you will see the result of this horrific crime:
Sean Every and Elisha Cuthbert after the assassination attempt

iPod on Windows XP: Delayed Write Failed (UPDATED)

A couple years ago I posted about a fix for Delayed Write Failed errors when updating an iPod on Windows XP. While my suggestions in that post worked for the most part, I still encountered the error from time to time.

So it’s been a couple years and now I NEVER receive this error. Here’s how I did it:

I used to connect my iPod to my PC via USB. However, I had purchased an external Firewire hard drive which required me to install a Firewire card into a PCI slot on my machine. The card had 4 Firewire inputs, and I needed to free up a USB port for some other peripherals that needed them. So I decided to move my iPod connection from USB to my new Firewire card (Koutech KW-582V2 – cost me $21 bucks from NewEgg).

Ever since then I have NEVER received the Delayed Write error. So if you’re having trouble updating your iPod and get the “Delayed Write Failed” error, perhaps it is your USB connection. Try moving your iPod to another USB port, and if you’re using a USB hub, try bypassing the hub and plug your iPod directly into your computer’s USB port. If THAT doesn’t work, try a Firewire port. If you don’t have one, grab yourself a Firewire card. You can get them cheap and are much more valuable than all the hair you’re pulling out trying to fix your Delayed Write Failed.

FCKeditor Error: this.DOMDocument has no properties

In my prior post I ran into a problem with FCKeditor on Apache having to do with serving JavaScript files as the proper MIME type. I ran into a similar problem with XML files when trying to load multiple instances of FCK textareas:
Error: this.DOMDocument has no properties
Source File: http://www.mysite.com/FCKeditor/editor/js/fckeditorcode_gecko.js
Line: 43

This is easily fixed in the same way, by telling Apache how to properly serve XML files. Put this in your httpd.conf or an .htaccess file:
AddType text/xml .xml

FCKeditor in Firefox – Illegal Character JavaScript error

For some reason, FCKeditor would not load in Firefox 2.0 even though it loaded in IE just fine. Turns out Apache was serving up the javascript files as the wrong FileType, so Firefox would choke on some jibberish characters:
Error: illegal character
Source File: http://www.myserver.com/FCKeditor/editor/js/fckeditorcode_gecko.js
Line: 1, Column: 1
Source Code: /*

The fix is easy enough, simply add an .htaccess file to your dir containing the following:
AddType application/x-javascript .js
Now FCKeditor should work fine in Firefox.