Southern Rail Strikes Dates

GTR operates the Southern rail franchise in England, which covers several counties south of London. They are currently in a dispute with the RMT and ASLEF Unions over on-board roles and responsibilities.

I work with a number of town centres across the affected region and we are interested in seeing the effect of these actions on High Street performance. To achieve this, I have compiled a list of dates and sources. It will be updated as I gather more information, and I welcome contributions.

Disclaimer: This post was last updated on 6 December 2016 and is a work in progress. E&OE. It may not be current and should not be relied upon for planning or other purposes.

Apr 2016

1100 Tue 26 April – 1059 Wed 27 April
RMT strike, 24 hours – Sources: BBC; RMT Website

May 2016

Postponed 1100 Tue 10 May – 1059 Wed 11 May
RMT strike – Source: RMT Website; postponement notice

Postponed 1100 Thu 12 May – 1059 Fri 13 May
RMT strike – Source: RMT Website; postponement notice

0001-2359 Wed 18 May
RMT strike. Was Fri 20 May but brought forward. Sources: Southern Press Office 1 & 2; RMT switch notice

Brought forward 0001-2359 Fri 20 May
RMT strike. Pulled back from two previous 24-hour strikes. Source: RMT Postponement notice

June 2016

0001-2359 Tue 21 June
RMT strike. Sources: Southern press release; BBC; Twitter

July 2016

* Southern began revised timetable from 11 July 2016

Aug 2016

0001 Mon 8 Aug – 2359 Friday 12 Aug [Sources: RMT announcement and calling-off]
RMT Strike suspended at 2200 on Wednesday 10 August. Southern resumed pre-strike timetable on Friday.

Sep 2016

0001 Wed 7 September – 2359 Thu 8 September
RMT Guard strike on Southern [Source: RMT]

Called off 0001-2359 Wed 7 September
RMT Station staff strike across GTR i.e. not specific to Southern [Source: Southern; RMT calling-off]

Oct 2016

0001 Tue 18 October – 2359 Thu 20 October
RMT strike [Source: BBC; RMT]

Nov 2016

0001 Thu 3 November – 2359 Sat 5 November [Source: BBC]
RMT strike

0001 Tue 22 November – 2359 Wed 23 November [Source: BBC]
RMT Guards strike

Dec 2016

0001 Tue 6 December – 2359 Thu 8 December [Source: BBC; RMT]
RMT Guards Strike

Tue 13 December – Wed 14 December [Source: ASLEF]
ASLEF Drivers strike

Fri 16 December [Source: ASLEF]
ASLEF Drivers strike

0001 Mon 19 – 2359 Tue 20 December [Source: RMT]
RMT Guards Strike [changed date, was 22-24 Dec]

Brought forward Thu 22 – Sat 24 December [Source: RMT]
RMT Guards Strike – brought forward to 19-20 Dec

0001 Sat 31 December – 2359 Mon 2 January 2017 [Source: RMT]
RMT Guards Strike

Jan 2017

Mon 9 – Sat 14 ASLEF [confirmed ASLEF website]

Updates?

Please use the comment form below. Note: This post is not intended for debate on the actions. Comments welcome for date changes, corrections and updates only. All others will be removed.

When IS the Night Time?

Seems like a daft question, but the definition of ‘Night Time’ in a city centre is all over the place. Specifically, this refers to the Night Time Economy (NTE) which businesses and place managers use to measure performance in the evening.

We need a consistent definition to compare like for like, across suppliers and organisations. Here are a few choice notes:

The ATCM Purple Flag scheme defines NTE as between 1700 and 0600.

Retail intelligence company Springboard uses 1800 to 0400.

A recent report from the Greater London Authority describes it as 1800 to 0600.

1700 was initially a little close to working hours for my comfort, but it forms part of the Purple Flag which is a well-known and widely used reference. It seems reasonable to imagine people transitioning from the workplace to night-time destinations (after-office drinks!). Indeed, workers are important contributors to the local economy so very much on town centres’ radars.

The distinction between 0400 and 0600 is likely negligible. It looks like only service and transport workers are typically active this early, and with long licensing hours I suppose there’s little to be lost from measuring all the way to 6am.

It also looks to me, from reading some towns’ NTE strategies, that the emphasis is on early evening. Given that nearly all of these are based on the Purple Flag this looks like a reasonable de facto standard definition.

