Beginning irc

After some discussion last night at PHP Hants about the fact that irc is a great facilitator of support / discussion, but largely ignored because there is rarely enough information for a new user to get going I decided it may be worth putting together a howto type post so here goes…

What is irc?

First of all, what on earth is it? I’m tempted to describe it as Twitter done right years before Twitter even existed, but I’m a geek and I’ve been using irc for years. It has a long heritage, but unlike the ubiquitous email it hasn’t made the transition into mainstream use. In terms of usage it has similarities to things like Twitter and Instant Messaging. Let’s take a quick look at this.

Twitter allows you to broadcast messages, they get published and anyone who is subscribed to your feed can read what you say. Everything is pretty instant, and if somebody is watching the screen at the right time they can respond straight away. Instant Messaging on the other hand, is more of a direct conversation with a single person, or sometimes a group of people, but it too is pretty instantaneous – assuming, of course, that there’s someone reading what you’ve said. Both of these techonologies are pretty familiar to many. If you go to the appropriate website you are given the opportunity to sign up and either use a web based client or download one.

It is much the same for irc in terms of usage, although conversations are grouped into channels which generally focus on a particular topic rather than being generally broadcast (Twitter) or more specifically directed (Instant Messaging). The downside is that in most cases you don’t get a web page with clear instructions of how to sign up, download a client and find where the best place is to join the conversation.

Getting started

There are two things you need to get going with irc, a client and somewhere to connect to. Let’s put that into a more familiar context.

The client is what you use to connect with; this can be an application – so as an example Outlook or Thunderbird would be a mail client, or IE, Firefox, Chrome or Safari are examples of clients for web pages – or it can be a web page that does the same thing – so if you go to and login you are using the web page as your Twitter client. Somewhere to connect to can be compared to a web address, or if you’ve got close enough to the configuration of your email to see the details, your mail server address.

Let’s start with the ‘somewhere to connect to‘ bit. Freenode is one of the most popular irc servers, so let’s take a look. First we’ll see what we can find out from their website,


There’s a lot of very daunting information there for somebody new to irc, so ignore most of it and follow the Webchat link on the left.


That’s all very well and good, but what do we put in there? I guess the screenshot above gives a clue, but if you actually visit the page the entry boxes will be blank. Well first off there’s the Nickname, this can be pretty much anything you like, no need to register it – stick to the basics of letters, numbers and some simple punctuation (if you want to), keep it short and so long as nobody else is already using it you should be fine; if it doesn’t work try another. Channels is the awkward one, how do you know what channels there are? If you’re lucky you’re looking into this because you’ve been told there’s a channel there and hopefully you’ve been given the channel name. For now let’s just use the PHP Hants channel, so that would be #phph in the Channels box. Now all you need to do is type in the captcha, ignore the tick boxes and click Connect and you are on the irc channel and ready to chat. Down the right you’ll see a list of who else is there, and in the main window there will be a bit of introductory information (e.g. topic for the channel) and depending on how busy it is anything from nothing to a fast scrolling screen of text.


If you’ve miss typed there’s a chance you’ll end up in a channel specially created for you because it didn’t exist; don’t worry, just quit and try again (I’ll explain that process shortly).

For now all you really need to worry about is typing in text an posting it, this is as simple as typing it into the entry box at the bottom of the page and pressing return. Be polite, be patient and you’ll be fine. There are plenty of commands that you can use to do things, but for now the only one you need to worry about is the one to leave, this is:


Type it in the entry box, press return and you’ve disconnected from the server. The next thing to look into is using a client program since this is far more flexible, but I’ll save that for another post.

Scratch in a network environment

I have been running a Code Club at my local Primary School for a while now, and thought it was about time I put details of a few tweaks I’ve made to the default Scratch install to make things easier. So here goes:

With the default install of Scratch (on Windows) projects are saved to the C: drive. For a network environment, with pupils work stored on a network drive so they always have access whichever machine they sit at, this isn’t exactly helpful. It also isn’t ideal that they can explore the C: drive in spite of profile restrictions (although it isn’t the end of the world as there is little they can do from Scratch).


After a bit of time with Google I found the answer, and since it didn’t immediately leap out at me when I was searching I thought I’d post it here (perhaps my Google Fu was weak that day). It is actually quite simple, especially for the average Code Club volunteer I should imagine; just edit the scratch.ini file. This is, as would be expected, located in:

C:\Program Files\Scratch\Scratch.ini

