The internal forum (powered by phpBB) I was using was suddenly giving me the error "cannot insert new word". Tailing /var/log/messages and MySQL error logs came up empty. After Googling a bit, it seems that the MySQL tables are corrupt. Running the SQL command below fixes the problem beautifully:

Monday, July 21, 2008

I've been trying to get Intrepid Ibex Alpha 1 & 2 to boot on VirtualBox in a Linux host; but due to what it seems like a kernel bug, I've been unable to do so. If you're interested to see the development/status of this bug, click here.

I've always get burnt for setting the wrong HTTP headers for cache control. So here's the braindump of what these headers are and what to set them to. The RFC for HTTP header field definitions is located here.

Note that it's always better to set the headers both in the HTTP-EQUIV META tags as well as to set it via the headers as some browsers have problems parsing the HTTP-EQUIV META tags.

There are 3 HTTP headers that control browser caching behaviour. These are:

expires

pragma

cache-control

The "expires" directive gives the date/time after which the response is considered stale. The value 0 (zero) indicates that the response is has immediately expired while any negative value indicates that the response had already expired.

The "pragma" directive indicates that the page should not be cached. The common use is to set the directive to "pragma: no-cache".

The "cache-control" directive is a HTTP 1.1 specification. It instructs the browser how the page should be cached. Commonly set values for this directives are:

I've always get burnt for setting the wrong HTTP headers for cache control. So here's the braindump of what these headers are and what to set them to. The RFC for HTTP header field definitions is located here.

Note that it's always better to set the headers both in the HTTP-EQUIV META tags as well as to set it via the headers as some browsers have problems parsing the HTTP-EQUIV META tags.

There are 3 HTTP headers that control browser caching behaviour. These are:

expires

pragma

cache-control

The "expires" directive gives the date/time after which the response is considered stale. The value 0 (zero) indicates that the response is has immediately expired while any negative value indicates that the response had already expired.

The "pragma" directive indicates that the page should not be cached. The common use is to set the directive to "pragma: no-cache".

The "cache-control" directive is a HTTP 1.1 specification. It instructs the browser how the page should be cached. Commonly set values for this directives are:

Thursday, July 3, 2008

Was asked to help on backing up files in one server and then transfer the image to another server. Sounds simple, but unfortunately the server which files are to be backed up has very limited disk space and prevents me from creating a tar-ball.

Instead of creating a tar-ball in the server, I used netcat (or known as nc) to stream the files over to another server while running the tar command.

On the server, run the following command:

tar czvf - /opt | nc -l -p 8888 -c

This creates a tar gzipped file of the /opt directory and put the output to stdout. Pipe the output of tar to netcat (nc) which is listening (-l) to port (-p) 8888. The additional -c option is to close the connection after EOF on stdin. If this option isn't there, netcat will continue waiting for data from stdin. This is not what I want as I need the backup action to end properly in order to place it in a script.

On the receiving end, just run the following command:

nc 10.112.133.12 8888 > opt.tar.gz

This instructs netcat (nc) to connect to the IP on port 8888 and write the output to opt.tar.gz.

Well, there you have it. A quick and dirty way to transfer a backup image if you're short of space to create the backup file.

Managed to get my hands on a repackaged Huawei E220 USB GSM modem provided by Maxis via their Maxis Broadband package. Since there's no instructions to install and use it on Linux (Windows and OSX instructions are provided), I decided to see how Linux will behave when it's plugged into the USB port.

Kubuntu Hardy detected it just fine! This should work on any other distros as well. Next comes running wvdialconf as root. It should detect the modem at /dev/ttyUSB0. wvdialconf goes through some init sequences and finally writes the config file at /etc/wvdial.conf. Mine looks like this after a little bit of tweaking:

The phone number was found by a little Googling. You can use any Username and Password value as the dialler doesn't check for it. Once you're done, perform a test by executing wvdial. It should work. Here's what I see from my /var/log/messages:

Also make sure you're assigned an IP and use ifconfig to see that ppp0 interface is up and running.

Next, I tried to configure a dialup connection via KNetworkManager, but it's broken. A bug report has been filed here. Instead, I fired up KPPP and configured a new modem with the second init string (Init2) with the same values written in /etc/wvdial.conf. The phone number should follow that in the config file as well. Once you're done, fill in the username and password values and away you go :)

Tuesday, July 1, 2008

Been experimenting with kismet over the weekend and was finally well enough to configure it after some quick digging.InstallationDo a simple apt-get to install kismet:

apt-get install kismet

That's all there to it. Please note that the version in Ubuntu's repo is 2007-10-R1-2build1. It's a lot older than the one currenly available for download i.e. Kismet-2008-05-R1.

ConfigurationIf you run kismet right after installation, you'll get the following error:

Launching kismet_server: //usr/bin/kismet_serverSuid priv-dropping disabled. This may not be secure.No specific sources given to be enabled, all will be enabled.Non-RFMon VAPs will be destroyed on multi-vap interfaces (ie, madwifi-ng)Enabling channel hopping.Enabling channel splitting.NOTICE: Disabling channel hopping, no enabled sources are able to change channel.Source 0 (changeme): Opening none source interface none...FATAL: Please configure at least one packet source. Kismet will not function if no packet sources are defined in kismet.conf or on the command line. Please read the README for more information about configuring Kismet.Kismet exiting.Done.

You'll need to configure kismet and attach it to a wifi device. To do this, open up /etc/kismet/kismet.conf and look for the following line:

source=none,none,changeme

I'm using iwl3945 on eth1 on my machine. So here's my config:

source=iwl3945,eth1,eth1

You can look at the list of supported device in kismet's README file here:

/usr/share/doc/kismet/README

It's gzipped, by default (README.gz). So do a quick gunzip before reading. Look for the list under the section named "Capture Sources".

Running ItNow run kismet again and you'll get a nice screen like below:

Unfortunately, after exiting kismet, I was greeted with a segmentation fault error and my eth1 link unusable (note the UNSPEC word):

Sunday, June 29, 2008

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...

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: