Categories
Uncategorized

London Perl Workshop

Yesterday was the London Perl Workshop. Thanks to the joys of the british railway system I had to catch the 07:19 train from Brighton in order to make it in reasonable time. This included an extra half hour on the train due to “maintenance” being carried out. I was only diverted about 10 miles, you do the math. When I eventually arrived, I was there for about 3 seconds before bumping into Muttley who was worrying about the lack of signs. Apparently all the signs had been destroyed by a beer infestation the previous night. So I volunteered to go outside with Acme and guide people in to the main lecture theatre. I also bumped into mirod whilst standing there—I’ve been using XML::Twig for years, so there was plenty to talk about. Eventually, Mark turned up with the signs, so we went inside to the talks.

After a lot of faffing around trying to find U214, I got to Abigail’s first talk on Regexp::Common. It’s a repository of useful regexes (NB: I have no idea of the correct pluralisation). It can match things like numbers, URLs, email addresses, postcodes and a tonne of other stuff. But what’s really cool/scary is the interface. It acts as a string, or a hash, or a regex, or an object, or a function, all depending on how you use it. Naturally, it’s originally a DCONWAY production. If that wasn’t scary enough, you need to look at how it uses uses tied hashes to pass flags in when creating a regex, so you can adjust the details of how it recognises a number. I really need to go back and use this module in lots of places. What’s nice is the ability to extend it seamlessly without having to understand all the magic.

I popped back to the beginners track briefly to hear <a href="http://search.cpan.org/arc/”>Aaron Crane talk about Content Management at El Reg. Most of the talk appeared to be why they found Bricolage inappropriate and instead refactored their old system to come up with Troi, their custom CMS. What’s good to see is that they publish to static files and use rsync to distribute amongst several web servers. A great way of serving a lot of content. They also use SSI to do the page template, which is about as quick as it gets. I really liked the way that they use libtidy to get very clean HTML which then gets chucked through some XSLT to generate the final content. All in all, it sounded quite a neat solution. He did admit that there was no version control at all, but justified it on the grounds that there wasn’t a real business case for having it. Oh, and they’re still using Falk.de for advertising, but it’s apparently quicker now (yeah right).

After a quick nose through the O’Reilly stand outside (30% off! Woo!), I wandered back to the other room to hear Abigail on “Lexical Attributes.” I caught the end of the Parrot talk, but I don’t think that I missed much that I need right now. I also managed to discover from talking to <a href="http://search.cpan.org/nwclark/”>Nicholas that <a href="http://search.cpan.org/kane/”>Jos Boumans, due to speak next was not present due to unit testing the new licensing laws (unfortunately, it’s still very easy to say “ok” after several units of alcohol 🙂 )

Anyway, Abigails second talk was very interesting. He covered lots of problems with the standard way of implementing objects in Perl, and then set about trying to find the best way to solve them. He started out exploring the Flyweight pattern, and moved through several other ideas, before arriving at (more-or-less), Class::Std (aka Inside-Out objects). This appears to fix most of the problems, like good encapsulation. But he also went on to describe the <a href="http://search.cpan.org/abigail/Lexical-Attributes-1.4/lib/Lexical/Attributes.pm”>Lexical::Attributes module, which goes even further at solving the problem. The only catch: it’s a source filter. So, it turned out to be a nice possibility, but not good for production code. Wait for Perl 6 instead.

I have to praise Abigail as a speaker. Even though his slides have some odd colour schemes, he managed to get the point across swiftly and also managed to be brutally funny at the same time. He had the typical dutch poker face whilst producing very funny, brutal insults. Good stuff.

Due to the lack of Jos, Mark Fowler bravely stepped up and did a live introduction to Froody, a web-xml framework thingy. Yes, another one. But this is cool. It tries as hard as possible to get out of the way. It’s modelled on the Flickr API, and is a really good candidate for REST-style interfaces. I like it a lot. All it needs now is some JavaScript goodness to make it Ajax ready. And apparently, that’s on the way. In short, if you need to shove up some kind of API on your web site, it’s probably worth taking a peek at Froody. I’m going to have to try it to be sure, but it looks like it hits a sweet spot between functionality and configuration. Check out the QuickStart.

After this, I pottered off to lunch with Mirod and Maddingue. We found a nice looking cafe and found Robin Houston (with less hair than I recall) there as well, a nice surprise. It’s great to actually be able to talk shop with some new people a bit. You can’t really talk about computers in polite company without a lot of peoples’ brains dribbling out of their ears.

After lunch, I popped into the talk on Perl at the Sanger institute, but to be honest found it a bit uninformative. I already know something of both DNA and Perl and this didn’t tell me much new. As always with biological computing though, the numbers are terrifying: 350Tb disk, 450 node clusters for doing sequencing. Fun stuff. Naturally, the compute intensive bits are all in C, and Perl is just the glue. Sadly, there wasn’t much on Bio Perl, which would have been interesting. Although there was stuff on their derivative, ensembl.

