Posts from April 2003.

Non-objectivity in football

BBC Five Live – He’s hit the bleeping post: a collection of local radio football commentators’ less than objective moments. I bet Motty is dying out to be able to be this happy about goals sometimes.

—–

Latent Semantic Indexing

Latent Semantic Indexing is a newish technique for indexing documents; essentially, you get a list of all the important words in all your documents, then build an n-dimensional space (where n is the number of words in the list), and each document takes a place in the space according to whether it contains each of the words or not. You can then compare two documents for similarity by looking at each document’s vector in the space (the line between the origin and the document’s point) and seeing how small the cosine of the angle between the two vectors is.

This is basically how Autonomy works. I’m interested in this because, if it can be implemented, I don’t have to buy Autonomy :)

Sleep and newspapers

Seems like a lot of people are having trouble sleeping. I know what you mean, although I’ve been doing this for nearly two years now and y’all are just jumping on my bandwagon, yeah.

I’ve been slowly psyching myself up to implementing Don Park’s idea of a newpaper UI for an RSS reader. And then he goes and starts writing it himself. Swine. Although, looking at it, it’s done in the American style: English broadsheets aren’t quite as aggressive in displaying a byline for each article. This is both a good and a bad thing; good in that it means you’ll be focusing on content, not on who wrote it, but bad in that I do focus on author because some authors do consistently higher quality work. Then again, I suppose the argument here is that you only read what you consider to be high-quality feeds.

Wouldn’t it be nice if everyone had categorised their post categories list with XFML so that you could group up posts by category in the newspaper? I know Aquarion did, and I’d imagine Mark has, but certainly it’s not a massively common thing. I wonder how Don plans to get around this? If Mono worked then I could run his .net thing when it comes out.

Memo to self: will Mono run Syndirella? After testing, it seems not: running the exe throws an error (”Assembly ‘Syndirella.exe’ has the non-standard metadata heap #-. Recompile it correctly (without the /incremental switch or in Release mode).Can not open image Syndirella.exe”), and I can’t get mcs, the Mono compiler, to compile the code. (For a while mcs died with a Wine error before I worked out that you have to do “mono mcs foo” to run it. Nonetheless, it throws a parsing error on IHTMLDocument2.cs, and I know nothing at all about C#, so I don’t know how to fix that.

None

Bits and pieces

A load of odds and sods:

Chandler 0.1 is out (via Mitch, Ned, and Ted). With an RSS reader called ZaoBao as a supplied parcel. It needs some work, but I’m already liking ZaoBao, and if I get a chance I’d like to hack on it to help out.

Talking today with a guy at work about .NET and how it handles XML: I use the DOM for this sort of thing, but apparently .NET has more advanced handling. I’d be interested to see how this works; I don’t know any decent way of parsing XML other than the DOM or SAX, so I need to look into it.

Ronaldo talking about A Canticle For Leibowitz has prompted me to actually go and get it, which I have been meaning to do for years. Hope it’s as good as he says.

Nina Simone is dead (via Meg). This is a tragedy; she was one of the last great blues singers, right up there with Sarah Vaughan and Billie Holiday, and Feeling Good is one of my favourite songs.

Sam writes down some of his thoughts about the evolution of RSS. It looks like people are really starting to get a handle on this sort of thing, which Tim notes that we need to do.

Still can’t work out how to do Vellum plugins.

—–

Show applicable styles

This is far and away and without a shadow of doubt the most complex bookmarklet I have ever written. It’s in response to Simon’s challenge and then his further rebuttal that my previous attempt didn’t quite do what he was looking for. Jesse at SquareFree also came up with an implementation, but then went on to say, "Simon actually wanted a bookmarklet that would show the style rules that apply to an element, like the DOM Inspector does, but I don’t think that can be done in a bookmarklet".

Red rag to a bull, that.

So, the International House of Kryogenix presents:

Show applicable styles

What this should do is (eventually) pop up a separate window and then display, in that window, all the styles in your stylesheets that affect the element you’re currently hovering over.

This will almost certainly not work in your browser. Whatever browser you’ve got. It works for me in the latest Phoenix (er, Firebird) nightly build. I’d be profoundly shocked if it worked in IE, and it will just not work in Opera or Safari at all, I imagine.

Big, big caveat 1: it does not work for sites which have a stylesheet which @imports a sheet (to hide styles from NN4). As far as I can tell, @imported stylesheets don’t appear in the document.styleSheets array. Not really a lot I can do about this, I don’t think. This means that Simon’s site won’t work, that diveintomark won’t work, ad nauseam.

Caveat 2: if you find it doesn’t pop up the extra window (and throw a Javascript error about newwin) then you might want to check that you’re not blocking popup windows, and unblock the site you’re looking at. Took me half an hour to work that out.

Anyway, if it works for you and you find it useful, good stuff. I might write up something on how it works, if I get a chance.

Justified true belief

True story (not mine; someone else’s): My friend, N, and I walk through the philosophy dept and finally find our professor sitting in an office. N looks around and says “Wow! You sure have a lot of books.”

Without even a second’s pause the professor says “That’s an excellent example of why justified, true belief is not knowledge. You obviously believe I have a lot of books. And you are justified in thinking so since I’m a college professor. And it is indeed true that I have a lot of books. However, this is not my office.”

Only people who have read any philosophy will find this funny. :-)

None

Show computed styles bookmarklet

Simon Willison, annoying bastard that he is, throws down the gauntlet:

This is certainly a problem with CSS layouts – their maintainability can suffer due to the separation of the presentation from the layout (itself the greatest advantage that CSS provides). Tools such as the ViewStyles, ancestors and ShowDivs bookmarklets certainly make this easier but to my knowledge no one has written a bookmarklet that shows the inherited styles for the currently selected element – at least not yet. Pixy’s List Computed Styles comes close, but shows styles for every element in the document all in one big window.

I am busy, dude!

Nonetheless, I have taken time away from banging my head against plugin handling in Vellum (and watching The Matrix again, I admit), to sort out:

Show computed styles for element

This should, when clicked, pop up a new window and then show you the full list of styles (there are a lot!) for an element as you mouse over it. It builds on my work with the Q element (and computed style) and the SquareFree ancestors bookmarklet. It could do with prettying up a bit. It would also be very good to not show things which are set to the default value (i.e., have no style overrides and are being displayed as the browser does it natively) but I don't know how to know what the browser default is. Someone else can make this a nice usable bookmarklet, but the structure is here.

Tested in Phoenix 0.5 on Linux only; it should work with IE, but no guarantees.

None

Django Beckham

The new Pepsi ad is pretty good. It features the Man Utd team in a wild west setting. Oh, and Roberto Carlos. There are a couple of things that stick with me about it, though.

First is Our Dave B’s voice. Yeah, looks pretty hard in the leather poncho and hat and all. So why spoil it by sounding just like Graham Norton when ordering his Pepsi at the bar? Ridiculous.

And the second? From the website:

Pepsi, has a strong heritage with football and has enjoyed past and present relationships with some of the biggest payers and clubs, including David Beckham, Roberto Carlos, Raul Gonzalez, Rivaldo and Juan Veron and Real Madrid and Manchester United. By inviting consumers to get closer to their world class football talents and taste stardom, Pepsi is again showing its dedication in providing unique football experiences and adding excitement to consumers’ daily lives.

Biggest payers, eh. Real and Man Utd. Yep, you were right the first time.

None

—–

Obituaries

Good news, bad news.

It seems that CNN inadvertently put up publically their obituaries-in-progress for some notables, such as Fidel Castro, the Pope, and Nelson Mandela, all of which are based around their obit of the Queen Mum (which explains the bit about Fidel’s life as the Queen Consort).

The bad bit

One obituary yesterday, however, was not placed in error. It seems that Eric Meyer’s mother has died. Our thoughts are with you, Eric and Kat.

None

—–

I hate computers

You know how I was supposed to be working on Vellum, right? And thinking up a new name, the current lead candidates for which are "Vellum Polygon" and "Vellum Palimpsest" — thanks for the suggestions, all, by the way: I actually prefer (after Dorothea) the second (Vellum Palimpsest), but I’m not sure I can face typing it in a lot, and it doesn’t have namecheck recognition except to word geeks like me and Dorothea, even if we are destined to rule the world and all you illiterate riffraff. Anyway, right, on top of that I’m also about to start playing with the Blender3d game engine for the Bloke vs. Bloke project. I’m also trying to write a thing that lets you split up one long mp3 of an album into its constituent tracks (not automatically; you have to go through and set where tracks end, but it should be nice and graphical). All fun stuff.

