You all know the story. This time around it’s table-based layout with some crap JavaScript rollover script that is throwing debug errors in IE. Whatever.
Knee-jerk response to Flickr Gamma
Flickr’s new Organizr is a huge step backwards. It takes an incredibly usable Flash application, reworks it into a much-slower JavaScript version (that’s still just as inaccessible, and who really cares about screen readers seeing as we’re dealing with vast numbers of photos? *flamebait*), and in the process removes useful graphic (as in, having the quality of graphs, not graphical) elements, replacing them with numeric date selectors, etc.
Oh, yeah, and they’re browser-sniffing and rejecting anyone aside from Firefox, Safari, and IE. Which is ridiculous because Opera is so much easier to get to work with stuff than Safari is… in fact, it’s one of the better behaved browsers. Meanwhile, Flash would work on anything and so many people have Flash it’s hardly a great problem. To choose between a great, usable app and a less-usable, quasi-standards-embracing, still-just-as-inaccessible app seems like it should have an obvious outcome. Sigh. Why couldn’t they just focus on making the Flash thing work better? Multi-select dragging in the Flash UI was the last thing I really desired from Organizr: beyond that, I’d be pretty much content with existing features. But no… they had to go tear it apart. Grrr. Just because programmers like numbers, doesn’t mean the rest of us do. Bring back the drag-and-drop!
p.s. Yes, I know you can get to the old version still. It’s not that so much as the new version seems like a massive regression with absolutely zero advantages, and development on the Flash version is going to be in permanent hiatus (at least until they realise I am infallible and surrender in their folly, etc., etc.)
Horrible homonyms
I’m not even thinking of homonyms so much (though that may be true of the word in question, if you ignore similar meanings) when I get upset (as I am at present) about the untenable nature of the word “class” or “classes” (as in school/education) in any context where it could possibly be confused with programming of any sort.
As usual, it’s the geeks’ fault. I suppose classes in programming generally refer to a grouping of objects, as a class of students is a grouping of the same… so perhaps context should make the distinction clearer. But still, waaaay too much potential for confusion. Roget’s was thoroughly unhelpful in this regard… “course” is inaccurate, “grade” is too broad, and everything else was way off the mark. I think I’m going to go with “course” for the minute, at least until/unless I come up with something better.
For those wondering why I’m talking about something IT-related outside of the murky realms of semantics (though this arguably relates, albeit in a different sphere!), pseudo-design/browser-bug-fighting, and my all-encompassing-JavaScript-ineptitude… well, I’m playing with Ruby on Rails again. Or rather, properly for the first time. Because, you know, I don’t think there are enough balls I’m trying to juggle already ;-) Meh. If Rails is really fast and I don’t run out of time and make this drag out forever (which I inevitably will… bleh) this’ll probably take about a month. If Rails actually sucks, which by most reports it doesn’t — speculation about crap performance for large-scale services and concern over the small bus-factor (if one dev member got hit by a bus, what’d happen to the project?) aside — then I might give up for another couple of months. Whatever!
If nothing else maybe I’ll learn some stuff about MVC along the way. Not bad for an Arts student, hey?
JavaScript print_r() equivalent
It was observed today that I’m doing an awful lot of JavaScript for someone who has no idea what they’re doing with it. Anyway, was looking for an easy way to do a PHP-esque print_r but with Javascript today and stumbled across this rather-nifty function.
*bookmarks*
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!)
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.
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).
St George Internet banking sucks
It requires Java. I can live with that, it’s a web application.
I had to call up to find out what browsers they officially supported, only to be told that support was limited to Internet Explorer on Windows, Mac (!!) and Netscape 7+ on both platforms. Firefox “hasn’t been tested”, Safari hasn’t been looked at. I’m not particularly keen on this, but hey, they’re a bank… we all expect them to be a bit backwards.
The application sniffs for a Java Virtual Machine and refuses to load without even providing an error message if one isn’t detected. This wouldn’t be so bad but for the fact that it checks explicitly and exclusively for the Sun virtual machine… so anyone who doesn’t use that platform for whatever reason (licensing, ethical, platform) — even if they have another fully compatible virtual machine — can’t get access.
My solution? Disable Java (not JavaScript) altogether using the Web Developer’s toolbar, then sign in (it doesn’t choke!), wait til you get to the main applet pane, re-enable Java, and press F5. Magic, it works.
There is absolutely no reason or excuse for this behaviour. If this fits into some perverted notion of security, I’m not comfortable having my money there. If it’s the product of an incompetent web team… well… they’re an incompetent web team. Grr.
I called up and asked why it wasn’t working, then explicitly asked for a report to be forwarded to the web team. Please lots of people do this (heh, you don’t even need to be with St George… they didn’t ask me for a name or account number during the phone call!)… this service is unneccessarily stupid at present!
On a plus side, their phone service is good fun. I couldn’t find a support number quickly, so I called the dragondirect number provided on a letter (1300 30 10 20) and when none of the options matched “support”, I just hammered “9” repeatedly. Works on a lot of PBX systems, and it worked there… I got through to a human within 30 seconds, who then put me straight into the queue for web support. Good stuff.
| 5 Comments »


Recent Comments