Initially it looks like this:


Pretty standard stuff, but unfortunately no comments to indicate what else you can do with it. As it happens you can add the following two lines (for example):


To get this:


They do exactly what is says on the tin. If you click on the Home button in a file dialogue box then you only get the drive(s) specified. You can also put a full path in if you want to put the home directory further down the directory structure.


The VisibleDrives option restricts what you can see if you click on the Computer button in a file dialogue box. If you want to allow more visible drives then separate them with a comma.


You can do the same with a Mac (for the home drive), just use the appropriate directory format (i.e. no drive letter and the opposite direction slash).

There is more that you can do, so take a look at the Scratch documentation here. For example if you use a * in the directory path it is replaced by the name of the currently logged on user.

Depending on your network environment it may be handy for your Code Club to put the extra resources on a shared network drive and open up an extra drive in the VisibleDrives. One I haven’t tried yet it is the proxy setting, which I hope will allow me to upload projects to the Scratch website. It goes something like:

ProxyServer=[server name or IP address]
ProxyPort=[port number]

Code Club Christmas Capers

There have been a couple of false starts in publishing the Christmas special Code Club project, Christmas Capers, this year. Since I am planning to use it at my last Code Club of this term, which is on Tuesday (much to the disappointment of my ‘Codeclubbers’), I have been keen to get it tested. Unfortunately, although the course notes were circulated, the resources haven’t quite made it yet, so I decided to see what I could do.

First thing I noted, having gone through my past emails, was that it was used last year as well (unfortunately I don’t seem to have a copy). The link on the original Code Club blog is no longer working sadly, however there was hope that resources would be out there somewhere. After a bit of searching I found a copy on the Scratch website that someone had uploaded, so I grabbed the resources from that and tested it so I was sure everything was there. I had a slight issue with the Jingle_Bells.mp3 file not being a supported format, but this seems to be down to something missing on my netbook as all is fine under both Windows 7 and Ubuntu Linux on my main machine.

So, for anyone looking for the resources, they are here in a full package including a copy of the project and course notes.

Keep up the good work fellow Code Club volunteers, and if anyone would like to pop along and encourage my Code Club recruits to blog a bit more, we are here. As a school governor with an interest in literacy as well as computing I’m trying to make it a bit cross curricular 😉

Oh, and if there is anyone in the Portsmouth and surrounding area interested in meeting up, I’m hoping to get my act together and do something in the new year. Do get in touch.

Windows is weird

I’ve just been putting together a post about some modifications to Scratch for use in a school environment that I have used for the Code Club that I run. Everything went well on the school computers, but when I tried to do the same on my own Windows 7 desktop to get some screenshots things went a little weird.

First off, it is a pain to edit the required .ini file. Right click and edit doesn’t give you administrator privileges so you can save it. My first thought was to run Explorer as administrator, but sadly the administrator privileges don’t extend to Notepad when you right click and choose edit. As it happened I was only going to use Notepad for the screenshots, so I took them and then used Notepad++ to do the actual edit. A quick right click and “Edit with Notepad++” followed by closing it and opening it again with administrator privileges did the trick.

This is where things went from slightly annoying (isn’t Windows always!) to weird. When I ran Scratch my edits to the .ini file didn’t appear to have taken, so I checked the file – fine, nothing wrong there. So this being Windows I decided to try a logout and login just to be sure there wasn’t anything odd going on there. No joy. So I decided to check from the command line with Edit. For some reason when I opened the .ini file up in Edit the extra two lines I had added were missing, so I checked in both Notepad and Notepad++ and they were there. I double checked I was working on the same file and there had been no name change for some strange reason and all was well – or at least I confirmed I was working on the same file.

At this point I realised that the command line I was using wasn’t running as administrator, so I opened up an administrator command prompt and headed to the same directory to edit the file there. The only issue was that when I open it in Edit the two lines I had added were there. This would seem to imply that there are two versions of the file, one for the administrator with the edits and one for my user account without. Although then again, not, since when I edited in the GUI with Notepad or Notepad++ either as administrator or my standard user I did have the edits! This didn’t make much sense. For a moment it looked as though I was going to have to mess around with changing the permissions to work out what was going on. Anyway, I switched to the non-administrative command prompt to edit the file, only to find that my changes have magically appeared (and I hadn’t messed with the permissions yet)! So I tried Scratch again and there we go, the changes are working.

So it would appear that, for some reason, the edits I made to the file (using administrative privileges) took a few minutes and a logout and back in again to be visible to my user account! …and some people wonder why I prefer using Linux!!

vTiger, Payslip and vtlib

If you look at the website there is a download of VtigerCRM_5.2.0_Vtlib.pdf which describes the basic (very basics) of getting going with developing for vtigerCRM. Unfortunately it isn’t 100% accurate when it comes to working with version 5.4. I’ve thrown together a few notes that I made when getting things working on my first install in case they are of use to others.

First off, in Step 1: Creating Module, there have been a couple of changes. With vtiger 5.4 the backend database structure for controlling the menu positioning has been changes. The vtiger_parenttabrel doesn’t seem to be used for the menu positioning and a column called ‘parent‘ in the vtiger_tab table is used. This means that the lines:

$menuInstance = Vtiger_Menu::getInstance('Tools');

don’t do what is required. I have left them in for legacy purposes, but in order to set the Payslip module to be listed under the Tools menu you need to add a line to define parent in the above $moduleInstance section:

$moduleInstance = new Vtiger_Module();
$moduleInstance->name = 'Payslip';
$moduleInstance->parent = 'Tools';

this adds the data in the necessary column of the database table without needing to manually edit it.

Webservices will need enabling under vtiger 5.4, so add the following to the end of the file (before the ?> on the last line):

/** Enable Webservices */
$moduleInstance = Vtiger_Module::getInstance('Payslip');

Alternatively this can be included more tidily at the top by simply adding the lines:

/** Enable Webservices */

immediately before the $module->initTables(); section.

There is also a mistake (at least as far as use for 5.4 goes, I’ve not tested other versions) in that the line:

$field2->name = 'PayslipType';

needs to be modified to:

$field2->name = 'paysliptype';

the capitalisation of the name stops the picklist working.

Once this has been done and you have run the script by placing it on the web server and accessing it with a web browser, you need to create and check the module directory. This is done by copying the 5.4.0 directory (or matching version number, I’m working with 5.4.0) from vtlib/ModuleDir/ to modules/ and renaming it (in this case to Payslip) – remember to change the permissions to match the other module directories.

After renaming the three ModuleFile* files in the root of this directory to match the module name (e.g. Payslip* in this case), there are a few differences in the edits to what is now the Payslip.php file:

  • The $groupTable variable doesn’t appear to have been used since 5.0.4 so will not be found in the 5.4.0 version of the file
  • The $sortby_fields variable doesn’t appear to actually have a value in versions laster than 5.0.4 so doesn’t need changing
  • There is no sign of $detailview_links in any of the versions from 5.0.4 onwards
  • The same goes for function ModuleClass, no sign in versions 5.0.4 onwards

The Payslip module should now be functional, but there are two further things to note:

  • The Picklist is not automatically populated, so you will have to manually assign the values to the roles (the values have been set, jut not assigned).
  • Some of the text pulled from the language file needs to be set, as an example for en_gb create a file called en_gb.lang.php which is basically a copy of en_us.lang.php.

Change the first 3 lines under the line:

$mod_strings = Array(


'ModuleName' => 'Payslip',
'SINGLE_Payslip' => 'Payslip',
'ModuleName ID' => 'Payslip ID',

i.e. replace the generice ‘Module Name‘ with ‘Payslip

at the end of the list, before the ); add the line:

'LBL_PAYSLIP_INFORMATION' => 'Payslip Information',

this one is for the Mass Edit function.

Obviously you can do the same edits directly on the en_us.lang.php file if that is the one you are using, or make matching edits to the equivalent edits to the language file you are using.

To put the tab into the main set of tabs across the top rather than in the More drop down it is necessary to set the ‘tabsequence‘ field in the vtiger_tab table. By default the first eleven are shown, and these correspond to values 1 through 12 (for some reason 2 is not used). The value -1 corresponds to leaving the item in the More drop down. The value of 2 seems a good choice and puts it to the right of the Home item. If you match one of the numbers already there it will show up to the left of the one one listed, with the exception of 12 where it ends up in the More menu. Whatever is chosed only 11 items are shown and and others end up in the More menu. To actually set the value when creating the module use the line:

$moduleInstance->tabsequence = 2;

or whatever value you choose, above the line:


as detailed above.

Alfresco Desktop Sync on Linux

First off a disclaimer: Not only is the Alfresco Desktop Sync a preview release at present, there isn’t an official Linux version available, so all this is very, very unsupported!!!

