Category Archives: Computer stuff

Blog Broke

For some reason, comments on this blog don’t seem to be working (and haven’t been for a while). I just upgraded the WordPress software which runs the blog, but it doesn’t seem to have helped. Rather more major surgery is called for – which I don’t have time for at the moment. I will try to find the time over the next few weeks, but in the meantime if you want to get hold of me, just email me at the usual dan at sumption . org email address.

PS, yes, I do plan to post some more stuff here soon!

Mouse-wobbling blobby things

I’ve been spending the last few days on some rather interesting ActionScript challenges. I’ve been building a sort of a lava lamp gloopy movement machine. I’ve been up to my neck in physics and trigonometry, so today when I had to change the way that the mouse moves objects around in the “gloop”, I got too carried away with triangles and tangents before coming home to think, and realising how simple it ought to be. Here’s some fun code, paste it into any MovieClip in Flash: put it on the first frame and then on the last frame, add a simple gotoAndPlay(2) so that the initialisation doesn’t take place twice. Or turn it into a proper object: this is just my quick & dirty version:
Continue reading Mouse-wobbling blobby things

Upgrade. Reboot.

Apologies for the slightly drab look around here. Just upgraded WordPress (from 2.0.4 to 2.3, in case you’re interested – quite a big leap). Everything looked fine, but there were a few small niggles. So I had to upgrade K2 as well. That’s when it all started going a bit screwy. I must have made lots of customisations to the theme last time I fiddled with my blog layout, so now I have to reverse-engineer all of them. Well… not now. When I find time. Meanwhile, please bear with me.

The day’s got a “y” in it – so it must be time to update iTunes

iTunes drives me mad.

It seems there’s hardly a day goes by without that Apple software update app popping up and ruining it for me. And of course, every time I update iTunes I then have to delete the now inoperative shortcut icon from my quick links bar (why they can’t stick the new version in the same location, like virtually every other bit of Windows software, is beyond me), I have to agree to another set of Apple T&Cs, and I have to wait while the new version “scans” my music library. Ah well, it could be worse: at least they seem to have given up on the habit of re-installing that utterly useless Quicktime system tray app, which I used to have to uninstall every time around the merry-go-round.

I’m not even sure what it is that I’m getting with these never-ending updates: I haven’t noticed any useful improvements in the last year or so. I can only assume that the updates just bolt on new ways for Apple to make money out of the iTunes store, which I never use.
I’ve finally taken the only sane route and disabled iTunes auto-updates, although it annoys me that I should be bullied into doing so.

Testing UK Postcodes using Javascript

I got very sidetracked today, creating a JavaScript routine to validate UK postcodes. I actually made it into a Dojo package, and will be trying to get it accepted into the main Dojo release, but here is an alternative version which doesn’t need Dojo:

