Category: Sci/Tech

AJAX (by )

Eeeeeaaarrrggghhhhh....

People seem to have found a new way to make Web pages that aren't very usable for the blind.

AJAX is its name, and it's causing a lot of excitement about creating "rich user experiences".

I automatically cringe when I hear that. The Web works because HTML doesn't really define the "user experience", it defines the structure of a document with headings and text and links and stuff. You can layer on a "user experience" with some optional, ignorable, CSS. This means that screen readers can ignore the "user experience" designed by people who assume everyone can see a two-dimensional display surface, and examine the actual structure of the page.

Garbage collection (by )

One of the interesting little problems in converting a CPU, some RAM, and a bunch of I/O devices into a useful system is memory management.

Your everyday PC with 512MB of RAM contains about 512 million little memory cells, each of which contains an eight-digit binary number. This is where all running applications, and all the information they are dealing with, must be stored; programs, text, images, and whatnot are all encoded as sequences of these eight-digit numbers (known as bytes) and stuffed into memory.

The problem is - where to put everything? After all, when you double click on a program, the computer looks at the size of the program on disk, and needs that many bytes of memory to load the program into. How does it know which bits are free and which are in use? Different computers have different amounts of memory, and may be running any combination of apps already, so there's no way to reserve a given bit of memory for a particular program; the system has to keep track of what's in use and what isn't in real time. And when you load your app, it will start asking for bits of memory to keep track of the windows it has open, to store your document in, and so on.

Now, the first problem to be solved is how to keep track of which bits of memory are in use and which aren't, in such a way that the computer can efficiently find a block of free memory of a specified size - that problem is harder than it may seem, especially when you consider that multiple threads of execution will be requesting memory at once. But that's not the problem I was pondering as I sat on the train today.

My problem is how to figure out when a block of memory isn't used any more, so that it can be handed back to the system that keeps track of free blocks and reused.

SpotMeta (by )

My friend Ben Summers has been busy developing SpotMeta, which is a nifty tool for Mac OS X (Tiger).

The hole that SpotMeta fills is a basic omission in how Apple have implemented Spotlight, their system for indexing files for rapid searching.

Spotlight works by being notified whenever a file is modified. It then looks at the file type and invokes an appropriate "importer plugin" for that file type, which extracts relevant searchable information from the file. For example, the PDF importer extracts the page count and page size from the file. The result of the importer is a bunch of key=value pairs, plus a summary of the plain text content. Spotlight merges this with basic information from the filesystem - file size, last modified timestamp, creation timestamp, file name, that sort of thing - and indexes the result.

You can either do a quick search for any given string, which will be looked for in the indexed content as well as in all the indexed key=value pairs, or you can set up a structured search query - telling the system to find files with a modified date in the last week and whose content contains a certain phrase, for example.

However, this is rather limited in some ways. For a start, only one importer is applied to a given file. That's a problem, since many file formats have support for optional extra application-specific information within them. A PNG file, for example, might have an importer that extracts the standard comments field inside a PNG, but a scientific visualisation application that extends PNG files with extra information about the units of the axes will either need to write a whole new importer that provides the standard PNG fields as well as their own - or just live with their users not being able to find images that show a time axis with an accuracy better than 3ms.

On the other hand, Tiger's file system allows you to store arbitrary key-value pairs for any file - "extended attributes", in computing parlance. Yet Spotlight doesn't bother indexing these attributes, and it's not easy for a normal user to view or edit them.

SpotMeta does three things that, together, rather neatly solve these problems.

  1. It provides a nice user interface to edit extended attributes. A metadata schema editor is included, which lets you define your own keys - you might have a choice field with a given list of options, a multi-choice field with a specified list of checkboxes, and plain text, date, or numeric fields, as well as a few other options. Then you can use the Finder context menu or a keyboard shortcut (from within the finder or an application) to edit the attributes of the selected file, according to your definitions.
  2. It provides a framework for extending the Spotlight importing process. Basically, it allows other importers to run as well as the "native" importer for a file, and merges their results with what the native importer proides. So the author of the PNG-based sci vis package could write an importer that just reports on their extensions to PNG files, and have it run as well as the native PNG importer.
  3. It provides an extension importer that reads the user-defined extended attributes and indexes them, so they can be searched for with Spotlight.

The net result is that you can define (and subsequently refine as you wish) a tagging system for your files - I already organise my directory structure by client and project, so tag my files with the project lifecycle stage they relate to (legal, requirements, specification, implementation, documentation, ...) and whether they still require action. Then you can search for files based on your requirements - I can find all legal documents I've not dealt with, and what's more, I can create a 'smart folder' that will always show the result of the search (changing in real time as I alter my files).

Neat stuff!

No more CPU fans (by )

Mmmm, my fanless mini-ITX motherboard is now running.

NetBSD is happy with it - had to deal with fxp0 turning into vr0 and the UPS being on tty00 rather than tty01 (it only has one serial port), but apart from that, all is now fine.

So all my files are back!

Right, now to resume the backup job I was in the middle of when the server died... always a nasty time to have a server death...

In the meantime, for the BSD geeks out there, here's my dmesg: Read more »

CPU fans (by )

Ugh. The CPU fan on my home file server died on Monday. I'd been suspicious of it in the past, since the machine kept hangling oddly, but opening it up showed a fine spinning fan, so I assumed it was just bad luck.

But the day before the kernel paniced deep within VFS locking code, during a dump. And after a reboot, gcc threw a signal 11 and died, but worked when run again. Then the machine paniced again on Monday. so I rebooted into the BIOS to look at the hardware monitors (the NetBSD envstat drivers didn't find anything they liked in my chipset, alas) and found the CPU at 75 degrees.

Uhoh!

Read more »

WordPress Themes

Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales
Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales