Author: Rowan (Page 4 of 4)

iCalendar for English Bank Holidays

I’ve been making increasing use of Lightning (backed onto Google Calendar) recently, for both work and personal use, and being able to see bank holidays in my calendar would be very handy. But for some reason, all I can ever find is calendars for “UK Holidays”, which are pretty useless – for one thing, not all parts of the UK have the same bank holidays, and for another, they tend to include random events like Saints’ Days which aren’t “holidays” in the sense of a day off work!

So I decided to make my own calendar, showing bank holidays, in England, and nothing else. And, just for the sake of it (and because there was a very nice-looking library available), I wrote my first ever Ruby script to generate the iCal file for it! A seasoned Ruby coder will probably look at it and laugh, but hey, it works!

The dates are based on this government website, which currently has data up to 2011. The resulting files should work fine in Lightning, and as imports to Google Calendar, so feel free to “subscribe”.

Update: For those still finding this after the end of 2011, I should point out that I have been regularly updating this calendar as new dates are added to the government website, and will continue to do so whenever I think to check.

Additional Note: The best way to use these links is not to download the files themselves, but to right-click and copy the URL. Then in Lightning, or Google Calendar, or whatever other calendar you use, find the option to set up a new calendar and paste in the URL (calendar type is “iCal” if it can’t guess). That way, when I update the files (generally once a year to add the next year’s dates, but occasionally to fix a typo), it will update like any other shared calendar.

The Case for a better Switch

The C-style switch-case construct – used in various programming languages, including PHP – is a curious beast. Most commonly used as a streamlined form of if-elseif-else, it actually has more in common with the oldest of control statements, the goto, since control jumps to the first match and carries on until you tell it to stop.

Firstly, am I the only person in the world who thinks that the break should be indented to the same level as the case, not the level of the commands between? If you are using it as a series of separate elseif blocks, then surely the two form a matching pair, with the code block “enclosed” within them. Of course, you can generally break early inside the code, just like you can return early from a function, which is hard to make stand out – but that’s just an argument not to do it too often!

And, of course, the fact that another case comes along does not mean that the code won’t carry on. Which brings me neatly to my next thought: is there any language that insists you declare when you’re falling through to the next case – and if not, why not? What if every time you put a case, you had to end it with either a break or a continue? It seems to me it would prevent a lot of bugs caused by cases inadvertently falling through and running completely the wrong code. And if overloading an existing term like continue is too confusing, lets just have a fallthrough – anyone got a case against? [No pun intended; probably…]

New Mozart, Old Hat?

So, apparently 2 “new” pieces of music by Mozart have been “discovered”. Is this the latest case of “I was looking in my attic and guess what I found…”? Well, no – the attic in question was the archive of something called the “Mozarteum Foundation“, and they knew they were there all along. But now that they’ve decided they were by Wolfgang Amadeus Mozart (and not, say, his Dad), suddenly they’re really interesting.

Now, I’m not saying they’re rubbish, but isn’t this a bit like saying “It may just be a doodle on a napkin, but I’ve just discovered it’s Picasso’s doodle on a napkin, which makes it Important”? Or, contarily, “I’ve had this great painting for years, but I didn’t know who it was by, so I didn’t put it on my wall…” Either it’s good music, in which case it should be performed regularly whoever it’s by, or it’s not, in which case it’s of interest only to music historians. Continue reading

Watching Le Tour on ITV. Or trying to.

I’m a bit of an annual cycling fan – that is, I get really into the Tour de France every summer, and barely follow the sport at all the rest of the year. It’s a bit like only watching Tennis when Wimbledon’s on, or football when it’s the World Cup. Which, come to think of it, I do a bit too – but not as regularly.

Now, part of this is because the Tour de France is the only professional cycling race that’s generally covered on “mainstream” TV – I’ve never had the “luxury” of Eurosport. A few years ago, even that was in doubt, with Channel 4 suddenly dumping the rights, and ITV rather half-heartedly taking them over. Which brings me to this year’s “good news, bad news” story.

Piracy, Morality, Ted & Alice

I’ve always been very suspicious of the piracy statistics put out by what you might call the “IP industry” – big software, music, and movie companies and lobby groups. So it’s gratifying to see Ben Goldacre demolishing the latest claim that piracy is “costing £billions”. Summary: they guessed the figures, then “accidentally” multiplied them by 10 before telling the press.

But it led me into some other discussions about piracy, such as Greg Pyes’ defence of the “piracy = stealing” argument, and got me thinking about the complexity of when “piracy” is actually immoral (as opposed to illegal) .

Continue reading

Newer posts »