Josh (the blog)

I’ve delivered simple, clear and easy-to-use services for 20 years, for startups, scaleups and government. I write about the nerdy bits here.


@joahua

Don’t do this on a large site

This post is actually something I meant to say last week, but forgot.

So I’ll say it now: Loading JavaScript on a prominent page that builds a link to a non-existent resource is a BadThing. Think ridiculous numbers of 404 errors and partially-defeated statistics tracking! Having said that, I managed to manual work out JS/no-JS support to be even lower than it is on this site — it’s 1.5% non-JS here — which is impressively (pleasingly) low!

AWstats is fun to run on many-gigabyte logfiles… just not multiple times once you’ve realised “Oh, I screwed up and no amount of grepping can save me now!” (First time I’ve absolutely required my dual-boot Ubuntu/XP install at work… because it’s lots easier to watch load on a computer you’re physically on rather than by SSH, and because multiple-GB-logfiles aren’t fun to transfer across networks!)

MKC 2006

MKC 2006 -- Telling the Sermon on the Mount like it really is

Spent time away at an awesomely challenging men’s convention up at Katoomba Friday night through all day Saturday, looking at the Sermon on the Mount. The two points that stuck most with me were

  1. the concept of living for an audience of one (God) in everything, and;
  2. the ‘unheeded’ Christ, in that the influence of his teachings (so often) have ridiculously little influence on the lives of those who profess to follow him (specifically, the idea of loving enemies… our embrace of this seems to always be conditional, in that it’s very rarely loving enemies at all! Guilty of this as most people…)

I was… very impressed with the teaching and with the fellowship and everything (except that bloody keyboard that sounded as though it were from the wrong decade). ’twas a great weekend, looking forward to next year!

Why MSM and open paradigms don’t mix

Microsoft are now playing ball. They’re “getting” this whole cluetrain gig, even formalising their enactment of it into a conference billed as a 72-hour conversation. They’re doing blogs. They’re lightly, if at all, moderating those blogs. And they’re responding to content on those blogs as appropriate (that is, ignoring the absolute rubbish and closed-mind-open-source-supporting-nerds).

In every way what they’re doing and what they’re changing is absolutely awesome. As an IT company maybe it’d be fair to say they’ve got a headstart on the rest of the world. They’re certainly doing better than MSM are.

Say, for example, there was a social networking/photo site to be integrated into a TV programme’s community site: one that’s meant to actually connect with viewers, and falls under “Community” in the network’s structure — not the one that mindlessly pushes top-down content. And that because of concerns about moderation — chiefly stemming from the notion that public identities are untouchable and sacred in the network eye, and the arrogance that comes as a part of that –, the only advantages (politics and free bandwidth because of deep-linked photos aside) of integrating an external photo service are negated, and users have absolutely no incentive to sign up for a wider Yahoo! sign-on (which would allow them to comment on photos at Flickr, amongst other things).

So MSM structures are still winning. I expected this would be the case. I think it’s going to take another five years before people can get over themselves enough to realise that allowing people to comment (not anonymously — that was never on the cards!) isn’t an intrinsically dangerous thing. The idea that the greater fool is the one stopping to make flippant disparaging (even just seemingly so!) remarks about people they’ve never met is, in fact, turned on its head by the recognition of such remarks. To acknowledge a fool’s power surely isn’t the most intelligent thing one could do in response.

I digress. The point is, for as long as they’re thinking they have any chance of controlling what’s going on, this isn’t going to work. Wanna stop people commenting on a photo you stuck up on Flickr? Sure thing, feel free to disable it. If the comment is of consequence they’ll blog it anyway and the damage is out there and you’ve got a hell of a lot more work to do if you want to purge that blight on your carefully-constructed-cult-of-celebrity-image from the web… and if it’s not of consequence they won’t bother to publish it anywhere else, and, in all probabilitiy, it wouldn’t have done a great deal of harm were it to be published in the photo’s comments anyway. In many ways, inline commenting is actually a more restrictive form of social interaction in the online sphere because it’s centralised. I’m advocating it here because the audience has appalling electronic literacy (which is, I take it, typical of the bulk of the Australian population still: even if the SMH writes about blogs, only people who blog will bother to read an article that has “blog” in the headline… and then they’ll go and blog about it), so the blog thing is still, probably, 5 or so years off hitting “mainstream” audiences. (Incidentally, anyone proclaiming the death of radio/rise of podcasting should similarly anticipate no-one is even knowing what they are talking about for a similar period of time — and no, the fact that iTunes has an obscure feature doesn’t help matters).