So, naturally, nature reacts to the idea of me being able to do fun stuff by creating work for me to do that must be done first. Nature being the bitch that she is, her green and pleasant self is inflicting on me the thing that fills me most with dread.

Computers breaking.

You see, I hack on applications. In scripting languages. Something going wrong with a computer at a lower level — hardware failing, kernel not working, crashes — is about six abstraction layers below what I do, and I am therefore completely crap at it. Recompiling a kernel is stressful — not that I can’t do it, I just hate having to sod about at that sort of level. I’m much like jwz in this sort of thing; that’s a solved problem. I have to recompile my kernel, because the usbdnet stuff to connect to the Zaurus lets me put individual things over using FTP (and I use my handy ipkgput script) but locks up the whole machine if I try and do anything larger like, say, back the fucker up with QtopiaDesktop. Apparently there were some bugs which have now been fixed, but I have to upgrade to 2.4.20 and repatch the kernel with usbdnet. Which means worrying about whether the alsa stuff will work after I’ve built the kernel, which it probably won’t. Oh, and when my machine reboots it sometimes doesn’t start up again, because it doesn’t think that there’s a fan plugged in to the motherboard, and so the BIOS stops it booting. Even though there is not only the chip fan but a separate fan that doesn’t do anything (it just sits in a hard drive bay inside the machine, out of the way) just to try and convince it that there is a fan plugged in.

So, that’s what I have to do to my machine. I found out on Wednesday that the fan in angel, the machine that hosts kryogenix.org (and dellah.com, and a few other things), is beginning to die. So, I need to fix that; really, what I need is to buy a new angel, because it’s pretty slow, which means I need a ton fifty that isn’t going on any other projects, which I haven’t got. The fan in tara, the firewall (an identical machine to angel) is also beginning to crap out, and if that dies I don’t have a spare machine to put in its place, which would be a catastrophe.

And finally, spike, my wife’s machine, is almost completely fubar. It crashes.

Without warning. For no reason. Under both Linux and Windows. It doesn’t seem to be reproducible, and it doesn’t happen if you just leave the machine sitting there not doing anything. But you can’t do anything (read mail, surf the web, play Escape From Monkey Island) for more than about ten minutes without it either locking up solid or rebooting. Oh, and then of course it has to fsck all the drives, and fsck can’t automatically fix the problem and therefore goes into Emergency Panic Mode and makes you log in as root and run fsck yourself (and lean on the “y” key), which is obviously brilliant for Sam who doesn’t even know what fsck does. How the hell do you troubleshoot a problem like that without, oh, just replacing all the components in the machine, which I can’t do on grounds of both technical ability and component shortage? I’ve got a whiteboard with a list of about fifteen things on it that are wrong with various computers here in Castle Langridge. Printing doesn’t work from spike or giles. Syncing the Palm IIIx doesn’t work on spike. DHCP on tara isn’t issuing the same IP addresses back to machines when they’re rebooted, so the port-forward of port 22 to giles so I can ssh in from outside doesn’t work. The mouse attached to dawn appears to be giving up the ghost, and I haven’t got any more serial mice. On and on and on until my head explodes.

Computers are shit. I’ve got this enormous pile of medium or incredible difficulty stuff that I need to do, and it’s sapping my will to live. I’ve got this Easter holiday to fix it all while I have some time to myself, so I might be quiet for a few days.

Then again, I might be very unquiet for a few days as I browse the web and post a lot to avoid work, which is a not unreasonable estimate of what I’m likely to do. I should get on with it now. But I think that I’m going to have a drink and read a book for a bit.

A couple more things

I fiddled with the design again,, as you may have noticed, after everyone in the universe complained about it :)

Thinking about a new machine to replace angel, this webserver, I am bloody tempted by the idea of Xbox-Linux, especially since there’s an unofficial Debian port. You need a modchip for the Xbox to run it: where do you get that kind of thing from? Computer shops? Or is there some kind of underground black market? It’d be great to not have to worry about the hardware etc all fitting together right, I don’t need to worry too much about special USB plug converters because the box is headless and remotely hosted and therefore doesn’t need a mouse and keyboard, and it looks like I could probably pick one up for sixty quid or so on eBay. Besides which, it would be cool upon cool. Modchips seem to be about thirty quid after a quick web search, so with less than a ton I’d have a full-on functional super box. With a big X on top.

