ADAM'S WEB PRESENCE

25 June 2006

Computers Contain Human Blood

Filed under: General — adam @ 11:58 am

SlashedAargh! blood on the motherboard again. I never seem to be able to assemble a PC without cutting myself on those damn cheap Taiwnaese pressed metal chassis with expansion slots like knives.

Many of the machines I have built over the years seem to end up with a few drops of my blood in them. Maybe I could look at it like some kind of initiation.

Or maybe it could be like that old 80s movie where a CP/M machine becomes sentient after having champagne spilt in it. What would blood do to a Pentium ? Turn it into some kind of digital were-vampire ? I’ll just have to make sure I switch them off on the night of a full moon.


19 June 2006

A new site (again)

Filed under: General — adam @ 11:11 pm

Welcome to my new site. Can you notice the difference ?

I am now using WordPress instead of static pages. With a little jiggery-pokery, I have managed to make a custom theme which looks just like my old site.

So I now have all the niceties of a proper blog such as search, comments and RSS. Neat.


18 June 2006

Friendly URLs in WordPress (Apache2 / Linux)

Filed under: Nerd Notes — adam @ 9:20 am

Here is a simple step-by-step to enable more readable and more search engine friendly URLs on your WordPress blog. This guide is for people running WordPress 2 and Apache2 on Linux. I wrote this because I could not find a simple step-by-step for Apache2 on Wordpress’s website.

BEFORE: http://www.doctort.org/adam/?p=5

AFTER: http://www.doctort.org/adam/nerd-notes/friendly-urls.html

Step 1: Enable mod_rewrite

$ cd /etc/apache2/mods-enabled

$ sudo  ln -s ../mods-available/rewrite.load ./

$ sudo /etc/init.d/apache2 reload

Step 2: Create an .htaccess file

$ cd /var/www/html/

$ sudo touch .htaccess

$ sudo chown www-data.www-data .htaccess

Step 3: Enable nice permalinks in Wordpress

  1. Go to Options / Permalinks on the Wordpress admin menu
  2. Click the custom radio button
  3. Type the following into the custom field: /%category%/%postname%.html
  4. Click Update Permalink Structure.

15 June 2006

Auto Shutdown on Overheat

Filed under: Nerd Notes — adam @ 12:18 pm

I wrote a program to automatically halt a Linux box when it gets too hot.

Why did I do this ? Well, I have a box running in a very badly ventilated cupboard and it tends to get pretty hot in there. Now when PCs get hot, stuff fails. After losing a hard drive to heat death, I wanted to make sure it did not happen again.

This is a cheap machine made of junk and spare parts which lives under my TV so I can watch the odd DivX movie and muck about with DVB cards, it’s hardly mission-critical so I’m not going to spend loads of cash on a sophisticated cooling system. This script is very simple and works fine.

Prerequisites

To make it work, you need to have lm_sensors installed and configured properly. This can be a little tricky and the procedure varies for different models of motherboard so unfortunately I cannot give you step-by-step instructions. You’ll have to read the manual I’m afraid.

Once that is working, you need to set the limits on each sensor. This is done by editing the file /etc/sensors.conf

Note that whenever you make any changes to /etc/sensors.conf, you must run the following command to commit your changes to the driver:

# sensors -s

If all is good, you should be able to type sensors and see a result like this:

$ sensors

as99127f-i2c-0-2d
Adapter: SMBus Via Pro adapter at e800
VCore:     +1.68 V  (min =  +1.52 V, max =  +1.84 V)
+3.3V:     +3.57 V  (min =  +3.14 V, max =  +3.79 V)
+5V:       +5.08 V  (min =  +4.73 V, max =  +5.24 V)
+12V:     +12.10 V  (min = +10.82 V, max = +13.19 V)
-12V:     -12.46 V  (min = -13.22 V, max = -10.74 V)
-5V:       -6.14 V  (min =  -6.14 V, max =  -3.76 V)
fan1:        0 RPM  (min =    0 RPM, div = 2)
fan2:     5037 RPM  (min = 2836 RPM, div = 2)
fan3:        0 RPM  (min =    0 RPM, div = 2)
M/B Temp:    +32°C  (high =   +60°C, hyst =   +58°C)
CPU Temp:  +46.0°C  (high =   +80°C, hyst =   +78°C)          (beep)
temp3:     -31.5°C  (high =  +122°C, hyst =  +121°C)
vid:      +1.600 V  (VRM Version 9.0)
alarms:
beep_enable:
Sound alarm enabled

