Warning: the Dell inspiron 500m laptop reacts badly to having coffee poured over it. Must be some kind of design fault, aren't computer users coffee drinkers by definition?
Moral: don't let baby near coffee.
Warning: the Dell inspiron 500m laptop reacts badly to having coffee poured over it. Must be some kind of design fault, aren't computer users coffee drinkers by definition?
Moral: don't let baby near coffee.
I needed to set up an automated backup of a web site via ftp. I would have used rsync but that does not seem to support ftp. Looking through the ftp clients on ubuntu I found lftp which can be driven from the command line (and hence cron) and has a 'mirror' command that will replicate the files and directories on an ftp site.
It took some fiddling to find a command line that worked: the -c option to run a command string only seems to work if it is the only option. Anyway, here is a one-line lftp recipe (why is it so hard to put examples in man pages?):
lftp -c 'open ftpsite.com; user fred fredpassword; mirror --delete -p -X _*/*'
This does the following:
Once the web site is copied I use my normal stratagem for backing up.
Some more tips for the k750i camera-phone:
Filed under: gadgets k750i phones photography
I haven't looked into outliners much recently, since the microblog saga, but I have recently been playing with freemind which is more of a brainstorming tool than an outliner.
Bullet review:

I like to do these kind of diagrams for brainstorming so I may stick with this.
Filed under: outliners
I am about to start work on a couple of embedded firmware projects and I just happened to come across protothreads which use a clever C trick to implement pseudo-threading. Each thread uses only two bytes of memory (thats two: the threads do not need a stack) so it should be great on a 8051.
The trick relies on a quirk of C where it is possible for a switch statement to jump to case labels inside control statements like for loops. This code very cleverly uses the line number within the file (i.e. __LINE__) as the target for a later switch jump. Hence to 'resume' a thread the code just uses a switch statement to jump to the place within the function where it last yielded.
This offers the hope of efficient multitasking without loathsome state machines. Nice sequential coding: bliss. Compared to 'real' threads or interrupt service routines, these protothreads should not be too sensitive to obscure bugs as you know where task switching is likely to happen. This means you don't necessarily need mutexes and whatnot scatterred around. I've always been a believer in doing as much as possible in the foreground and as little as possible under interrupts and this technique will make it easier for me to do this.
The only shortcomings of the trick (apart from relying on am obscure quirk of the compiler) are that you cannot use switch statements as your thread is based on a switch statement, there are limitations regarding blocking in subroutines and local variables do not hold their values (which also applies to state machines).
I'm tempted to use the SDCC 8051 compiler as the old version of the Keil compiler we have at work does not run on Windows XP. It remains to be seen whether this trick will work with this compiler: I have no hardware to test it and I cannot get the sdcdb emulator to support serial IO so I could only tell if it worked by setting breakpoints and seeing if they are reached.
Thought: if the thread was within the first 255 lines of the source file, each thread would only need one byte to store it's state.
Had someone complaining that their Acer Travelmate Laptop was slow, played audio badly, sometimes missed keypresses etc. Listening to mp3's it was choppy, whenever the system went to the hard disk the sound would cut out. The system seemed generally quite slow, even for a system running XP in only 256M ram. I looked in the device manager and found that the Primary IDE channel was running in PIO mode, the slowest possible.
I spent a long time trying to reinstall the cd drivers and it took a long time to get rid of the yellow exclamation mark. This seems to have been caused by a driver called 'pxhelp20' which google told me was a trouble maker. I deleted all references to it from the registry and the exclamation mark went away.
The IDE channel was still in PIO mode so I went back to basic googling. This article solved the problem: just uninstall the Primary IDE channel, reboot windows and let it add the channel back. Voila, Ultra DMA mode 5. The article speculates that reading a scratched disk can cause windows to decide that the DMA channel is flaky and sets it to run in PIO mode: forever more, even after reboots.
Moral: use Linux.
Filed under: windows
Following from the tragic accident here is the progress on the fate of the Dell Inspiron 500m laptop that had coffee poured over it.
Conclusion: laptop is working fine, I'm using it to type this, but I can only run it from the mains. If I unplug it from the mains then I lose my BIOS settings when I plug it back in. From a portable computer I have gone to one that cannot even be moved without typing the date in.
It's sad.
The worst of it is that now I'm tempted to get a 12" Apple iBook.
Pros:
Cons:
I've discovered the 'Alias' keyword in apache2 config files. This keyword allows a pretty free hand at redirecting urls to directories and files on the hard disk. Consider this extract from the site config file (in /etc/apache2/sites-available/intranet):
<VirtualHost *>
ServerName intranet
ServerAdmin webmaster@localhost
DocumentRoot /var/www/intranet
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/intranet>
# pcw No directory listsings
# Options Indexes FollowSymLinks MultiViews
Options -Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Alias /bugzilla "/var/www/bugzilla/"
<Directory "/var/www/bugzilla/">
Options ExecCGI -Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from all
</Directory>
This is telling apache that the site is called 'intranet' and is normally served up from the directory /var/www/intranet. However, there is a subdirectory called 'bugzilla' that is addressed as http://intranet/bugzilla but is served up from /var/www/bugzilla rather than /var/www/intranet/bugzilla.
Why would I want to do this? Because /var/www/intranet is a drupal setup stored in subversion and I don't want to put the bugzilla stuff in subversion or fiddle around telling subversion to ignore it. It keeps each feature of the domain cleanly seperated.
Filed under: apache bugzilla subversion
I tried a suggestion Breezer left in a comment. It allows you to create shortcuts to your ssh logins. Here is the recipe:
$ which ssh-argv0
/usr/bin/ssh-argv0
$ ln -s /usr/bin/ssh-argv0 ~/mysshserver.org
$ ~/mysshserver.org
That's it. If your username is different on the ssh server then you should use:
$ ln -s /usr/bin/ssh-argv0 ~/username@mysshserver.org
Combined with bash tab completion this is a handy little tip.
Filed under: ssh
One of the computers at work died yesterday. This pc happened to have some report generation software on it that was written by folk long departed and not backed up anywhere. On investigation today both of it's hard disks were fried, putting them in three other pc's, one of them was not recognised by the Bioses, the other had a corrupt partition table.
I did some googling and discovered that knoppix comes with a tool called 'gpart' which attempts to guess the partition table (guess partition: gpart, geddit?). I downloaded Knoppix 4.0 and tried running gpart but no joy.
As the two drives were identical I then tried swapping the drive electronics and now the Bios could see the other disk but the partition table was also toast and gpart gave an IO error.
In conclusion, failed to restore anything. However, I still think knoppix is has great potential as a data recovery tool.