Ask Al-Sahaf!

Fabulous article in the Grauniad’s football section: Ask Al-Sahaf, your chance to ask the Iraqi information minister for football advice.

Dear Mohammed Al-Sahaf, I am fat and useless and have scored half as many goals in twice as many starts as Milan Baros. What do you suggest I do? Yours, Big Emile, Toxteth

I am still in hysterics.

New names for Vellum

Since, as alluded yesterday, I need to retitle Vellum a little, I’m interested in suggestions. I’d really like to call it ‘Vellum [something]‘ (or possibly ‘[something] Vellum’, because then I can keep all the Googlejuice and links I have built up already, which would be rather nice. Ideas? So far, my best effort is ‘Vellum Leaf’, which isn’t great. Creative people, help me out!

Designs change, and stay the same

New design, as you may have noticed. I started to get really sick of that beige background. The new one’s not perfect, but at least it’s not orange. :-) Only had to change the CSS, too, which was handy, although I did take the opportunity to remove the footer, which has been annoying me for ages.

Bits I forgot to mention:

Nice buttons
I’m using Nick’s HTML versions of the Antipixel buttons, and very nice they are too.
Pre text
I got completely sick of preformatted code screwing up my layout. So it’s now displayed in a scrollable fixed-width area which won’t break stuff. Yay!

None

Be a made man

How to join La Cosa Nostra: a set of articles on entering the Mafia, becoming made, and becoming the boss. Just in case you ever wanted to know.

Repeat until false

Things programmers do that they know shouldn’t work but they try anyway, and which sometimes actually work, such as recompiling everything. — The Jargon File on voodoo programming

Well, it looks like Vellum needs an overhaul. This is because I cannot work out a way (by which I mean a non-evil-hacky way) of allowing plugins to interfere with the display of pages. For example, there’s no way that a “Preview” plugin could tell the Vellum core to display the previewed text and ask for the user’s agreement, or for an HTML Tidy plugin to display the tidied HTML for checking before posting. Damn. This means rethinking how the whole thing works, I think, having spent about two months trying to work out a Better Way of handling it without breaking the whole thing, which I am very annoyed about indeed.

Moreover, Vellum GmbH, manufacturers of Vellum CAD, asked me (politely and nicely) if I’d consider renaming the package so that it doesn’t clash with their commercial product. Now I know how the ChimeraCamino people felt. So, I shall be rethinking. Damn. I hate it when I get things wrong.

Antipixel buttons without images

Last night I got the idea of trying to replicate the pretty Antipixel buttons without using images (prompted by a comment there from jwz). Then I fell asleep in my chair. This morning I discover that Marek Prokop has already done the right thing here. However, I think his styling’s a little overwrought. Marek creates his buttons as a DIV and then adds a link inside, and spans inside that:


<div class="w3cbutton3">
      <a href="http://validator.w3.org/check/referer"><span class="w3c">W3C</span> <span class="spec">XHTML 1.0</span></a>
    </div>

I prefer a slightly simpler version:


<a class="silbutton" href="http://validator.w3.org/check/referer"><strong>W3C</strong>
<em>XHTML 1.0</em></a>

Then you change Marek’s CSS slightly:


    .silbutton {
      margin: 1em 0;
      width: 9em;
      border: 1px solid #ccc;
      font-family: helvetica,arial,sans-serif;
      font-size: 70%;
      font-weight: bold;
      display: block;
    }
    .silbutton:link, .silbutton:visited, .silbutton:hover {
      background-color: #fc6;
      color: #000;
      text-decoration: none;
    }
    .silbutton span.w3cstrong {
      padding: 0 0.4em;
      background-color: #fff;
      color: #0c479d;
      font-weight: bold;
    }
    .silbutton em {
      font-style: normal;
    }

(i.e., style the A element directly, rather than wrapping it in a div and styling the div). I’ve also used semantic tags that seem appropriate, rather than named spans; it seems to me that "W3C" should be strongly emphasised in this, and your level of compliance emphasised over ordinary text.

