Peter's Blog

Redefining the Impossible

Posts made during October 2005


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.


Filed under: dell inspiron

2 Comments

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:

  • -c runs the command string
  • open ftpsite.com opens connection to the site
  • user fred fredpassword logs in as fred with fredpassword
  • mirror replicates the ftp site locally: default is root of ftp site to current directory
  • --delete means delete files on backup if they have been deleted on the source
  • -p means do not copy file permissions. The ftp server I was backing up uses Windows IIS and with -p the directories were created without the execute bit set !?!
  • -X _*/* again, because it is windows the ftp server has a load of garbage directories with names that start in a _ containing stuff only known in the darkest bowels of msdn. This excludes them from the backup.

Once the web site is copied I use my normal stratagem for backing up.


Filed under: backup linux ubuntu

1 Comment

Some more tips for the k750i camera-phone:

  • In camera mode, press * to turn the light on and off
  • Also in camera mode, press 7 to turn 'night mode' on and off. 'Night mode' seems to slow the 'shutter speed', giving less digital noise on indoor pictures at the expense of blurriness if the subject is moving.
  • The joystick can be used to switch from still camera to video mode
  • When filming videos, don't be tempted to hold the phone in 'portrait' mode unless you have some way of rotating the videos when you play them (maybe put your tv on it's side).

8 Comments

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:

  • written in java i.e. it's slow to boot up and uses lots of memory (i.e. lots of swapping on 256M system). Performance is ok once it is running.
  • Nice graphical display:
    images/PetersBrain.jpg
    the idea is that it is highly graphical to appeal more to the right side of the brain which likes pretty colours.
  • The graphic above was generated using a simple 'export as jpeg' option.
  • The map acts like a huge canvas. You scroll around the canvas by clicking and dragging (as per google maps) so you don't need to use the scrollbars (very nice).
  • Very responsive on the keyboard: return key to start new sibling which is more intuitive than it sounds. This would make it quite quick for note taking and it could be driven without the mouse.
  • Nodes can link to web pages, disk files etc. Annotate your hard disk!
  • It saves maps in XML format. There is potential here for generating maps in software for display.
  • maps can be put on the internet read only either as html (without the graphics, just trees) or graphically if the browser supports java.

I like to do these kind of diagrams for brainstorming so I may stick with this.


Filed under: outliners

Add a comment

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.


Filed under: c firmware sdcc

Add a comment

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

Add a comment

Following from the tragic accident here is the progress on the fate of the Dell Inspiron 500m laptop that had coffee poured over it.

  • After a day or so of drying out I took off the covers of the memory and wifi card bays and drained out the coffee which was still liquid.
  • After a day or two more the laptop would actually boot but the keyboard did not work.
  • Laptop would run on battery but not mains.
  • Left more time for it to dry out.
  • Laptop would only run from mains if battery was pulled out: can run on battery alone but cannot charge it, even with the laptop switched off. The mains adapter appears to crowbar: the green led on it fads out.
  • Took laptop to bits. Keyboard very dead. Stripped it down to it's membrane, no visible coffee staining but it would not work. Probing keyboard plug with a bit of wire I established that the circuitry was ok, the membrane was dead.
  • Cleaned up what I could with nail varnish remover, which appears to be acetone and water so should be safe.
  • Ordered new keyboard from ebay for £45. The keyboard is type 1M723.
  • Fitted new keyboard, works fine.
  • Examined circuit board to try to resolve battery problems. Heavy corrosion around the battery circuitry. Cleaned it up to no avail.

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:

  • Smaller
  • the battery lasts longer
  • a totally new non-ms environment to explore.

Cons:

  • Apple are going intel next year. How long would PowerPC support linger?
  • Linux will support intel indefinitely. In 5 years time when this box is only useful as a server, will I be able to get any contemporary software to run on it?
  • Apple appear to be corporate bully boys like microsoft. They aren't the cool guys.
  • I have to find Macintosh versions of my favourite apps: Firefox, Vim, Putty.
  • Paying for it
  • I have to grow a pony tail.

Filed under: dell ibook inspiron wifi

4 Comments

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

Add a comment

I tried a suggestion Breezer left in a comment. It allows you to create shortcuts to your ssh logins. Here is the recipe:

  • Create a symbolic link from your hostname to something called ssh-argv0. You might have to find it first:
    $ which ssh-argv0
    /usr/bin/ssh-argv0
    $ ln -s /usr/bin/ssh-argv0 ~/mysshserver.org
    
  • Now you can connect to mysshserver.org by typing:
    $ ~/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

Add a comment

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.


Filed under: knoppix linux

Add a comment