I started working in Swansea University’s Computer Science department five years ago today. Here’s the evidence. It’s been a blast, and the executive summary still holds true, somewhat amazingly. That is all.
Water! From the skies! – Armstrong & Miller comedy gold on Youtube.
I used to love Armstrong & Miller — hit and miss, for sure, but when it hit it hit well. If you ask me what the funniest thing I’ve ever seen was, I’d tell you it was a sketch of theirs involving an undercooked steak, some surly chefs, and a remote-controlled car. Haven’t found it online yet, and in a way I hope I never do because it’ll be bound to be a disappointment now, but oh, the memory…
Bash cut her hair today. Photos (mainly by me) here.
(Photos of the Circles of Sound gig should be forthcoming soonish, but she’s got about 500 to wade through – ’twas a good night!)
After some random recent upgrade, emacs started doing something annoying: when in TeX mode (eg when editing LaTeX docs, which I do a lot), it would treat every underscore in the document as a signal that the next symbol should be subscripted, and display it as such: the character would be offset vertically using font-lock magic. This is very annoying, because underscore only means subscript in maths mode; the rest of the time, it’s wrong and silly to visibly subscript the thing. In general, I don’t want emacs to do such semi-WYSIWYG-ness – syntax highlighting is about as much as I need, thank you.
Anyway, how to turn it off is non-obvious, and required several increasingly imaginative google search strings. In the end I came across this recent thread on gnu.emacs.help, one of whose posts suggested that turning down font-lock-maximum-decoration from “maximum” is the right thing to do. Yep, that works: I changed it to “nil” and now I’m happy.
I have a new love; she is a girl; she fills the world with beauty, sadness, and utter disregard of the laws of physics. Her name is minus, and she starts here.
Lots of things have been happening to me outside of computers lately, which is one of the main reasons I haven’t written anything here. I suppose Facebook has also been pressing my online contact buttons. Anyway, here’s one of those things.
Yesterday, I had my first experience of something called Five Rhythms dance. It’s hard to describe, but in short, you might say it’s moving meditation, set to music (ordinary, popular music, though thoughtfully chosen and sequenced), journeying through five phases called flow, staccato, chaos, lyrical, and stillness. A complete sequence through all five is called a wave. Well, yesterday I was at an all-day workshop here in Swansea, with a theme of male/female balance, in which we went through three waves: two before lunch, flowing together seamlessly (or was it just one? it feels like it was two, but it is a blur, I admit!), and then another, slower (deeper?) wave in the afternoon.
I’m finding it quite hard to write about, because what I want to express, I can’t, really. I suppose I could say it was one of the most incredible experiences of my life, but that somehow sounds throwaway and doesn’t really capture it. It certainly feels like it’s going to have been a very significant experience – it’s definitely opened up some doors.
As someone who loves anyway to dance, and in particular rejoices at the moments when the music and the dance take you out of yourself, out of caring who’s watching, out of thought and out of the moment, well, I just loved it. It was easy and challenging, and familiar and surprising, hot and cold, fast and slow, I could go on…
I’d worried, in hearing about the process, that the music would be some half-baked new agey nonsense incapable of moving me. I was completely wrong – it was singularly excellent, including a number of pieces I recognised (Massive Attack’s Protection and Art Of Noise’s Close To the Edit are two staccato pieces I particularly remember), and much else new. The James Holden Remix of The Sky Was Pink by Nathan Fake (as I found out afterwards) was where it hit the peak to me, at the start of chaos in the final wave. You can hear it on Youtube, but you’ll have to imagine satisfactory bass and a transcendent mental state, I feel. (I’ve just bought it on Juno — my first paid-for music download evah!)
I’m feeling very different after yesterday, about a number of things. If I had to pick one word it would be “calmer”, but it’s also a sense of being more centred, more accepting, more flowing, more connected and (frankly) more alive. A reinvigorated sense of connection with everyone and everything else – for which I’m sure I can largely thank the group, which was (trying not to sound too much of a hippy, if that’s not too late) just utterly welcoming, safe, nurturing, open, opening. If the purpose of the day was the explore male/female balance, it certainly worked for me. Gah, incredible and indescribable!
Though I have written many, words fail me. There we are.
If you want to find out more, and in particular if you’re in Wales and want to try it, here’s Alan Withers, the teacher (workshop dates here, and there are weekly classes in Swansea (clashes with Shiko, alas) and Cardiff). If it sounds at all interesting, I’d say go for it – only good things can happen.
Oh, PS: Shiko should be busking somewhere in Swansea town centre this Saturday, hopefully, as part of Oxjam. More details when I know them. Come gives us your ears and money!
Find your own pose!
Fantastic quiz, particularly question 3. Evany still rules, I’m happy to say.
No blogging for ages because: lots of work, nobody cares anyway, and the devil that is Facebook. Have re-established contact with many many old friends, and made the somewhat disquieting discovery that most (but – yay – not all) of the girls I used to fancy have settled down and started making babies. The life, she goes on.
Next Saturday it’s carnival time in Swansea! Once again I’ll be playing steel pans with Rocco’s Rockets, or whatever we’re called this year. Photos from last year here. This time, I’m pleased to report, I’m on bass (pleased because this is easy, it’s bassy, and I’m close to the Jamie-powered main drumkit).
A number of changes from last year: starting point, route, and ending point is different – in particular, we end up on the open area in front of the Waterfront Museum, which sounds all right to me. This probably means we go down Wind Street, which ought to be interesting.
So, come and see!
Then, the following weekend, on Saturday 1st September, Shiko are gigging in sunny Porthcawl. It’ll be in the afternoon, around 2pm, as part of some bigger event taking place (possibly some surfing thing?). There’ll be several drumming groups from the area playing, so it promises to be pretty good. More details as I have them.
(I may get round to writing something actually meaningful and/or profound at some point – but not right now.)
(I do, however, really dislike all this “before you die” nonsense. See sketch in recent Mitchell & Webb radio series. Also, surely we’ll all live forever now thanks to genetic engineering / uploading ourselves into vast computers / our benevolent alien overlords – so the whole concept’s totally passé.)
As part of an art project about spoken directions, we’re trying to collect as many recordings as possible of people giving directions.
To take part, use one of the buttons below to give us directions to wherever you think of as “home”, in any country, and speaking in any language. Don’t refer to any maps or guides, just give directions as if you’d been asked on the street.
Fanti djembe and dun-dun/bell patterns for Shiko gig @ Bee Hop, July 21st, 02007.Read the rest of this entry »
Djelidon djembe patterns for Shiko gig @ Bee Hop, July 21st, 02007.Read the rest of this entry »
Loving it: It’s All Text, a Firefox add-on to enable you to edit textarea contents in the editor of your choice. It works!
Here’s a pretty clear explanation [reddit] of closures, which have hit the mindspace in a big way since Rails made Ruby the hot sauce of the day. When I say “clear”, I mean, perhaps, from a “traditionalist imperative” point of view — the discussion of stack frames and the funarg problems in particular. Of course, lambda-heads and category theorists probably have other criteria for “clear”. ;-)
(Spoiler: idempotence wins.)
I had a hearing test this morning. To my small amazement, my hearing is apparently just fine – completely within normal bounds. In particular, there are no signs of noise-induced hearing loss, which is frankly incredible given the punishment (mainly via headphones) I’ve given these babies over the years.
The bad news: this means that my apparent difficulty in following conversations (particularly ones I’m on the edge of) in loud-ish surroundings (eg parties, pubs, conferences, etc.) is either a result of deficient mental processing or (probably more likely) that I’m simply not paying enough attention. Still, good to know!
Back in June 2003 I blogged about the truly wonderful Roy Orbison In Clingfilm stories – if you haven’t seen these yet I highly recommend a visit. Anyway, I’ve just noticed, returning for a long-overdue refresher, that there’s now also an interview with the author which is also not to be missed.
I am not aware of anyone seeing it as humour. I venture the occasional joke or puckish remark in my work as relief from the sensuality and romantic lyricism, and if people laugh that is nice, but I do not think my fans would class me as a humorist in the way that you would, say, Dan Brown.
I remember I read an interview with Gunter Grass just before my tome was delivered to the printers, and he talked of his forthcoming book and said that it was the best thing he had ever written, and I thought Oh no! Gunter Grass has had the idea to write a book on Roy in Clingfilm too! I will only be the Buzz Aldrin of this genre. And I can laugh with relief now as his book turned out to be some boring thing about the Nazis, but at the time this obsessed me, and I considered examining his dustbins and so forth to find out. Perhaps I should not admit this but I actually rang his agent of literature and pretended to be a reporter and asked ‘May I enquire, who are Herr Grass’s favourite musicians?’ but he only mentioned people like Rush and Hawkwind so I knew it was OK.
Movie here. Psychedelic!
What’s going on here? OK, so it’s not 40,000 pendulums “all going at once”, because obviously they’d bounce off each other. ;-) What we have is a 200×200 grid (ie 40,000 pixels), and for each pixel we define a pendulum. At a given time, a given pixel’s colour represents the corresponding pendulum’s distance, at that time, from each of the 3 magnets (the pixel’s RBG components represent the three distances). Each pendulum’s movement is affected only by the magnets, ie the pendula are independent of each other. Hey presto, psychadelica-a-go-go.
I’m William John Cavendish-Bentinck-Scott, the Fifth Duke of Portland. Which Historical Lunatic Are You?
Heyup. Shiko will be drumming at Croft Carnvial this Saturday — come and see us!
Crofty is a small village on the north coast of the Gower Peninsula (map here). I’m not 100% sure of the times yet, but I think it starts around noon. I should become certain tomorrow. It’ll probably be a smallish fun affair, drumming on foot as part of a parade, apparently. As usual with Shiko gigs I’m not completely sure what to expect. :-) There is talk of heading off to Pontardullais afterwards to do some busking in pubs (it’s their carnival this Saturday too).
(If you can’t be bothered to read all the of the following, just watch this video and know that I Was There…)
At 5pm yesterday, I left Swansea in the company of eight excellent people. Around 10pm, we arrived at the car park at Stonehenge, and set up our tents. Around 11pm, I stood before the stones and took a deep breath, before walking among them, touching them, looking, wondering (and weaving my way through a tight-packed throng of revellers). Around 4:50am, along with about 24,000 other weirdos, I looked to the sunrise but alas, ’twas hidden in clouds. Around 6am, I was in the tent, being horizontal; around 10am, I was up and about, rejuvenated and ready for the drive home; around noon, we left. Around 5pm I was waving madly at ex-students from the passenger window of a mini on the M4, much to their amusement. Around 7, I got home and made the cats happy through the magic of food.
26 of the most pleasant hours I have ever spent, I must say. The only thing missing was Bash, which is an excellent excuse for going again next year.
I’d never been to Stonehenge before at all, and I am incredibly grateful to my parents for never taking me, because this was the best first visit I can imagine. Ordinarily, it’s impossible to get right up to the stones (see google maps – those greayish dots trailing around the stones are disappointed tourists), but for the solstice it’s open and free – all praise English Heritage. It was so good to be able to walk right up to this incredible site without restriction, and I recommend a solstice visit if only for this purpose. Word to the wise, however: if weirdos bother you, arrive early, touch the stones, and don’t stay past sunset.
Cos yep, it’s gotta be said: the place was full of weirdos. I was happy to be one of them, but definitely on the normal side, alas. Much nonsense was spoken, but I was particularly amused by: “Emergency! Emergency! Glowstick breakage on the western stone!”, “If you’re not drinking ginger wine you don’t really exist – it’s a quantum thing.”, and “Your hat would be no good for Burning Man: they’d run you out of town. No, they’d fire-poi you out of town.”
BBC coverage here – though I’m sure most of the crowd didn’t get up early: they stayed up late. :-) “It’s bad lovin’, woo hoo, it’s bad lovin’!”
It was a clear night with stratocumulus scudding in from the south just in time to sprinkle us with a couple of light showers and obscure the sunrise – given the rain lately, we were more than grateful for the weather. I certainly didn’t mind not seeing the sun actually break the horizon: I was there for the night, not for the moment. It was a bit chilly around 3am, but I was kept super snug (and thus smug) by my birthday present from Bash and my parents: a shiny new Montane Extreme Smock, as recommended by intrepid Mountain Rescue types. All hail.
Interesting: 5000 more people than last year, but 1000 less cars. Only four arrests.
Photos will follow.
Two weeks ago, we spent the weekend in London, to attend a civil partnership ceremony (I call it a wedding as, I’m sure, would the happy couple) and a house-warming. The wedding was on Friday morning, so (after giving up on trying to find reasonable rail tickets) we drove up Thursday night and stayed with Jason & Sid, whose party was on Saturday. The wedding was lovely: Robin & Oliver, South-African compadres of Bash’s who came to ours (front row/right in this photo), so we were very happy to return the honour. :-) They made a lovely couple, and the ceremony was very touching. The wedding took place at Old Marylebone Town Hall (“Reception Room”) – a very nice venue, with lovely officers (though marginally and amusingly haphazard a couple of times), followed by reception at The Groucho Club. I shudder to think how much it cost them, but the food and wine were both delicious and copious. No, we didn’t see anyone famous. :-)
We milled around Wimbledon on Saturday, wombling on the common and browsing expensive charity shops. In the evening, the house-warming party… Continuing the geeky tradition begun at New Year, some of us did some programming: this time on the classic Amstrad CPC-464 at the top of the stairs (Jason is Very Retro). This being a bit old and light to run a python interpreter, Jason and I knocked up a simple BASIC program to print “Welcome to Jason & Sid’s party” at a random place on the screen every 5 seconds. We even had to RTFM.
It wasn’t all geekery, of course: evidence here. My choice cuts follow.
Quiet here lately because it’s exam processing time in the real world, so I’ve been busy busy busy marking, check-marking, and munging. Next week’s busy too but then I can settle into research gear for the summer and do lots of Haskell — woo.
I’m still loving the hell out of xmonad, which just keeps getting better every day. Yesterday I went dual head through the magic of Xinerama; at first it made my brain hurt, trying to keep track of where each workspace was, but now I’m getting to grips with it, I’d say. It’s nice to be able to work on one thing (a blog post, say) while keeping an eye on a background job, and while programming it’s cool to have multiple emacsen filling my field of vision. What could be better?
There is surely much more to say about many things, and I will surely say them soon.
The first thing I complained about the first time I saw Xmonad was the lack of a status bar. As Xmonad approaches its 0.2 release, it has become clear to me that this absence is in fact a feature, not a bug. Here’s why…
It’s now possible in Xmonad to define gaps on the edges of the screen, over which it will not arrange windows. This immediately and beautifully solves the status bar problem, because now you just run a separate status bar app, filling in whatever gap you’ve defined. If the app sets the “override-redirect” X flag (which anything claiming to be a status bar should), it’ll appear on every desktop and be excluded from Xmonad’s window management.
This is a stroke of genius, and a fine illustration of that principle at the beating heart of Unix, namely that you should write apps which do one thing well, and use them in synergetic combination. xmonad manages windows, but it is not in fact its job to provide a status bar: only the space for one. Factoring the status bar out in this manner gives us choice and orthogonality, both of which are A Good Thing.
For now, I’m going for the easy option: dzen, a minimal text-only status bar (looking a bit like this but at the bottom of the screen). Alternatives exist, for example the KDE kicker, but I haven’t really explored that space yet. In all honesty, I’ll probably just stick with dzen. What I want next: a way to display, on the status bar, info about which workspaces are in use, and which is visible. For this, Xmonad will need to report its current status somehow, perhaps like wmii does with its plan-9 inspired pseudo-filesystem.
Update 2007-06-15: very quickly, I got my wish; xmonad now has configurable logging hooks which can write arbitrary data to stdout every time the internal state changes — pipe that to dzen and hey pesto, problem solved. By default there’s a basic logger which simply writes a list of workspaces which currently have windows on, with the current workspace surrounded by square brackets. Lovely jubbly.
One thing I’ve learnt, to my great surprise, while marking my students’ exams is this:
My handwriting, which I’ve always considered pretty bad, really really could be a hell of a lot worse.
(Found while googling for “Moments in Love”, the old Art of Noise number, yielding this fine rendition.)
We went to Hay-on-Wye today. For those that don’t know, it’s a little town with an abundance of (mainly second hand) bookshops, and the location of an annual literary festival much beloved of the British middle class: Guardian readers/Radio 4 listeners in particular. Today was the last day of the 20th edition (a ha ha ha) of the festival; we popped by but didn’t linger, all the good events being sold out. Instead, we hit the shops.
I’m very proud to say that my prize purchase of the day was not in fact a book (though I bought four), but the album Innervisions by Stevie Wonder, featuring not only what I’m rapidly coming to believe is The Greatest Song Ever Recorded, Higher Ground, but also what is certainly The Song With The Greatest Intro Ever Recorded, namely Don’t You Worry ’bout a Thing. Awesome. Just incredibly awesome. Why wasn’t I informed?
I can only conclude that until now, I was not ready, and so the Universe kept Stevie and I apart from each other. I note that Innervision was released in 1973, the same year as Tubular Bells, an album which (along with its successors and others like of its ilk) had a much greater influence on my musical development than the joyous funkfest within which my ears are currently glorying. I wonder if I’d have grown my afro sooner, had things only been different…
While we’re on the topic of shaking your (big) hair, I’m happy to report that Shiko’s Monkey gig on Saturday went well and was a lot of fun. It was crowded (and cramped – we were playing literally on the dancefloor!), people danced (a few, anyway), people appluaded and cheered, and (it was generally agreed) we sounded good and didn’t noticeably screw up. Later there was an impromptu jam on the top floor with three djembes, a shekere and a bell, which was much more raw and at least as enjoyable (as a player) as the “proper” gig. So yeah, a great night. I’m still very much loving the drumming, and loving getting better at it, which I seem to be doing. Woo.
Losing my Star Wars virginity (not me, obviously).
10.05: C-3PO and R2-D2 are making me laugh. They’re like bickering lovers. I hope Princess Leia escapes Darth’s evil clutches and makes it to Alderaan.
I want to move gimbo.org.uk to a different web hosting provider. Got any recommendations? (Particularly good UK ones?)
From day one, I’ve been with webquarry; I’ve been happy until recently. Now I’m unhappy because their MySQL server goes offline for 15 minutes every day for backup, taking Gimboland with it (I didn’t notice until I switched to WordPress, because my pages used to be static), and because they’ve just disabled catchall email accounts (for, eg, firstname.lastname@example.org) without telling us. I understand the rationale for disabling these, but having to work out ourselves that it happened has been stressful and costly, both in time and money (business lost).
I need to host 4 domains (gimbo.org.uk, gimbo.co.uk, andys-trek.co.uk, basheerakhan.com – with gimbo.co.uk just aliasing gimbo.org.uk); I need email and webspace on each of these; I need ssh access; I need MySQL databases; I need all the obvious things you’d expect, basically. I need it to not go offline for 15 minutes every day! I’d like it to be in the UK so latency on ssh sessions is reduced. ;-) Oh yeah, and I don’t want to pay too much…
I’m paying about $13 (about £7) per month right now, but only getting 1GB of disk space, 48GB of bandwidth per month (the bandwidth’s OK, but that disk space is tight.
Bash pointed me at Media Temple, whose grid service hosting looks excellent and good value at $20 pcm. 100GB of storage, never offline, up to 100 domains, 1000 emails, etc. – it does look good. If they were in the UK I’d go for it immediately. I do, however, have a slight hankering to host in the UK, if only for reduced latency during ssh sessions, and MediaTemple, like WebQuarry, look to be in California. :-)
So: who’s your web daddy?
Jenny had a mouthful of Carillon gueuze â€“ one of the most exalted blends â€“ at a bar on Friday lunchtime, and she looked at me in horror. “I suppose it’s meant to taste like that,” she said. “Yep,” I replied. “It’s not for me,” she said. I took a sip. I could see exactly what she meant. It was like an wildly unsuccessful stab at a Lithuanian salad dressing. But… I had to keep ordering gueuze, where’er we went.
The Venn diagram of my friends includes a number of sets. “Computer Scientists” is an obvious one. Less obvious is “German”: since coming to Swansea I’ve made a lot of friends who are either German, work in the German department, or are buddies with people who work in the German department. This is probably mainly due to house-sharing with a lovely German, Barbara, for the first year I was here. Well, of late it’s become clear that many people in or close to that set are also in “Salsa dancers”. I recently realised that my colleagues Ben & Parisa form the intersection of “Computer Scientists” and “Salsa dancers”. There was even a rumour that Markus might conjoin all three sets – alas, not yet.
Still, it became increasingly clear that some kind of cosmic conjunction was underway, and Something Had To Be Done. So we’ve done two things.
First, a couple of weeks ago, sixteen of us went for a big walk on the Gower, which proved to be something of a Meeting Of Sets. Bash & I had planned to go check out Paviland Cave with our friend John since last autumn, and finally managed to set a date. Somehow, over the fortnight leading up to the day, we managed to invite a further thirteen people between us – a lovely mish mash of computery types, visitors from other shores, and sexy salsa dancing girls – with at least one person in all three categories.
It was a great day – a really gorgeous walk with some great people, blessed with superfine weather, a taste of adventure, and a nice pub meal at the end. I made a map of the route we took via google maps (with some notes). Parisa took some great photos, including one of me climbing the rocks towards the cave (another), though at times I wished I’d bowed out gracefully at this point. I did make it to the cave in the end, one of the six of us who did, where I took these photos:
So, yeah, all in all, a great day, and a highly recommended excursion.
The second thing we’ve had to do is, of course, give this salsa dancing lark a try. I was resistant to this for quite a while, on the grounds that I had the prejudice that it’s something thirty-something yuppies do as a substitute for actually having fun. However, at a recent night at the Monkey I got dragged onto the dancefloor by a recently-returned-from-Mexico drumming compadre, and realised the point of salsa: dancing close to girls. Aha. Not actually a substitute then, but the genuine article – even if I am a thirty-something (I don’t think I’m upwardly mobile enough to count as a yuppie).
So we went to a beginner’s class at Mambo last Friday and Had Lots Of Fun. It was easy enough to get, but new and difficult enough to not do well, and very hot and sweaty, and full of a big mix of interesting looking people. A good way to spend a Friday night, for sure. Thus, watch this space for more salsa musings as I learn my steps. One thing I’ll say: I think the drumming has definitely improved my sense of rhythm, and my ability to learn/remember sequences of actions to perform with my limbs. Ain’t brains wonderful?
Gig-tastic… Shiko will be drumming at 5pm this Saturday (19th May 2007), at Coffee Cesso, next to the Waterfront Museum in Swansea Marina. We’ll be playing as part of a charity fundraiser for wells in Africa, so come along, listen to some good music, and give generously! It looks like a good event – from 12 noon until 7pm it’s free (fingers crossed for good weather so we can play outside), then from 7pm to midnight it’s ticketed (a tenner each) but with some pretty good local bands, I’d say. More details here. While Shiko gigs are usually “unpredictable” in terms of timing, we’re assured that 5pm really is our slot, and it really will be 5pm not, say, 5:30. So don’t be late!
Then, the following Saturday (26th May 2007), we’ll be playing again, at the Monkey, on the wonderful Mondo world music night. Woo! Heaven only knows what time we’ll be playing at this one. :-)
(Within an hour or two of publishing this, it was pointed out to me that this talk is really about the IO monad rather than monads in general, and that in particular the assertion that a monad represents a computation which performs a side-effect is not, in general true. A nice example is the Maybe monad. So a better title for this talk is “A pragmatic look at monadic I/O in Haskell”.)
A pragmatic look at monads in Haskell (PDF, 293KB) – slides from a talk I gave last Friday in Swansea University’s Computer Science department, as part of our “No Grownups” series of non-research talks given for and by postgraduate students.
The aim of the talk was to explain monads to a non-expert (and, largely, non-Haskell-programming) audience: why do we have them, what problems do they solve, and how are they used? The approach is pragmatic in that the talk explicitly does not go into technical details, instead focusing on a broad understanding, and on some specific useful “rules of thumb” for programming with monads in Haskell. I don’t claim to be an expert on monads or to have produced a talk which is authoritative or even necessarily completely correct. I do hope to have produced something reasonably comprehensible and useful, however. I would welcome any feedback, comments, corrections, clarifications, etc.
The talk was filmed, but I don’t know if my delivery was good enough to warrant putting it online. :-) Let me know if you’re interested. The post-talk discussion was quite useful, so it might be worth it for that. In particular, there was a question about when exactly the “non-purity” happens – when does referential transparency go away? My answer was that it happens when it needs to (ie when the result is required) and that yes, obviously somewhere there is some code which isn’t pure Haskell and which is doing the impure operation – eg an operating system call. Markus opined that a big part of the point of monads is to give us a clear indication, in the type system, that an operation is impure and thus, in some sense, unsafe/not nice. I thought that was a good enough point that I’ve since added a bullet saying that to the talk – but that’s the only addition I’ve made before publishing.
Background/reference material: A History of Haskell: being lazy with class (historical context), monads @ wikibooks (the nuclear waste metaphor), IO inside: down the rabbit’s hole (probably the point where I started understanding monads), rules for Haskell I/O (not an influence, but something with a similar flavour which I saw when I’d nearly finished), do-notation considered harmful (desugaring), monads on the unix shell (just because the dirty string “dramatisation” is so great).
mux on #haskell pasted what is perhaps the most beautiful code I’ve ever seen in my life:
<mux> > nubBy(((>1) .) . gcd) [2..] <lambdabot> [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,...
(Number two in an ongoing series of jaw-dropping Haskell one-liners which began with the fibonacci series.)
This morning, I was having a problem involving Haskell’s Cabal build system. Since it’s something which could conceivably affect others, and since googling on the error text didn’t help me, I’m going to report my experience for the benefit of future travellers/googlers.
I was trying to (re)build xmonad, and got the following error:
Read the rest of this entry »
[gimbo@orb xmonad] runghc -v Setup configure Could not find module `Distribution.Simple': Use -v to see a list of the files searched for.
Wtf? Warrant issued for Richard Gere’s arrest in India following public kissing. Kissing on the cheek, mind you. An “obscene act”, apparently – it’s official!
Public displays of affection are still largely taboo in India, and protestors in Mumbai (Bombay) set fire to effigies of Gere following the incident.
Wtf? They burnt effigies of him? For a bit I wondered if the anger was directed solely at him. Apparently not.
… while protesters in other cities shouted “death to Shilpa Shetty”.
Here we have actual human beings, calling for the deaths of other actual human beings, because they kissed in public? Ye gods and little children, will the insanity of men never cease?
Wow, synchronicity. Yesterday I was browsing dons‘ space (because I spotted something like my string split in his h4sh stuff), and was very intruiged to spot xmonad. It’s another lightweight tiling window manager in the style of ion, wmii, dwm, and appears to be most like dwm in fact. It’s written in Haskell. Today, they announced the 0.1 release, so I just had to take a look.
It wasn’t too hard to install… A few dependencies, but all handled by Cabal, tvm. Since I already use wmii I didn’t find the keybindings too alien, and of course I can configure them at leisure should I wish to (and unlike dwm, it apparently doesn’t need a recompile when the config changes). Its (dwm-like) style of window management doesn’t sit completely easily with me, I have to say. I guess I’ve got used to the wmii way. I’m going to give it a go for a while, though, as I have an inkling I could grow to love it. It’s very snappy.
I miss three things.
First, a statusbar visible on every workspace. I just want to be able to see some things at a glance, always. Examples: time/date; battery life and charging/discharging status; xmms time remaining and shuffle status. Looking at the mailing list archives, it smells like there is or will be room for user-supplied extensions, and I guess this is an obvious candidate. If I don’t write it I’m sure someone else will. :-) Related to this is the ability to name workspaces, so they’re not just 1-9 – not critical but very handy. I don’t care about the whole tagging thing wmii does – I just want named workspaces as an aide memoir in the statusbar. “Ah yes, workspace 6 is hets.” That kind of thing.
Second, and routable-around: floating/unmanaged workspaces. Tiling/management is great 95% of the time, but sometimes it’s just a pain. The Gimp is the main culprit here, with its myriad windows of joy, but there are other cases. Xnest is probably the answer here. Here’s a little script to run an embedded icewm session:
#!/bin/sh Xnest :1 -name "Xnest" +kb -ac -geometry 1280x800 & DISPLAY=:1 xsetroot -display :1 -solid black & exec icewm
Third, I miss my window bars (the bits along the top where most wms put close buttons, etc.). Primarily I miss them in my terminals, where they report the full path of the current working directory. Another handy at-a-glance feature. I guess I can live without this though, for the sake of precious screen space. :-)
None of these are killers/blockers, though, so I’m definitely going to give xmonad a serious go.
(I realise it’s gone very “theory of programming languages” round here lately. Don’t worry, I’m sure I’ll have something else to talk about soon.)
Church’s Thesis and Functional Programming, a lovely little paper by David Turner (he of SASL & Miranda fame). Like the Google Tech Talk I mentioned a couple of days ago, it’s big on unifying historical perspective, which is a welcome change from most of the papers I see on these topics, which seem to assume you’ve either read all the papers they reference (recursively), or you’re about to. ;-)
It’s a veritable concucopial tour of TPL: Church’s thesis; the equivalence of lambda-calculus, Turing machines, and recursive functions; how the halting problem fits into that; the lambda calculus; Church-Rosser; strict vs. non-strict; combinatory logic; typed lambda-calculi; implementation of lazy FP (exemplars Miranda & Haskell); domain theory; FP without general recursion; Curry-Howard; Martin-Lof; and a hint of abstract Stone duality (which always makes me think of Father Stone). Seriously, if you’re at all interested in theoretical computer science, you should definitely take a look at this. I started losing the thread in the final section, but loved the rest and, I think, learnt quite a bit – mainly how various bits fit together; like joining the dots on a map.
(Ooh. Strachey coined the term “syntactic sugar”.)
From Bash, a great portrait of my father and I:
… and from Gimbo, three pictures of our cats:
Bonus from Bash, just ‘cos it made me say “wow”:
Haskell’s an incredible language but I’m repeatedly struck by (what I perceive as) gaps in its standard libraries (though as proven yesterday I could know them better). For example, there aren’t any cross-platform file path manipulation routines in the style of python’s os.path (though not for long, thanks to Neil Mitchell). Another lacking area seems to be string manipulation.
Today, I needed to split a string up according to some token, where that token is itself a string, not a single character. Thus, a split in the style of python’s strings’ built in split() method. That is, I wanted to be able to do this:
*StringSplit> split ", " "one, two, three, four" ["one","two","three","four"] *StringSplit> split "an" "banana" ["b","","a"]
To my amazement, this isn’t a standard library function, and I couldn’t find hundreds of examples of how to do it via google. I couldn’t even find one! I could find a number of variants where the token is just a single Char, usually utilising takeWhile and the like. Gladly this led me to a reasonable (I hope) solution. This example splits on Chars but in the comments I was introduced to unfoldr, which looked tantalisingly close to what I wanted. All I needed to do now was write the function unfoldr calls. About half an hour and much hoogling later, hey pesto:
module StringSplit where import List -- | String split in style of python string.split() split :: String -> String -> [String] split tok splitme = unfoldr (sp1 tok) splitme where sp1 _ "" = Nothing sp1 t s = case find (t `isSuffixOf`) (inits s) of Nothing -> Just (s, "") Just p -> Just (take ((length p) - (length t)) p, drop (length p) s)
All of the complexity is in sp1 (short for “split once”), which performs a single split. sp1‘s type is String -> String -> Maybe (String, String); the section (sp1 tok) then has the right type for unfoldr (sections just seem to be cropping up everywhere lately, eh?). The point of sp1 is to split s at the first occurrence of t. It does this by using inits to build all prefices of s and finding the first one having t as a suffix. If found, it splits the string at the token, throws the token away, and return the (before, after) pair. If the token isn’t found, it just returns s paired with an empty string; that gets passed by unfoldr to sp1 on the next call, causing sp1 to return Nothing, causing unfoldr to finish – whew!
That last bit sounds a bit complicated, but it was necessary to fix a bug present in my first implementation of sp1:
sp1' t s = case find (t `isSuffixOf`) (inits s) of Nothing -> Nothing Just p -> Just (take ((length p) - (length t)) p, drop (length p) s)
This misses the final substring, so split "n" "banana" would return ["ba", "a"] instead of ["ba", "a", "a"]. Hence the whole empty string/Nothing/stop machinery.
I could not have written this code two weeks ago, I think. Thus, I’m sure there are better ways to do this, and would love to hear them – and any criticism. I was a wee bit worried about using inits and find in this way for finding a substring (no standard substring function?). Haskell’s lazy nature ought to help me here though: inits will only build the entire list of prefices if t isn’t in s at all. For anything I’m planning to use this for, it ought to be fine; it’s probably not the best general way to do it though.
For good measure, since I had to implement it later that evening, here’s a string.strip() (aka trim):
strip :: String -> String strip s = dropWhile ws $ reverse $ dropWhile ws $ reverse s where ws = (`elem` [' ', '\n', '\t', '\r'])
I’m particularly proud of the ws part. :-) Look at me, all full of Haskell pride. ;-)
I realised I can generalise split beyond strings, to work on lists of anything of class Eq:
-- | A function inspired by python's string.split(). A list is split -- on a separator which is itself a list (not a single element). split :: Eq a => [a] -> [a] -> [[a]] split tok splitme = unfoldr (sp1 tok) splitme where sp1 _  = Nothing sp1 t s = case find (t `isSuffixOf`) $ (inits s) of Nothing -> Just (s, ) Just p -> Just (take (length p - length t) p, drop (length p) s)
*StringSplit> split [2,3] [1,2,3,4,3,2,1,2,3,4] [,[4,3,2,1],]
Great stuff: Parametric Polymorphism and the Girard-Reynolds Isomorphism [reddit] – a 30 minute Google Tech Talk by Phil Gossett. A really clear presentation covering a number of interesting topics, with a very convincing historical sweep. Certainly cleared a few things up for me, at least. His response to the last question is really more Hindley-Milner than Girard-Reynolds, mind. ;-)
Last week I wrote about sections in Haskell, and discovered flip. Today I hit upon a problem which got me thinking about them again, leading to one of those wonderful moments when Stuff You Just Learnt turns out to be exactly what you need to solve the problem you’ve got right now. (Then you blog about it and find an Even Better Way, as it turns out.)
I’ve been writing some file-manipulation code, and along the way had written the following function:
-- | Check if a given string (subject) ends with another (target). endswith :: String -> String -> Bool endswith sub tgt = drop (length sub - length tgt) sub == tgt
(Actually I’ve forgotten now whether I wrote this myself or found it somewhere, but it’s clearly not a new problem. If anyone knows a source for the above code, please do tell so I can attribute it. Anyway…)
So then you can do:
*Ew> endswith "banana" "na" True *Ew> endswith "banana" "moo" False
So far so good. Later, I had a list of filenames, and I wanted to filter it down to just those ending with a particular suffix. Initially, unthinkingly, I tried:
*Ew> filter (endswith "na") ["banana", "cat", "iguana", "mastodon"] 
Spot the cunning use of a section. Actually not so cunning, as it turns out – the empty list is not the result I was hoping for! The problem is that the first parameter of endswith is the subject (the string to be searched) not the target (the string to be searched for) so the section (endswith "na") is not the function which checks if a string ends with “na”. It’s the function which, given a string, checks if “na” ends in that string:
*Ew> (endswith "na") "banana" False *Ew> (endswith "na") "a" True *Ew> (endswith "na") "na" True
My first reaction was to just swap the parameters around. Let’s call this version endswith'. It’s exactly the same as endswith except for the parameter order:
endswith' :: String -> String -> Bool endswith' tgt sub = drop (length sub - length tgt) sub == tgt
Then (endswith' "na") is the section I’m looking for, and in particular works as I want under filter:
*Ew> (endswith' "na") "banana" True *Ew> filter (endswith' "na") ["banana", "cat", "iguana", "mastodon"] ["banana","iguana"]
I only use endswith in a couple of places, so this change was totally viable. Lesson learnt (or so I thought): you have to think carefully about parameter order when writing functions, because some sections will be more useful than others. Obviously with endswith, the section with bound target is more generally useful than the section with bound subject.
Later, I realised this lesson is bogus, or at least not very strong. I mean, there’s probably something in it, but I didn’t actually have to swap the parameters to make my filter work. That’s exactly what flip does:
*Ew> ((flip endswith) "na") "banana" True *Ew> filter ((flip endswith) "na") ["banana", "cat", "iguana", "mastodon"] ["banana","iguana"]
What’s going on here? (flip endswith) is endswith with the parameters flipped. Thus ((flip endswith) "na") is exactly the same function as (endswith' "na") which, as we saw above, does what I want. So in the end, I didn’t have to replace endswith with endswith' to get my filter to work – I could just flip it. Bearing in mind I didn’t even know flip existed a week ago, I felt pretty smug to realise this. :-)
The next question on my mind is what you might call “generalised sections for multi-parameter functions”… If I have a 4-parameter function and I want to build a section where 2 of the parameters are bound (say), and it’s not the first two, how do I do it? Stupid toy example:
f :: Int -> Int -> Int -> Int -> Int f a b c d = a + b + c + d
Can I make a section representing f with b fixed at 3, and d fixed at 5, say? I know I can do this:
g :: Int -> Int -> Int g a c = f a 3 c d
but can we do it inline, as it were, as with the section approach? Answers on a postcard to the comments page, please! :-) I suspect currying‘s going to wind up in there somewhere…
That’s all I originally intended to blog about; when chasing links to support this post, however, I read this and learnt two more interesting things.
First, someone has, of course, solved this problem already, and I can just use isSuffixOf to get this job done (Strings in haskell are Lists of Chars). So now I get to throw endswith away – w00t, less code. A fundamental lesson: once the language starts making sense, learn what’s in the standard libraries!
Second, thanks to Haskell’s ability to deal with functions in infix form, the section (isSuffixOf "na") can also be written as ("na" `isSuffixOf`) which is, I suppose, more natural (provided you’re not scared off by the backticks, which I’m trying not to be). Then we have:
*Ew> filter ("na" `isSuffixOf`) ["banana", "cat", "iguana", "mastodon"] ["banana","iguana"]
A name I’ve come across in my work on hets is Grothendieck. In a great example of Wikipedia cascade, someone on #haskell this morning mentioned the programming language Joy (which looks pretty cool), which led to the page on monoids, which led to the page on Grothendieck groups, which led to the page on Grothendieck himself, who a) also looks cool, and b) “gave lectures on category theory in the forests surrounding Hanoi while the city was being bombed, to protest against the Vietnam war”. Respect.
The Reason for Blogging, or rather Josef Svenningsson‘s reason for blogging – but I agree with what he says. In fact, I was only reading that post because he had commented on an earlier post of mine – a post which someone (ooh, dons)has submitted to programming.reddit.com and which was hence received some attention. As such, the following particularly resonated:
But then, why do I blog, as opposed to just writing on a piece of paper? The reason for me is that the possibility that someone might read what I write helps me write. Blogging means that I have an (at least potential) audience which I can target my writing towards. This (perhaps imaginary) audience is very important for me, I wouldn’t be able to write without it. I simply can’t motivate myself to write only for my own sake.
Absolutely. That post of mine about sections started with me just playing around for my own sake, investigating something interesting I’d just come across for the first time. I like to make notes (my memory is lamentably poor), and a blog is a nice way to do that; but as Josef says, once you commit to publishing, you think more carefully about what you write, how it’s structured, etc. Of course, I’m fairly used to writing (sometimes extensive) notes for semi-public consumption in my work, but a blog is nicer than a lecture in that anyone can leave comments and expand my understanding. That happens in lectures sometimes, but rarely, and almost never with random Haskell experts from all over the world. :-)
Another goodie of Josef’s: yak shaving. Yep, been there.
Boy falsely jailed for bomb threat for 12 days due to DST changeover. (URL in RISKS story doesn’t seem to work? Lots of google hits though, many of which have the same content and no attribution, sadly.)
Webb gave an insight into the school’s impressive investigative techniques, saying that he was ushered in to see the principal, Kathy Charlton. She asked him what his phone number was, and, according to Webb, when he replied ‘she started waving her hands in the air and saying â€œwe got him, we got him.â€’
‘They just started flipping out, saying I made a bomb threat to the school,’ he told local television station KDKA. After he protested his innocence, Webb says that the principal said: ‘Well, why should we believe you? You’re a criminal. Criminals lie all the time.’
Dorks. Dorks in positions of authority, more to the point.
Oh wow. According to the all-knowing Wikipedia Corey Feldman‘s second marriage was offociated by MC Hammer! I think that’s the best thing I’ve heard all year.
(Why am I Feldman-surfing? Last week, Bash & I watched The Goonies. I hadn’t seen this movie since its original release, when I went with my mum to see it at a cinema in Aylesybury. That must have been late 1985, and I’d have been 11 years old. Fun film, good to see it again, but made me wonder whatever happened to ol’ Corey. Well, now I know. :-) )
Here’s a super-cool (and very very large) image: All (known) bodies in the Solar System larger than 200 miles in diameter. Via the recently unveiled Long Now blog.
I received my Long Now charter membership card this morning. The envelope was beautiful – square, dun cardboard, a big Long Now logo, pretty American stamps, a San Francisco postmark, understated address labels… I was really impressed. Unfortunately, I was much less impressed by its contents, my “limited edition, individually numbered, stainless steel Charter Member card”. Flimsy (in fact, slightly bent), and fingerprinted, it really didn’t have the expected feel of, well, longevity. I was, at least, expecting something thicker and less bendable. :-)
I’ve spent most of today looking at Haskore, which appears to be the most well-developed kid on the block for doing Csound type things using Haskell (and indeed, doing music type things using Haskell). Here are my notes on finding/installing it, which experience wasn’t completely straightforward…Read the rest of this entry »
Consider the function (:) in Haskell…
Hugs> :t (:) (:) :: a -> [a] -> [a]
So, (:) is a polymorphic function which takes an element of some type, and a list of elements of that type, and returns a list of elements of that type. In particular, it prepends the singleton element onto the list. For example:
Hugs> 'c' : "ello" "cello"
Now for the fun part.
Hugs> :t ('c':) ('c' :) :: [Char] -> [Char]
Here, we see that ('c':) is a function which takes a list of characters (ie a string) and returns another one. As you might expect, it prepends it with a 'c':
Hugs> ('c':) "ello" "cello"
('c':) is an example of a section: we “partially evaluate” a function by providing only some of its parameters, which yields a new function. Obviously this is only possible if we have higher-order functions in our language.
We can take the section “on the other side” of the :, and define the function which takes a character and prepends it onto the string "ello"…
Hugs> (:"ello") 'c' "cello"
What’s its type?
Hugs> :t (:"ello") flip (:) "ello" :: Char -> [Char]
Interesting. The type is as we would expect (Char -> [Char]), but what’s this flip thing?
Hugs> :t flip flip :: (a -> b -> c) -> b -> a -> c
So flip takes a function with type signature (a -> b -> c) and returns an equivalent function with type signature (b -> a -> c) – OK, simple enough. But why did hugs introduce it here, I wonder, though, why didn’t hugs just do what ghci does, and say:
Prelude> :t (:"ello") (:"ello") :: Char -> [Char]
? I say: shrug.
In other news, I’ve just discovered Neil Mitchell’s Haskell blog. I met Neil at BCTCS 05 in Nottingham, and again at BCTCS 06 in Swansea (though at that time I felt like I was moving away from TCS). He’s a thoroughly nice bloke, and clearly knows considerably more about Haskell than I do, thus, a good blog to find. I enjoyed:
I think I was quite a bit less successful at explaining this one. The only way you can show sequence is not necessary is by writing an OS, a compiler, a web server etc in Haskell – all of which have been done. Unfortunately I only had a small piece of paper so couldn’t write any of those.
(The section saga continues here.
I have Firefox configured to not allow pages to specify their own fonts: instead, everything just gets rendered as sans-serif. I do this to make the web more legible.
This morning I realised an unintended consequence: my view of Gimboland differs from everyone else’s! While I was seeing it in beuatiful clean sans-serif, everyone else saw Georgia, or Lucida, or one of a list of several possibilities specified by the style sheet. Not what I wanted! So, for now, I’ve switched Gimboland’s style-sheet to specify sans-serif. To my mind this ought to be nice & clean (assuming your fonts are reasonably sensible); you may of course disagree – do let me know if you care to. And you can, of course, override the font in your own browser if you don’t like it. ;-)
This is, by the way, part of my ongoing effort to make Gimboland look OK across platforms & browsers. I think I’ve sorted out the alignment in the header, and now the only thing to do is work out why the sidebar overflows horizontally under Windows (even in Firefox, I think?).
Clive James on hoaxes & fraudsters. I’m with him on this one.
Some commentators regard fraudsters as romantic types, more interesting than poor old plodding us. These commentators say that few of these frauds would work without our greed. Perhaps not, but none of them would work without the propensity of the fraudster to lie.
How many software engineers does it take to change a lightbulb?
Just one. But the house falls down.
Handy & cunning: netrenderer: how does such-and-such-a-URL look in IE7? Handy for those of us who avoid Windows like the plague as much as possible…
(And yes, I know Gimboland’s still a bit broken. Ah well.)
Oh, hey, the Shiko gig at the Monkey on Monday was fun. It was reeeeaaalllly quiet: probably a quarter of the people there were Shiko people, I’d say. Monday night in Swansea’s bound to be fairly quiet, I suppose, particularly outside term time, plus it was the first night of the new Wales-wide smoking-inside ban. The latter may or may not have been a factor, but it certainly made for strangely smoke-free Monkey experience.
We were there as part of an “African Rhythms” night – basically a couple of guys DJ’ing African music (not the usual Mondo boys, one of whom, Eddie, is also a Shiko’er), and us! As I said, it wasn’t massively well-attended, but that was kinda cool, because it ended up feeling less like a gig, and more like just going and playing together somewhere, but with people dancing. :-) Two people in particular: two girls who do African dancing (they were in the carnival, I remember). We’d prepared three pieces, but in the end only did two of them, and that seemed enough. Later, some random jamming occurred, which was sweet. So, all in all, very chilled, very cool, very much fun.
You can now get sushi in Swansea – at last!
A place called Wasabi opened in Uplands a few weeks ago (phone no/address here); we’ve eaten there twice: it did not disappoint on either occasion. Great food, nice decor/atmosphere, loads of cute asian waitresses, plum wine, sake, green tea ice cream (deep fried and not), etc. The first time, I had gyoza, california rolls, and shoyu ramen, which last dish would have sufficed perfectly well alone – huge and delicious, with a soup spoon more like a gently dimpled spatula. The second time, the irresistable gyoza again, and another ramen, this time with spicy beef. My only disappointment here was that it wasn’t spicy enough: I’d hoped for something reminiscent of a spicy beef soup I’d had for breakfast on my last day in Beijing, nearly two years ago. Life continues to attempt to teach me the lesson that things anticipated are rarely as sweet as the anticipation, and I continue to put my fingers in my ears and sing la-la-la.
Anyway, all in all, highly recommended, long overdue, and very welcome.
Weirdly, they seem to have done a really bad job of sorting out an internet presence. On Friday they didn’t even have a Yell listing, though they’ve sorted that out now. (It clearly did no harm to their sales – word of mouth, I assume, assured that the place was packed both times we went.) Furthermore, and quite curiously, the menu sports the address www.wasabi.com, which is (currently) just a placeholder page, and the domain is registered to a PO box in Hong Kong. I guess it could be the people behind the restaurant, but my first thought was that it was just a domain squatter, and that the restauranteurs had made a big blunder, somehow. :-) The email address email@example.com is also on the menu, though, so they really do seem to mean it. It all seems a bit weird, to me — can it really be that the (surely highly desirable) wasabi.com domain is owned by a restaurant in humble Swansea? I could understand it being owned by a chain, but then I’d expect the website to have more than a holding page.
Ah, in true geek fashion, I’ve spent as much of this post discussing domain issues as I did on the food (and the waitresses). Somebody save me, please.
Oooh! In related news, congratulations to Jo, who had her PhD viva on Friday and got through it without needing rescue or anybody getting poisoned. Hurrah for Jo! (And thanks for the spicy beef ramen.)
While going through Gimboland history, I came across this post from 2001, discussing the near-certainty of an imminent catastrophic hurricane/flood decimating New Orleans — less than four years later, along came Katrina. Interestingly, Wikipedia tells us that the population of the city has largely bounced back since Katrina — so expect more of the same in a few years, I guess.
Found while rambling. Yowzer.
Kassa djembe patterns for Shiko gig @ Monkey Bar, April 2nd 02007.Read the rest of this entry »
Yankadi/Macru djembe patterns for Shiko gig @ Monkey Bar, April 2nd 02007.Read the rest of this entry »
Kennefoli/Soli djembe patterns for Shiko gig @ Monkey Bar, April 2nd 02007.Read the rest of this entry »
Sweet. I’ve just discovered the joy of media="print" Cascading Style Sheets. Now if you print (or, yea, print preview) any of the pages on Gimboland, the printed version won’t include sidebar, footer, most of the header, or a comment entry form (if one is present). Tidy!
This is achieved using the strip-it-down magic that is my print.css.
Seems to work great under Firefox. Slightly less optimal under IE7 but hey, who cares? I haven’t tried it with Safari or Opera yet. Any takers?
Your opinions, please:
As of the 10th of April, the Gimboland household will once again be television-free, and thus free of the obligation to pay for a TV licence. The Gimboland household will, however, continue to love such gems as Late Junction, Rob da Bank, Radio 4 (except the plays, obviously), and the BBC’s online presence in general. All of the above are funded by the licence fee, so the question is: should we in fact continue paying it? I’m half tempted, despite the lack of a legal obligation, simply because I do so value the BBC, in all its commercial-free glory. It has been said by wiser humans than I that the fee is worth it just for Radio 4, and that’s not entirely untrue, I’d say.
Woo hoo. I am the 348th charter member of the Long Now Foundation. Among other things, this gets me access to the US premiere of Eno’s “77 Million Paintings”; alas, I’d say the probability of me affording a flight to the USA this year is approximately zero. Ah well.
On the other hand, I don’t really mind. The best thing you can do to protect the environment, as Spencer Beebe says, is stay at home. :-)
She so foxy. 4 years ago now, mind! Oh, but still foxy. Don’t hit me, Bash. Ow.
That is comedy.
Woo. In a surprise move, Shiko will be drumming at the Monkey Bar, Swansea, on the evening of Monday 2nd April 2007. There is, apparently, some sort of African night going on, and since our beats are west African, our beats are invited. :-) Come!
Handy for future reference and pointing confused ASCII-loving students at: all about python and unicode, just the thing to explain the mysteries of unicode in a friendly manner, especially, er, if you know python.
I know this is nothing new, and I know there are many, many pages like this on t’Internet, but I just wanted to bookmark one for personal future chortle reference, thus: loads of pictures of cats acting mad or looking weird. Often the captions make the picture, though the whole “i’m on yr noun, verbing yr noun” meme gets stretched too far too often, I think. Still, I love cats, I love looking at them, I love laughing at them – so this is pure uplifting fun as far as I’m concerned. :-)
Classics: full speed ahead · your guy · dead of cute · proceed · offline · (original) · fail · charles · askance · thoughts · sup · shoryuken · relevant · rumbled · lion · slippers · trap · danger (how beautiful is that?) · cookie · hats · bat country · richard griffiths · camouflage · schweaty.
RSS feed – don’t miss a kitty!
Three days ago, I enthused about the Python community, and what a great help to me they were back in the day.
These days it’s Haskell that has my brain feeling too small, and I’ve just had my first experience of the Haskell community. I installed an IRC client for the first time in four years just so I could log on to the #haskell IRC channel. I’m happy to report that the experience was entirely positive.
For an imperative programmer, learning Haskell is initially hard because you have to stop thinking in terms of issuing instructions which will be performed in order, and start thinking in terms of composing pure functions (which have no side effects) together to Get Things Done. It’s weird at first, but ultimately very powerful, as it lends itself much more nicely to higher-order programming, lazy evaluation, actually composing programs out of reusable parts, etc. I’d say I’m starting to get a reasonable feel for that, although I’ve got a long way to go.
Unfortunately, a little later, you realise that there are cases where you need side-effects (eg input/output), which leads you into this whole sort-of-imperative side of Haskell, at the heart of which lie the hairy monad things. You totally can’t avoid this, because sooner or later you need to do I/O. Monadic I/O (and monads in general) look & feel imperative at first, but you soon hit barriers thinking like that, and ultimately really have to read stuff like The I/O Inside Tutorial, Tackling The Awkward Squad, etc. in order to understand what’s really going on, which is actually really clever, decidedly not imperative, and at some point turns into lambda calculus or category theory (take your pick).
It’s monads that I’ve been wrangling with lately. I’ve been trying to do a fairly simple I/O task: I have some directory containing some files; I want to operate on a subset of the files in that directory, for each of them reading the file and creating some data object representing its contents. The details aren’t important. Doing this in Python (say) is trivial. Doing it in Haskell has had me stuck for nearly a week. :-) I spent all day last Friday working through “I/O Inside”, and now understand monads much better than I did, and maybe half as well as I should (but maybe not even). That was all very informative and educational, but still didn’t answer my problem.
Anyway, long story short, tonight I installed an IRC client, went on #haskell, asked the question, and got an answer immediately and in a wonderfully friendly fashion. Full #haskell chat log for today is here if anyone’s interested, but in essence it turns out that mapM is what I need for this task. Sweet, and actually incredibly simple when you know it. I think a lot of Haskell is like that…
By the way, the #haskell channel has this neato lambdabot running, which among other handy functions, remembers and repeats amusing/apposite quotes when instructed to do so. Given the sad theory geek that I am becoming, this quote it kicked up tonight made me chortle:
Binkley: the sex is all in the operational semantics, denotational semantics only deals with love.
Sometimes people complain to me that I don’t tell them about Shiko gigs far enough in advance (typically I forget about it until the day before, or the day after). Well, let’s do something about that, and put some gigs on the long-range radar for anyone who’s interested.
First, on Saturday 19th May, there’s a benefit gig in Cafe Cesso (?) at the Waterfront Museum, Swansea Marina. This is the cafe at the edge of the museum, with a stage, etc. I think this happens in the afternoon, and there’ll be various people playing, raising money for a project installing wells in Africa. (Novel wells where the pumping is powered by a kids’ roundabout at the top, which leads me to imagine parents swinging whips and shouting “play harder!”, though I’m fairly sure that’s not the actual intent.)
Second, and muchos excitingly, on Saturday 21st July, we’ll be playing at the Bee Hop festival in Dorset, which just looks so cute you could take it home and feed it. This one I’m really looking forward to.
So there you go – no excuses, come and watch! I’m sure there’ll be more cropping up as the summer gets going, and I’ll try to do a better job of mentioning them here. There is, by the way, also a running page of upcoming Shiko stuff on the Shiko site. But anyway.
Drumming in public last Saturday was super ++fun.
The “Mumbles St David’s Day Parade” turned out to be somewhat smaller than I’d expected, but was excellent, nonetheless. It consisted of a group of primary school children in a Chinese-style dragon (red, of course), Shiko drumming alongside them, and another group of primary school childen behind, dancing and holding aloft a banner (which I didn’t actually read). About 50 people in total, I guess? It was enough, anyway, and a good crowd turned out to watch us.
The dragon looked like this:
The parade started in the quarry car park, crossed the road to get to the sea front, went south for maybe a couple of hundred metres in front of the grassy bit, then back north along the road to the mini-roundabout, and up Newton Road past the shops and the Ostreme Centre as far as the church at the top. We should have ended up in the school grounds opposite the church, but apparently nobody knew the combination lock for the gate! There was a moment of faff before plan b, and a diversion over the road.
This was the first time I’d drummed and walked at the same time. We all had light drums, mine one of these, donated to Shiko by Abbie, sadly missed since she disappeared around the world on a yacht. Although you can’t see it, I carried it via my climbing harness & a crab, as opposed to the more traditional sling (eg Chris, on the left). I wasn’t sure how well that was going to work, but it was great! I felt very much the modern climbing djembe innovator.
So yeah, it was a lot of fun. Lots of enthusiastic spectators, bemused shoppers & Mumblians, and an interesting mix of car drivers. The downhill traffic was halted all the way down Newtown Road (the uphill side was kept clear, halted further back), and the cars contained, I’d say, a 70/30 mix of people who were lovin’ it, happy to be in the middle of this strange unexpected happening (especially if they had kids, as you can imagine), and scowling men on their own in large cars trying to get to town and Do Important Things. I took particular care to play enthusiastically at these people, and make it as clear as possible that I was having a damn good time on this gorgeous sunny day, even if they weren’t. :-)
Highly recommended reading for any of my students out there: a comparison of message-passing concurrency vs. shared-memory concurrency, with a healthy dose of historical perspective. The author introduces Erlang-style concurrency in a Java-ish setting, and does so quite well, to my mind.
Reading the introductory remarks about candidates in interviews, I was pleased, nay, smug to realise that – albeit inadvertantly – I came to multi-threaded programming via the message-passing route, and would probably have made him quite happy if he’d interviewed me. Back when I worked at Frontier I did my first multi-threading work, in Python, and made heavy use of its excellent Queue class for inter-thread communication. Queue provides a thread-safe message passing mechanism, hiding all the nasty details of locking from me, which was exactly what I was looking for. My threads shared almost no state, and what state they did share was mostly Queue objects. They communicated by passing messages through Queues (messages could be anything, and often were), and it was all lovely and clean.
Why did I go down that route? No genius; I just got lucky (yeah, lucky in that I was using Python not Java or C or C++). I had excellent advice from the good folk on comp.lang.python/python-list: this was the way to proceed. Of course, looking back I realise many of these guys knew all about message passing vs shared memory, they knew about Erlang, they knew about Haskell, hell some of them even knew about Lisp. A community as smart and welcoming as that one is a precious resource for a budding programmer.
Anyway, this led to two strongly noticeable results.
First, my code worked well, and didn’t suffer from mysterious hard-to-debug race conditions, etc. It “just worked”, as is often the way with Python.
Second (confession time), I didn’t actually learn properly about semaphores, monitors, shared memory concurrency and all its ridiculous fiddly baggage until I came to teach them in the Operating Systems module at Swansea! By then I’d already formed a strong sense that high-level languages (and Python in particular) made life so much sensibler, so the shared memory stuff slotted quite readily into the mental space of “low level stuff which has to be understood, but is best done by software not humans” (like much of that module).
I was discussing this whole issue with one of my students earlier in the week. If she closed her app’s main window while a worker thread was running, the program would exit uncleanly. This being Python, it was nothing more drastic than an exception/traceback, but she found this properly displeasing and wanted to clean it up (good, I said). It turned out that the main thread wasn’t waiting for the worker to finish: it exited immediately, cleaning up all data, including data the worker was trying to update. Hence, exception city. I showed the simple fix (make the main thread wait for the worker to finish, using a shared boolean “I’m not dead yet” variable), but then I tried to persuade her that message-passing concurrency was the way to go for all inter-thread communication. Even, said I, right down to the (frequent, many) interface updates caused by the worker thread. That is, I suggested, the worker shouldn’t update the GUI component directly, because the GUI is owned by the main thread. Instead, the worker should pass messages to the main thread telling it what updates to perform, and the main thread should poll for these messages and do the updates. I don’t think I sold her on it entirely, but maybe I planted sump’n.
(Caveat: yes, if performance really matters – eg you’re doing volume graphics – this may be poor advice. For the other 95% of us, however…)
Sad day: Mum rang earlier to tell me that Callington museum caught fire this morning. Sadder still, I haven’t ever visited it – for all those years since it opened, I’ve always postponed going because “it’ll be there when I get round to it”. Well, too late Gimbo. Lesson in there for all of us, I’d say.
(Callington is my home town, btw.)
Update 2007-03-05: Dad sent me the following photo:
Apparently he spoke to one of the firemen, and (I quote) it would appear most of the artifacts were saved, with only smoke & water damage. Cause was apparently an electrical fire at the control box.
PHP programmers: did you know that the name of your favourite language actually stands for Pot Head Pixies? All starts to make a bit more sense now, eh?
The spam issue I reported a few days ago seems to have gone away (for now). I suppose they used gimbo.org.uk addresses for “one run”, and then I saw the undeliverable reports petering in over the next few days (though mostly on that first day), and now they’ve stopped. Still, it could start up again any time.
My ISP’s advice was to disable the (otherwise very handy) “catchall” account; I can still create “one use” addresses my setting up an alias/forward (easily via their web admin interface), but that’s still gonna be a PITA (I’ll be bound to miss some, too). Why is the world full of people who insist on making things shittier for the rest of us? The catchall is really handy but now I’m told I can’t use it because of some asshat trying to sell viagra? It ain’t right.
Tags in Gimboland were broken. Now they’re fixed. That is all.
Wow… The Blind Melon bee girl (or someone claiming to be her) has sent a postcard to Postsecret. Apparently she’s 18 and still trying to find where she belongs. She shouldn’t worry; I’m 32 and only just starting to work it out, I think.
(I hope that permalink remains valid – in the past, Postsecrets have been impossible to link to effectively once they fell off the front page.)