Finally, the data also points to a broader definition. I have a couple of counters in areas specifically designated as NTE strongholds (i.e. streets with pubs and clubs). Taking Fridays as an example, there is a small rise between 1700 and 1800, peaking at 2300-0000, before falling by 0400. Other areas tend to mix NTE and commuters, so more difficult to see.

 

On CHAR, Unicode and String searching

As part of my wifi project, I need to store the hashed MAC address of devices so we can run analysis and gather daily figures. We use MariaDB, based on MySQL, for this particular application. There are various tables used for this, and all JOINed by the common hash.

When I first put the system together in haste, I used VARCHAR(20) as it wasn’t obvious at the time which route we’d go down, or how things would be processed. You can be a little more wasteful with VARCHAR as the storage space is n+1 (where n is number of chars), so the field shrinks to suit. Fixed strings using CHAR always pre-allocate a fixed space, so are less flexible.

Roll forward a year. Things have grown very fast, and we’re starting to see performance limits being hit, and storage space becoming an issue, so it’s time to review the schema.

 

Now we know the maximum bytes for any hash will always be four. They can be smaller than this (depends on application) but eight is the limit.

So, CHAR(8) would seem a reasonable way to store eight bytes in hex. If you’re screaming about INT/BLOB/VARBINARY storage, I’ll come back to that in a moment…

Issue one – UNICODE

First problem is that, if you use a multi-byte charset like utf-8, CHAR is potentially much worse than VARCHAR. As a fixed field, CHAR must allocate the maximum space for all supported Unicode characters, so three bytes are reserved for each character (MySQL utf8 doesn’t support supplemental unicode characters, so three is the limit).

Compare to VARCHAR, where the field size is dynamic and therefore grows according to the characters in use. For anybody using straightforward Latin characters, this needn’t be more than one byte per character.

In the case of utf8, VARCHAR can be far more efficient than CHAR.

If you’re only using basic characters or storing hex values in CHAR, explicitly set the latin1 character set on this field:

ALTER TABLE `mytable` MODIFY `col` CHAR(8) CHARSET latin1

Issue two – Comparing CHAR and VARCHAR

As I was testing this I converted some tables hoping that the comparison would be fairly straightforward, but it seems there’s a big performance hit when comparing a VARCHAR field to a CHAR field (possibly not helped by charset differences). I was seeing queries slow by a factor of 50+ in some cases.

SELECT a.id, b.category from a inner join b on b.fk=a.id

(fk is a varchar; id is a char – both contain the same string)

This is easily solved by explicitly setting a cast on the VARCHAR field, thus:

SELECT a.id, b.category from a inner join b on CAST(b.fk AS CHAR(8) CHARSET latin1)=a.id

Performance will be drastically improved. I believe this is due to the order and type of string comparison going on, and this addition explicitly converts all the potential strings up-front and avoids doing it on an ad-hoc basis.

Next steps

Performance is now much better, but this is still a fairly wasteful way of storing four bytes. The advantage is that, for debugging, it’s easy enough to test queries and investigate issues without having to deal with binary fields.

In terms of efficiency, the next step might be to switch to an UNSIGNED INT, which is allocated four bytes. This is readable in query output, and can be passed in the browser without too much fuss.

I suspect INT and BINARY also have further performance gains. I haven’t tested the overhead, but I suspect the collation (the system of testing equivalence in characters) is adding some work to string comparisons – none of which we need here.

I need to test further before using UNSIGNED INT, and the update process is marginally more involved as the field needs to be converted and modified.

Right now, the performance is back at decent levels, so this is probably something to park for a while!

 

 

 

Reporting Data with Daylight Savings Time

At the end of October it’ll be time to put the clocks back. We’ll get an extra hour in bed to compensate for the hour lost at the end of March, and the bi-annual tradition of media articles asking whether we should ditch the whole thing will run again.

For anybody dealing with dates and times, daylight savings can be a pain. If your job involves managing computers, you might well keep everything in UTC (/GMT) to save headaches. This is also sensible advice if you deal with multiple time-zones. By sticking to UTC, you avoid the annoying issue of living out the same hour twice one morning somewhere in Autumn.

In city centres, retail and business, our data is very much dictated by local time, not UTC. If the shops open at 8am, it will be based on local time. Work starts at 9 sharp, even if your previous night’s sleep was rudely shortened by sixty minutes.

For this reason, when we (meaning I – my company) report on city centre figures, we use local time. It keeps the peaks and troughs of the day in order. If we used UTC, it would be harder to compare a July day with a November day – they’d be off by an hour.