Anyway, only minor tweaks. It would be nicer to emulate Antipixel’s actual (very pretty, but still all text and colours and borders, which should be doable in pure HTML and CSS) buttons, which I shall have a crack at later if someone doesn’t beat me to it :)

The Q tag and JavaScript

Simon has put together a semi-solution for IE’s failure to obey the CSS quotes declaration. He goes on to note a couple of problems with his solution:

There are two main disadvantages to this solution: It introduces an invalid property to your CSS, and it could result in duplicated quotes in IE 7 should that browser finally fix the lack of quote element support.

Both of these are, I think, soluble. Obviously, the first, invalid CSS, would be simply solved by not using MS-proprietary IE DHTML behaviours. You know it makes sense.

The second is a little more complex and requires a bit of guesswork on my part. It is possible in both Mozilla and IE to (at least theoretically) get the computed style for an element from JavaScript. This computed style dictates how the element is actually being displayed, covering all style declarations that apply to it (from external and internal stylesheets, inline style, and JavaScript changes); the more familiar element.style collection only covers the latter two. Moz does it the standards-compliant way, using document.defaultView.getComputedStyle(element,'') to get the computed style for element, but it’s somewhat ropey in terms of how well it actually works. IE uses a proprietary element.currentStyle collection. So, using one of these, we can see the full computed style for the element. Now (and this is where the guesswork bit comes into play), I have assumed that IE’s complete lack of support means that it will not include quotes in the computed style of an object, even if a quotes attribute is applied in the CSS, and indeed this does turn out to be so. I’ve also assumed that, should IE7 change to support this CSS declaration, they’ll make its value settable from JavaScript, which would mean adding it to currentStyle for an element. So, if we get the computed style for an element with quotes applied, and it does reflect your application of the quotes directive, we assume that the browser handles it and leave it alone. If, however, you apply quotes to an element and that application is not reflected in the computed style, we assume that the browser doesn’t understand it, and we can then go on to manually apply quotes as Simon’s code does.

How do we check for quotes showing up in the computed style? Like so:


quotesElements = document.getElementsByTagName("q");
if (quotesElements.length > 0) {
  q=quotesElements[0];

  if (q.currentStyle) {
    s = q.currentStyle;
  } else if (document.defaultView &&
document.defaultView.getComputedStyle) {
    s = document.defaultView.getComputedStyle(q,'');
  }
  supportsQuotes = false;
  for (prop in s) {
    if (prop.toLowerCase() == 'quotes') {
      supportsQuotes = true;
      break;
    }
  }
  if (supportsQuotes) {
    alert("Supports quotes declaration");
  } else {
    alert("Does not support quotes declaration");
  }
}

This code checks for a quotes declaration in the computed style of your first <Q> element.

Rush and fly

The other day, I was in the park, and I heard a youngish boy, in the midst of an activity with some of his friends, shout a phrase I hadn’t heard for years. "Me, Pete, Alex, and Chris stick." Those of you who are British, about my age, and male will no doubt be nodding in nostalgic recognition. Those of you not, well, you might well know what it means too — I’m not sure how far that particular bit of slang propagated, or whether it was ever applicable to things other than what I saw.

What I saw was some boys playing football. What the above phrase means, for those of you in darkness, is that the shouter, Pete, Alex and Chris are one team, and everyone else is the other team. This differs from just choosing those four as a team (and this is where the word stick becomes important) in that if someone new turns up halfway through the game to play, they will automatically be on the other team. "X, Y, and Z stick" is short, perhaps, for "X, Y, and Z stick together against everyone else".

A fun game of football, as opposed to the increasingly money-burdened and formalised professional inception of the beautiful game, is not only one of life’s true pleasures, and something that practically everyone who used to play it as a boy will look back on with fondness, but is also a thing redolent with strange slang. Most of this slang is peculiar to the boys’ game because of its freewheeling and informal nature; in particular, it’s often unreasonable to assume that there will be an even number of total players, or sufficient players to give members of the team fixed positions in the field. There may not even be a goal, other than that marked out by a couple of piles of jumpers and coats. The other two terms that leap at me from my memory when I think about this are “rush” and “fly”, both pertaining to the goalkeeper.

