• 25 Nov 2007 /  Facebook, Linux, Microsoft vs Linux

    Last week, I gave a Lightning talk to CompSoc on the subject “Linux vs. Windows- which is better?”. It seemed to go down fairly well (I wasn’t lynched outside afterwards…), and following a request from Will for the, er, “interesting” graph that was on one of my slides, here they are. There’s also a JPEG of the graph as I scanned it, and my speaker’s notes.

  • So, as those not reading via one of the planets will be aware, I’ve rolled out the fourth (or is it fifth?) new theme for this site since May 2007. I’m definitely more pleased with this one than any of its predecessors, and intend to stick with it for a good while.

    In other news, I blew £160 on new technology for my desk this week: specifically, a new 4GB USB pendrive to replace my ailing 256mb one, a 250GB external hard disk for my backups, and best of all, a 19 inch TFT monitor to act as a second screen for my laptop.

    All of the above were very reasonably priced over at Dabs, and the £100 inc delivery cost of the monitor in particular came as a very pleasant surprise.

    This is the first time I’ve given multiple monitors a serious go under Linux (specifically Kubuntu), and KDE certainly puts Windows (at least up to and including XP) into the shade here: a taskbar on each monitor? Yes, it can do that. Separate background images per monitor (without silly hacks involving stitching image files together)? Yes. Only show the buttons for the windows on this monitor on this monitor’s taskbar? Certainly, sir.

    It’s only been two days, but I’m already wondering how I ever managed without a secondary screen. It certainly made finishing the new theme for this site a lot easier.

  • 05 Oct 2007 /  Code

    Last week, the beta version of Ubuntu Gutsy Gibbon was released, so I decided to blow away the slightly messy installation of Feisty on my laptop, and make a clean start with the new OS.

    It’s a beta, of course, so I wasn’t expecting an entirely smooth ride. I didn’t entirely anticipate the installation crashing out or freezing repeatedly, and thus rendering my laptop unbootable, but I suppose I should know by now that my hardware isn’t particularly Linux compatible.

    Anyway, with much help from Andrew and Martin, I finally got the text-mode installer to boot using the VGA compatibility cheat codes, and 20 minutes later, I rebooted into Gutsy.

    First impressions were good - the inclusion of ntfs-3g by default is a boon for users like me with NTFS partitions who dual-boot Windows, and the graphics are all a bit shinier. We were very impressed with the speed at which my laptop suspended to RAM, too, though sadly it still doesn’t manage to resume.

    I’ll be making a serious effort to use Ubuntu more over the next couple of months - for nearly everything I do on my computer these days, I reckon it’s just as good or better than Windows XP, though undoubtedly still rough around certain edges.

    I’ll let you know how I get on. I suppose I should update the somewhat dated LaptopTestingTeam wiki page for my laptop, too.

  • 17 Sep 2007 /  Linux

    I’d been a regular user of SSH for several months before I discovered screen. For the uninitiated, it allows you to create multiple ‘windows’, each containing as shell, inside a single SSH session. It also allows you to detatch the whole session from the terminal, log out, then log in and reattach it later, with all programs that were running in it still there. I’ve now fixed up my SSH logins to automatically reattach my screen, and create it if it isn’t there:

    ssh -t david@machinename screen -d -R

    In PuTTY, the ‘remote command’ option in the SSH config area (as per the relevant manual section) achieves the same effect.

    This ‘automatically-reattach-or-create’ stuff all worked fine on one Ubuntu, three Debian, and one Solaris machine when I tested it last week, but trying to log in to the Solaris box last night produced

    bash: screen: command not found

    I think this is because the screen binary lives in /opt/sfw/bin/ on these machines for some reason, hence it’s not in the default PATH variable. It is in my user PATH, but I presume that isn’t loaded when SSH tries to execute the command. Anyway, specifying /opt/sfw/bin/screen rather than ’screen’ in the SSH command solved the problem.

  • 17 Sep 2007 /  Linux

    I needed to set up a Planet recently, and there appears to be very little online documentation about the process. To be fair, if you install it on Debian using apt-get, debconf will walk you through most of the setup, and it drops some examples into /usr/share/doc/planet to get you started, but here’s my quick guide anyway:

    How to install planetplanet on Debian

    Follow these instructions at your own risk:

    1. sudo apt-get install planet
    2. Follow the prompts from the installer to fix up your basic configuration
    3. Create a virtualhost on your web server if necessary, and make the directory which the planet URL will map to
    4. Edit /etc/planet.conf to change the output_dir line to the directory you just created
    5. debconf should have set up a cron job to update the planet if you asked it to, but meanwhile you might find ’sudo planetplanet /etc/planet.conf’ handy to manually update it whilst checking it’s all working.
  • 17 Sep 2007 /  Linux

    My friend and web host, Martin, recently decided to scrap his old server running DirectAdmin, and replace it with a shiny new CentOS VPS running Plesk. Having spent an enjoyable day with him last week rummaging in the bowels of the old server trying to fix SpamAssasin, I agreed heartily with his decision. I got dnorth.net over to the new machine with reasonably little fuss, apart from a few minutes when I hosed the DNS by being in too much of a hurry. I also forgot to copy the .htaccess file, which resulted in everything but the front page of this blog being down for several hours. Of course, I didn’t check anything except the front page.

    Moral of the story: command-line scp doesn’t copy files whose names begin with a dot, unless you explicitly tell it to, i.e do this:

    scp -r user@host:'/dir/* /dir/.*' destination-dir

    Rather than this:

    scp -r user@host:'/dir/*' destination-dir

    And just because the front page works, that doesn’t mean the rest of the site is OK…

  • 08 Sep 2007 /  Uncategorized

    The problem: Windows doesn’t have an inbuilt SSH client, so trying to check out files from a Subversion repository over SSH doesn’t work out of the box. I’ve just spend half an hour looking for a way round this, and here it is [as ever, you follow my advice at your own risk]:

    1. I couldn’t manage to get it working using PuTTY. Please leave a comment if you have.
    2. Install Cygwin, making sure to include the openssh package
    3. Edit the C:\Documents and Settings\(yourusername)\Application Data\Subversion\config file to include a line reading
      ssh = c:/(cygwin root path)/bin/ssh.exe -i "C:/privatekeypath"
    4. You can omit the -i option and the bit after it if you don’t have SSH key authentication set up. If you’re using it, though, make sure you use forward slashes in the path to the key file. Note that the private key needs to be in OpenSSH compatible format. If you have key authentication set up in PuTTY, you can export your private key to an OpenSSH compatible version using PuTTYgen.
    5. You should now be able to check out repositories in the usual way from a command prompt:
      svn co svn+ssh://you@repositoryhost/path/to/repository/ destination-dir

      If you exported your PuTTY key as described above, you shouldn’t be prompted for your password on hosts where the corresponding public key is in place.

    Update

    Since writing this post, I’ve had Tortoise SVN recommended to me

  • 28 Jul 2007 /  Code

    Recently, I’ve been working on a new project, an update to the Magdalen College JCR Rooms Database. Doing this whilst on holiday with no internet connection certainly made me appreciate the reference panel built into Dreamweaver. However, it didn’t help me with the following problem: to simplify slightly, suppose you have a database table like so:

    +----+---------+---------+
    | id | version | name    |
    +----+---------+---------+
    |  0 |       1 | apple   |
    |  0 |       2 | apple2  |
    |  1 |       1 | orange  |
    |  1 |       2 | orange2 |
    +----+---------+---------+

    Let’s call it fruit. The primary key is the composition of the id and version fields, each group of rows with the same id being different versions of the same object’s details. Possibly not the best idea in the world, in retrospect, but it was too late now.

    What I wanted to do was get the row with maximum revision within each id, i.e. a single SQL query which would return

    +----+---------+
    | id | name    |
    +----+---------+
    |  0 | apple2  |
    |  1 | orange2 |
    +----+---------+

    Getting the maximum version number within each id is, of course, as simple as

    SELECT id, MAX(revision) from fruit GROUP BY id

    .
    Then you could do a second query like

    SELECT * FROM fruit WHERE id = '$id' AND version='$ver'

    to get the rest of each row, plugging in the maximum version from the first query and working through the rows one at a time…which is fine, except that there are 250 of them in the real thing, and that’s only going to increase.

    Methods involving multiple separate queries were out. Quite apart from the performance issues, I wanted a single query to allow me to search through the latest revisions of all rows by adding to the WHERE clause.

    After much further head-scratching, I came up with

    SELECT * FROM fruit GROUP BY id HAVING version=MAX(version)

    …which returned precisely the square root of stuff all. Initial investigations when back at an internet connection led me to blame this on the rather ancient version of MySQL doing service as development SQL server on my laptop; however, upgrading to the latest stable version didn’t help.

    What did help, though - and at last we reach the point of this rather large post - were these pages, which pointed me in the direction of this one, and told me everything I ever wanted to know about the “groupwise maximum” problem, as I discovered it was called. The solution I’ll be using, paraphrased from the examples on that last page, is

    SELECT fruit1.id, fruit1.name from fruit AS fruit1,
    (SELECT id, MAX(version) AS ver FROM fruit GROUP BY id) AS fruit2
    WHERE fruit1.id=fruit2.id
    AND fruit1.version = fruit2.ver;
    

    The bracketed expression is a sub-query, which internally creates a temporary table to match the maximum versions from. Searching through the results is just a case of adding AND fruit1.field = ‘value’ to the outer WHERE clause.

    All of which is quite enough SQL for one day, and leaves me realising I still have much to learn about it.

  • 27 Jun 2007 /  Web Design

    So, I’ve spent the last 48 hours writing a couple of style sheets.

    The first one, as the regular readers amongst you will notice, was for this site (apologies to those of you reading this on Planet CompSoc, you’ll have to click through to see what I’m on about). I’ve gone for a minimalist black-and-white look. I’m not entirely happy with it, but I’ll keep tweaking…

    The second, still very much in progress, is for the Magdalen College JCR site, which I’m giving a comprehensive makeover this summer. Feel free to leave a comment on either - constructive criticism is always welcome.

    Update

    Apologies to anyone who visited this site at about 20.40 BST on 27/06/2007 and wondered what the heck had happened to the new theme this post mentioned. Suffice to say that the correct way to fiddle with WordPress is to start in the backend manager, not to do random find-and-replaces across the underlying code. Don’t try and rename the directory the current theme lives in, either.

  • 20 May 2007 /  Web Design

    So, after a few weeks of holding pages and messing around, my site is now up, and it’s here to stay. The default WordPress theme certainly isn’t; chances are I won’t have time to make a nice new one until the end of June, though. As some of you may have seen, I had a go, but it ended up being not much better than my first ever attempt at web design, so clearly I need to take the time to do it properly. Watch this space…

Bad Behavior has blocked 20 access attempts in the last 7 days.