We also store data in local time, mainly because of the complexities involved in constantly switching between UTC and local time. It’s a minor issue, buts adds time to every query and makes the underlying system more complicated. Some might store in UTC, and convert. However you do this you’ll still need to decide what to do at 2am at the end of October, when time steps backwards.

Springboard

For some useful observations, I needed to look for high-traffic places with a decent night-time economy. These are from Heart of London (West End):

heartlondon-springboard

First observation is that all the times appear to be based on local time. The general peaks/troughs appear to line up irrespective of daylight savings time. Sunday is shown in grey on these charts.

There’s not a lot to go on here, but March 2015 looks like a straight line between 1am and 3am. March 2014 has a data point in the non-existent time, but there’s a noticeable drop. By comparison, October (where we live 1am-2am twice) seems to have a bump at 3am. This is also what I saw in the 2014 data – not shown here.

Given that there’s data in the March 2014 slot, I wonder if this is being accommodated in Springboard’s stats – and if they’re similarly compensating in the early hours of October’s backwards step.

Highways England

Looking elsewhere, Highways England publishes traffic data across its network on a 15 minute basis. They also use local time – again, this makes sense as traffic demands are dictated by the clock.

In March, they simply skip over the non-existent time. 1am to 2am is missing in the data, so for one day per year there are 23 hours’ worth of records.

In October, there is something weirder. The hour is repeated, but the data is inconsistent. This is the traffic data on a section of the M25 over October, with 1am-2am counted twice. Time Period shows the end of the 15 minute section as measured; the last column shows the number of vehicles of a given length over this period.

he-october

It looks like the sensor has managed to send something across throughout the affected time, but the data is largely missing. Interesting that the time period reports as :59 seconds only in this highlighted period, and for the two records where this doesn’t happen (01:44:00 and 01:59:00) we seem to have data. I wonder if this is a bug of some kind.

Conclusions

These are the two main data suppliers I have an interest in, but it’d be useful to gauge feedback from elsewhere. This is a tricky issue. The ultimate goal is to show something which is meaningful to the reader, but we need to do this in a way that does not affect comparisons at the hourly level.

In one way this is a fairly moot point. The volume of traffic at 2am on an out-of-season Sunday is likely inconsequential for many. However it does raise an interesting challenge for reports and figures, and is just one of many subtleties to consider in this sort of analysis.

Final thought: is it possible that the change in daylight savings time actually attracts people?

MariaDB Indexes on DATETIME and DATE functions

Quick note in haste, but important for me to remember.

SELECT * FROM table WHERE DATE(`period`)='2016-09-05'

is orders of magnitude slower than

SELECT * FROM table WHERE `period`>='2016-09-05 00:00:00' AND `period`<'2016-09-06 00:00:00'

where `period` is an indexed DATETIME field. The former uses an assortment of WHERE and INDEX clauses; the latter relies on the INDEX and uses a RANGE search, which is much faster.

Visual Studio/ASP.NET Code Behind

I’m going to need to remember this, as it runs slightly counter-intuitive to what I was expecting (although makes sense).

Code compiled in App_Code is available globally, so any other piece of code can reference it.

Code compiled in code-behind (i.e. the .cs files ‘behind’ ASPX pages) is only available to its corresponding ASPX page unless you explicitly reference it.

This can be done by adding the following to the ASPX page:

<%@ Reference Page="......link to .aspx" %>

One to remember.

The 5 Weekends 823 Years Thing

There’s a thing going around Facebook about ‘this month has five weekends, it only happens once every 823 years’.

At first glance, it is pretty amazing. The dates line up just right to grant us five whole weekends, including Friday. Bliss.

11796265_868726643198344_7206118342273344835_nSadly, it’s rubbish. Or, to put it another way: if you like 5 weekend months, I’ve got good news for you!

The only way a month have even a chance of five weekends (I’m counting Fri+Sat+Sun) is if it has 31 days. Any shorter, and at least one of those weekends would also be cut short.

That means only January, March, May, July, August, October and December can qualify.

We can also only achieve this if the first of the month is a Friday, since it’s the only way we can fit all five weekends into a single month.

So, of the seven months of the year that fit the criteria, at least one of those needs to start on a Friday. You’ve seven months; seven days. The odds are pretty good.

I make it 1-(6/7)^7, around 66% chance that any given year will have at least one 31-day month that starts on a Friday.

But wait, there’s more…

Years are pretty regular things. Apart from the small annoyance of February (damn you February) every month is a fixed length – and even the changeable one is predictable.