To get the Alfresco Desktop Sync working in Linux you basically need to get the java code extracted from one of the other clients and install the Linux version of jnotify-lib. That all sounds simple, and it isn’t as complex as you may expect.

First off the easiest way to get hold of the java code is to extract it from the Windows exe (I did take a look at the dmg, but had little success with the later versions of the Desktop Sync). You can download the Windows version of the file from here:

Open the .exe file up in Archive Manager and drag the following files into a suitable directory (I created /scripts/alfrescosync/ for the purpose):

Desktop Sync.jar
Desktop Sync.vmoptions

The next job is to get the JNotify code for Linux. This can be downloaded from here:

Extract the zip file into the same directory as the previous files, which should create a sub directory (in my case jnotify-lib-0.94). Now you are ready to run the .jar file with the appropriate parameters to tell it where JNotify is. I did this by creating a bash script called desktopsync:

#! /bin/bash
java -Djava.library.path=~/scripts/alfresco/jnotify-lib-0.94/64-bit\ Linux/ -jar Desktop\ Sync.jar

Remember to make it executable and you should now be able to run it with:


On my Ubuntu 12.10 installation this created an icon on the panel and downloaded the files from my Alfresco installation (once configured of course).


One thing to note is the URL, this should be along the lines of:

the /api at the end is the key, before that you just have the standard server URL, port and /alfresco

For reference I’ve worked with and DesktopSync_windows_0_9_6.exe.

A few things I’ve noted with this setup are:

  • On testing this I’ve found new files are successfully downloaded, although changes are not uploaded (I’m not sure if this is what the app is supposed to do or not, I haven’t explored further yet).
  • It also appears that, at least on my test system (a 64 bit install of Ubuntu 12.10) there is actually no need to install the JNotify library as this works out of the box). This means you can run the code with java -jar Desktop\ Sync.jar
  • I’ve noticed also that, if you set it to Auto login (you cannot set it to Run on computer start) it will always fail to connect first time and you have to do it manually.


Finding VirtualBox IP addresses

I have been running some server instances in VirtualBox recently and as I move between networks it is a pain to have to log in and get the IP address from ipconfig before being able to access the test web sites I have running in them. I also prefer to SSH to them rather than use the VirtualBox instance (it gives better character screen size, although I could reconfigure things; I also tab my terminals).

Anyway, in order to make things easier I put together two scripts, one that handles getting the IP address of the Virtualbox instance, and the other that handles connecting via SSH just by telling it the instance name. In order to do this you need to install the VirtualBox Guest Additions. This package is generally used in connection with video drivers for GUI based guests, but it also has some extensions that present extra information about the guest to the host machine.

Installing on Ubuntu is quite easy. My setup is using Ubuntu 12.10 on the desktop (host) and Ubuntu 12.04 LTS on the server (guest). To start with there is a package with the Guest Additions ISO in, so start by installing it with:

sudo aptitude install virtualbox-guest-additions-iso

Next you need to mount the ISO in the guest OS. To do this choose the Install Guest Additions option from the Devices menu. Since this is a CLI server OS it won’t automatically mount the ISO, so you will have to do this manually with:

sudo mount /dev/cdrom /media/cdrom


Once you have done this you need to install dkms and then run the install script with:

sudo aptitude install dkms
sudo /media/cdrom/

It will complain about not having found X to install the graphics drivers, but this isn’t a problem.

Once you have done this you can use the command:

VBoxManage guestproperty enumerate <vname>

where <vname> is the name of your guest. This will list out all of the available information that can now be accessed.

Using this command in a little bit of bash I created the two scripts. Firstly to get the IP address of a named guest:

#! /bin/bash
VIP=`VBoxManage guestproperty get $1 "/VirtualBox/GuestInfo/Net/0/V4/IP" | awk '{print $2}'`
echo $VIP

Secondly, to SSH to a named guest:

#! /bin/bash
VIP=`VBoxManage guestproperty get $1 "/VirtualBox/GuestInfo/Net/0/V4/IP" | awk '{print $2}'`
ssh-keygen -f "/home/paul/.ssh/known_hosts" -R $VIP
ssh $VIP

This second one is a little more involved because it first deletes the entry from the known_host file (remember to change the location). I’ve done this to stop an error coming up if the IP address has already been used, which isn’t uncommon with DHCP leases (you often get the same one, but not always!). You will have to confirm the authenticity of the host each time you connect, but since this is scripted and the IP has been automatically obtained locally to the machine this shouldn’t present a security risk.

