Wednesday 15 July 2009

PixoPoint Menu Widget

This is a very simple plugin that adds a widget to WordPress, containing the menu from the PixoPoint menu plugin (which must also be installed).  The menu plugin is currently in beta, see the forum discussion.

The standard installation procedure for the PixoPoint meun plugin is to edit the theme files, which gives you more flexibility as to positioning of the menu, but is an extra step.  When I installed it I knew I wanted the menu in one of the standard widget areas, since it was replacing a standard page widget, so the easiest approach for me was to create a new widget to host the PixoPoint menu.

I haven't had a chance yet to package it properly as a plugin; when I do, I will update this post.  For now, you can pick up the php file from my location Subversion server at http://www.mortia.org.uk/svn/webs/alan/wp-plugins/pixopoint-widget.php and drop it into your plugins directory.  Once activated, it will add a widget "PixoPoint Menu", which you can place by going to Appearance > Widgets in the normal way.

Wednesday 22 October 2008

Robustly copying large directories on Windows

When my Windows XP installation self-destructed, I was fortunate that it was only the system that was corrupted; my data was still accessible.  Compared to rebuilding the system, copying the data from the old, dodgy disc onto the new disc seemed like it should be simple.

Of course, it was not to be: between the virus scanner complaining that some of the Linux scripts I had checked out were viruses, and Explorer not liking the length of some of the paths, I gave up on doing it the obvious way.

Instead, I fell back to good old xcopy.  After a bit of googling, here's the command line I ended up with:
C:\>xcopy G:\builds E:\builds /E /C /Q /H /R /K /X /Y
957918 File(s) copied

I don't know whether all these flags are necessary, but they did seem to work!  The intention is to copy as many attributes of the original files as possible.

If the directory doesn't exist, xcopy will ask whether you wanted to create a file or a directory.  I imagine if you say "file" it won't work too well.
C:\>xcopy G:\Data E:\Data.old /E /C /Q /H /R /K /X /Y
Does E:\Data.old specify a file name
or directory name on the target
(F = file, D = directory)? d
1702 File(s) copied

Thursday 22 March 2007

TiddyWiki

I've been using TiddlyWiki for a couple of months now, and it's brilliant. It's a wiki-style notebook, but entirely self-contained as a single web page, so it doesn't need a server to set it up -- or a network connection to use it -- and it's easy to copy it around and take it with you when travelling.

The interface is a little quirky to start with, but you quickly get used to it. It might be easiest to imagine that each tiddler (most other wikis would call this a page, but since TiddlyWiki is a single page, that doesn't quite work) is a tab in a browser. Clicking on a link to another tiddler opens that tiddler at the bottom of the page, if it is not already open, and scrolls the browser window to it; imagine that it's opened a new tab for the tiddler if necessary, and brought that tab to the front.

I'm currently using a TiddlyWiki for my to-do list, which allows me to create richer hyperlinked structures around tasks, so things like meeting minutes and design notes tend to end up in it too. I started with a structure based on that of GTDTiddlyWiki, with top-level lists starting with an @ character etc. Don't use GTDTiddlyWiki directly though, it's based on an older version of TiddlyWiki, and you're better off going with the newer version. (This way of tracking tasks is based on Dave Allen's book "Getting Things Done," which I have bought but have yet to read. I found the scheme originally via a post on Kathy Sierra's blog, which linked to an introduction to GTD at PigPog. So far it's working well.)

I've also used it for other note-taking style things, such as for keeping notes from my weekly Salsa dancing classes.

Internally, the HTML that it stores is relatively good for use with line-based diff programs, such as that used by Subversion: each tiddler is stored on a different line, but with the characters '\n' between each line of tiddler text.  I've been storing one wiki in svn for a few weeks, and it's relatively usable, although it would be nicer if the body text of a tiddler was expanded so the details of the changes showed up in the diffs.

The default settings work very well, but whenever I start a new tiddlywiki, I make the following changes to have it working as I like:

  • Open the options from the menu on the left, and make sure the author name is set

  • Tick 'SaveBackups' and 'AutoSave'. This saves the wiki every time you make a change, leaving the previous version around as a dated backup. It would be nice if it could auto-clean these somehow, but for now, I just delete them all manually every now and then.

  • Open the AdvancedOptions, and set a folder for the backup files. A relative path works fine.

  • If the wiki is going to last for a while, I like to change the colour scheme to make it a little distinct. Open the tiddler 'ColorPalette', and edit it to set the colours as you want them. (The ColorPalette tiddler isn't linked anywhere by default, so far as I can tell. You can add a link to it from wherever you like, or just add '#ColorPalette' to the URLin the address bar and reload the page. If you don't have autosave enabled make sure you save your changes before reloading. Having done this once, it will appear in the TimeLine.)


There is lots of good information on the main TiddlyWiki site, but sometimes it's hard to find what you want, and I often use this quick-reference page for checking formatting syntax etc.

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.