Category Archives: Tips

Hash as filename

md5, sha1, etc are very handy tools for programmers to generate hashed strings from random or fixed keys. A lot of the times, we simply store these hashes directly into databases, setting the field data type as string, or use the hashes as filenames (handy for creating cache files) or as part of URL. While [...]

Posted in Tips | Tagged , , , , , , , | 2 Comments

Connect to IBM DB2 on PHP via ODBC

This was done and tested on a Linux (CentOS) system running PHP 4. Configure PHP with ODBC support. You should check that it is successfully installed by doing phpinfo(). Obtain the latest DB2 ODBC driver from IBM. You can download it from here. Lookout for Driver for ODBC and CLI. Untar it at a dir. [...]

Also posted in Database | Tagged , , , , , , , , | 2 Comments

How to convert a char column to numeric in PostgreSQL

Attempting to ALTER a char column directly to numeric will result in the following error: ERROR: column “COL_NAME” cannot be cast to type numeric Here’s how to get around that: Verify data is ok & delete away the old column. I blog about PostgreSQL and other Linux sys admin stuffs on my Twitter (@uzyn) and [...]

Posted in Tips | Tagged , , | Leave a comment