Moo.com

I've had a few things printed recently by 'Moo'. They do high quality printing on decent card. We've used them for christening invites and some special presents for Caitlin (stickers). The brilliant thing is they'll print many different pictures on a set. So each of the christening invites had an different, but equally cute, picture of Ewan on it and each of Caitlin's stickers has a different picture on it. At some point soon I'm going to get some business cards done and each one can have a different picture on the back … nice. 

Check them out and if you fancy something I use this referral URL and you'll get 10% off your order and I get a nice little kickback too!

http://www.moo.com/share/8222hf

Installing IBM iSeries Access on Ubuntu 11.04

Having recently moved back to a Linux machine (running Ubuntu 11.04) I had a few things to get working to be back to working at full speed without needing to use my Windows XP virtual machine all the time. One of these things was access to the iSeries that we use as our development and live machines. 

IBM now provide an RPM based installer for IBM iSeries Access that can be downloaded from the IBM website (login required). Once downloaded the first step is to convert this into a package that is usable on Debian based systems. The utility 'Alien' will convert an RPM into a DEB allowing it to be installed on Ubuntu. All of this needs doing as root (I think anyway … I couldn't get it to work as a standard user) so:

sudo -i

Install some required packages using apt-get or your chosen package manager:

apt-get install alien dpkg-dev debhelper build-essential libmotif-dev libmotif4 libmotif-dbg xfonts-scalable xfonts-utils xfonts-100dpi xfonts-75dpi msttcorefonts -y

Use alien to convert and install the rpm:

alien -i iSeriesAccess-7.1.0-1.0.i386.rpm -cv

Then add some links in order for the relevant packages to be where iSeries Access expects them:

ln -sf /usr/lib/libXm.so.4 /usr/lib/libXm.so.3
ln -sf /opt/ibm/iSeriesAccess/lib/libcwbcore.so /usr/lib/libcwbcore.so
ln -sf /opt/ibm/iSeriesAccess/lib/libcwbrc.so /usr/lib/libcwbrc.so

As I am using en_GB as my locale and it doesn't seem to fully exist when installed I needed to generate it:

locale-gen en_GB

Once this was done I was able to start either 

/opt/ibm/iSeriesAccess/bin/ibm5250 -LANGID en_GB
/opt/ibm/iSeriesAccess/bin/setup5250 -LANGID en_GB

Because I had to install as root I need to run as root in order to pick up the config files created by setup5250. I created a script lauch5250:

#!/bin/bash
/opt/ibm/iSeriesAccess/bin/setup5250 -LANGID en_GB

and then added a launcher that runs launch5250 with sudo automagically:

gksudo /opt/ibm/iSeriesAccess/bin/launch5250

This may not be the neatest or the most 'correct' way to get this working, but it works and I couldn't find a better solution online. 

JavaScript parseInt() Octal Mode

I spent a good deal of time today trying to work out why some maths in a script I was writing was not working. The script in question doesn't do anything particularly complicated but kept going screwy whenever an 8 or 9 was entered into one of the numeric fields. Turns out this was due to a peculiarity in the use of the parseInt function of JavaScript. It should be noted that it isn't a bug … parseInt performs this way by design.

I was using parseInt to convert form fields read using JQuery into proper integers. As the integers in question are part of a time I was zero padding them … so 8 is 08 and 9 is 09. Turns out that the parseInt function used in it's simplest form:

parseInt("08");

thinks the leading zero indicates that the number is an octal integer and as octal using the digits 1 – 7. 8 & 9 are invalid so are interpreted as 0. This issue can be easily avoided by using parseInt fully and specifying a radix:

parseInt("08", 10); // Force use of base 10

You could of course use Number instead. I am not sure of the performance advantages / disadvantages of each method but historically have always used parseInt or parseFloat rather than Number. This feature isn't present in parseFloat. In this case I converted the script to use Number and all seems well now.

Update: So I have completely refactored the script for a couple of reasons but it is now uploaded here. I have gone back to using parseInt and parseFloat but to ensure no issues am specifying a radix for each use of parseInt.

HDR Photography

I got interested in HDR a few months ago after seeing some of the awesome photos at http://www.stuckincustoms.com/ and thinking that I would like to be able to do that! 

The idea is that a photo can never truly capture everything that you would see with your eyes. This is because your eyes continually adjust to differing light levels allowing you to see the whole picture. Unfortunately with a camera you choose your settings and take the shot meaning that you often loose detail either in the dark parts of the picture, the light parts of the picture or both. HDR is a method of taking and combining multiple pictures at different exposures to try and capture the image like your eyes would. 

Continue reading

Asterisk 1.6 on Ubuntu Server

There is a lot of information on t’interweb about installing Asterisk on lot’s of different distributions of linux. However quite often they contradict each other and it seemed that most were written about version 1.4 rather than the lastest stable release 1.6. I don’t think I could have got to where I am now without this guide so fair play to Riccardo. So this is what I have done, it may not be the best way to do it, it may not be right, but it seems to work … or at least install anyway!

Continue reading

Running Ubuntu in MS Virtual PC 2007

To get the install to run

  1. At install screen press ‘F6′ for install options then ‘ESC’ allowing a direct edit of the install options
  2. Replace ‘quiet splash’ or ‘quiet’ with ‘vga=0×314 noreplace-paravirt’
  3. Hit ‘enter’ to start the install

To get Ubuntu to run first time

  1. At GRUB  screen press ‘ESC’ to configure
  2. Select the relevant kernel line, press ‘e’ to edit
  3. Select the relevant kernel line again, press ‘e’ to edit again
  4. Replace ‘quiet splash’ with ‘vga=0×314 noreplace-paravirt’
  5. Hit ‘enter’ to save
  6. Hit ‘b’ to boot

To get Ubuntu to run everytime

  1. sudo -i
  2. Edit ‘/boot/grub/menu.lst’ with your favourite editor
  3. Find the relevant kernel line
  4. Replace ‘quiet splash’ with ‘vga=0×314 noreplace-paravirt’
  5. Save the file