It was back in the middle of March that I first raised the question of running some training in conjunction with the Perl Conference in Amsterdam this August. I didn’t mean to leave it so long before following-up, but I’ve a lot of real life to deal with over the last couple of months and I’m afraid a lot of my digital life got shoved to one side.

But I’m back now and we should really get something organised for Amsterdam.

So here’s a Google Form for you to fill out, to tell me what training course you’d like to see me run in Amsterdam. I’ll leave it running for a couple of weeks before making a decision.

The post Amsterdam Training Questionnaire appeared first on Perl Hacks.

May 27, 2017
@davorg
May 27, 2017
@davorg
May 26, 2017
@davorg
May 26, 2017
@davorg
May 26, 2017
@davorg
The People's Songs: The Story of Modern Britain in 50 Records
author: Stuart Maconie
name: David
average rating: 3.87
book published: 2013
rating: 0
read at:
date added: 2017/05/25
shelves: currently-reading
review:

Dave Cross posted a photo:

Can you tell what it is yet?

via Instagram ift.tt/2r92geg

Dave Cross posted a photo:

Railway station with a view (and a rainbow)

via Instagram ift.tt/2rzHHVd

Dave Cross posted a photo:

The Finished Article

via Instagram ift.tt/2r0jDOo

Dave Cross posted a photo:

Making gin

via Instagram ift.tt/2qz4nGN


A one-day practical tutorial on modern Perl web development practices using Dancer 2.

How to make useful data feeds of the Tower Bridge lift times.

The Perl Conference (formerly known as YAPC) in Amsterdam is getting closer. Oh, sure, it’s not imminent, but in five months time it will all be over. And there’s a lot to get done in those five months. I’m glad I’m not one of the organisers.

But there is something that I need to get organised over the next couple of months. It looks likely that there will be training courses running before or after the main conference and, assuming that happens, I’d like to be running one of those courses.

Last year, the “Modern Web Development with Perl” course that I ran in Cluj-Napoca seemed to be very successful (it certainly had the most attendees of any course I’ve run alongside a YAPC) and I think that was down to two factors:

  1. We planned and announced the course nice and early.
  2. I asked you what course I should run.

I’m not doing to mess with a successful formula, so I’m going to take the same approach this year. Consider this my “what course should I run?” post.

This is how it will work. In this post I’ll make a few suggestions of courses. We can discuss them in the comments and you can add your own suggestions. In a few weeks time, I’ll pull out the most popular suggestions and put it to a public vote. I’ll run the course that gets the most votes.

So what courses could I run?

There are courses that I’ve run many times and that would only need light updating. I have a course on DBIx::Class (I ran that in Granada in 2015), one on Moose and one on testing. I’d be happy to do any of those.

At the LPW last year, I ran a “Modern Perl Update” session which seemed to go down pretty well. I went through the last few Perl releases and explained the new and changed features. It was only a couple of hours long, but I could expand it. Perhaps I could add some stuff about CPAN modules that people don’t seem to know about.

I could re-run the Dancer course from last year. In a day, the class went from nothing to writing a functional and useful Dancer application. Perhaps there’s a big enough audience to do that again.

Or, perhaps, some kind of extension to last year’s course. I don’t mean that you would need to have done the previous course in order to find it useful, but maybe something about integrating Perl web tools with a modern web development toolkit. Using Angular or React as the front end to a Perl backend. Or how about writing APIs in Perl?

I’ll should point out that there are some things that I’m not the right person to teach. Perl 6 is top of that list. Not only have I not had the time to really explore Perl 6 yet, but given that Damian Conway is going to be at the conference and I fully expect him to clean up on the Perl 6 training front.

So there are half a dozen suggestions. What do you think? Are you coming to Amsterdam? Would you (or your company) pay extra for a training course? What course would you like to see?

Let me know your thoughts.

The post What Training Should I Run In Amsterdam? appeared first on Perl Hacks.

Long-time readers might remember that I once had a bit of an obsession with aggregating web feeds on sites that I called “planets”. I wrote Perlanet to make this job easier and I registered the domain theplanetarium.org to host these planets.

The planets I built were of varying levels of usefulness – but of all of them, planet davorg was the vanity project. It was simply a way to aggregate all the web feeds that I produced. There were feeds from various blogs along with things like Flickr, Twitter and CPAN.

One of the things I liked about planets was that they were self-maintaining. Once you’ve configured a planet, it will just keep on running (well, as long as the cron job is running). If the web feeds they are aggregating have new content, the planet will have new content. And many of the feeds that powered planet davorg were still running.

But last weekend I found a couple of  problems with it. Firstly, it looked like it was designed by an idiot. Which, to be fair, it was. Web design was never my strong point. But we have Bootstrap now, so there’s no excuse for web sites to look that bad. So that’s how I spent the first hour or  so – slapping a bit of Bootstrap paint onto the site. I think it now looks acceptable.

The second problem was that not all of the feeds were still running some of them (Delicious, for example) were just dead. I can’t remember the last time I posted anything to Delicious – can you? So I spent some time tweaking and fixing the feeds (replacing CPAN with MetaCPAN, for example). Most of this was easy.