This is partly how people manage to tell you the day of the week, given any date in recent history. They don’t memorise each day – it’s systematic.

So if January is a ‘5 weekend month’ then October of the same year will also be one, provided it’s not a leap year. If it is, then July is also a 5 weekend month.

This affects the probabilities a little, since the dates aren’t truly random, but 66% is a fairly good ballpark for most purposes.

Good news for fans of the weekend

2015 has one month that fits the ‘5 weekend month’ rule: May (not August as the original email suggested).

2016 has two: January and July

In 2017 we’ll have to wait until December to celebrate again.

2018 there won’t be any – so we’ll have to wait until March 2019 before we pull out the party poppers again.

Whatever the outcome, it’s certainly not once every 823 years so don’t worry if you missed it.

Slice of Radio for the Raspberry Pi

As part of an ongoing project I have been trying to get multiple Raspberry Pis to talk to each other across a city centre. First, they used wifi for ad-hoc networks. In some cases I’ve used 3G dongles to connect over the Internet. Both have their downsides. Now, I am looking at radio communications to build a mesh of devices.

After a bit of investigation I’ve purchased three Ciseco Slice of Radio devices from Pimoroni or Ciseco themselves. These are fairly straightforward devices that enable the Pis to communicate over radio via the serial port.

There’a a fair amount of information out there about configuring them (although you need to look for the chip itself – SRF – rather than ‘Slice of Radio’ in Google) – this is the best resource I found (with handy links at the bottom).

These devices send 12 byte packets by default, so I’ve written a low level protocol to support a mesh-style network. This will allow the individual devices to relay messages through the network and eventually communicate with a server on the Internet. More on that soon.

Meanwhile, the range of the devices as bought is somewhat limited. I have two devices successfully talking to each other over radio, from the front of the house to the garage in the back garden. Straight-line this is going through two internal walls, an external wall and a metal garage door – so not too bad.

In production this is likely to be more challenging, so I will need to try adding an antenna to the device. There are two types I can use – u.FL and a simple (vertical) wire.

I’m an absolute novice with radio so please excuse/correct me if something is wrong! These are more notes than anything concrete!

u.FL supports the ‘standard’ coaxial aerial found on wifi hubs and – as far as I can tell – this is the connector (presuming u = micro). One can then get a u.FL to SMA (bigger) connector and start adding standard antennae.

Here’s a fairly good overview from Instructables.

Option two is to use a ‘wire whip’ or ‘whip antenna’ connected directly to the board. For an 868Mhz device this needs an 82.2mm vertical wire.

In terms of aesthetics and practicality I’d rather not have a vertical wire coming directly out of the Pi – as shown here – and need to figure out the options.

For the antenna, then it looks like I’ll need the following:

u.FL connection for mounting on the board itself. – £1.00

u.FL to SMA cable – £3.33

SMA ‘rubber duck’ aerial. – £4.58

Total material cost of adding the aerial is therefore £8.91 + VAT

There are various other issues to deal with, but this seems like it’ll give a significant signal boost for the devices. As I explore further, expect more updates!

 

Bruges

Bruges (or ‘Brugge’ locally) is a wonderful mediaeval city in the north of Belgium. The cobbled city centre and its canals form a UNESCO World Heritage Site and regularly attracts visitors from all over the world.

Last week, my wife and I visited the city for a long weekend (our second visit) along with the in-laws (their first visit). A quick-ish trip across Eurotunnel and a 90 minute drive the other end, and we were at a B&B just outside the city.

Belfort Tower
The Belfort Tower dominates the main square
IMAG0561
Near Christmas, the main square is transformed into a seasonal market and ice rink. It’s quite beautiful.

 

View from the top. Looking out over the city of Bruges
View from the top. Looking out over the city of Bruges.

Between this and the last visit, we’ve taken in most of the major attractions. The city lends itself to wandering. There are plenty of beautiful areas and little streets to walk through. Coffee shops and brasseries are numerous – you don’t go hungry in Bruges (except Mondays; many places close – although this seems to be diminishing).

The Belfort Tower stands high above the main market square and gives some impressive views of the city and area (as well as a nervous walk back down on a tight spiral staircase).

De Halve Maan (‘Half Moon’) Brewery is an interesting guided tour around the place where local (delicious) beers are brewed. Brugse Zot is a particular favourite of mine. There is now a beer museum near the main square, although we didn’t try this.