My little C program will look at any sensor item whose name has “Temp” in it (”CPU Temp” and “M/B Temp” in the above example). If these items exceed the preset limits, the machine will be cleanly shut down.

You can download the source code here:

sensor-alert.c (2 kB)

Installation Instructions

To install it, first compile it:

# gcc -o sensor-alert sensor-alert.c

Then install it in /usr/sbin

# mv sensor-alert /usr/sbin

And finally, add the following line to /etc/crontab

* * * * * root /usr/sbin/sensor-alert

And there you have it. Hopefully this machine won’t be cooking itself now.

And yes, I know you could probably do it in three lines of PERL but I’m a C programmer so shoot me.


13 June 2006

NetGear WG311v2 Wireless LAN and Ubuntu Dapper

Filed under: Nerd Notes — adam @ 12:17 pm

Here is how I got my NetGear wireless network adapter to work under Ubuntu Linux. I had this working before under Hoary using ndiswrapper but since upgrading to Dapper Drake, the ndiswrapper doesn’t seem to work any more.

I found that Dapper tries to load its own WLAN driver called acx. This does not work with this particular card using the default settings.

I suppose I should mention at this point that the WG311v2 is completely different from the earlier version of the same card. It even uses a different chipset! Anyway, back to the story…

I kept getting some error message in dmesg about the firmware not being the right version so after doing a little research, I discovered that there is an alternative firmware included in the Linux driver. To activate it, you need to add the following line to the file /etc/modprobe.d/options

options acx firmware_ver=1.2.0.30

Then restart the driver:

$ sudo rmmod acx

$ sudo modprobe acx firmware_ver=1.2.0.30

Then it is just a simple matter of configuring the interface by adding these lines to /etc/network/interfaces (you will need to alter the IP numbers for your own network setup of course):

# Wireless networking
auto wlan0
iface wlan0 inet static
    address 192.168.0.11
    netmask 255.255.255.0
    gateway 192.168.0.1
    wireless-mode managed
#   wireless-keymode open
#   wireless-key
    wireless-essid 
    dns-nameservers 192.168.0.1

(I’m not sure you really need the wireless-* lines, they were left over from my previous ndiswrapper setup)

Finally, start the interface:

$ sudo ifup wlan0

And that is it! It took me a while to figure out but the card works fine now.

Update

I have just replaced this card with a TP-Link one. It is sooo much faster and more reliable than the NetGear card. Read my article on setting up the TP-Link.


12 June 2006

tomsrtbt on a CD

Filed under: Nerd Notes — adam @ 11:21 pm

I quite often use Tom’s root-boot floppy to salvage scragged PCs but today I needed to fix a box which has no floppy drive.

Fortunately tomsrtbt comes in a CD-bootable version but you have to jump through a few hoops to make it work. So to save you the time and effort of figuring it all out for yourself, I have created an ISO image which can be burnt directly to a CD. You can download it right here:

tomsrtbt-2.0.103.iso (3.2 MB)


That’s all. You don’t need to keep reading but just in case you want to know, here’s how I created this ISO using Linux.

1. Go to Tom’s download page at http://www.toms.net/rb/download.html and choose your favourite mirror site.

2. Download the “ElTorito” image (note that the version number might not be the same as this example):

wget http://www.tux.org/pub/distributions/tinylinux/tomsrtbt/tomsrtbt-2.0.103.ElTorito.288.img.bz2

3. Decompress it:

bzip2 -d tomsrtbt-2.0.103.ElTorito.288.img.bz2

4. Create a file structure for your cd:

mkdir mycd

mkdir mycd/boot

mv tomsrtbt-2.0.103.ElTorito.288.img mycd/boot/

5. Finally, create the ISO image:

cd mycd

mkisofs -b boot/tomsrtbt-2.0.103.ElTorito.288.img -c boot/boot.catalog -o tomsrtbt-2.0.103.iso .

Now you can use your favourite CD-burning tool to create a CD from the ISO image. Personally I like K3b for CD burning under Linux.


3 June 2006

KidType v1.1 released

Filed under: Products — adam @ 12:20 pm

I have finished an update to my KidType application. As an engineer I could not cope with the executable being 408k for such a simple application, it really was irritating me so I tossed the MFC and re-wrote it in Win32 and now it is only 36k. Much better but I still won’t be entering the 4k coding competition any time soon!

I also changed it to save in TXT format instead of RTF because that is simpler and also more compatible with a wider range of other software.

CLICK HERE to check it out.


Powered by WordPress