In search of unicorns

In search of unicorns

So the Brexit saga continues with Captain May still at the controls of H.M.S. Titanic, despite hitting a rather large iceberg yesterday when Parliament comprehensively rejected her EU withdrawal deal.

In trying to predict what will happen now, my natural inclination is to look at the logical outcomes. I’m fully aware that this might seem hopelessly naive. Politics is not logical, either in Parliament or in the electorate at large.

But bear with me for a moment. My logic is as follow. There is no version of a Brexit deal that can be agreed with the EU and also get through Parliament. No deal would be a disaster that almost nobody wants. The only way to break the political logjam will be another referendum.

I’m aware that politicians don’t want this and that another referendum might give the same result. But at least going back to the people would enable us to move forward. In the end I think politicians will be forced to accept that this is the only option.

The key thing will be to ensure that all the options that we ask the people to choose between are real, implementable, options.

Not lies, fantasies and unicorns.

Brexit: Bidding for a Dollar

Brexit: Bidding for a Dollar

There is a famous game, at least amongst economists, known as “Bidding for a Dollar”. In this game, players participate in an auction for a dollar bill. The bill goes to the winner, who therefore stands to make a profit if their winning bid is less than $1. However, the bidder who comes second has to pay over the amount of their final losing bid.

The game starts off sensibly enough with bids of 5, 10, 15, 20 cents and so on, with the participants trying to land the winning bid and maximise their profit. However, as the bids mount and approach $1, it begins to dawn on the players that the best they can hope for is to make a very small profit. However, the second highest bidder realises that dropping out now means that they will lose money. That is hard to accept, so the bidding continues until the highest bid stands at $1.

If they hadn’t realised it before, this is the moment when the participants work out that this is a “no-win” game and continuing to play now guarantees a loss. However, having started, it still makes sense to keep on bidding and so a bid of $1.10 is placed. Better to lose 10 cents than a $1.

It seems to me that this is the point that the UK has arrived at in the Brexit negotiations. We spent the first two years after the Referendum with the different Brexit factions squabbling over the “Brexit dividend”, or which faction was going to get what share of the dollar bill. Reality has now dawned that there isn’t any Brexit dividend and the factions are now desperately trying to minimise their losses and make sure the blame for this fiasco lands somewhere else.

The only smart strategy for playing the “Bidding for a Dollar” game is not to start playing at all. The Brexit equivalent is to jump in a time machine and stop Theresa May triggering Article 50. The latest polls seem to indicate the British public has rather belatedly worked this out (“Two-thirds of the public now think the outcome of Brexit negotiations will be bad for Britain”).

Let’s hope someone knows where to find that time machine.

Brexit: Hard Facts

The Irish problem with Brexit

Brexit: Hard Facts

Theresa May attempted to clarify the government’s vision of what life after Brexit would look like in her Mansion House speech on Friday.

In it, she made reference to the need for the country to face up to some “Hard Facts” about Brexit. I think that should be welcomed, as facts have been something that have been sadly missing from the Leave camp to date.

However, those hard facts were buried pretty deeply in the usual sea of platitudes and slogans. Sifting through the 6,700 words of the speech and the Q&A which followed, I have tried to extract what seem to me to be the facts that we all need to face up to in the Theresa May vision of our post Brexit future.

1. No customs union

The government has finally admitted that regaining the freedom to negotiate trade deals with the rest of the world, one of the key objectives of Brexit, means not being part of the customs union.

Brexiteers believe that other countries will be more willing to open up access to their markets to the UK than they are to the EU as a whole because we are more willing to open our markets to them than the EU is. Whether deeper access to the UK market is worth more to other countries than shallower access to the whole of the EU is hard to judge. Personally I doubt it, but only time will tell.

So the first hard fact that comes from this is that our access to EU markets will reduce. Theresa May was fairly up front about admitting this.

The second consequence is that there will be a border in Ireland, or between Northern Ireland and the rest of the UK (or perhaps both). Theresa May did a lot of dancing on the head of a pin to avoid saying this, but the graphic above demonstrates that this is unavoidable. The only question is how “soft” those borders can be. The government seems to be placing its faith in technology to solve this. Maybe with a sufficiently long implementation period that might be possible, but nobody really knows.

2. We will still need to abide by EU rules in many areas

The Brexiteers are famous for wanting “have their cake and eat it”. This was obviously never going to work, given that the other side has a stronger negotiating position. It is more likely that the UK will end up neither having nor eating the cake. To paraphrase Theresa May, we will end up with the rights of Canada and the obligations of Norway.

