Variable randomness

The main point of this post is to remind myself of how to solve a problem in the unlikely event that I encounter it again. If anybody else with the same problem stumbles across it, so much the better.

In these modern times, it is easy to quote a tweet on a wordpress blog post – you just put in its url and a kind of magic happens. Back in the olden days, life wasn’t as easy as that, but there was a third party plug in called Blackberry Pie which performed an equivalent function. It broke with an api change years ago, but I still have a handful of its shortcodes scattered across long ago posts.

Most of them are easy enough to fix – the shortcode includes the full link to a tweet which is easily extracted. But Blackberry Pie was smart enough to cope with just the tweet id, and there is no apparent way of recreating the full tweet url from that, since links always include the twitter username.

So I turned to Twitter itself for help.

And help there quickly came.

That looked good in theory, but I couldn’t make it work in practice non-programmatically, even with the authentication keys. Not to worry, more help was to hand.

Well I don’t particularly python, but I was game to try, though this was starting to turn into a more serious enterprise than the size of the task seemed to warrant.

But then I struck gold – though I nearly missed it.

My first thought was that this had missed the point altogether. The link structure

https://twitter.com/Tweet_Maker_User_Name/status/Tweet_ID

still seemed to need me to know what to put in for the placeholder Tweet_Maker_User_Name, which was precisely the problem I had in the first place. But then it occurred to me that perhaps it was a special code which effectively did the job of the api call and that only Tweet_ID needed to be substituted. And so it proved. The link resolved to the full standard url, username and all. Job done.

But I was still a bit curious about the apparently generic username placeholder and wondered whether it was documented. A search produced precisely one result, a Stackoverflow discussion of the question I had started with. One contributor suggested the Tweet_Maker_User_Name approach – and was squashed by another who made the same misjudgement I had. But the final reply gives the answer I had begun to suspect, that the link structure is not so much

https://twitter.com/Tweet_Maker_User_Name/status/Tweet_ID

as

https://twitter.com/any_random_string/status/Tweet_ID

Indeed, even substituting a valid but incorrect username doesn’t cause a problem, the link still resolves to the correct full url, fixing the wrong username as it goes.

Which leaves me with the intriguing twin thoughts that the use of usernames in twitter urls is to help human readers rather than having any technical significance, and that this redundancy appears to be very little known.

And a final serendipitous twist. The Stackoverflow question was posted on 22 May 2009, six years almost to the day before I was looking for the answer. It’s attracted a leisurely eight responses over those six years, the last and most useful of which was posted on 17 May 2015, immaculately timed to be there when I looked for it.

Thanks to Simon Dawson, Chris Yiu and Joshua Mouldey

And further thanks to Adrian Short for providing the perfect postscript:

All long help threads should have a sticky globally-editable post at the top saying 'DEAR PEOPLE FROM THE FUTURE: Here's what we've figured out so far ...'

Crotchet quavers

A decade is a long time in digital. Surviving one revolution is not enough any more.

There’s a small online music retailer called Crotchet. Its website offers a huge and eclectic range, intelligently curated. I have been buying CDs there on and off for 15 years or more.

Today I got an email confirming that a disc from my latest order is in the post. At the bottom was a terse announcement that the business is closing. The website has vanished, leaving only a longer version of the same announcement. The owners are apparently retiring. They haven’t sold, perhaps couldn’t sell, the business as a going concern.

I don’t know the story behind that, but I can make some guesses. Having eaten many of the physical locations where people used to buy music, the web is now consuming businesses, such as Crotchet, which had dematerialised the shop but still sold the product in physical form.

I don’t really want to buy CDs any more. They used to be an efficient way of moving data, but now they’re not. Buying the data not the disc is increasingly common and increasingly attractive. But even that is becoming old fashioned in a works of instant availability streaming.

The design of Crotchet’s website never really changed. What they were selling last month is fundamentally what they were selling a decade ago. That used to be enough for businesses to cascade through the generations. It’s not any more.

Perhaps this is my last CD.

Sur Incises

Music stands

The double bass is not one of the great solo instruments. Those who play it do not normally have starring roles in music in the classical tradition. It is not an instrument associated with drama and extroversion. It is large and often lugubrious, its very existence can be treated as an extended joke.

It was a joy to see all those stereotypes confounded in 20 minutes of bravura composition and performance at the Barbican last week. Nicolas Crosse, with the Ensemble Intercontemperain played a new piece by a composer I had never heard of – Asymétriades, by Yann Robin.

Crosse made the double bass produce a range of sounds I could not have imagined with an energy and attack second to none, partnered by a small ensemble of 15 players, who not only provided a foil for the soloist but themselves produced sounds which it was sometime imposible to work out quite where they had come from or what combination of instruments might possibly have produced them.

There was one other tiny detail which made the performance novel for me. The ensemble and the conductor had printed music on ordinary music stands. But the soloist had something a little strange, a tiny music stand on which you might have arranged a postcard or, at a pinch, a miniature score. From where I was sitting, I could see no more than that, so it was only after the piece ended and the stage was being rearranged that I saw the stand had in fact held an ipad.

A moment’s googling shows that ipad music readers are an entire category of their own (and have been around for several years, which suggests I don’t get out enough). It’s an unsurprising, inevitable development, even if I still can’t quite work out how Crosse was turning the pages.

But the question I am left wondering about is whether the ipad was intrinsic to the performance. The solo part was the most unrelentingly demanding of any I have ever seen. It wasn’t at all obvious when Crosse might have had the chance to turn a page had there had been pages to turn. Perhaps a way could be found, but there must be some limit case (even if this was not it) where the intersection of the technical demands of performance and the intentions of composer and performer make sheet music something close to a point of failure. And at that point, the ipad becomes essential: it gives the composer latitude to do things which he or she might otherwise be constrained from doing.

After the end of the main concert and after most of the audience dispersed, Michael Barenboim played Pierre Boulez’ two Anthèmes. He was alone on a stage large enough for a symphony orchestra, standing behind a music stand in a small pool of light. In the closing moments, the lights slowly dimmed to a complete blackout, leaving the hall in darkness. Except for the pale blue glow of an invisible ipad, illuminating Barenboim’s face from below.

The video below is a performance by Barenboim of Anthème 2, given at the Proms in 2012 performed with great virtuosity by both the soloist and the invisible sound engineers – with an entirely conventional music stand. Or rather with seven of them, lined up across the stage. He never turns a page: when he runs out of music on one stand, he simply moves on to the next.

Not all solutions are digital.