Coming out, I picked up two new O’Reilly books. I was too tempted by the shiny “30% off” offer. I also overheard muttley frantically trying to locate MJD for the final talk…

Meanwhile, I went to see Casey West on “Using Attributes.” This is one of the few areas of Perl where I know absolutely zilch, so I was really looking forward to it. And in the first few slides, you could really see why this was part of the “Advanced Perl” track. The summary is that attributes let you attach arbitrary bits of code to a subroutine or variable. And you need to use Attribute::Handlers in order to avoid going insane. But it made it really easy to see how you could implement a :Private attribute for an object. Pretty cool stuff.

Afterwards, back to the main hall to hear MJD. But I managed to catch the final 5 minutes of acme and Leo talking about MighTyV, their project that wone them a prize from the BBC. I wished I had heard the rest of that. They make a great double act.

Shortly thereafter, MJD arrived, completely spaced out from the flight over still. He was giving a talk on “Red Flags”—things you see in a Perl program that make you think “Hmmm, that doesn’t look right.” They seem similiar to bad code smells. Apparently, this was a 3 hour class usually, and he was trying to get through it in an hour and a half…

MJD started out by saying he wasn’t here to tell us how to do clever stuff. Merely how to make existing code better by thinking about simple things. “You don’t have to be clever to write good code” was his mantra. Most of what he talked about was a very simple example. He’d taken a script from usenet or Perlmonks or somewhere which copied files from two input directories into an output directory. A really simple task, mostly trivial, which sysadmins everywhere love to use Perl for. But the script had many, many flaws. Basically, everything was repeated twice, once for each input directory. So, in his words, he was going to “fix the hell out of it.” He went through lots of bits of it, pointing out the slightly daft bits, and how to pick up on them in general. Stuff like “For repeated variable names, use an array” and “for related variable names use a hash.” Common sense stuff, but things that are often missing in code that you happen to inherit.

His biggest lesson was “Repeated Code is a Mistake.” This is the same as the pragmatic programmers saying “Don’t Repeat Yourself.” While none of what he said was a cast iron rule, more a guideline, this came closest to being 100% enforceable.

Like Abigail before, MJD was an fantastic public speaker (which is probably why he gets paid to do it). Despite significant heckling from the audience (participation), he kept up the snappy comebacks. Very entertaining. In fact, nobody wanted to interrupt him at 17:30, so we ran on until 18:00. Sadly, I had to get away quickly in order to travel back to Brighton. I didn’t get in my front door until 21:00. 😦

Overall, I had a great day. I’m enourmously grateful to the sponsors for enabling such a fantastic event to be put on for free. It was a triumph for all concerned.

Categories
Uncategorized

This mornings cycling

I went out a bit late this morning—9am. If I’d gotten out earlier, I could have cycled for longer without it eating into the remainder of the day’s activities. So I took a short ride, similiar to last weeks (which I failed to mentioned, but which was utterly freezing thanks to the fog).

First I went up to Devils Dyke. This was the only cold bit, thanks to the brutal wind along the top of the ridge. Because I hadn’t been going for long, I was still warming up as well. My arms were exposed and turned bright red in a matter of minutes. At the Dyke, I saw some parents taking their small girl for a walk, in the most fabulous pink wellies. Kids clothes are always so much more interesting.

I turned back from the Dyke and headed left down the path towards Saddlescombe farm. This was surprisingly dry. There was a bit of mud, but nothing serious. It started getting a bit slippery as I got towards the road about, but that was it.

Crossing the road into Saddlescombe farm, I went through the farm, to the left and up the path under the trees. Full of branches and rocks, as well as being quite steep, this was a bit of a sod to get up. I came off twice. Finally getting through that, I went into the open fields and the steep climb up Newtimber hill. That was good, with plenty of work required, but pretty good traction on the grass. No wheel spinning.

At the top of the hill, I turned right to start the journey back home. I went through the gate down a small path which didn’t look as overgrown as the last time I went through there. This was a shortcut in order to cut out about 500 yards of cycling. Silly mistake. I got half way through the path and it was nearly completely enclosed in brambles. Thankfully, somebody else had obviously realised the same thing at the same point and there was a large escape hatch in the hedge where the previous person (probably a pony actually) had cut through back to the main path.

From there it was a regular farm road all the way down sweet hill to waterhall playing fields. Unfortunately, this is where I really started to encounter the mud. I had been this way once before in a thunder storm with some friends and the chalk had really stuck to my wheels. But this time, the mud was like super glue. It didn’t just stick to my wheels, it stuck to itself very well. So that every few metres a large clump of mud would gather on the front wheel and wedge itself into the arches, bringing me to a complete halt. Very frustrating. Especially when it happens in front of some farmer unloading hay for the cows.

The end result was that I had to repeatedly cycle for a few yards, and then shake the bike to clear the mud off for several hundred metres. Grrr. As I turned into the final downhill stretch of Sweet hill, I hit tarmac and managed to shake off some of the mud. But even when I got home about 10 minutes later, I still had more mud on my bike than I’d managed before. So I had a lovely afternoon cleaning mud off the bike. What a bonus…