isValidUkPostcode = function(/*String*/value, /*Object?*/flags){
// summary: A regular expression to check for valid UK postcodes
// value : the string to be tested
// flags : An object.
// flags.strictChecking: check strictly against conventions
// published in
// i.e. exclude certain letters from certain positions -
// NB These conventions may change in the future if
// operationally required.
// flags.fullCode: check for full-length postcodes, i.e. incode
// and outcode
// flags.outCodeOnly: check for outcode only postcodes,
// e.g. SW1V

// assign default values to missing paramters
flags = (typeof flags == "object") ? flags : {};
if(typeof flags.strictChecking != "boolean"){ flags.strictChecking = true; }
if(typeof flags.fullCode != "boolean"){ flags.fullCode = true; }
if(typeof flags.outCodeOnly != "boolean"){ flags.outCodeOnly = false; }

var numericPositionRE = "[0-9]";
var alphaPositionRE = "[A-Z]";

// Outcode
if(flags.strictChecking) {
var firstPositionRE = "[A-PR-UWYZ]";
var secondPositionRE = "[A-HK-Y]";
var thirdPositionRE = "[A-HJKS-UW]";
var fourthPositionRE = "[ABEHMNPRV-Y]";
} else {
var firstPositionRE = alphaPositionRE;
var secondPositionRE = alphaPositionRE;
var thirdPositionRE = alphaPositionRE;
var fourthPositionRE = alphaPositionRE;

var outCodeRE =
"(" + firstPositionRE + numericPositionRE + ")|("
+ firstPositionRE + numericPositionRE + numericPositionRE + ")|("
+ firstPositionRE + secondPositionRE + numericPositionRE + ")|("
+ firstPositionRE + secondPositionRE + numericPositionRE + numericPositionRE + ")|("
+ firstPositionRE + numericPositionRE + thirdPositionRE + ")|("
+ firstPositionRE + secondPositionRE + numericPositionRE + fourthPositionRE + ")";

// inCode
if(flags.strictChecking) {
var inCodeAlphaRE = "[ABD-HJLNP-UW-Z]";
} else {
var inCodeAlphaRE = "[A-Z]";
var inCodeRE = "([0-9]" + inCodeAlphaRE + inCodeAlphaRE + ")";

// exceptions
if (flags.fullCode & flags.outCodeOnly) {
var exceptionsRE = "(GIR 0AA)|(GIR)";
var postcodeRE = "(" + outCodeRE + " " + inCodeRE + ")|(" + outCodeRE + ")|(" + exceptionsRE + ")";
} else if (flags.outCodeOnly) {
var exceptionsRE = "GIR";
var postcodeRE = "(" + outCodeRE + ")|(" + exceptionsRE + ")";
} else {
var exceptionsRE = "GIR 0AA";
var postcodeRE = "(" + outCodeRE + " " + inCodeRE + ")|(" + exceptionsRE + ")";

var re = new RegExp("^" + postcodeRE + "$", "i");
return re.test(value); // Boolean

The Perils of Five-Star Rating Systems

There are many ways of rating “things”. Michelin will give your restaurant zero to (if you’re very lucky) three stars. All sorts of things are scored on percentage scales. On hot ot not, and elsewhere in life, you’re judged on how well you match up to being a “perfect ten”. But probably the majority of rating systems operate on a scale of from one to five stars (or… insert non-starry symbol of choice here. Or even the numbers one to five). There are very good reasons for this. A major one, I guess, is the nature of the human brain: short-term memory generally has seven plus or minus two slots for us to store information in, so if you go much over five then you risk having more discrete levels than you can actually comprehend at the same time. Also, five fits a standard scale centred around an average value, with values for good and ungood, plus extreme values for very good and very ungood. So, five is cool.

But after a few months of using iTunes and rating my songs according to their five star system, I started to run into problems. I started to want half-stars in between the stars. Or at the very least, a sixth star. Continue reading The Perils of Five-Star Rating Systems

I Hate Macs

I just discovered that the gorgeous website I built for Ed Griffiths doesn’t work at all on OS X. Not just “looks slightly wrong on OS X” but is completely and utterly screwy, almost everything that could possibly go wrong does. There’s no text anywhere and everything goes to the wrong point on the screen. AAAARRRGH!

I’d always assumed that a Flash file was relatively platform independent. Obviously not. Back to the drawing board…

Update: The website actually does work on Mac, as long as you have Flash Player 8 installed. However, unlike on a PC, it seems OS X won’t warn you if you have an earlier version of Flash installed, instead you are served a ballsed-up totally incomprehensible version of the Flash movie.

Photoshop Learning Curves

For the last month or so, I’ve been devouring Dan Margulis books, firstly Photoshop Lab Color: The Canyon Conundrum and Other Adventures in the Most Powerful Colorspace and now Professional Photoshop: The Classic Guide to Color Correction – 4th Edition. The guy writes like an angel. I can count on the fingers of one hand the number of computer books I have read which have been so compelling they’re hard to put down, and these are two of them. And as I’ve read, my understanding of Photoshop (and colour, and printing, and half-a-dozen other related topics) has skyrocketed.

For a couple of years now I’ve been wanting to get to grips with the levels command, not understanding exactly what it represents and how I can use it to improve my pictures rather than ruin them. Margulis poo-poos this rather blunt instrument and dives straight in to doing everything with curves, something I’d been even more terrified of (so much so I only had to look at the curves dialog box and I’d break into a cold sweat). Well, I’m not quite there yet with curves (my theory is running far ahead of my practice) but at least I now know what they do, how they can (in theory at least) be put to good use, and I can knock together some only slightly hamfisted curves of my own.

I’ve also learnt plenty of thing I never knew existed or were important: more LAB colour voodoo than you could shake a skull-topped stick at, what GCR and UCR are and why I need to know, how to tame the Unsharp Mask filter, how to (and why to) correct colour by numbers rather than visually, plus a million different blending tricks. And it feels like the journey is just beginning.

Browsing through some old images, I came across my “snowball” photo from Todmorden, taken just under a year ago. It looked like a challenging picture to play with, so I did. I’m fairly pleased with the results, although there’s a couple of parts I’m not sure about (and it’s a real bugger to find the right unsharp mask to use on it). Anyway, here’s three versions, I’ll not say what they represent but I’d be interested to hear which you like most/middle/least and, if possible, any comments you have on them. I’ll publish further details of each in a few days.