The Choco Story features a detailed history of chocolate (its manufacture, health benefits and economic status) which is pretty interesting. Tied with this is the Frietmuseum (‘Chip Museum’) which is a potato-based equivalent. You might also take in a visit to the Diamond Museum – combined tickets are available between the three venues.

Canal tours are readily available from several locations, and are a great way to see the city from its numerous watery thoroughfares. You will take in the convent/monastery Ten Wijngaerde; Sint-Janshospitaal – an 11th c. hospital; Onze-Lieve-Vrouwekerk (‘Church of Our Lady’) and plenty more.

Similarly, horse rides through the city take a different route and explore even more. With a group of four, it was certainly a good way of seeing the city. Rides start in the main square.

We left the in-laws to take in the canal trip while retreating to the Bierwall, a fabulous – if slightly touristy – place to sit, drink and enjoy the passing crowds and canal tours.

If travelling in by train, you should have no problem getting around. Most areas are within walking distance. The station is a short trip outside the city centre.

It’s possible to drive through the centre but I wouldn’t recommend it unless you need to. The streets are bursting with tourists who seem to have no skills of awareness. It could also be a little daunting for those driving on the continent for the first time.

Fortunately parking is fairly easy, find ‘t Zand or Centraal Station parking in the south west. Both are reasonable, spacious and the station has a park & ride facility (although walking is again quite possible). Station parking was €3.50.

I believe it’s also possible to park along the ring road on the northern parks – but don’t quote me on that.

All in, a great time (again) and somewhere we could well imagine visiting again & again. The restaurant food is fantastic and not too pricey. Once all the tourist activities are done, it’s still an incredibly beautiful city and a great place to relax and explore.

I’m not a huge fan of tourist-heavy hotspots. This is definitely one of them, and prepare to fight your way through a sea of selfie sticks and tours. Normally something I’d avoid at any cost, but in this case the beauty of the city is well worth it, and the facilities that come with the crowds are appreciated.

Horse meat

Just over two years ago, a number of food sources were found to be using horse meat in some of their products, usually substituting more expensive beef. This affected both small and large retailers alike. There’s plenty to read about the ‘horsemeat scandal’ on the BBC Website.

As far as I can tell, there are two key objections. First, about the deception itself – we expect beef in beefburgers. Second, about the choice of replacement – we simply don’t eat horse in the UK, it’s just wrong.

It’s this latter part that got me intrigued. Why don’t we eat horse in the UK? What’s so repulsive about the idea?

Again the BBC provides much more about this than I can possibly contribute. Suggestions vary: horses are companions; national tendencies; feedback loops of supply, and so on.

Amongst my group of friends (myself included) a new response emerged from the scandal: Actually I’d quite like to try horse – see what all the fuss is about.

Mission accepted.

In Europe, the Belgians are the biggest consumers of horsemeat according to Eurostat. Italy and the Netherlands are roughly equal second eating around a kilo per person per year. Typically, the average French person eats less than half of this.

IMG_20150530_143543 (1)

This roughly tallies with my experience of shopping for the stuff: paardenvlees and viande de cheval for Dutch- and French-speaking areas respectively. Finding it in northern France was rather tricky (we eventually found steak in a large Carrefour supermarket), whereas it was easily found in Colruyt (Belgian bulk supermarket) and Albert Heijn (Dutch; smaller supermarkets).

It can often be found smoked (key word gerookte in Dutch, or fumé in French) and ready to put in a sandwich or salad. The meat is also used in continental dishes (such as stews).

Generally speaking, horsemeat is much darker than beef with a richer colour. I found it very soft and the meat breaks apart in your mouth. The taste (disguised a little when smoked) is a bit hard to describe. I find it a bit stronger than beef, and leaner too.

It’s frankly a delicious alternative to beef and one I’d be happy to include more regularly in meals.

I was hoping that some enterprising butchers would source horse meat following the scandal – to capitalise on public curiosity – but it seems there’s still a fair amount of opposition to the idea and I haven’t seen it added alongside wild boar, kangaroo or crocodile (at our more diverse local shops).

It could well be that British tastes make the widespread import/production of horse meat unlikely, but tastes do change. In the US it might prove to be an economical option. Our closer neighbours clearly have no issue with the meat, and there are plenty of stockists willing to take a risk or two.

If we do see horse meat on the shelves in future, it will of course be correctly labelled and – one would hope – responsibly sourced. Rather than being an undesirable addition to our meals, it might well be a welcome one. I for one would be happy to buy it if that ever happened.