My take on Theresa May’s speech is that the government has made a subtle shift of strategy. Rather than trying to keep the good bits and lose the bad bits at an overall UK-EU relationship level, they are now trying to cherry pick sector by sector. Hard Brexit for agriculture, soft Brexit for the Automotive Industry and so forth. The hope seems to be that the EU will take a pragmatic approach and give the UK a continuing say in regulations for sectors where the UK is a major player, such as Pharmaceuticals, Air Transport and Financial Services.

The challenge as ever is whether the EU will play ball. Making the EU single market work is already a famously complicated business. Overlaying a bespoke set of sectoral arrangements with the UK will make this harder. In the real world of EU politics, trading off the interests of one sector against those of another is a key tool for getting to agreement amongst the member states. Allowing the UK to participate selectively is a big ask. Ironically, it might have been easier to achieve this from within the EU. In two of the most sensitive areas, monetary policy and border controls, the UK secured an opt out, participating in nether the euro nor the Schengen Agreement.

In the end, I remain of the view that the whole Brexit decision was a big mistake. As the hard facts of what is possible to negotiate become clear to people and the cake eating wishful thinking is revealed for what it always was, I hope that it is not too late to reconsider. But I am not holding my breath.

The road to 200Mb/s

Speed test

The road to 200Mb/s

When we moved to our present house six years ago, the only thing that I missed about our last one was the internet connection. That house had been one of the first to get BT Infinity and I’d quickly got used to 50Mb/s speeds. We only moved 1.7 miles, but suddenly we were cast back into the dark ages with a connection speed of 0.8Mb/s.

This clearly wasn’t going to work, so I signed up for an expensive satellite connection. In theory this offered 20Mb/s speeds, but in practice it was about half that and came with 800ms latency (no good for gaming) and nasty data caps (no good for Netflix).

Things improved three years ago when BT upgraded the cabling, but the distance from the exchange still limited the fastest speed we could get to about 12Mb/s. Upload speed was particularly constraining at 1Mb/s, which is a big problem with a house full of people uploading their photos and backing up their phones to the cloud.

Back in February 2015, I went to Israel to look at the tech/startup community and we were accompanied by friends from the BT Innovation group. Inevitably, the BT folks grouched about their airline problems and we complained about our broadband issues. This set in motion what proved to be a two and a half year joint quest to sort out my internet.

Many possible solutions were explored with BT over the ensuing couple of years, but it was frustratingly difficult to get real options. I think one of the problems was the regulatory restrictions that BT is forced to operate under. The people who could do the actual work (BT Openreach) weren’t allowed to talk to end customers. The people who were couldn’t fix my problem. Somehow we went round and round in circles for months, which stretched into years.

Finally, I got some real options on the table and decided to get a dedicated leased line from BT Local Business. A full fibre to the premises service, which understandably came with an associated high price tag and required me to register as a business. Rather than go for the “Managed Service” option, I decided to go for the slightly less expensive “wires only” option. “How hard can it be?”, I thought.

Well actually quite hard! BT’s “user guides” seem to assume that you are a qualified telecommunications engineer. Unusually, the internet wasn’t much help. So I thought I’d make a few notes on how to get things working for anyone who is mad enough to attempt the same thing.

I’d opted for a 200Mbps speed, delivered over a 1000Mbs fibre bearer. The following section in the BTNet “No Router Option (NRO) User Guide” describes how to connect things at the customer end:

4.1.4. 1000Mbps

1000Mbps services are presented to the customer as 1000Mbits/s Gigabit Ethernet conforming to IEE802.3z[25]. The customer connection is via a port on the WES1000 NTE.

The EAD1000 NTE customer interface is 1000Base-SX optical presentation via a Multimode dual LC optical connector as specified in the Gigabit Ethernet IEEE802.3z[25] specifications.

The customer must provide the necessary fibres to connect their equipment to the BT NTE.

The optical fibre patch cords to be used must be 850nm wavelength, 62.5/125 or 50/125 micron multimode fibre with LC connectors. The maximum fibre length is 550 metres for 50/125 micron or 220 metres for 62.5/125 micron.

It took me quite a while to decipher this and figure out what I needed to do.

Step 1: Which port do I need to plug into?

“WES1000” stands for “Wholesale Extension Service 1000”, with the 1000 referring to the 1,000Mb/sec speed of the line.

“NTE” stands for “Network Terminating Equipment”, which at least in my case was a box made by ADVA with a model number of FSP150CP FSP-ORNT-11-B. Here is a picture of one, which I have annotated to show the “Multimode dual LC optical” port referred to above.

