talideon.com

Blackout Ireland

Entries for April 2005

April 4, 2005 at 8:03PM Shock! Horror! This site looks fine in Opera!

I haven’t looked at Opera in a very long time. Not that I dislike that browser or anything: I just haven’t bothered installing it anywhere.

Well, just for fun, I decided I’d install it and see how much of a mess it would make of my CSS. I was happily shocked to discover that it worked almost perfectly!

So a pat on the back to me (’cause I know for sure that any wierdness isn’t my fault) and a pat on the back for the guys at Opera too!

BTW, I’ve another reason for installing Opera: I want to practice working with small screen devices. There’s no reason why sites should look awful on modern mobile phones, and I want this site to work on them.

April 8, 2005 at 4:55PM I have some really strange old code.

I found this sitting amongst some old JavaScript libraries of mine:

function _DefaultHandler() {
    return true;
}

function AttachEventHandler(obj, evtName, fn) {
    var oldHandler = obj["on" + evtName] || _DefaultHandler;
    obj["on" + evtName] = function(evt) {
        evt = evt || window.event;
        return oldHandler(evt) && fn(evt);
    }
}

A few thoughts:

  1. This is rather clever! Obviously I wrote this under the influence of alcohol. [wink]
  2. Was I doped up on Perl when I wrote this?
  3. When did attachEvent() and addEventListener() become mainstream? And why didn’t I use them?
  4. A bit closure-happy, isn’t it?

In case anybody’s wondering, this code isn’t quite what I first found: the original code used eval() to get the originally assigned handler and again to assign the new one. Urgh!

April 15, 2005 at 6:40PM I’m sick of CF5, and want to upgrade

The server this site is running on is running CF5, and I’m at the end of my tether with it. There’s some really cool stuff I want to do, especially with FusionWiki, that would require me to use at least CFMX, but I can’t because of this blasted server.

I’m very close to moving this site over to the new server.

April 18, 2005 at 4:25PM Shower Ideas

Is it just me, or do all the most kicking of ass over fences ideas happen when you’re in the shower? I’m just after having one of the best ones ever--programming-related, of course--but it’s one of these I just can’t reveal as yet, no matter how much I want to.

It’s an idea for a product for work. Well, part of a nascent product, but such a major part that if everything works out, Digital Crew could actually manage to change a large number of people’s ideas about development radically.

This is just so incredibly cool!

April 26, 2005 at 11:01PM Hacking Greymatter pt. 1: First attempt.

I spent a good five hours last night trying to do some light refactoring on Greymatter. I thought it would be fun to exercise my Perl-fu on it.

So I sat down, threw on some Boards of Canada, and hacked. First I scanned the code and looked for whatever low-hanging fruit I could. The first thing I thought to do was to take each function one-by-one and make their variables local using the my operator, and the same for file handles with the local. This turned out to be more soul-destroying than I though.

The thing is, the functions were just too big! So I changed my tack and thought that I’d try refactoring all the file loading and saving code into their own functions. I mean, from scanning the datafiles, it all looks similar enough. Only it’s not.

So, why not try factoring out the date processing code? With this I’d more success: I actually managed to create a bunch of functions that encapsulated all that (needlessly extensive) date-processing logic. Mostly.

But even then, it just wasn’t enough: I decided the only way was to design a new and better way to store the program’s data, write a script to extract the data and convert it in the new format. That I’m going to do this weekend.

When I’ve that done, I’m going to extract all the backend templates, and using only the manual, I’ll write something that is, on the surface, functionally equivalent to the current version of GM.

I’ve a layout for the new backing store worked out. There’ll be one file per entry, and one file per comment. In both, the file format will be a header containing name/value pairs, followed by a newline seperating the header and body, and then the body. Karma will be stored in its own file.

Equally, templates will be stored in their own files for both the blog itself and the administrative console. The blog metadata will be stored in its own file, as will the counters and so on.

Whether these will be stored in their own file format, or be Perl code, I haven’t yet decided. The templates will be just plain HTML files, and I’m thinking of simplifying the templating language, mainly to make the tokens shorter, and to implement file inclusion and simple iteration. I’ll be converting over my old PHP FastTemplate clone (which doesn’t suck as much as the original Perl one), which does most of that as it is.

Oh, and it’ll use CGI.pm, goddamnit!

Let’s see how it goes.

April 28, 2005 at 7:26PM Dumb Terminals and Windows Remote Desktop

I’m spending a lot of time connected via Windows Remote Desktop to an external network so that I can do work on their machines.

So here’s a question: are there any IT departments out there that are using this to give their users old-style dumb terminals so as they can reduce the amount of maintainence they need to do, and their costs?

The setup’d simple enough. All you need a bunch of basic machines with decent graphics cards and a decent monitor. They needn’t even have harddrives: all the software could be stored in ROMS. All you need is a machine fast enough to do any necessary compositing, to redraw the screen quickly, and to send any data from the keyboard and mouse down the line. You’d have totally silent machines that consume very little power.

The only software the client boxes need are a basic OS that can do sufficient networking to support the desktop client. The OS needn’t even support the kind of sophisticated multitasking that a full system would need.

On the server side of things you could have a gateway that would receive initial connections, and farm them off to one of an array of identical boxes behind it, maintaining a balance across all of them. This would allow for a degree of redundancy, so if you were doing upgrades, you could do them without anybody noticing (more or less), and if one of the boxes died, the only people who’d need know would be IT staff.

Most users only use a fraction of their machine’s processing power most of the time, so I really doubt they’d feel any slowdown as long as everything felt responsive to them.

Of course, such machine might not have the same kind of eye candy as standalone boxes, but that’s not a consideration here.

History has a habit of repeating itself. Maybe with the availability of broadband and fast LANs, it’s time for people to take a serious look at timeshare again.

PS. Don’t bring X up: (un)fortunately it’s not used widely by ordinary users, and therefore not used widely by your average corporation.

PPS. The X protocol sucks. There, I said it. NeWS was much cooler, it’s just a pity Sun didn’t have the cop on to make it open. In some ways it’s a bit of a pity that Display PostScript and NeXTStep (which rocked even more) or something else open and in a similar vein didn’t appear first.

PPPS. This is making me nostalgic about RISC OS again. The only difference between printing and redrawing the screen was the drawing context. So combined with the SpriteExtend, Draw, and FontManager modules, you’d virtually the whole package there. Sigh.