Category Archives: Content

Posts which aren’t treated as blog posts. These posts contain info and opinions in a more structured manner than my usual ramblings

Arctic Circle Trail

The Arctic Circle Trail (ACT) is a 100 mile wilderness backpacking route between Kangerlussuaq and Sisimiut on the west coast of Greenland. I walked the route in August 2014 with my wife Anna and friend Steve.

Here you can find a series of diary entries I made along the way, as well as photographs from the trip.

Munros

A list of the Munros I have walked up.

Name Height Date Climbed Accompanied By
Fort William
Ben Nevis 1344m 2/08/2008 Kat Sharp
Stob Bàn (Mamores) 999m 14/02/2010 Anna Maciejkowicz
Mullach nan Coirean 939m 14/02/2010 Anna Maciejkowicz
Kintail
A’ Ghlas-beinn 918m 3/10/2008 Alasdair Paton, Geoff Judd, Ivan and David Haigh
Ciste Dubh 979m 4/10/2008 Alasdair Paton, Geoff Judd, Ivan, Sandra and David Haigh

Climbing in Southampton

At first glance, the Southampton/Winchester area can seem somewhat devoid of places to climb; there’s no rock in Hampshire! But drive a little ways, and there are a range of indoor walls and options for outdoor climbing too.

Indoors

  • St Mary’s
  • Southampton Uni
  • Fort Purbrook
  • Craggy Island (Guildford)
  • Calshot
  • High Sports (Alton)

Javascript

Foreach

Javascript lets you have associative arrays (of sorts), e.g:

var myArray = {
    a : 'val1',
    b : 'val2'
};

If you want to loop over this array, you can use a foreach loop:

for( x in myArray ) {
    alert(myArray[x]);
}

This code will pop up a message box for each entry in the array. Because the key is assigned to the variable x, you can use the key as well as the value.

Dojo AttributeMap

When using Dojo templating, most guides on the web suggest using ${variable} in your template, where variable is the name of one of your widget’s attributes. When writing my first custom widget, I couldn’t get this to work; no matter what I tried the templating engine would not replace ${} blocks.

Frantically searching for a solution, I found numerous references to using an “attribute map” instead of ${}, but the documentation was pretty poor.

Basically, you can add an attribute map by declaring an attribute in your widget called attributeMap. You then perform a mapping between attribute name in your widget and node in your template.

dojo.declare(
    'customWidgets.MyWidget',
    [dijit._Widget, dijit._Templated],
    {
        variable : 'myVar',

        attributeMap : {
            // key is attribute name, value is node identifier
            variable : 'myNode',
        },

        templatePath :
            new dojo.moduleUrl('customWidgets', 'MyWidget.html')
    }
);

This seems pretty straightforward. Except… well:

  1. What is myNode
  2. What part of myNode does it bind to?

In your template, you need to declare a dojoAttachPoint, which will become your node. This is pretty straightforward:

<div dojoAttachPoint="myNode"></div>

For point 2, what this will actually do, is create an HTML attribute called variable in your <div>, i.e.

<div variable="myVar"></div>

This may or may not be useful. You can invoke this behaviour more explicitly

        attributeMap : {
            variable : {
                node : 'myNode',
                type : 'attribute'
            }
        },

If you want the div‘s contents to take your value, you can set type to innerHTML. The bit of info that’s useful to know, however, is that you can add a third property called attribute:

        attributeMap : {
            variable : {
                node : 'myNode',
                type : 'attribute',
                attribute : 'alt'
            }
        },

In this example, variable will be mapped to the alt property of myNode. Very useful if you want to set a src on 2 separate images, for example.

Linux on W500

I recently got my IBM thinkpad, a T60p, replaced with a new Lenovo model; the W500. Here are some notes on my experiences. For explanations of commands such as !$, see this page.

64-bit or 32-bit

I originally assumed I’d have to install 64-bit Linux, as the laptop came with 4GB of RAM and it seemed a waste to only have 3 usable. It seems that this issue has been solved now, however, with the PAE kernel. The standard install CD of Ubuntu Karmic will detect a system with >3GB RAM and automatically install the PAE kernel. Nice.

Graphics

When Ubuntu Karmic first started up, I was presented with an option to install some proprietary graphics drivers for my card. I elected to do this initially, but found I couldn’t sleep or hibernate the system. Editing /etc/X11/xorg.conf

Section "Device"
 Identifier    "Default Device"
##    Driver    "fglrx"
 Driver "radeon"
EndSection

commenting out fglrx and adding the radeon line. This didn’t seem to help much either. Switched back to proprietary and sleep/hibernate working…

The W500 comes with 2 graphics chipsets; 1 on-board (intel), 1 a separate card (ati). Linux can’t cope with this. In the BIOS, you can choose between integrated (intel) and discrete (ati). If you want to use multi-monitor, you have to use the discrete graphics. Also remember to set the “OS Detection for Switchable Graphics” option to disabled.

Compiz

Compiz, would not work with the radeon driver for me, so if you want pretty effects/3D, you need to use the proprietary driver or have more luck than I.

Comments on this issue:

oldmanuk@gavinwillingham thinking about it, it may be that the OS driver shipped with karmic doesn’t support 3d-accel on the W500s new adapter.

@oldmanuk via twitter

planetf1@oldmanuk @gavinwillingham On Fedora 12 you needed to add the mesa-dri-drivers-experimental package. Look for similar in ubuntu

@planetf1 via twitter

To get the cube effect running, you need to install the compiz settings manager:

[[email protected]]: sudo aptitude install compizconfig-settings-manager

This new utility appears in System->Preferences->CompizConfig Settings Manager.

Compiz does make window resizing ludicrously slow; I disabled it in the config manager (“resize window” in settings manager). It re-enabled itself. I can’t currently get it to disable 🙁

Monitors

The screen on the W500 is much worse than that of the T60p – the viewing angle is atrocious. The colours are also very washed out, but this can be addressed. Using a utility called xgamma, you can tweak the colour levels to a more sensible level. I’m currently using the following settings.

xgamma -rgamma 0.9 -ggamma 0.8 -bgamma 0.65

This command unfortunately affects both monitors (laptop and external). If using the proprietary drivers you can configure on a per-monitor basis, but I’ve not got that far yet.

Synergy

Synergy2 is, quite possibly, the single most useful utility in the world. It’s like a software KVM, in that it allows a mouse and keyboard to be shared across multiple computers, the beauty being that it is seamless; move the mouse past the edge of one screen and it appears on the next.

Synergy is in the apt repository, so is quick to install with a simple

[[email protected]]: apt-get install synergy

Unfortunately, with my install I could not get a client to connect to my server (run synergys --daemon), until I opened the port with iptables:

[[email protected]]: iptables -I INPUT 1 -p tcp --dport 24800 -j ACCEPT

Mouse

In firefox, to get the middle button to scroll with the trackball, set auto-scroll in advanced prefs to on.

Rational Software Architect

When installing RSA with the embedded version of WAS, the install will fail during the setup phase trying to create a new profile. You can complete the install by electing not to create a profile, but will still not be able to create one as usual. This is caused by /bin/sh being linked to dash in Ubuntu, not bash. This is easily fixed as follows

[[email protected]]: unlink /bin/sh
[[email protected]]: ln -s /bin/bash /bin/sh

Comments on this approach

oldmanuk@gavinwillingham a) you should use dpkg-reconfigure, not unlink and b) you’re increasing your boot speed – http://j.mp/m0wU

@oldmanuk via twitter

When running the Install Manager, and once installed when running RSA, I encountered a strange issue where clicking on a button didn’t have any effect other than to select the button. I was sent a link to the solution, which basically involves setting an environment variable, GDK_NATIVE_WINDOWS to 1

Flash on Chrome

When you download the Flash installer for Linux and unpack/run it, it will offer to install the plugin into firefox. Which is nice if you use firefox. I chop and change between firefox and chrome. To install the Flash plugin into chrome, first create a plugins directory (if it doesn’t already exist, then copy the plugin into it).

[[email protected]]: cd ~/Downloads/wherever_i_unpacked_flash_to
[[email protected]]: mkdir /opt/google/chrome/plugins
[[email protected]]: cp ./libflashplayer.so !$

You’ll have to restart chrome for this to take effect.

Remote Desktop

I currently use my desktop Windows machine extensively as my main development machine. I use Remote Desktop when working from home, so I needed an equivalent in Linux. It’s called “Terminal Server Client” and can be found in Applications->Internet.

Using the default settings, I was able to quickly connect to my box. Annoyingly, the clipboard mirroring feature did not work though. By switching the protocol from RDP to RDPv5, this started to work.

Linux shell commands

A number of commands and trick that I regularly use in Linux to make my life easier.

!$

Typing !$ into a bash command will substitute the last argument from the previous command.

[[email protected]]: date > test.txt
[[email protected]]: cat !$
Mon Feb 22 12:02:53 WET 2010

!! will provide the whole of the previous command

[[email protected]]: updatedb
updatedb: can not open a temporary file for `/var/lib/mlocate/mlocate.db'
[[email protected]]: sudo !!

Adding bind Space:magic-space to ~/.bashrc will mean that pressing space after entering either of these commands will immediately convert (e.g. !$ will be replaced with test.txt).

!* provides all of the arguments from the previous line, e.g.

[[email protected]]: touch a.txt b.txt c.txt
[[email protected]]: chmod 777 !*

will create 3 files and set the permissions on each to 777.

Finally, using !somecommand will search backwards through the command history to match a command

[[email protected]]: cat test.txt
[[email protected]]: date > test.txt
[[email protected]]: !ca
Mon Feb 22 12:02:53 WET 2010

You don’t have to enter the whole command, just enough to match the line you want.