What they mean by a WES1000 NTE

Step 2: What cable do I need?

You need a fibre cable like this one, shown below.

Duplex multimode fibre cable with LC connectors

Step 3: How do I turn this into something I can connect to my router?

You need a media convertor, which will connect optical fibre to regular copper 1000Base-T. I used a TP-LINK MC200CM Gigabit Multi-Mode Media Convertor.

Media convertor

You will also need a 1000Base-SX module like this one to provide the right socket for the fibre cable to plug into.

1000Base SX Module

Step 4: Connect your router

All that remains is to link the media convertor to the WAN port on your router with a standard ethernet cable and configure your router to use the static IP addresses that BT provides you with for your router, the gateway and BT’s DNS servers.

And that is all there is to it. 200Mb/s up and down and a happy household.

Travel Statistics

My wanderings…

Travel Statistics

Travel stats. We all love them. But where’s the best place to go to find out where you’ve been?

IAG, my employer and owner of Aer Lingus, British Airways, Iberia, Vueling and the newly launched LEVEL has been running a corporate accelerator programme for startups, called “Hangar 51“. I’ve been sponsoring the “Data Driven Decisions” category, and one of the startups I’ve been working with is esplorio, an automated travel journal service.

One of the things IAG and esplorio have been working on together is to offer our customers the opportunity to link their esplorio and BA Executive Club accounts, to give them a combined view of their data. Whilst we are sorting out the technical details, I thought I’d do a one person “proof of concept” by manually consolidating my own data.

Esplorio is a relatively young service, but it enables you to link to your Facebook, Twitter and Foursquare accounts. This means that I have data in Esplorio going back to 2011, which was when I joined Foursquare.

My BA data starts in 2004. This is when BA thinks I joined the Executive Club. I’m pretty sure that I joined before this, but maybe BA knows me better than I do.

According to esplorio, I’ve been to 30 countries and have travelled 454,648 miles. BA thinks I’ve been to 24 countries and have flown 351,818 miles. Whilst the two data sources agree on 21 countries, BA missed 9 that esplorio had and esplorio missed 3 so the true total is 33. Which I think demonstrates the power of combining data and also makes me think I’ve spent too much time on a plane.


Where is the missing external keyboard incorporating the new Touch Bar
Where is the external Touch Bar keyboard?


OK, I’ll admit I’m what some would call an “Apple fanboy” and I am inclined to give them the benefit of the doubt when it comes to some of their more controversial decisions. I’m certainly prepared to accept higher prices and being required to regularly upgrade peripherals to the latest standards if that gets me a better product. For example, dropping Firewire for Thunderbolt or 30 pin for Lightning connectors.

But I have to say that recently Apple has been annoying the hell out of me. Not yet enough to get me to switch away to another operating system, but certainly enough to make me doubt the competence of the company’s management.

Back in 2010, Apple released the 27 inch Thunderbolt display. I bought one in 2012 for £750 and loved it. If they had upgraded it every 2-3 years, I would have happily given them another £1,500+ by now. They didn’t and have now killed it, instead promoting LG and Dell displays. If they believe that these displays are good enough, why the hell wouldn’t they rebadge one of them and earn a markup and keep that Apple logo front and centre for their customers? If they don’t think the quality is good enough to put their brand on, why are they willing to promote them as the preferred solution?

They neglected the Mac Pro for years and then Phil Schiller finally introduced a new one in 2013 with the line “can’t innovate anymore, my ass”. They have completely failed to update it ever since. Phil’s ass has a lot to answer for at this point.

The Touch Bar introduced yesterday on the new Macbook Pros is a decent new innovation. So why didn’t they launch a new desktop keyboard incorporating it? It would have been straightforward from a technical point of view and would have instantly added value to their existing lineup of desktop machines. A missed opportunity that suggests a culture of neglect for the Mac.

I’m also getting fed up with the dropping of ports. I’m OK with dropping old ports for which there is a better, more modern equivalent. I’m also somewhat sympathetic to the pruning of ports where weight and space are at a premium. But the new Macbook Pros couldn’t squeeze in an SD slot? Or an HDMI port? Neither of these has a more modern equivalent. And whilst USB-C is the successor to standard USB, how problematic would it have been to include at least one for a generation of Macbook Pros whilst in transition? It’s not even as if Apple has come up with any great external options. A drawer full of dongles is a really bad and inelegant solution.

Overall, I can only conclude that the current Apple management is either out of touch or getting the short term / financial considerations out of balance with the long term / customer value ones. Phil Shiller’s ass deserves a kicking and Tim Cook needs to listen to the views of his increasingly disillusioned loyal users.