However, one feed was a problem. My Last.fm feed was dead. For over ten years I’ve been “scrobbling” ever song I’ve listened to and one of the feeds I was aggregating was that list. According to this page on their web site, my feed is supposed to be at http://ws.audioscrobbler.com/1.0/user/davorg/recenttracks.rss – and that was the URL in my Perlanet configuration. But it doesn’t work. It returns a 404 error.

I tried to contact someone at Last.fm to find out what was going on, but I haven’t got any kind of response. It looks like they’ve been running on a skeleton staff since CBS took them over and they don’t seem to have the time to support their users (not, I suspect, a recipe for long-term success!)

But there was one possibility. You can get the same data through their API. And some quick experimentation, revealed that their API hasn’t been turned off.

And CPAN has Net::LastFM which will make the API calls for me. Ok, so it hasn’t been updated since 2009, but it still works (I’ve just noticed that there’s also Net::LastFMAPI which is a little more recent).

So it just took a small amount of work to write a little program which grabs uses the Last.fm API to get some JSON that contains the information that I want and convert it to an Atom feed. In case this is useful to anyone else, I’ve put the code on Github. Please let me know if you do anything interesting with it.

And if anyone from Last.fm reads this. Please either turn the web feeds back on or remove the documentation that still claims they exist.

The post Shaving Last.FM Yaks appeared first on Perl Hacks.

It’s far too long since I’ve posted anything here. I’ve no excuse really. Following the end of my contract in Canary Wharf, I was off work for seven weeks. OK, I was on holiday for two of those weeks, but that still leaves five weeks when I could have been doing something constructive, but actually just spent a lot of time watching Netflix.

But there were a couple of things I did. Neither of them took more than a few hours, but I thought it was worth writing them up – if only to give an example of a couple of really useful (to me, at least) things that I was able to build really quickly with Perl.

Cooking Vinyl

If you were a music fan in the 1990s, then there’s a good chance that you own at least one album released on Cooking Vinyl Records. At times, it seemed like pretty much every album I bought was released by them. Back in 2005, I wrote a blog post where I tried to explain how much they meant to me.

In particular, they produced a series of compilation albums that introduced me to so many of my favourite acts. Ten years ago, I tried to find a definitive list of all of the songs and artists which appeared on those compilation albums. As I failed to find one, I created it myself. At the time, it was a static list of albums which listed the tracks and artists on each of the albums. For ten years I’ve had it in the back of my head to do something more interesting with the data. A few weeks ago, I finally got round to it.

As I said, the original page just had a list of albums with artists and song titles. That’s useful, but it would be more interesting to be able to cross-reference the data in various ways – list all of the albums that an artist appeared on, for example. And for that, we need a database.

If you’ve come on any of my database training course over the last ten years, you’ll know that I use a CD database example. The model that I use is pretty simple and, in particular, it assumes that all tracks on a given CD are by the same artist. As I say in the class “various artists compilations don’t exist in this simplified universe”. Obviously, that’s not going to work in this example. So I needed to come up with another database model.

Compilation album data modelCompilation album data model

Here’s the data model I designed. You’ll see that it all hinges on the track table. A track is an instance of a particular song, recorded by a particular album appearing on a particular album. The only extra data on the track table is the “number” column which allows us to declare the order in which tracks appear on an album.

Advanced students will have spotted an omission from the data model. An artist might well have different versions of a song. There could be the original version, an edited single version and many live or remixed versions. So actually, we could add a “recording” table and it’s the recording that appears on an album. That’s, perhaps, an enhancement for the future.

Having designed the database the rest of the code just falls out really. I already had a data file so it was just a case of parsing that and inserting the data into an SQLite database. DBIx:Class (and, particularly the find_or_create method) makes this trivial. I then wrote another program that generated the web site using the Template Toolkit. Nothing complex there at all.

The site is at http://cookingvinyl.dave.org.uk/. And all of the code is on Github. It could do with being made a bit prettier – perhaps I can add some pictures.

Why not have a look. And check out some Cooking Vinyl recordings.

Tower Bridge

I’ve lived in London for thirty-five years. And in all that time I have never seen Tower Bridge opening. Oh, I’ve seen it when it’s  open, but I’ve never been in the right place at the right time to see it actually opening. As a Londoner, that’s a matter of supreme embarrassment to me.

But the office I’m working in currently is three minutes walk from Tower Bridge. All I need is a way to get a notification a few minutes before the bridge lifts. Surely, there must be a way to get that?

Sadly, no. The Tower Bridge web site has a page listing the upcoming lifts, but no service that would send any kind of notification. So, once again, it was up to me to provide one. I asked the London Perl Mongers on IRC what would be a good way to get notifications of upcoming events on an Android phone and Ilmari pointed out that the obvious method was to create a calendar that could be read by the calendar app on my phone.

So that’s what I’ve done. I use Web::Query to scrape the data from the Tower Bridge web site (doing some over-complicated madness to account for the fact that they are missing the year from their dates) and then create a .ics file using Date::ICal and Data::ICal. I also create a JSON version of the data in case it’s useful to anyone (if it is, please let me know).

The site is at http://towerbridge.dave.org.uk/ and (of course) the code is on Github.


So, there you are. Two (hopefully) little projects that I threw togther in a very small amount of time using the power of Perl. Please let me know if you find either of them useful.

The post Two Weekend Projects appeared first on Perl Hacks.

Dave Cross / Saturday 27 May 2017 13:03