Sunday, June 29, 2008

Intrepid Ibex Alpha 1

The first alpha of the next Ubuntu version code named "Intrepid Ibex" is now available! Get the release info and the release notes here. Gonna download it and try it out on a VM. Let's see what's new in a few :)

I'm downloading Kubuntu 8.10a1 as I type this. However, seems like only the "alternate" version is available. Strange...

Thursday, June 26, 2008

Argument list too long

Ever tried to do a "rm *" on a directory and got the error "argument list too long"? Use xargs and chain the commands!
ls | xargs rm

Found this gem here: http://www.shell-fu.org/lister.php?id=251

UPDATE...FROM

The UPDATE...FROM SQL statement saved me tonnes of time during a previous system migration. Using the FROM clause in an UPDATE statement allows you to pull data from one or more tables into the data you're updating.

Say you have a table with 10,000 user records (let's call it tbl_migration_1) which you'd like to find the last login time which is stored in the master user table (let's call it tbl_user). Here's what you do:
update tbl_migration_1
set tbl_migration_1.last_login = tbl_user.last_login
from tbl_user
where tbl_migration_1.user_id = tbl_user.user_id
You can freely add more conditions to match the records.

EDIT: Oops, forgot to mention that I'm using Sybase for this. Not sure if it's ANSI standard. Well, do let me know :)

Wednesday, June 25, 2008

Using CURL to obtain superflous HTTP verbs

Instead of using netcat or telnet to check a website for allowing superflous HTTP verbs, CURL makes it simpler:
curl -X OPTIONS -I <host name>
An example of the output is shown below:
# curl -X OPTIONS -I http://thestar.com.my
HTTP/1.1 200 OK
Allow: OPTIONS, TRACE, GET, HEAD
Content-Length: 0
Server: Microsoft-IIS/6.0
Public: OPTIONS, TRACE, GET, HEAD, POST
X-Powered-By: ASP.NET
Date: Wed, 25 Jun 2008 03:51:52 GMT
Another one line wonder :)