Categories
Programming

Line of Succession

I’m a republican. No… wait… come back! That’s not what I mean.

I’m a long way from being a supporter of the Republican Party. I mean “republican” in its older meaning of “someone who thinks their country should be a republic. That is to say, I’m not a big fan of the British royal family.

But while I believe that the UK should get rid of the royal family, I’m also fascinated by them. In particular, I’m fascinated by the laws that determine the line of succession – that is the list of people in line to take over the throne.

When I was a child I believed that the line of succession was a big list that had every British person’s name on it and that it would only take a single catastrophic event to propel my name to the top of that list. Later on I discovered the Act of Settlement (1701), which is the law which actually defines the line of succession (modulo a few later tweaks). I was disappointed to find that there were only a few thousand people on the list (and that didn’t include me!) and also that a lot of the people on the list weren’t British (largely due to Queen Victoria’s children marrying royalty from all over Europe).

A few months ago, I started to think about building a web site that would allow people to explore the line of succession through time. And over the last few weeks, I have build the site. It’s at lineofsuccession.co.uk. On the main page, you will see the current line of succession. And in the navigation bar is a drop-down menu that allows you to move to a few interesting data (the days that the last four monarchs came to the throne) and a date picker allowing you to choose any random date.

The code is, of course, on Github. The web app is a pretty standard Dancer2 application which really doesn’t do anything clever. Most of the complexity in an application like this is in the data gathering.

Currently I have just over a hundred people in the database. That’s most of the descendants of Edward VII (there a few lines that I haven’t completely filled out yet), but eventually I want to go back to all include all of the descendants of Electress Sophia (the person who the crown was “settled on” in the Act of Settlement). I’ve heard estimates that she has somewhere between 5-6,000 descendants. So I have a bit of work to do there!