You see, it’s unlikely that a bunch of lads playing will have enough players that they can mount a reasonable attack and still leave someone in goal the whole time; imagine 6 of them playing, which is by no means an unreasonably low number. If you leave someone permanently in goal, you’ve only got two players to attack with. If your attacking teammate is marked, therefore, you are a little short of choices. (What this actually means is that you make a glory-boy run at goal, which is something that you do all the time anyway, but we’ll leave that aside.) So, the concept of a "rush goalie" was introduced. A game played with the "rush" rule allows the goalkeeper to essentially behave like an attacking player the whole time. This results in all three of our hypothetical players participating in the attack, but does mean that the keeper has to run madly back to his own goal if the other team take possession and begin their own attack. That’s part of the fun. A rush goalie is never bored, and is always more tired than the rest of his friends by the end of the game. But you do get to do everything: attack, defend, save.

Interestingly, proper football rules include the rush rule; the keeper may come out as much as he likes. You see this at the end of desperate matches, where a team one goal behind may throw all eleven players, including their keeper, into the opposing team’s goal area for a corner. Keepers very rarely do come out, though, and hence, I think, it was assumed by all of us that they could not do so under the rules (we were none of us well versed in the minutiae of the FA’s Association Football rulebook). This therefore necessitated a special rule to allow keepers to do so.

"Fly" goalie is a different beast. If you have a rush keeper, he may come out and play, but he has to be the one who runs back. A team with fly keeper may have anyone in goal, and change without warning or notification. So anyone who’s in the area can be goalie and save the ball with their hands. Technically, fly doesn’t grant rush, which means that although anyone can be nominally in goal, someone must always actually be so; one of your team must always remain in your own goal area (but who that is can change arbitrarily). In practice, however, a team granted fly is assumed to have been granted rush as well. Fly goalie wasn’t awarded very much, because it gave the team with fly a big advantage, and because it was open to abuse: when under attack, everyone on your team essentially feels that they can use their hands when in the area, because at that moment they’re implicitly the keeper. In extreme circumstances, some teams would stand in the area and throw the ball to one another, catching it in their hands, on the assumption that the goalkeeper position was passing form one player to the next after it was thrown and before it was caught. Some games tried to patch this up by stating that the change of keeper had to be made explicit in some way (normally just by shouting), but most just didn’t allow fly keepers.

Both rush and fly are agreed before a game starts, in much the same way that house rules are agreed in a game of poker; they’re suggested by someone and then agreed by general acclamation. One player may offer a suggestion for teams: as above, something like “Me, Pete, Alex, and Chris stick.” The other team may then agree, with the proviso that they get rush. In such ways is diplomacy conducted.

Machinima

Machinima (via Greg Costikyan) is a new trend for making animations using an available game engine (such as the free-software Quake and Quake II engines). This is an intriguing idea; the first step, perhaps, on the way to quality films being made without actors. Now, we already have that: cartoons have been around for decades, and Pixar/Disney made strides with Toy Story and similar. However, this technique beings the concept within the range of ordinary people, who are short of the expensive tools (and the time) required to make something like A Bug’s Life. One to watch.

The Power of JavaScript

Paul Hammond notes (in his mini links weblog) an essay, JavaScript: The World’s Most Misunderstood Programming Language. This is excellent; it covers a lot of structural stuff that JS can do that most people probably don’t realise. Frankly, I think we’ve only begun to scratch the surface of what’s possible with the combination of JavaScript and the DOM in web applications. Some of the things people are doing are library-type functions to use as building blocks (for example, Simon’s document.getElementsBySelector), some are doing work with the DOM (Andrew’s posting form), but there’s very little that’s actually putting it all together. The most obvious example of something that is is Oddpost, an emulation of the Outlook UI in a browser. Drag-and-drop mails around, popup menus, it’s all there.* There are plenty of desktop-emulations in JavaScript around, and windowing libraries, but not many people are using them. We could really move away from the whole paradigm* of submitting things back to the webserver for changes, and start pushing a lot more out to the client. Unload our servers, give users better response times. This would be marvellous. I’m still not sure that we have the infrastructure to do it, the building blocks we need to avoid writing the whole low-level interface from scratch, although I imagine that this is what the authors of those cross-browser APIs and windowing libraries are trying to change.

* Well, I imagine it is. Oddpost only works in Internet Explorer. Bah.

* I used the word "paradigm". Shoot me now. Shoot Thomas Kuhn first, though. :)

—–