broken tick

I’m releasing another Bot::BasicBot at the moment, to change the semantics of the tick() method. Instead of getting called every 5 seconds, you now need to return a value from the tick() method, and you will be called again in that many seconds. this is waaay more useful than before, but of course it’ll break anything that uses it. Oops. But 0.2 has only been out a short time, so I should get away with it.

More of a problem is what to do with Bot::BasicBot::Pluggable, because I now can’t just pass the tick method straight through. I have a new version in CVS that I’m very happy with, needs more tests, though, but the feature still stopping release is per-module tick events. I want every module to be able to have independant tick events, instead of sharing one global tick, but haven’t come up with an elegant way of doing it yet..


I was reading this article on m3u files and decided to scratch one of my long-term itches, building a decent windows playlist on the file server. It’s a.. large collection, so I don’t want to build things on the client end, you see, it takes bloody ages.

Up till now, I’ve just created a list of paths, and used that as the playlist. This had 3 disadvantages:

  • it’s very hard to have it sorted by anything useful, using the filename is hopeless as there are several different naming conventions involved. blech’s fault.
  • I’d quite like to have the track lengths already by the tracks when winamp starts, as opposed to have it add them whenever you see them.
  • for some reason, winamp starts much faster when there are EXTINF tags in the playlist file. Don’t know why. Don’t care.

So now I search the server for files, read the id3 tags, sort by artist/album/tracknum/title and print out, along with the track length and name in an EXTINF tag. The whole process takes almost exactly 2 mins, but it’s not very memory-efficient. For various complicated reasons the server has almost a gig of memory in it (ok, they’re not complicated reasons – we just don’t own any other boxes that can use the stuff) so I don’t care about this.

code is here, if you care. It’s hard-coded for my server, but the only thing you’d really need to change is at the beginning, where $root and $remote are defined – $root needs to be where the music lives on the server, $remote is where it lives on the network. For my server, I samba share /music on the server cowboy as cowboymusic. Also, $playlist should be where you want the playlist to go.


Well, in the end, rather than fold my code into CGI::Wiki and its example scripts, Kake has persuaded me to release the thing as an actual module. So, the world now has CGI::Wiki::Formatter::Kwiki and CGI::Wiki::Kwiki. I’m not sure about the name of the latter, but given that is was mostly written as a Kwiki importer and front end, it made the most sense. I hope that people also realise that it doesn’t have to have anything to do with Kwikis at all, and can be used as a stand-alone wiki front end..

They still have very small version numbers, the formatter needs code, tables and comments, and the Wiki front-end needs tests (bad me), but as far as I can tell, for the most part they both work. The code is much cleaned up from the “last release”:/blog/programming/CGI-Wiki, all modular and everything, I’m much happier with it now.

You can get them both from CPAN.


blech and I were bored, so we played with FileVault. And it’s shiny. As long as you’re on the local machine, it all works transparently. When you have FileVault turned on, your home directory contains a single file, {username}.sparseimage. This is a standard Mac OS X encrypted disk image, certainly I can just mount the thing using a different user no problem. When you log in as a FileVault user, your encrypted image gets moved to ‘/Users/.{username}, and the sparseimage is mounted in your old home directory. When you log out, this is all undone. Pretty nifty.

Aside from the encryption, which is nice, the main benefit I see here is that suddenly your home directory is a really nice, easy-to-back-up .sparseimage file on it’s own. I’ve been having problems recently trying to find a nice way of backing things up, and this might be it. Slight worry is that only Panther can mount the .sparseimage, Jaguar has problems, so restoring needs a fairly recent machine. But I can live with that. I ph33r what will happen if I try to back up the image while I’m using it, though, so I’ll probably have to log out and in as another user to run backups. Which will be annoying, but bearable.

The next thing we wanted to try was network access. And this is where things get not-so-nice. Essentially, it looks like the process above is the entire system, other than the nice GUI to turn FileVault on and off. When you connect to the home directory using AFP or Samba or something, and the user is not logged in on the local machine, you get a folder containing one file, the disk image. Not very useful. If you have Panther, of course, you can just locally mount the image at this point by double-clicking on it. But that’s 2 steps, not very Applish. And of course, on any OS other than Panther, you’re out of luck, Jaguar can’t mount it, and Windows / linux don’t stand a chance.