Inspired by the Romans

Roman inspirations

Inspired by the Romans

After two and a half weeks in Italy visiting the sites in Rome as well as Pompeii and Herculaneum, I have been reminded how impressive the Romans were. I still can’t really understand how the whole thing collapsed given how advanced they were.

With Trump in anti Muslim mode, perhaps we need to make contingency plans for getting rid of our politically incorrect Arabic numerals. Despite the impracticality of Roman numerals, the recent Brexit vote tells us that politics can easily override rational thinking. So in preparation (and perhaps in the spirit of the summer silly season), here’s a bit of Swift code for doing the necessary translations:

let charValues = ["I": 1,"V": 5, "X": 10, "L": 50, "C": 100, "D": 500, "M": 1000]

let numerals = [(1000, "M"), (900, "CM"), (500, "D"), (400, "CD"), (50, "L"),
                (40, "XL"), (10, "X"), (9, "IX"), (5, "V"), (4, "IV"), (1, "I")]

func fromRoman(roman: String) -> Int? {
    var result = 0
    var maxSoFar = 0
    for char in roman.characters.reversed() {
        guard let value = charValues[String(char)] else { return nil }
        if value >= maxSoFar {
            result += value
            maxSoFar = value
        } else {
            result -= value
    return result

func toRoman(int: Int, numerals: [(Int, String)] = numerals, cumulative: String = "") -> String {
    guard let (intValue, stringValue) = numerals.first else { return cumulative }
    let newNumerals = Array(numerals.dropFirst())
    if int >= intValue {
        let quotient = int / intValue
        let remainder = int % intValue
        let stringToAdd = String(repeating: stringValue, count: quotient)
        return toRoman(int: remainder, numerals: newNumerals, cumulative: cumulative + stringToAdd)
    } else {
        return toRoman(int: int, numerals: newNumerals, cumulative: cumulative)

Meanwhile, I hope everyone is enjoying the MMXVI Olympics. Currently, the UK is number II in the medal table, which is amazing!

Brexit Aftermath

Some things are clear, but much is still murky
Some things are clear, but much is still murky

Brexit Aftermath

It is just over a week since the Brexit referendum. The leader of the Leave campaign, Boris Johnson, has fled the field. I’d like to think his decision not to stand for the Tory leadership was driven by shame for what he has done, but it was more likely a simple act of political realism and self interest. In the post vote, post Boris, world, some things are now becoming clear but much remains hard to predict.

It seems the Conservative MPs are going to close ranks, elect a ‘safe’ leader in Theresa May, accept ‘the will of the people’ as far as leaving the EU is concerned and avoid an early General Election which would put their own jobs at risk. Worryingly, the irreconcilable objectives of the Brexiteers (control immigration, avoid paying into the EU whilst staying in the single market) look like being resolved by abandoning the single market, hoping that increased trade with the rest of the world can compensate for lost trade with Europe. The EU’s refusal to have any dialogue with the UK about the terms for exit before the UK commits itself irrevocably to leaving by triggering Article 50 seems to have made it very likely that the UK will be irreversibly on course for exit before the 48% of people who didn’t want to leave (and perhaps a few more who now regret their Leave vote) will get an opportunity to try to change the policy in a General Election.

What is less clear is what the opposition is going to do, with Jeremy Corbyn still apparently determined to try to hang on. Many of us are still hoping that there is a chance to avoid an exit. I loved this letter to the FT, speaking out on behalf of “the 48%”. I agree that we need an effective opposition arguing the case for the half of the country that views the exit vote as a national disaster of historic proportions. The Conservatives seem to have decided that the survival of their party and their own political careers require them to implement an exit, whatever the cost for the country. Perhaps Corbyn will go quietly and a new Labour leader will rally the MPs in the House to speak out for “the 48%”, for Leave voters who now realise they were lied to, and for common sense. I only wish I could be more hopeful that this will happen.

Meanwhile, don’t give up. Let the MPs who want to fight know they have mass public support. Let the rest of the EU know how many people in the UK feel European and want to stay that way. And let the non British born people living in and contributing to our country feel welcome and valued, not rejected, hated or unwanted.

Brexit Madness

Sick of being attached to a tree, a man decides to take back control of his branch.
Sick of being attached to a tree, a man decides to take back control of his branch.

Brexit Madness

Sad, angry and fearful for the future of the UK and for Europe. That is how I felt when I woke up on Friday morning to the news that the Leave campaign had won the Brexit referendum. The sadness and the fear remain but, somewhat to my surprise, my feeling of anger has only grown over the last 24 hours. I’ve never posted anything political here before, but I am so angry that I feel I need to speak out.

How did we get here? The root of the problem is the deep divisions about Europe in the Conservative Party. The party has been held together by a series of leaders who managed to paper over the cracks. The rise of UKIP made this more and more difficult. Prior to the last election, David Cameron made a disasterous short term political decision to offer a referendum to the Eurosceptics in his party. He had tried the same trick over Scotland and that almost ended in disaster (indeed it still may). Whether he thought he would be saved by the Liberals, or was confident he would win the referendum is hard to say. Whatever the case, it was a stunning case of gambling the future of the country for short term political expediency. Well, the gamble has failed. He has ended his own career and possibly also destroyed his party. In fact, I have come to the conclusion that the destruction of the Conservative Party as we know it is what needs to happen next if we are to avoid Cameron’s reckless gamble destroying the country too.

I know people will say that the people of the UK have spoken and we must respect their decision and leave the EU. But this was never an issue that should have been decided by a referendum with a simple yes/no answer. Everybody had a good idea about what voting Remain would mean. Nobody knew what a vote for Leave would actually mean. For some, it would be more money for the NHS. For others, it would be reductions in immigration. For many, it was a desire for the UK to “take back control” – people were fed up with being “told what do by faceless, unelected eurocrats”. OK, these are all valid and legitimate goals. But the simple truth is that there isn’t any chance these are all going to happen. Unlike after a General Election, there isn’t a leader or party that can be held to account to deliver on the promises made during the campaign. There has never been an overall plan of action set out by the Leave campaign. It has no overall leader with a complete vision of where to take the country. Instead we have single issue politicians like Farage and political opportunists like Boris who will say whatever he thinks will get himself into number 10. Whether you agree with Farage on his single issue or not, anyone who would trust the future of the country to him needs their head examining.

So what should happen now? Whatever happens, we should have a General Election before anything is done to enact leaving the EU. Let us see who would be Prime Minister and have a chance to vote for them. Let us hear the whole plan of the party or parties that want to go ahead and leave the EU. The implications of leaving are so significant and intertwined with other issues that it can’t be just “grafted on” as an optional extra. You can’t just choose your party of government and then add or subtract EU membership to taste.

The second thing that needs to happen is the breakup of the Conservative Party. I have voted for them in every election, so I say this with great sadness. But the truth is that what we now need is a proper centrist party to vote for, free of both left and right wing extremists. In 1981, the ‘Gang of Four’ broke away from the Labour Party to form a new centrist political party, the SDP. Sadly, this came to nothing in the end. But 35 years later, it is time to try again, this time starting with a break away group of pro EU Conservative MPs. Perhaps the current political crisis and the disarray in the Labour Party under Corbyn even makes it possible for them to be joined by a break away group of moderate Labour MPs. Now that would be a party I would vote for and I think would give the country an option which might beat “none of the above” as the party of choice.

A Swift update

A Swift update
A Swift update

A Swift update

Once again, I failed to live up to my good intentions to update this blog more in 2015. So as a new year starts, I thought I would do a few “catch up” posts covering events from last year.

The first one of these is a catch up on the coding front. I’d been playing with Swift right from the beginning, but early attempts at rewriting some parts of my Mac Finances application in Swift rapidly convinced me that Swift just wasn’t ready and I reverted to Objective C. However, I continued to play with Swift on the side as I do really like the language.

The advent of Swift 2.0 prompted me to ‘take the plunge’. I decided to completely rewrite the application in Swift – not because this is a good idea, but because I felt this would be the best way to really learn the language. I took me about 5 weeks to rewrite 12,700 lines of Objective C, working in my not very large amount of spare time, which is either a long time or surprisingly quick, depending on your perspective. It probably took me another couple of weeks to squash the final bugs that I had inadvertently introduced during the process. Overall, I’d say the experience was quite positive.

One of the things that I was intrigued to discover was whether Swift would produce more compact code, so I keep track of things as I converted things over. The outcome was a 13.6% reduction with a resulting Swift code base of 11,000 lines. I did make a few functional changes and refactored some of my earliest code along the way, so I can’t guarantee that this was all due to the language, but I kept track of the reduction as I went and it did seem pretty consistent. The reduction was only a little larger than number of lines of code in the objective C header files, so I think that elimination of these is probably the main saving. But what struck me the most was that the final Swift code was much cleaner and more elegant than the Objective C version and the “proof of the pudding” is that I would be really unhappy to have to switch back now.