17 Sep

Automatically dumping your camera contents to the desktop

Bronwyn has recently become interested in computers – in particular, using them to communicate her interests to others with her hobbies.

In order to help her, I am trying to make things as simple as possible on this computer. That’s a damned pain, sometimes.

I am currently running Mandrake 10 on this machine, with a custom kernel. Mandrake comes with a patch to the kernel which makes automatic mounting for cameras a cinch, but the kernel I built does not.

So, I needed to build an automatic script for getting photos from the camera to the computer.

The following script is a modified version of Kevin Lyda’s mounting script. It loads your camera and dumps the contents to a directory on your KDE desktop. The directory is named with the date and time, so is unique, assuming you don’t mount and remount within seconds.

To use, create a /mnt/sda1 directory and place the following code in your /etc/hotplug/usb/usb-storage file:

#!/bin/sh

logger -t usb-storage "Starting"

case x"$ACTION" in

    xadd)
        # from usb/usbcam
        # new code, using GNU style parameters
        if [ -f /var/run/console.lock ]; then
            CONSOLEOWNER=`cat /var/run/console.lock`
        elif [ -f /var/lock/console.lock ]; then
            CONSOLEOWNER=`cat /var/lock/console.lock`
        else
            logger -t usb-storage No console owner found
            exit
        fi

        logger -t usb-storage "Mounting camera"
        mount -t vfat /dev/sda1 /mnt/sda1
        logger -t usb-storage "Camera mounted, copying files"

        # generate a unique-ish directory
        suffix=$(date +%Y.%m.%d-%H.%M)
        prefix="camera_"
        NEWDIR=$prefix$suffix

        mkdir /home/$CONSOLEOWNER/Desktop/$NEWDIR -p
        find /mnt/sda1/dcim -type f -print0 | xargs -0i mv '{}' /home/$CONSOLEOWNER/Desktop/$NEWDIR
        chown $CONSOLEOWNER.$CONSOLEOWNER /home/$CONSOLEOWNER/Desktop/$NEWDIR -R
        umount /mnt/sda1

        echo -e '07' > /dev/console; sleep 1
        echo -e '07' > /dev/console; sleep 1
        echo -e '07' > /dev/console

        test -d /var/run/usb || mkdir /var/run/usb
        ( echo '#!/bin/sh' ; echo rmmod usb-storage ) > $REMOVER
        chmod 755 $REMOVER
        ;;

esac

logger -t usb-storage "Finishing"
17 Sep

Babarino weblog

I setup a blog for my co-worker Vincent MacDonald yesterday.

I’m interested to see how he gets on with it. We’ve already spotted a few points where WP is not up-to-scratch (images, mostly), and I hope this will lead to some helpful contributions back to the project.

One particular thing I’m interested in, is how well Vinny does with customising his own part of the BlogoSphere. He is not a technical man at all, so it will be interesting to see. I’m sure he’s picked up a smattering of HTML and CSS through osmosis from myelf and the rest of the team, though – we’ll see.

As I commented to Donncha, back when I moved from B2++ to WordPress, the fact that WP allows you code-level access in your templates frankly scares me! It’s a hack waiting to happen! I’m sure Vincent will not have the technical know-how to abuse this, but some-one might!

I may try it myself.

17 Sep

Firefox is growing trendy for the common viewer

I’ve been following TheCounter.com’s stats for a few weeks, and a very interesting trend is emerging.

I think that TheCounter is probably a more accurate view of browser status than most of the more technically-minded stats sites.

For example, w3schools claims there is a 20% market share for Mozilla. This is certainly not in the non-technical community. Government offices, for example, are traditionally slow to change technologies, and home-users tend to use what has come with their computer and nothing else.

Anyway – I believe TheCounter.com offers a more valid status.

Here is a slice of the last 9 or so days. I’ve only taken the stats for Mozilla-based browsers and IE-based browsers. I ignore all others, and IE3- and NN4-.

08/09/0409/09/0410/09/0413/09/0414/09/0415/09/0416/09/0417/09/04
IE62809391430411721322543383729274439432983416484234380865145987875
IE550870615449934572559164344346757312709466174288367759053
IE494268101497not taken124086130751137542144749151380
Mozilla682356737769782658921321974166102795110808641135247
NN7317419341740361169474727439413461675483835505864
NN6not takennot taken262363104232951348563661238610
NN5280483326900364350416702520788565912611693658746
MICROSOFT96.3096.2496.1295.9795.9395.9095.8795.84
GECKO3.703.763.884.034.074.104.134.16

What I think is very interesting in this is that there is an uptake of at least .03% for Firefox every day. The first three recorded days are a bit spotty, but it is very obvious that there is a threat for Microsoft!

I’m just waiting for Firefox to hit 20% using this table before I try really plugging it to my company. As a web development company, we generally focus on the browsers with the highest market share, and that’s a real shame, as that’s IE6 at the moment, which has really spotty support for most standards, and introduces things which don’t work in other browsers.