If, when you log in, the user is logged in on the local machine, you get their home directory, and I should point out that this is their home directory being sent unencrypted over the wire. Not good if you had paranoid reasons for using FileVault, which will be most people.

Of course, I can’t think of a nice, simple, elegant way of having this do the Right Thing. The best we could come up with is that a Panther system should realize it’s connecting to a filevault home directory, and remount the .sparseimage locally again, so that the only thing going over the wire is encrypted disk image. This has the advantage that you could host these things on a linux / Windows server as well. But I have no clue how you do locking on a .dmg, it sounds too horrible to contemplate, so you’d need a way of negotiating with all the other clients so they couldn’t mount the drive at the same time.

So yeah, the current system has the advantage of being very simple, and Just Working. But not having network access to my home directory unless I’m logged in will be annoying.


useful things that rendezvous should be able to do:

  • detect an SMTP server and set or whatever client you’re using to send through it
  • Detect the equivalent of a Domain Server, and add a ‘log onto local server’ option in the login screen that will pull down a profile from a server, so you get workgroup functionality merely by being on a local network with a workgroup server
  • I want iCommune back, but in a way that works.

I also really want these things to work from non-apple machines as well – I want the server at home to advertise the house music collection and SMTP server, despite the fact that it’s a linux box. But that’s harder to whinge about.

from a conversation with blech.


sharpreader – a windows RSS feed reader. Uses .NET, which is all the rage nowadays, apparently.

It’s beautiful, easily the best RSS reader I’ve ever seen, and that includes the one I wrote :-). Proper OPML export / import (It’s amazing how meny readers get this wrong), the interface, although slightly hard to figure out makes a lot of sense once you get the hang of it, and frankly usability and learning curves can go hang once I can use the thing.

The nicest feature, though, is the threading. I’ll notice which other blogs you read have linked to this one, and will do the litte ‘+’ symbol thing so you can expand them and see all the interlinks. It’s niiiiiiiice. I’m suddenly tempted to go back to “lectern”:/programming/lectern and hack this in somehow, though it’ll be hard. Maybe I’ll write a mac one and steal the niche of NNW. Maybe I’ll write a bad alpha and get distracted by some other project. Yes, that seems to be the best idea.

Software interfaces evolve like this, it’s wonderful to watch. Web browsers are another fairly immature tech that grow “tabs” and other interface things, and that’s nice to watch too, even if they’re stupid. Genuinely new types of apps are rare, I can’t think of many off the top of my head, although obviously once they’re pointed out, it’s obvious…

blech has been on at me recently to finish my half of our evil ‘Wire and string’ project – it’s a cunning, cunning plan which we really should put more effort into. Anyway, here’s a heap of self-congratulation that I’m done, and he should get off his butt and implement the other half.

Essentially, the problem is as follows: We have a computer in the lounge that can play music, hooked into the network and the stereo system. But there’s a complete lack of decent software to control the thing. We searched and searched, and all the interfaces we could find sucked.

Now, the best music control interface we know of is iTunes. We want iTunes to control what is being played on the lounge machine. But it’s not a mac. Hence the goal – have iTunes on a mac locally, pick up what song is selected/playing, and send that to the lounge computer, which will then play it through the amp. blech took the iTunes half (the Wire), I got the server half (the string).

Now, there are no non-awful MP3 playing interfaces for perl. None. Almost everything that I could get to compile at all (and didn’t need non-free libraries you can’t download any more) wrapped either mpg123 (now that’s a pretty web page) or xmms. The mpg123 wrappers seemed to be the best bet, and for the most part they work, but there are… issues. I didn’t get proper events for songs ending or stopping, it was quite easy to wedge the thing to the point where you couldn’t control it any more, etc, etc. | believe these are limitations of the command line mpg123 interface, and I can work round them, but I don’t want to have to patch the source code just to get a working system, and it makes distributing things a complete pain. I also need the server to be absolutely robust, it’s no good having to SSH in every 5 mins to fix the server – the whole point is to avoid having to think about it.

