The real world doesn't care about encoding

by Jannik Arndt

Last week one of our programs failed looking up an airplane by its registration. That’s not a surprise, since ac regs are a horrible identifier. They change all the time. Also there is almost no naming rule at all. Wikipedia states

When painted on the fuselage, the prefix and suffix are usually separated by a dash (for example, YR-BMA). When entered in a flight plan, the dash is omitted (for example, YRBMA). In some countries that use a number suffix rather than letters, like the United States (N), South Korea (HL), and Japan (JA), the prefix and suffix are connected without a dash.

Okay, so the only thing in common is a prefix and a main part, separated by a dash, but that’s often dropped. Nice! Also the both parts might consist of letters and numbers. And they vary in length. And most of the time, the prefix designates the country of registration, although there are exceptions, for example Guernsey, which is not a part of Great Britain (G–) but its property, therefore having the registration 2– They island has its own airline, Aurigny, but all of their 10 aircraft use the G--Prefix.

(https://en.wikipedia.org/wiki/Aurigny#/media/File:G-JOEY.jpg)

And then there are military aircraft. Since they are not affected by the Chicago Convention on International Civil Aviation, they are free to do whatever they want. In the US, they use the base code (as in code of the military base), year they were ordered and a serial number. In Germany consists of the aircraft type and a serial number. And this is where my error comes from:

We recently switched one of our source systems, and apparently the aircraft formerly entered as 10-27 now is 10+27. That’s weird, because the old source is more trustworthy (but incomplete), and you usually use dashes, not plus-signs.

A quick Google-search turns up the wikipedia page and an official Luftwaffe page, both in favour of the plus. Okay, but this is Germany, there surely is an official Behörde that clearly regulates all this! — Yes, there is! It’s the Luftfahrzeugrolle and their website states that due to data protection reasons they cannot disclose anything. Marvellous! The information written in huge letters and visible for everyone is protected. Wait! It’s written on the plane! And there are a lot of people taking pictures of airplanes! Alas, the solution is:

(https://commons.wikimedia.org/wiki/File:Luftwaffe_A310_10%2B27.jpg)

They use the iron cross as a separator! I give up…

Blog


I recently created a wonderful bug.




This is a basic example how to implement oAuth2 using Akka HTTP and Scala. It provides three endpoints. From the clients point of view:

  • / — publicly accessible, returns “Welcome!”,
  • /auth — provide your username and password, receive an access_token in return,
  • /api — secured by oAuth, send the access_token in a header to gain access.

From the server’s point of view:

  • / — publicly accessible, do nothing,
  • /auth — receive basic auth credentials, verify they’re in the list of known credentials, create an access_token, return it,
  • /api — receive authorization header, check if access_token is in list of valid tokens.

Since oAuth tokens are short lived, the server also has to invalidate expired tokens.




Getting a Akka HTTP-based backend up and running on Heroku for free can be done in less then 30 minutes — if you know the tricks.