Update: an improved version of the above script that simply ignores the information in the known_hosts file is (thanks popey I should have remembered that one!):

#! /bin/bash
VIP=`VBoxManage guestproperty get $1 "/VirtualBox/GuestInfo/Net/0/V4/IP" | awk '{print $2}'`
ssh -o StrictHostKeyChecking=no $VIP

Each of these scripts takes the guest name as a parameter, eg:

vbip Alfresco


vssh Alfresco

Lastly, to make these new scripts easy to use I created a .bash_aliases file in my home directory with the following:

## custom aliases
alias vssh='~/scripts/vssh'
alias vbip='~/scripts/vbip'

You will need to adjust for whever you have put these scripts, I tend to have a scripts directory in my home directory for this purpose.

Auto naming terminal tabs

I use Ubuntu on the whole for my desktops and servers and the more recent versions have Byobu which customises Screen rather nicely. I am still running 8.04 LTS on one server at the moment which is too old to have Byobu in the standard repositories (yes it is on my todo list to upgrade!), but one of the most useful features is quite easy to implement without Byobu.

When I have multiple terminal tabs open with various local and remote (via SSH) command lines running it is nice to know which is which. Byobu thoughtfully changes the title as you log in, but Screen does not (I have both configured to automatically launch when I log in). One line added to my .bash_profile does the trick though:

printf "\033]0;${USER}@$(hostname) - screen\007"
screen -xRR

The first printf line is the one that does the trick and tells me who I’ve logged in as and to what machine, as well as reminding me I’m in Screen. The second screen line simply starts Screen if it is not already running, or connects to the existing instance if it is.

Ubuntu ATI driver

A couple of weekends ago I was at OggCamp and the first talk on the Sunday was a good one by LornaJane Mitchell. For one it was a timely reminder of how my IT career started. It was also a virtual kick up the backside to get a bit more use out of my blog. I tend to think in completed articles, but I do have a precedent for short technical comment entries, so here goes more…

I’ve just upgraded my desktop machine, it isn’t exactly state of the art, the new one is only a 3.2GHz P4 and is my first 64 bit desktop, but that’s beside the point. The point is I dropped the old SATA HD into a new box and let Ubuntu get on with the job of sorting out the hardware changes (as an aside Windows 7 put on a bit of a show and then gave up in a huff!).

All went well apart from the graphics, which meant I couldn’t even get the login prompt (I knew I should have stuck with a console and typing startx!! To cut to the chase the solution that worked for me was to boot into the recovery mode kernel and do a one off boot into a safe graphics mode. From here I used the Additional Drivers tool to remove the proprietary ATI driver. This allowed me to reboot into the standard desktop and confirm thins were working, but sadly I couldn’t get above 1024×768 which restricted screen space somewhat.

As it happens I doubt the above was needed because my next action was to boot once more into recovery mode and restore the proprietary driver and reboot. This time when the screen went blank and complained about being ‘out of timing’ I used ALT-F2 to bring up a CLI login and from there used:

sudo aticonfig --initial

This created /etc/X11/xorg.conf, although unfortunately this didn’t make any difference, but it did prepare the ground for:

sudo aticonfig --resolution=0,1280x1024,1024x768

which persuaded the driver to use a more sensible set of parameters that worked with the monitor.

The most notable difference I’ve spotted in the logs so far is that when not working I had the line:

(II) fglrx(0): Setting screen physical size to 423 x 317

whereas when working it is:

(II) fglrx(0): Setting screen physical size to 338 x 270

I’ve not explored whether there is anything else, or what that actually means!

What have I done?

As the title says, what have I done? Just before Christmas (this post has been sitting in draft form for a while!) I spent some time with my eldest son, Aaron, showing him how I set up a website. This involved configuring Apache, installing WordPress, creating a MySQL database and then using WordPress to choose a theme and create some content. This was to some extent a bit of a whistle stop tour, but he has had fun deciding on what content to put in, and we have had some interesting discussions about being careful what you write and this issues around copyright on images, etc.

I’ve set him up as a contributor so that anything he posts has to be approved. The big question is, how much work have I let myself in for, and what interesting discussions are there in store? I guess also there’s the question of whether it will be frequently updated. Perhaps he will put me to shame, he’s already had more comments than I have, and so has my younger son, Scott!

For the record, the sites are: