My iMac Approaches Perfection Asymptotically.

I have written several times about the learning curve of turning my 27″ iMac into the computer that I am happy to use all day every day. Much of this process has revolved around me moving away from using the Mac OS X operating system as much as possible. I run Linux, and, as I’ve noted in other entries I have a very tweaked system.

But there was one thing about the Mac that was a problem from the start, and which I hadn’t been able to sort out. I like to listen to music when I work, but as I share an office, I have to be concious of the impact of the impact of music on others around me.

After installing Linux I found that plugging in headphones cut off the sound from the speakers, just as you would expect, but the sound would resolutely refuse to flow from the headphones.

I have finally found a fix, of sorts. The forum post which explains the solution is here.

Essentially a short Python script is created which resets the headphones configuration and allows sound through the headphones. Apparently it needs re-running every time you re-start the computer, but I can live with this. I already run a couple of scripts when I log into the computer in the morning (to turn on my preferred keyboard layout, launch Dropbox, X Screensaver, Synergy and other useful functions).

So now I can listen to music when I’m at my desk and not disturb others with my choice.



How Not To Write A Website.

One of the research groups where I work has asked me to update their website for them.

It seemed like a simple request at first, and then I looked at the code. It is awful. The code has styles defined in the tags themselves rather than in a single style sheet for the site. This means that if you find a style that needs tweaking then you need to modify it in each file in turn! Yuk!

Each sub-folder has its own style sheets too, which means that even if you find the killer edit which will fix the majority of their layout woes then the edit needs to be applied correctly 10 or more times!

Nothing is commented. Anywhere.

Oh, and it appears to use some fancy Javascript which breaks if you move the files to a different server.

I won’t mention which ‘design’ package might have been used to create this website, but many of these crimes seem pretty universal these sorts of programs.

It is so bad I would be tempted, had I the time, to rebuild the site from scratch by hand, with better coding standards. The whole thing would be so light, and easy to maintain. Maybe I’ll keep it as a project to help bring myself up to speed on HTML 5 some day.

Now, back to fixing things…

Synergy – Control For More Than One Computer At A Time.

I am not, by habit or practice, a tidy person. This is strongly reflected in my work desk which is awash with stacks of papers, forms and diaries. Unfortunately, I am also someone who has two computers on my desk (see many previous comments on the subject).

The computer I use most is a 27″ screen iMac. The screen is lovely, with excellent image quality.

However, I don’t particularly like Apple keyboards, so I don’t use an Apple keyboard. Instead I have a wireless Logitech keyboard (a  K230 for the record). The previous keyboard that I had didn’t have a number pad on it, so I added a separate wireless number pad (also Logitech, a N305). I’m also not that keen on Apple mice because I need at least two buttons and the direction of scrolling is all wrong, so I have a trackball, which I like because it doesn’t need lots of desk space (M570).

The brilliant thing about the Logitech kit is that they all link using Logitech’s ‘Unity’ wireless system, and, importantly, each Unity USB connector can support up to 6 devices. That means I can have the keyboard, number pad and trackball all connecting to a single USB connection, and I don’t lose a heap of precious USB ports.

I am very happy with this setup and can type quickly, mouse around accurately and enter data in spreadsheets efficiently.

Then there is my other computer. The keyboard is stiff and not particularly pleasant to use, and the mouse is an old Apple mouse (pre touch surface, even pre-rollable nipple thing) where the whole case of the mouse is the button. Its horrible.

So how do I manage this setup, and the challenges of limited desk space, preferred hardware etc. Enter Synergy, a simple system to manage multiple computers from a single keyboard and mouse.

Setting up Synergy appears to be easiest when you are sharing multiple Windows computers as Windows is provided with a nice handy app where you can name computers and define where their monitors lie in relation to one another. Users of other systems need to create and edit a text file to define these relationships. So I chose to make the iMac the server machine and the Windows machine a client. Following instructions was simple enough, and after having a few connection issues caused by misnamings of the two systems I was suddenly up and running.

I have a similar issue in starting the Synergy server on my Linux box that I have setting the keyboard, activating the screensaver etc, so initially I was tempted to append the instructions to activate the server onto the script that sets these things up. However, the only time I’m going to use the Synergy system is at work, so it doesn’t make sense to add this overhead to all my Linux systems. Instead I created a script which launches the Synergy server. I run this after my initial login (and after the keyboard setting script).

Using Synergy is simply a matter of mousing over to the screen edge which is defined as the point at which the two computers meet. For reasons of understandability this should be the edge of the screens where the monitors abut. Pause for a moment and the mouse will flip over to the other screen, and you are in control of the other computer.

One unforeseen advantage of this has been the way that the keyboard layout on the server computer, that is the iMac is the keyboard layout used on the other computer. As I have written elsewhere, I use a non-Qwerty keyboard layout. In Linux I can choose a Dvorak keyboard layout, but with UK punctuation (a £ sign, the @ sign being on the middle row, just by the return key etc). I also have the Caps Lock key and the left hand Ctrl key swapped so that I have a Ctrl key on the home row of the keyboard. Replicating the finer points of this in Windows is difficult as the normal Dvorak options are US English, Dvorak left handed and Dvorak right handed. Customisation is possible, but it requires installation of extra programs and understanding an arcane piece of software.

However, using Synergy with Linux as the server fixes this as the Linux keyboard layout is carried over to the Windows computer as I flip over. Bonus!


The Weird, The Wonderful and The Very, Very Lightweight.

One of the things that really separates Linux from both Windows and Mac OS X is the desktop.  In both Windows and Mac OS X you get a desktop, which comes with its own metaphors, and you have to pretty much learn to live with that.  The Operating System and the Desktop are essentially synonymous. Sometimes this can cause real problems. The launch of Windows 8 has seen the biggest change in the desktop metaphor since Windows 95 (I could comment on a naming convention that goes 3, 3.1, 95, 98, XP, Vista, 7, 8, but that will have to be a post for another day). And many people aren’t particularly happy with the new interface. I know that when I am required to use it, as, for instance I set up someone’s new laptop, I spend most of my time looking for things that I used to know how to find. Fortunately, I quickly found the search function, and probably use that more than anything else.  And as for Mac OS X, as users are slowly lead (through a series of expensive software and hardware upgrades) to the expected melding of the iOS and Mac OS interfaces, users have to get used to changes in the way things work every time.

Users of both Windows and Mac OS X are used to their set up, and in reality, there isn’t a sensible or universal answer to the question of which is better. Users of both systems become comfortable with them.  I personally don’t like the way that the Mac menu is a bar at the top of the screen which changes depending on which application is active. This approach seems especially churlish when you have a huge monitor and you have to move the cursor right to the top of the screen to pick a menu item. There are some oddities (from a Windows users perspective) about having to select a window before you can click on it, necessitating double clicks when changing applications. Since the introduction of Windows 7 I have got used to using the menu in much the same way as I use the terminal in Linux, or the alt-F2 application finder. I don’t bother looking for the icon, I just enter the first few characters of the app, and then select what I want.  I recently found out how to do something similar using Command-space in Mac OS X.

So what of Linux? When I first used Linux, back in the late nineties, it came with either the command line, or an awful windowing interface called CDE. It was ugly. It wasn’t really slow, but it didn’t really serve much of a purpose. Linux was still very command line driven, with all of the learning curve requirements that that involved, but at least you could run multiple terminals on your desktop. However, CDE was remarkably limited by just how few applications were available for it.

Since then, there have been huge advances in the Linux desktop. The obvious players are KDE and Gnome. KDE was what I used when I first moved to using SuSe Linux. It came with good programs which handled browsing and email. KMail even supported the use of encryption keys and signing. Gnome was available, but hadn’t been customised as much, but was easier to fiddle with.

I suspect most users chose their desktop on the basis of whichever was the default for their particular distribution. And over the years I have had positive and negative experiences with both. Most recently I was using Gnome for a long time.

But then I got a laptop which I felt, although it is a dual core machine didn’t really have a huge amount of ‘oomph’ to spare. I wanted to make sure that I made the best of what power I had. So I began to look at the alternatives to the default Gnome. And because of the modular nature of Linux there are an awful lot to choose from. Some of them set out to be a lightweight, but ‘normal’ replacement. Examples are Xfce, Openbox and LXDE. Xfce and LXDE especially are the sort of environments where Windows users will feel right at home. Openbox is less obvious as there isn’t a menu bar by default, though adding one is easy. Instead it uses a ‘pop-up’ menu which appears when the right hand mouse button is clicked. From that the applications can be started, and cycling through open applications was achieved in the usual Alt-Tab manner.

Having experimented with Openbox and Xfce I settled on Xfce for a long time. It is lightweight and fast, and worked well on the screen on my laptop. I spent a long time tweaking the functionality of Xfce. I had Conky running with my own brew configuration file which showed processor activity, network activity and disc usage. I was very happy with it, and I stuck with Crunchbang, by distribution at that time for quite a period, just because I was so happy with the desktop.

But then Crunchbang went with Openbox as its default, and I moved on to the new kid on the block, the marvellous Linux Mint. Of course, Mint has made its name by using a fork of the old Gnome 2 desktop (as opposed to Ubuntu’s Unity or Gnome 3). I definitely don’t really like Unity or Gnome 3 as both of them seem intent on using a similar approach to the ‘screen top menu bar found it Mac OS). So I used Mint in its Xfce form.

But I have also been looking at some of the other, less conventional options. For the sake of this post the ones I investigated most seriously are Ratpoison and Xmonad. Ratpoison is best considered a windowing equivalent of the command line program ‘screen’. You can open multiple programs and then navigate between them using the keyboard. It is designed to run everything full screen (which can be odd when you want to run multiple dialogue programs like The Gimp). I loved the idea, but I find the insistence on full screen a little daunting, especially on my work desktop. A small application filling a 27″ monitor seems a profligate waste of screen space! Xmonad is similar to Ratpoison in that most of its functionality can be driven by the keyboard, but it works more along the lines of tiling the windows it creates automatically so you can open programs that you want to use and have them fill the available space automatically. There are lots of ‘recipes’ for tweaking behaviour, especially in terms of keyboard layouts. This is especially of interest to me as I tend to use the Dvorak keyboard layout whenever possible.

One area of Xmonad which I would really like to investigate in the future is its multiple display support. It implements libraries for binding multiple displays into one unit, which sounds like great fun if I ever get to use. In the meantime this big display, chopped and spliced on the fly is an interesting concept, and I could see it becoming by preferred display for the time being.


Now I Just Need Paranoid Friends.

My last post was about protecting data stored on a server by having the data encrypted and un-encrypted by a special Linux file system. It is a very elegant way of securing data against physical theft (though, obviously, a hacker gaining access would be able to see the files).

The other area of interest that came back recently is more generic. Edward Snowden shocked America by blowing the whistle on the US government hoovering up everyone’s emails. One of the things I thought was very interesting was the unspoken part of the story. The ‘controversy’ is that the government is doing it to US citizens in contravention of the 4th Amendment. Apparently not controversial is the fact that various governments have been doing it to the citizens of the rest of the world for a long time, and with complete impunity.

Back in the day when I used to work at WorldPay we used to say to customers that they shouldn’t send anything by email which they wouldn’t write on a postcard and send by Snailmail. Despite that, there were occasional people who would email use with their complete credit card number in the email asking why their transaction had failed.

So what can you do to protect the information that you send by email? The best solution is to encrypt everything that you send. Classic encryption used to come in the form of a shared secret between the message sender and the message receiver. The same method that was used to encrypt the information was used to unencrypt it. The problem in this case is always how do you share the secret of encryption/decryption securely. In many ways this was the major weakness in the Enigma machines used by Germany in the Second World War. Many radio operators got lazy in how they transmitted their first message of the day (which included information on the days secret configuration).

The modern solution to this problem is to have an asynchronous key pair for encryption. There are two parts to the key, the public and private. The public key is intended for distribution. This can include publishing on web pages, uploading to public keyservers and the like. The private key must be kept safe and protected.

The way that the asynchronous encryption works is simple in concept:

  1. Identify the address of the person that you want to send an encrypted email to, and if they have a public key available download it.
  2. Use the public key to encrypt the information that you wish to send. The important point is that the encryption process is a one way street. Even with the public key to hand the original message cannot be extracted from the encrypted data.
  3. Send the encrypted data to the intended recipient. The user will receive the data and can then upencrypt the data using their private key and a passphrase associated with the encryption keys.

As you can see, the data treated in this way is secured. However, this information can only be sent to users who have generated their own encryption keys.

Another, more common use of the encryption key pair is to ‘sign’ messages or files in order to confirm their veracity. In many ways the signing process is similar to that of generating an m5 signature of a file. An apparently random string of characters which is a product of the information being signed, the users private key and passphrase is appended to the information. The public key can be used to compare the signature with the signed data, and can confirm that whoever created the signature has access both to the private key for the user, the key’s passphrase and the original content of the data. Changing either the data that is signed or the signing string will cause a mismatch indicative of data that has been tampered with.

All of this probably sounds like quite a lot of hassle. The good news is that it is simple to automate the process in a simple, cross-platform way. Thunderbird supports a simple add-on ‘Enigmail’ which handles importing and managing public keys, signing and encrypting. It also confirms the identity of users if content is signed.

The only downside? No one I know cares enough about this stuff to actually go through the steps of creating a key pair and starting to encrypt their information. I’ll just keep to signing for the time being.

If you want to be able to email me securely then the following are my public keys, along with their associated email addresses: (Work address):

Version: SKS 1.1.4
Comment: Hostname:

—–END PGP PUBLIC KEY BLOCK—– (Home address):

Version: SKS 1.1.4
Comment: Hostname:


The really cool thing is that with the apps APG and K9-Mail I can have this same functionality on my phone as on my desktop machines!

Of Books and Bibliographies.

As I work in a University, a lot of the documents that people write have to have bibliographies listing citations and the like.

As most users also write their documents using Microsoft Office they need a solution that works with it. The most common solution is to purchase and use Endnote.

And this is why I get disgruntled with Windows and Macs. If you go out and buy a computer, whether it is a Windows PC or an Apple Mac, you would hope that your expenditure would get you a working system, that all you would have to do would be to take it home and plug it in, and you could start doing useful things with it. But the reality is that that often isn’t the case.

So you want to write a letter thanking Auntie Maude for the Christmas money that means that there was enough in your bank account to buy your computer. On Windows you could use WordPad and on a Mac you could use TextEdit. But both are very limited, in their scope in order to encourage you to shell out more money for a decent word processor.

And in the majority of cases this ends up being Microsoft Word.

The situation is even worse when it comes to spreadsheets and presentation tools. Neither Windows or Mac ships with even a cut down tool for these core computer uses.

In effect, you are put in a position where you are essentially expected to buy a computer which will cost at least £400, and then you will be cajoled or bounced into purchasing software to make use of hardware, using the thing that most users will consider to be a central part of a computers use.

This is another of those reasons that I love Linux. I do an install of a modern Linux distribution, and I can expect it to include a word processor , spreadsheet and presentation tool. In many cases there will be more than one (LibreOffice and AbiWord are both capable word processors which will often be found on a fresh install). In the case of graphics editing programs the case is even more stark.

And if you don’t get the program that you need you can usually install it in moments with a simple command, for free.

So, while I appreciate that the learning curve is steeper, I have to ask why would anyone use Windows?

Shiny, Shiny… See, It Excites.

I have a little project at the moment. One of the research groups has ordered two brand new iMacs (21″ screen, i5 processors and oodles of ram).  They are actually going to be using them in laboratory experiments, testing subjects using a piece of software which is Windows specific.

At this point, you may be wondering, as I did, why purchase Macs to run Windows software. The only explanation is that the group supervisor is a Mac-ophile, and nothing else would do.

Initially the plan was to purchase and install Parallels, but for reasons that no-one (not even the Apple Sales Rep) can fathom, Parallels isn’t listed as an item for sale through the Cambridge specific version of the Apple store. While I was trying to get this sorted out I floated the idea of using BootCamp and configuring the Macs with dual-boot. This seemed to be a popular idea, so I am now trying to get the Macs set up this way.

The Macs themselves arrived at the beginning of the week, and I got the copy of Windows to install yesterday. So I unpacked one of the machines ready to carry out the install.

Being new Macs they are the slimline models. And of course that means that they come without a built-in DVD drive. This isn’t the first time I have hit this issue of a Mac without a DVD drive. The first time it was a researcher who arrived with a MacBook Air and an installation disc for Microsoft Office. It was then that I discovered that Apple expect users either to shell out for an external drive or to have a second computer that you can use  either to host the installation media. Obviously this isn’t a huge problem in that I do have a desk full of computers, but I can imagine it being a real ball-ache in the real world!

Anyway, I am now using my desktop machine to generate an ISO file of the installation disc which is being written to a USB stick (fortunately I have suitably large USB sticks on hand). I am doing this, obviously, on my Linux desktop, but I know that the Disc Utility in Mac should be able to do this, and I assume that there are tools in Windows too.

The command to generate an ISO file and write in to the disc in my case is:

dd if=/dev/disk/by-label/UDF\\x20Volume of=/media/KINGSTON/winstall.iso

The command takes a while to run, but can be left chugging away in the background. Then, when it is complete you can un-mount the USB stick and return to the Mac.

BootCamp Assistant is shipped with all modern Macs, and will take the ISO that you have just created and turn it into an installation disc. To do this I transferred the ISO from the USB stick to the desktop, then gave the USB stick as the target for the disc creation process and the ISO as the source. At this point the software unpacks the installer onto the USB stick, then downloads appropriate drivers for the hardware and then partitions the hard drive (it gives the option to adjust the partition sizes). Then the software completes the partitioning process and reboots the computer, beginning the Windows 7 installation process.

The Windows installation is familiar territory. Choosing options was a little laborious as the Apple Magic mouse wasn’t working, so there was lots of tabbing between options. And when I was presented with the options for which disc partition to install to, it wasn’t obvious, especially as all of them were marked as not being suitable. A quick check online, and it was apparent that the correct option was the partition marked ‘bootcamp’, but that you have to format it before use (to format the disc as NTFS).

In the classic Windows style, installation features numerous reboots (at the first reboot you have to unplug the USB stick to prevent the installation starting again). When installation was complete the resolution was shot and the wireless, mouse etc still didn’t work. Plugging the USB stick back in I found a folder which included Mac extras, basically the drivers for the hardware. Double clicking the setup and allowing the installation fixed all the hardware issues.

One last reboot, followed by installing MacAfee anti-virus (the University has a site license), Google Chrome for browsing and then the 103 ‘important’ updates. This is going to take a while, and will probably require more restarts! But I’m getting there. Time for lunch before my afternoon meeting.