|<< November 2007||January 2008 >>|
As you were. Be about your business.
Only eleven-and-a-half months to the next one.
Earlier this week, I outlined the equivalent XPath expressions for XSLT matches which use positions. I've bene avoiding implementing this for a while for a couple of reasons. Firstly, I thought it would take more time than I generally have in one Arabica sitting, i.e. more than an hour. Secondly, I wasn't quite sure how I'd actually go about it. I knew the equivalent expression were correct, I just didn't know how I was going to arrive at them in the code.
Happily, writing it out and then reading it back again later triggered the little flash I needed, and it turns out to be really quite easy. I've spent a bit of time on it this morning, having wrapped up the paying work for Christmas, and I've got the first pass working.
Within Arabica, each match pattern is represented as one or more steps, where each step in the pattern is represented as a TestStepExpression. A TestStepExpression contains some kind of node test (obviously) and one or more predicates. The predicate is the bit in square brackets. A match pattern like this
would be compiled into a TestStepExpression contain a NameNodeTest checking for 'a', and a single predicate '3'.
To find expressions that need rewriting is simply
The code is here, if you're interested.
foreach step in the steplist
foreach predicate in the step predicatelist
if predicate is type NUMBER
predicate = rewrite(predicate)
This kind of transformation could be done earlier on, on the AST produced by Arabica's XPath parser. It's easier, however, to operate on the compiled version. For instance, in the case above the numeric predicate could be a number literal, the result of a function, or the result of an arbitrarily complex calculation. Detecting all those cases is actually quite tricky at the AST level. Once the compiled objects are generated, we can just check the predicates return type.
Finding predicates containing calls to the last() or position() functions is going be slightly more work, and probably slightly fiddlier. I'm off to have a crack at that now.
[An hour or so later] ... and I think that's it. Each predicate is an expression, and an expression may contain other expressions and so on. An expression might model a comparision operator, for instance, which would contain expression each for the left and right hand operands. I put together a little walker to zoom through this expression tree looking for instances of the last or position functions. If it finds one, then I just generate the rewrite expression in exactly the same way as before.
Almost exactly two years ago (glurk!), I wrote a little item about XSLT match patterns and gave a clue to how I implement them. A pattern like
is equivalent to an XPath expression like
That's how Arabica actually implements it, rewriting the match pattern as an XPath expression during compilation.
This works in every case, except those involving positional matches,
for instance. In the simple case above, the rewriting is actually quite simple. You can push each step, here
para, onto a LIFO stack and then pull them off again adding the extra bit of wrapping as you go. For positional matches, the rewriting is a little more involved. A match like
needs to be rewritten as something along the lines of
although you could probably simplify it to
self::para[. = parent::*/para[last()]]/parent::chapter
self::para[. = parent::chapter/para[last()]]
Arabica::XSLT doesn't do this rewriting at the moment, which is, I feel, the largest single hole in it. I'm aiming to have a go at in the next few days. If I can crack it relatively quickly, maybe by this time next year I'll be looking for a new project :)
Positional matches must by the way, at least as far as I can see, be evaluated in this way (even if the underlying implementation is different). This is why matches like this can be quite expensive in terms of runtime, and are generally discouraged.
When we moved to Moseley, now chum Ken risked a severe thrill power overload by taking on my 2000AD pile. I realised that, since I continued to buy 2000AD, I would, eventually, finished up with another enormous pile I'd need to get find a new home for. The obvious solution was to head this off at the pass by handing the accumulated comics over to Ken at regular intervals. Conveniently, Tharg now wraps up all the ongoing stories in mid-December, in preparation for kicking it all off again with a Radio-Times-style-Christmas'n'New-Year bumper issue. As a result around this time of year, I bundle up the year's comics and hand them over to Ken.
That wrapping up, passing over, and big fat issue has come to mark the end of the year and start of the whole "festive" period for me. It might be slightly foolish that a magazine's publishing schedule plays such an apparently significant role, but hey! these are secular times we live in, no matter what those god-botherers tell you. These blooming Christians are always trying to spoil Christmas for the rest of us. Anyway, there it is and it has many of the attributes we associate with Chrimbo. It prompts me to reflect on the year gone by and look forward to the year ahead. It gives Ken and I a reason to get together and enjoy each other's company. Ken has the pleasure of fun-filled prezzie, while I get the warm glowy feeling of a good prezzie given. Tradition perpetuated via the vehicle of the Britain's, nay, the Galaxy's greatest comic. Hurrah!
Merry Christmas chums, and Splundig vur Thrigg.
Clearly I'm in recovery now as, while delayed again by Daniel's swimming, I arrived while the support band was still on. I don't know who they were, they didn't say, and I didn't bother to find out as they were entirely unremarkable, playing straightforward goth-rock of the type favoured by The Sisters of Mercy. Based on the singer's accent, I think they were German. That, and they couldn't help slipping in a couple of Scorpions' riffs.
I'm clearly going through a bit of a gimmick phase at the moment. Apocalyptica, as you might guess from the name, are a heavy rock band. A heavy rock band consisting of, you might not guess, four cellos and drums. Like The Ukulele Orchestra and Modified Toy Orchestra, they are simultaneously deadly serious musicians and fully aware of and able to exploit the inherent silliness of their proposition. They can really rock, loud and heavy, as on their own Harmageddon or when they cover Sepultura's Refuse/Resist. They're also terrific fun, blasting out a ridiculously fast version of In the Hall of the Mountain King, or conducting Enter Sandman as a big audience singalong.
As someone who long ago acknowledged that I dance like a Dad at a wedding (because ... you can fill in the rest), I had a terrific time. Everyone seemed to be having a great time, even the overenthusiastic lad who charged the stage while the roadies were setting up and so got himself chucked out before the band even came on. The band, particularly, really had a good time. They seemed thrilled by the turn out - while the place was by no means packed, the gig had originally been booked in the somewhat smaller Academy 2 - twice as many here as when they played their home town of Helsinki. In fairness to Helsinki, I feel I should note that it's only half the size of Birmingham. (Damn, I just can't help myself sometimes.) Touchingly, I thought, they all shook hands with each other at the end of the gig, before applauding the crowd. Finally, perhaps to remind us of their classical training, they stood in line and bowed. Rock!
And that's Post-GDFAF. I managed three outings during GDFAF fortnight, and then four in the shadow. That's the kind of result you wanted, isn't it Pete? Russ?
They're not a light entertainment act that does a bit of punk,
they're a punk band that does a bit of light entertainment.
While I'd been aware of the Ukulele Orchestra of Great Britain for some time, I might not have gone to see them had they not popped up recently on top kiddies' TV program, The Slammer. Two things sold me on them. First, the chap at the end, Dave, rocking out despite playing an instrument only slightly larger than the toy guitars sellotaped to the front of children's magazines. Second, they've got those kids completely hooked. Me too.
Lots of other people as well, it seems, because The Town Hall was fair heaving when the Bean and I took our seats. The Orchestra's stock-in-trade is, of course, familiar songs rearranged for eight ukuleles and voice. Sometimes they're deliberately comedic, as in their version of the theme from Shaft which is introduced in a round about way as an old American folk song collected in the Appalachian Mountains. Sometimes the comedy arises merely from the audacity of arrangement, Slade's Merry Christmas Everybody played as a slow waltz, or a gentle sing-a-long Anarchy in the UK. They somehow manage make that song even more English - everyone wants to smash the state, but let's not make too much of a fuss. Musical comedy demands perhaps a higher level of musicianship and commitment to the performance, which may explain why their Teenage Dirtbag pricked tears to my eyes. It's as transformative a cover as Johnny Cash's Hurt, and I found it quite remarkable.
On a little logistical note, the performance was in two halves with an interval. The Town Hall coped with the everybody rushing out for a drink without too much difficulty. Certainly I was able to get what I wanted without having to queue, and top marks also for allowing drinks back into the auditorium. Both the Bean and I were delighted that the little tubs of ice cream were again on sale during the interval. Other venues really should take note of that.
It's a modern world, so you can hear and watch the Orchestra on the miracle of the internet.
The JezUK Christmas tour wrapped up today when I got back to the attic at lunchtime. I presented a revised version of the talk I'd given at the ACCU Conference. I'd been a little unhappy with the original talk afterwards. While I thought the opening section was good, I'd been overly laboured in the middle stretch and built my point too slowly, before rapidly accelerating away like a mad thing towards the finish. The points I was making were sound, but I didn't put them over very well. This time round I expanded the opening section very slightly, but almost completely rewrote the second half using some much stronger examples (one of which is due to m'collegue Thomas Guest), and it worked much better. I enjoyed myself, and the chaps (and they were all chaps, alas) who came along appeared to enjoy it too.
If you're of a programming persuasion, you should give strong consideration to doing a presentation at something like this. You've definitely got something to say, even if you don't think you have. All you have to do is say it. Describe what you do. Tell people something that you know. You'll benefit from the telling, and your audience will benefit from the listening. Go and look at my slides - I haven't discovered some amazing new piece of computer science, all I'm doing is putting an everyday for-loop into (what is for most people) a slightly different context. Just because what you're doing doesn't seem remarkable to you doesn't mean it isn't of interest to others. It is. Even if you tell people something they already know, that's still to the good. Books like Design Patterns and Refactoring, for instance, sell by the wheelbarrowful precisely because they tell people things they already know.
There are currently four ACCU groups in the UK, but there are also Python groups, Perl mongers, LUGS, universities, general programming-type get-togethers and so on and so on in various cities, your own place of employment or client might want to have you. It's not hard to find an audience. All you have to do is do it.
HTTP/1.1 404 Not Found
Well since you ask, Russ ...
A couple of weeks before the GDFAFortnight, I wrote down fourteen fantasy gigs, just for funning, together with my guess about how likely such an occurrence might be. They were
That was what I fancied on the 23 September. What a lot of nils. If you asked me to do the same now, I'd come up with a different list.
Granted. The masters of plutonium rock would have been a good closer.
This must be how people become drug addicts. I was forcibly late for the last gig I went to, but this evening I cheerily and voluntarily turned up late, thus allowing my first born nipper to go swimming. He's only seven, but he can probably swim rings around you. Anyway, I rolled up at the Academy having completely missed whoever the support band was, assuming there even was one. Perhaps next time I won't even stay for the headliners. *Sniff* I can handle it.
Josh Homme featured twice on the fantasy GDFAF list I drew up back in September, once as a member of desert-rock pioneers Kyuss and once (although I didn't realise at the time) as a member of Seattle proto-grungers Screaming Trees. Consequently, when Queens of the Stone Age appeared on the Academy listings, it seemed silly not to go.
Live, Queens of the Stone Age are more than they are on record, a great deal more. They have a richer, denser sound, more powerful, more hypnotic, more transporting. When you closed your eyes you were taken somewhere else entirely, something my chum Russ would no doubt approve of. I get the feeling that Homme only stops between songs because otherwise the audience would get confused about when to clap. Nearly every song had an extended intro, a bit of a diversion in the middle, and an extended coda. A couple of tracks featured so many false finishes that even Dusty Rhodes would blush. Left to his own devices, I'm sure Homme would go out and play for an hour, maybe two, straight through, take his applause, and then stride manfully off stage. And you know what? That would be brilliant.
This is post-GDFAF, by the way, because I found out about it while researching for or actually going to one of my GDFAF outings. As I left, I pondered once again the eternal gig-goer's questions - is one's listening enjoyment enhanced by holding a cameraphone in the air for several minutes at a time; what are those chaps who bring their girlfriends thinking when it's plain before the band even takes the stage that they don't want to be there; and why in the name of all that's right and proper do people pay good money to see a band and then spend the entire time conducting conversations by bellowing at each other?
|<< November 2007||January 2008 >>|