Thursday, January 16, 2014

From here, former US defence secretary, Robert Gates, has warned:
"With the fairly substantial reductions in defence spending in Great Britain, what we're finding is that it won't have full spectrum capabilities and the ability to be a full partner as they have been in the past," he said.
My response:
Good! Why should the UK want to be a full partner to the every idiotic military action by the US? Every time they've followed the US into somewhere, the casualties have been higher on both sides than anyone estimated, the damage (physical, social and political) has been greater, and the monetary cost significantly in excess of what we can realistically afford.
Enough already! 

Friday, September 14, 2012

Apple iPhone 5?

Don't like the new connector?

Don't think the 5 is a big enough upgrade from the 4?

Not interested in a phone that's just 20% thinner than before?

Fine. Don't buy the silly thing.

I won't, but then I've only ever bought one Apple product, a Power Mac 5440, and that's long gone.

But for crying out loud, it ISN'T the end of the modern world.

Tuesday, July 03, 2012

Java on the Raspberry Pi

As anybody familiar with my blog will no doubt be aware, I'm a Java programmer by day, and one of my ideas for using my Pi is as a little web-server. I fancy having a go at writing one for myself, just to see what the fuss is all about ;-) So, Java is the logical choice for me! (At which point, any number of language nerdsgurus will insist that I'm made, and that I should do it in C/C++/C11/Fortran/Python/Bash ... you name it, anything but 'slow' Java)

Anyhow. Space is at a premium on the Pi, so I thought I'd try installing a JVM/JDK on my CIFS mounted file-system that actually lives on my desktop PC. Unfortunately, that filesystem is NTFS (underneath the hood), and that means it doesn't support Unix-style soft links... and the JDK that is available for the Pi (OpenJDK) is full of them, even once you get through the layers of soft links around the file system that lead to /usr/lib/jvm/java-6-openjdk. So, the network mount was out of the question. (Maybe someone, somewhere, has instructions for creating a virtual file system in a file on a network share, where the filesystem inside is something more native to Debian Squeeze Linux).

The not so bad news is that OpenJDK 6 is actually only (only?) 108Mbytes, which I can afford as long as I keep my project code on my projects drive. So, assuming your system is setup as I've described in previous posts:

  1. SSH/VNC to the Pi, logging in as 'pi'
  2. Run "ln -s /mnt/projects" to create a projects folder in my home directory that's actually safely squirrelled away on my PC. (auto-magically double backed-up every night via SyncToy and DropBox, by the way)
  3. Now install the OpenJDK version 6 (I'll save JDK 7 for another time as that's a whole different kettle of rather narsty fish!): run "sudo apt-get install openjdk-6-jdk"
  4. It takes a while, but when it's done, "which java" should give you:
    pi@raspberrypi:/$ which java
  5. and "java -version" should give:
    pi@raspberrypi:/$ java -version
    java version "1.6.0_18"
    OpenJDK Runtime Environment (IcedTea6 1.8.13) (6b18-1.8.13-0+squeeze1)
    OpenJDK Zero VM (build 14.0-b16, mixed mode)
  6. Now run "sudo apt-get clean", to remove the cached installation files from the various tools you've installed - I found this saved about 50Mbytes of space, so a not inconsiderable saving on such a small file system.
  7. Now to write some Java code.

Raspberry Pi Power Supply

One of the features of the Pi is that it comes with nothing in the box other than the bare board. No power supply, no SD card, no no network cable, no nothin'. 

On the basic setup Pi forums there are a number of topics on the subject of what power supply to use. Well, I don't know about anybody else, but I found that the power supply that comes with an Amazon Kindle was just perfect. 

The specification and FAQ on the Model B Pi board (the one that is available just now) is that it requires a stable 5V supply of at least 0.7Amps. The Kindle charger is rated at 5V at 0.85A ... match. Of course, it's all very well having a charger with the right rating, but I suspect more people will struggle with the power connector - it's a micro-USB. Yes, 'micro'. Not a mini-USB like a Sony eReader, or my old Motorola phone, and not the weird slim, wide, pseudo USB that my newer Samsung phone uses. It's a about the same width as the mini-USB, but half the thickness. In the FAQ, the Raspberry Foundation claim that GSMA expect micro-USB will be the universal charging solution for mobile devices, but it's not there yet.

So, as I say, the Kindle charger works just fine, which is just as well because despite quite a collection of mobile phone chargers and other electronic devices connectors, the Kindle charger is the only one that works for me. 

Monday, June 25, 2012

Give me spaaaaace!

More on my Raspberry Pi experiences. 

On the default disk image of Debian recommended by the Raspberry foundation, after install the VNC server as described in my previous post, you're left with just shy of 300MB of disk space to play with. This seems measly when you're used to talking about how many GB free space a disk has.

So what can we do about it without plugging in more *stuff* to my lovely little minimalist Pi? The answer is ... mount a network drive from the PC that acts as a file server and first-stage backup server to the rest of the house!

I have a Projects folder on my desktop, where I keep any coding ... well... projects, funnily enough. The drive that contains that folder has plenty of free space (about 200GB as it happens), so this is just fine for my purposes today.
  1. First up, create a share in Windows, with Guest as the Co-owner (yes, i know I could create a Pi user on my box, but I'm feeling lazy at this stage)
  2. Now ssh or VNC and open a terminal session on the Pi.
  3. run "sudo mkdir /mnt/projects"
  4. run "sudo vi /etc/fstab" and add the lines as follows

Contents of /etc/fstab:

# these lines exist already
proc            /proc           proc    defaults        0       0
/dev/mmcblk0p1  /boot           vfat    defaults        0       0
#/dev/mmcblk0p3  none            swap    sw              0       0

# this is the new line:
// /mnt/projects cifs user=guest%,uid=1000,gid=1000


  1. "" is the IP of my PC - I would use the named UNC path, but I have Virtual Box on the machine too, which is advertising another address under the same name, that just seems to confuse Samba on the Pi.
  2. "Projects" is the name of the Windows share
  3. "/mnt/projects" is the director where the files will appear on the Pi
  4. "cifs" is the type of file system
  5. "user=guest%" indicates we're logging into Windows as guest, with no password (I know, I know, even a private network needs security, I leave this as an exercise for you, the reader)
  6. "uid=1000,gid=1000" tells the file system to be owned by the "pi" user and group on the Pi, so we can read & write to the files without needing to "sudo" all the time.
Pretty simple really. And because I've used SyncToy on the windows folder to contribute any files from the Projects folder into my backup drive (external USB) and then into my DropBox account, anything I write from the Pi to /mnt/projects will automatically be double backed up every night. (Afterall, any data that you don't have at least two copies of is data that you don't care about, n'est pas?)


I just added a similar line to "/etc/fstab" for an 8GB pendrive in the unused USB socket, to give me more, local, faster space:
/dev/sda1 /media/usbstick vfat rw,uid=1000,gid=1000
(remembering to create the "/media/usbstick" directory first)

Sunday, June 24, 2012

Running a Raspberry Pi in headless mode.

I have just bought a Raspberry Pi micro computer (and boy do they mean 'micro'). It's a neat little computer about the size of your credit card. However it is a bare-bones system with no keyboard, mouse, monitor or hard disk. So what do you need any of them for? Well, with the Pi, you can get away without any of them, except you do need an SD card to act as the hard disk.

My problem is that I don't have an HDMI monitor or a TV in my study, where I want to use my Pi. And I can't be bothered to wait for an adaptor to connect the Pi's HDMI socket to one of my VGA or DVI flat panels. So what am I going to do? Well, a mate of mine solved this problem by using VNC - a remote desktopping solution that I already use at work. The other problem is that I'd really rather like to reduce the cabling required for my Pi even further and do without the heavy-weight LAN cable ... I know, I have an Edimax EW-7711UN wireless dongle that I bought ages ago when my ethernet-over-power failed. I wonder if that will work with the Pi?