Must finish with this priceless grab from a weekly newsletter, regarding viewer-directed content chosen via an online survey: “We always say our show is your show, so I think this segment makes a lot of sense.” And yet they’d rather not give viewers a voice at all. This isn’t giving viewers a say, it’s allowing them to effectively switch meta-channels (almost, presuming they’re voting with the majority). The segment makes sense from a MSM perspective, but the farcical nature of this “openness” comes to light pretty quickly as soon as any truely multi-directional communications channels come into play.

I think it’s going to be great fun watching “them” (MSM generally) slowly come to terms with this idea over the next couple of years. MSM isn’t going away, but I think any of these “social” shows are going to flop unless they radically re-think strategies (hybrid broadcast/Internet model, anyone?) or stop pretending…

A quick note: I haven’t mentioned anything by name here because, well, no-one else is bothering to blog about the site in question (an earlier blog post is on the first page of results for a particular keyword, I’d rather not do that again!) Actually it’s kind of funny because my site + semantic markup, etc., is blitzing the network’s core site (i.e. not our ancillary community site) in search engine rankings (well, Google at least, heh), but I digress! Not that I’ve written about anything sensitive… everything here is digested public information (or will be by the time this publishes tomorrow) and is consistent with my usual rantings and opinions about social media, IT, etcetera, and my usual cynicism and disdain for commercial (primarily broadcast — print is (painting broad strokes) generally less obviously tainted) media! Good fun.

Trapping return for form field focus

Today I had to cook up a simple form with two input fields, so that two barcodes could be scanned into their respective fields and then submitted (the point being to link two IDs in a database that have been encoded in separate barcodes). There was one twist.

The barcode reader automatically appends a return character to the end of the string it’s read… which would, in any normal circumstance, submit the form. Obviously problematic unless we split the form over several pages, which is just yuck.

If the barcode reader hadn’t returned character 13 (return/enter/whatever you’ll call it) at the end of the string, it’d be trivial to pick up a “maxlength=x then go to next field” script off the side of the road… they’re everywhere. Not so much the case with this exact problem, though, so I thought I’d share…

[source:str javascript]function catchEnter(e){
var characterCode
if(e && e.which){
e = e
characterCode = e.which
} else {
e = event
characterCode = e.keyCode
}
if(characterCode == 13){
document.getElementById(‘cardid’).focus();
return false
} else{
return true
}
}[/script]

Note we’re not using DOM methods here… there isn’t any equivalent to which or keyCode that I’m aware of (I looked enough). keycode is the important one… which is used by the likes of Netscape 4.x and other nasties… I don’t really want to know about it, but I stole the key trap code from somewhere (lost the site) and didn’t really have a reason to intentionally break the behaviour for those browsers!

So we use one of those (probably keycode) to set characterCode, which is a numeric value that corresponds to Unicode decimal values. 13 is carriage return. Then it needs to be compared to event (the character that triggered the onkeypress event), here used as e for convenience… and if this is true, then focus will go to the next field (in this case cardid) and the character will return false to prevent the form from submitting.

Screenshot of the demo page

I’ve got a static demo here (don’t mind the message at the top, it was an HTML mockup)… try entering something into the first field and pressing return. Then press return again, and the form will submit.

Obviously this Javascript only works for a two-field case… but you could dynamically set the element for focus to follow to by parsing that through to the function onkeypress event. The only other thing I can think of is to getElementsByTagName every input field in the form and use the array to dynamically set the “next” field… but that would have been waaaay overkill for what I had to do.

This behaviour isn’t just useful for barcode scanners, by the way. Desktop applications often exhibit this kind of behaviour, and it also goes some way to ensuring all fields are filled without doing formal validation (either JavaScript on submit, or server-side).

Tori’s 18th

Tori: sparkler in one hand, alcohol in the other

Tori turned 18 yesterday and had an awesome party (even though she caught a cold the day before… apparently my fault, even though she hadn’t seen me when I was sick!). I’d post photos, but most of the half-decent ones I took are on her camera (half-decent because I can’t really ever take “party photos” with any finesse).

Ridiculously delicious ice-cream cake

There was ice-cream cake. Oh was there ice-cream cake. Yum.

*ahem*

Anyway, happy birthday Tori… and get un-sick soon!