Thursday 11 January 2007

This year I will ...

1. Only use exclamation marks where they add meaning to a sentence.

2. Refrain from starting posts, comments, emails or other pieces of text with the word 'So'.

And, of course, eat better and drink less. But I always say that.

Monday 8 January 2007

Pass the Alt key to the shell in gnome-terminal

This turns out to be very easy: Edit > Keyboard Shortcuts > Disable all menu access keys. (from)

This has been bugging me for ages, I wish I'd looked earlier. It is useful because the bash shell supports lots of nice (emacs-derived) shortcuts for moving the cursor, such as Alt-F and Alt-B to move forward and backward by a word; since I'm used to these working, whenever I go back to gnome-terminal it confuses the nubbins out of me. I shall be confused no more!

Sunday 7 January 2007

Adding a new WordPress blog to a Debian install

The Debian WordPress package is set up to allow multiple blogs to be hosted on the same server, using Apache's virtual hosts. However, when I looked, I couldn't find any documentation on how to enable this.

This is how I did it, using wordpress and apache2.

Before you start, you must have control over your DNS, and the ability to create CNAME aliases. Add an alias for your web server, giving it the name of the blog that you want to host. In my case, the site is blog.mortia.org.uk.
Firstly, set up the WordPress database and configuration using the supplied example sript:
sudo bash /usr/share/doc/wordpress/examples/setup-mysql -n mortiablog blog.mortia.org.uk

Then we need to configure apache2 to serve WordPress, rather than the site's default index page, for the host blog.mortia.org.uk. I can't remember where this information came from (it was a while ago when I first did this); I think it's a modified version of the example apache configuration from the Debian examples directory.

Start by going to /etc/apache2/sites-available, and copy your default site file 'default' to another name. I used 'blog.mortia'. Then you need to edit it to trigger only for the new hostname that you've set up, and for the root to point to the standard WordPress installation:

  • Remove the outer 'NameVirtualHost *' directive

  • Add a 'ServerName blog.mortia.org.uk' directive inside the VirtualHost section.

  • Change the DocumentRoot from /var/www/ to /usr/share/wordpress/, not forgetting to modify the section too.

  • Change the names of the log files so they don't conflict with your main site.

  • Remove any other aliases etc that you don't want on the blog site.


To get apache2 to pick up this new site, you need to symlink the new config file into /etc/apache2/sites-enabled, and restart the server.

cd ../sites-enabled
sudo ln -s ../sites-available/drup.mortia .
sudo /etc/init.d/apache2 restart

Now you're ready to point your browser to the new URL, and start configuring WordPress as normal. You may need to shift-reload to see the WordPress page.

Update 2007/06/09: added the -n flag, supported by newer versions, to get a reasonable database name.

Friday 5 January 2007

Side-by-side computers with one keyboard and mouse

Do you have two machines sat next to each other, but no space for two keyboards? Even if you do have space, it's really annoying having to swap between them: here's a way to avoid that, without using a KVM or any other hardware except the network.

At work I use dual monitors, which after a little adjustment, I'm getting on very well with. I also have a laptop, which gets used intermittently before and after I travel, and as a scratch box for trying out new systems and so on. Previously, when it was running Windows, I would use Remote Desktop to access it via my desktop's keyboard, mouse and monitor, and leave it closed on the desk.

Recently, however, I've set it up to dual-boot into Linux. Rather than using VNC, I wanted to use the monitor on the laptop as well, but with the keyboard and mouse from the desktop -- in the same way as my existing dual monitor setup works, except that now there are two different hosts involved.

This turns out to be remarkably easy. On the Windows desktop side, there is a cool piece of software called Win2VNC, which sets up your machine so that you can move the mouse cursor off one side of the screen, and it will start accessing a remote machine via VNC. Unlike most VNC viewers it doesn't display anything, it only handles the input side.

(The link above is to a modified version of Win2VNC. The original version is here, but that version has difficulty with multiple-monitor setups, and gets confused about which window you are going off the side of).

On the Linux side, I used VNC version 4 (Debian package vnc4server). The Win2VNC page suggests x0rfbserver, but that appears no longer to exist, and has been removed from Debian now. The vnc 4 package has subsumed it in the form of the x0vnc4server command, which runs (like WinVNC) on the existing display, rather than starting a new one.

So far, it's working pretty well. There is still the occasional problem with losing the mouse cursor, but usually slowing down, and carefully swapping between screens and back will resurrect it.

And it's a great way to show off.

Thursday 4 January 2007

Hang on installing the Google toolbar in Firefox 2.0.1

When you install the google toolbar in later versions of Firefox (at least -- I haven't tried it in any other versions) on XP64 (again, probably other OSes too), it brings up a popup dialog. Unfortunately, combined (I think) with the session restore capability, this dialog hangs the whole app, and you have to kill it from the task manager.

Because it happens on startup, repeating the process just hangs again.

If you get in this state, you can fix it by throwing away your saved session. To do this, delete (or rename) the file

C:\Documents and Settings\Application Data\Mozilla\Firefox\Profiles\sessionstore.js

and start Firefox again. Then it will come up, you can make your setting in the dialog box, and at least start browsing the internets again.

I haven't yet figured out how to get the saved session back again.