So, my aim is a full-screen Pi with no monitor, accessible from my desktop PC, via my domestic wireless network - so I can put the Pi anywhere with power and a wireless signal in the house, and use it as the company intended: X windows on a proper screen.

Here's how I did it.

(Creating the hard disk image on an 2GB SD card I'll leave to other people, because they've done just fine.)
The image of Debian for use with the Pi comes with a an option to enable SSH (secure shell) access to the machine via the LAN cable, so that's where I started:

  1. mount the SD card with a PC card reader, rename "boot_enable_ssh.rc" to "boot.rc" to enable SSH
  2. plug the card into the Pi, connect the LAN cable and power, and boot without a monitor connection
  3. login with pi/raspberry
  4. use "passwd" to change to a real password
  5. run "sudo apt-get install tightvncserver" to install VNC server
  6. run "tightvncserver" and set a password
  7. run "tightvncserver -kill :1" to stop VNC server
  8. run "sudo bash" to elevate to root
  9. create "/etc/init.d/vnc" as below to start VNC server at boot time
  10. run "chmod +x vnc" to make the script runnable
  11. run "update-rc.d vnc defaults" to install the above script for boot
  12. run "aptitude install firmware-ralink wireless-tools" to get the wireless networking tools for Debian
  13. run "aptitude install wpasupplicant" to get the wireless security support for Debian
  14. attach the Edimax 7711 dongle to a usb socket
  15. run "lsusb" to ensure it's powered up and listed
  16. edit "/etc/network/interfaces" as below to boot the wireless card at boot
  17. run "ifup wlan0" to test your configuration - you should get an IP address - write it down.
  18. remove the LAN cable, and reboot 
  19. now you can login via the new IP address via VNC or SSH.
This is my Pi in action: notice the lack of spaghetti cabling so common in other configurations ;-)

I have got a powered USB hub on the way, so that will add another cable to the above, but actually, I'm not sure it'll be needed afterall.


# Provides: vncboot
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start VNC Server at boot time
# Description: Start VNC Server at boot time.

#! /bin/sh
# /etc/init.d/vnc

export USER HOME
case "$1" in
        echo "Starting VNC Server"
        #Insert your favoured settings for a VNC session
        su - $USER -c "/usr/bin/vncserver :1 -geometry 1280x1024 -depth 24 > /tmp/vncserver.log 2>&1 &" &
        echo "Stopping VNC Server"
        /usr/bin/vncserver -kill :1
        echo "Usage: /etc/init.d/vncboot {start|stop}"
        exit 1
exit 0


# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.

auto lo wlan0

iface lo inet loopback
iface eth0 inet dhcp
iface wlan0 inet dhcp
        wireless-essid YOUR SSID
        wpa-ssid YOUR SSID
        wpa-psk "YOUR NETWORK PASSWORD"
There are probably ways to encrypt the network password, but I've not figure them out yet.

Monday, May 14, 2012

A little time for Tesla

I know it's the Oatmeal, I know their comics are full of all sorts of nonsense and silly humour (okay, I like that kind of thing), but this comic by the Oatmeal is seriously good:

tl;dr? Nikola Tesla was the awesome genius that made the modern world possible, Edison just knew where the patent office was.

Friday, January 20, 2012

A proper apology!

It's a long time since anyone from Holywood actually impressed me, but today Mark Wahlberg gave an apology for some stupid remarks he made in a magazine interview ( and here's the important part: "I deeply apologise to the families of the victims that my answer came off as insensitive. It was certainly not my intention." (my emphasis).

Far too many people's apologies replace the work 'that' with 'if'. They just don't get it. If you've offended someone, you're the one at fault, you're the one apologising... so apologise. Don't imply that the offended party are at fault for being sensitive (as suggested by the use of 'if').

Re-read the above apology with 'if' and you'll see what I mean.