Other than more people, I have a few other things I’d like to add to the site:

  • More names and titles People on the line of succession tend to have many titles during their lives. The data model already supports the concept of a name that is only valid on a range of dates (see the current queen described as Princess Elizabeth of York on the day before her father became king,  Princess Elizabeth when he was king, Duchess of Edinburgh when she got married and, finally, Queen Elizabeth II when she became queen. But tracking down and adding all that data is hard work.
  • Excluded people Catholics are excluded from the line of succession. And people who married Catholics were also excluded until recently. Oh, and obviously children born out of wedlock (that’s more common than you might expect in some of the more obscure branches of the modern Windsor family). Of course, people can convert to (and from) Catholicism at any time, so supporting that in the app would mean implementing some kind of “exclusions” data. But it would be good to show these people, perhaps in a dimmer font.
  • Tree views Today I added text to each person showing their relationship to the monarch. That can help a reader to visualise the family tree, but I’d like to make it more explicit. Nested lists could make it easy to see the relationships. And, later, perhaps show the whole tree using SVG.
  • Position changes Sometimes the line of succession feels a bit like the pop charts. Take Prince Harry, for example. He entered the chart at position 3 and stayed there until Prince George bumped him down to number 4 and Princess Charlotte pushed him down to 5. He’s only likely to fall further in the coming years. The same thing happened to Princess Anne, who was number 3 when she was born, but currently languishes down at number 12. I think it would be interesting to plot those changes over time.
  • Make it prettier Bootstrap does the job. It allows design dunces like me to get a reasonable-looking site up and running in no time. But it’s not very regal.

Anyway, there’s my current itch scratched. And, as in so many cases, it’s just given me more itches. But please let me know if you find the site at all interesting or useful.

Categories
Training

Intended Audience

I thought I’d pretty much finished blogging about my upcoming Modern Web Development with Perl and Dancer training course. But a couple of days ago I saw a tweet that reminded me about an aspect that I’d completely forgotten.

And he’s right, of course. I haven’t mentioned that at all. Let’s put that right.

As it happens, yesterday I pretty much finished writing the slides for the course. So that means that I know what I’ll be covering and, therefore, what the attendees will need to know.

What You’ll Need To Know

To start with, I need to make it clear that this is not a “beginning Perl” course. There’s a lot of new topics to cover and if Perl itself was on the list then it would need to be a two or three day course.

So you’ll need to know Perl. But to what level?

If you’ve read Intermediate Perl then you’ll be fine. That means you’ll need to understand how to use modules, packages and references. Probably the most advanced Perl concept we’ll need is subroutine references. But, to be honest, if you’re not completely comfortable with them, that won’t be a problem.

You’ll need to know a bit about how web pages are made – so a little bit of HTML and CSS. We’ll be using Bootstrap to deal with most of our CSS, so you won’t need to do anything at all complicated with CSS. If you understand the difference between a class and an id in CSS terms then you’ll be fine.

We’ll be using quite a lot of Javascript – specifically jQuery with Mustache. I’m no Javascript expert, so it’s likely that many of the people in the class will know more than me. If you’ve never used jQuery, then I recommend that you spend a couple of hours looking into it before coming to the class. You don’t need to know anything about Mustache before the course.

There will be a database at the back-end of the app. I’ll be running MySQL (actually, probably MariaDB), but any of the popular database systems will work – just as long as Perl’s DBI supports it. I’ll supply SQL to set up the database and insert some test data and we’ll be using DBIx::Class which will remove the need to know any SQL. But it would be good if you were familiar with whatever database system you’re using – to the extent that you can run queries against your local database.

What You’ll Need to Bring

You’ll need a laptop. I’m assuming that we’ll have access to WiFi at the training venue, but it would be great if you could install as much as possible of the required software before the day – just so we save a bit of time.

My laptop runs Windows 10, but I do all of my development in a virtual machine running Fedora 24. I’m happy for you to work in Windows or OSX, but the level of support I can provide for people not running Linux will be limited.

You’ll need Perl installed. Linux and OSX will already have a version of Perl installed. For Windows users, I recommend Strawberry Perl. Get the most recent version of Perl that you can install. The current version is 5.24. I think my laptop has 5.22. Anything  earlier than 5.10 is unlikely to be particularly useful.

You’ll need some CPAN modules installed. These are all pretty common modules:

  • Dancer2
  • Dancer2::Plugin::DBIC
  • DBIx::Class
  • DBIx::Class::Schema::Loader
  • DBI
  • DBD::* (for whatever database you are using – e.g. DBD::mysql)
  • Moose
  • MooseX::NonMoose
  • MooseX::MarkAsMethods
  • DateTime
  • DateTime::Format::Strptime
  • Template

You’ll need a database server installed on your laptop. As I mentioned above, any of the popular database engines will work – but I’ll be using MariaDB. Make sure that you know how to start the database server and connect to it using a command line program.

You’ll need a Git client so that you can clone the Git repository that contains the source code for the course. You’ll want to ensure the the repository is cloned to your laptop before turning up to the course. You might even want to glance through some of the code to get a head-start on the rest of the attendees.

You can find the course code at

The CSS and Javascript libraries are all included in the Git repository.

I think that’s about all you need to know. Please let me know if you have any further questions.

I’ve been really pleased with the reaction to this course. We already have a large number of people signed up. So many, in fact, that I need to start thinking about the number of people I have room for. I think we can get another five (perhaps ten) people in. So if you’re thinking of signing up, please do it soon to avoid disappointment (trainers say stuff like this for every course – but this time it’s really true).

Hope to see some of you in Cluj-Napoca.

Categories
Training

Modern Web Development with Perl and Dancer2

Here are some more details of the Modern Web Development with Perl and Dancer2 course that I’ll be running in Cluj-Napoca on the day before YAPC Europe.

The course runs a full day (that’s six hours – in four 90-minute sessions with breaks in between). It’s a hands-on course – you’ll need to bring a laptop and closer to the time I’ll email attendees with details of the software they will need to have installed. Like all of the pre-conference training, the course will take place at Cluj Hub on Tuesday 23rd August.

Over the course of twelve steps, we’ll build a simple Todo list program. We’ll be using a number of modern web development techniques (not just Perl) in order to make the app look really shiny and modern.

The twelve steps we will be taking are as follows:

  1. Set up a basic Dancer2 app
  2. Make it look nicer with the addition of the Bootstrap CSS framework
  3. Use Plack Middleware to serve static content more efficiently
  4. Display some data in our app
  5. Get the data from a database
  6. Return the data as JSON and display it using Mustache
  7. Use jQuery to show/hide completed items
  8. Mark items as completed
  9. Add new tasks to the app
  10. Add user login
  11. Edit and delete tasks
  12. Add tags to tasks and filter the display on those tags

If there’s time left at the end, we’ll discuss other useful enhancements that we might want to make to the app – and perhaps even try adding them.

We’ll be using the following Perl tools:

And the following non-Perl tools:

Usually, a course like this would cost around £300. But because it’s at YAPC and the sponsors are so generous, we can offer it for the heavily discounted price of 100€.

Cluj Hub sounds like a fabulous venue for the training courses and I’m sure that the day will be a lot of fun. Perhaps more importantly, I’m also sure that attendees will come away with some useful skills to add to their CVs.

Tickets are on sale now. Please buy quickly – before they sell out.