Wrapping xmms isn’t much of an improvement. It’s got a much nicer interface to control it, but, of course, it’s controlling xmms, which is a seperate app that needs to be running, and it needs to be running on a machine with an X server. Hard, given this is a headless server.

But, in the end, that’s what I used. I was saved by Xvfb – I can run an X server on the machine without having to worry about graphics cards, and launching xmms from the cgi is possible, so it will run as the right user and everything. After a lot of messing with annoying permissions, I have a CGI that will make noise.

The other problem is that the Mac only knows where the music is on the machine locally. Rather than having the iTunes end convert the local path into something the server knows about, I take anything that might possibly be a path to some music, and trim things off the left of it till the right hand side matches something in the ‘locate’ database. Disadvantages – you need an up-to-date locate database. Advantages – you can pass just about anything that is music, and the server will have a shot at playing it. In practice it works really quite well.

So, yeah, code . w00t.

the broken desktop metaphor

There was a throw-away comment by Dan Hill in an article on Elite about the desktop metaphor and the workarounds we have to use to make it work. Now, I don’t think exposé is a work-around. I think it’s the most sophisticated window-management system I’ve ever used, it’s lovely. But it does hilight something that’s need nagging at me for a while. The Desktop.

Now, essentially, the desktop metaphor is broken. It’s not a desktop at all. It’s far too small, for a start, I’ve heard it described as the airplane seat metaphor. But the most important distinction is what’s underneath all your bits of paper. Suppose you have a real desk. Pick up all the things on it and look underneath them. What do you see? You’ve got a completely blank desk. Ok, now hide all your windows and things from your computer ‘desktop’. Got a blank desk? No? Didn’t think so.

Eventually, everyone needs a hack in their windowing system so that they can get at the desktop. Windows has ‘Minimize All’, or in extreme cases, ‘Show desktop’ (there’s a difference between these two. Try explaining the difference to a non-geek). For me, Windows always seems neatest with all windows either maximized or minimized. The fact that the only graphical way of getting at your hard disk is the ‘My Computer’ icon on the desktop means that you need to be able to get at it easily. Mac OS X 10.2 and before never had a really good solution to get at the desktop. There are various third party hacks but the only decent way I ever used was to Command-Option-Click on the desktop, or Command-Option-H with the Finder focussed. This hides everything except Finder windows. Of course, if there are Finder windows blocking your desktop, you’re stuffed. Ah, well.

Exposé solves this – one button and all your windows get out the way. Yay! Finally they’ve solved a problem Windows solved 5 years ago. (Or whenever, I don’t care).

I’m tired of working round this. I can shuffle through all of my windows with Command-Tab, but I can’t get to the desktop without moving all the windows out the way? This is an annoying special case, and I don’t like it.

New philosophy. Nothing will go on the desktop. Nothing at all. I won’t display drives on it, I won’t save files on it. I’m going to change it’s permissions so that I can’t write to it. My default download folder will be a folder in my home directory. We’ll see how long I last before I go insane.

Update – I follow this up here

The Finder Toolbar

The Mac OS X Finder has an interesting toolbar. blech will happily rant about it for hours, and I agree with him, toolbars do not belong on Finder windows. Or at least, not in the icon view Finder windows, and neither of us like the Browse view at all. But that’s missing the point. I’m convinced the toolbar on Finder windows is a vestigal shelf, although I can’t find anything on the web that backs this up, and I’ve never used NeXTStep, where the shelf was originally seen. You can drag things onto it from finder windows, and they’ll stay there and you can run / open them by clicking on them.

The way it fails in this is that you can’t drag files off the toolbar into another folder and move the original – dragging things off removes them from the toolbar. Arguably better from a least-surprise point of view, but it removes one of the nicest things about the shelf, it’s use as a scratch area. Oooh, thought, this is exactly how the right hand side of the dock behaves, except you can’t drag apps onto the right hand side of the dock.

Oh, and there aren’t any tooltips, so if you have ‘icons only’ toolbars, you can’t tell where things point. That’s annoying.