Blog

Exhaustive Union Matching in Python

January 12, 2022 – tagged Python, Programming

This blog post has been published on the Preferred Networks Tech Blog.

Pattern matching on algebraic data types is a powerful technique to process a given input and many programming languages have adopted it in one way or another. In this blog post I will first briefly explain the concept of sum types and give examples of pattern matching on these types in Rust and Scala. Then I will show how to define sum types in recent Python versions, and I will explain how the mypy type checker can (to a limited degree) be used to add exhaustiveness checks to Python code working with these types.

Best Practices for Working with Configuration in Python Applications

April 24, 2020 – tagged Python, Programming

This blog post has been published on the Preferred Networks Tech Blog.

Most computer applications can be configured to behave a certain way, be it via command line flags, environment variables, or configuration files. For you as a software developer, dealing with configuration comes with challenges such as parsing untrusted input, validating it, and accessing it on all layers of your program. Using Python as an example, I want to share some best practices to help you handle configuration safely and effectively.

Working in Japan: Filing a Tax Return

February 07, 2018 – tagged Japan, Money

When working in Japan as a salaried employee, most tax payments are handled silently by the employer and there is no need to file a tax return (with some exceptions). However, certain types of expenses are tax-deductible and it may make sense to file a tax return and get some of the paid income tax back. In this post I will share some details about that and show an example of how to file a tax return.

Working in Japan: End-of-Year Adjustment and Income Tax

February 04, 2018 – tagged Japan, Money

When working in Japan as a salaried employee, most tax payments are handled silently by the employer and there is no need to dig deep into details of tax legislation. In some cases it may still be beneficial to understand how income tax works in Japan and which expenses are tax-deductible. In this post I will explain what the end-of-year adjustment is and how your income tax is computed from your total salary.

Maintainable Servers with Docker

July 27, 2017 – tagged Docker, Admin

Setting up a Linux server to host a certain software is easier than ever before. One challenge that the average user will most likely not be able to solve as easily is the continued maintenance of such systems. How do you get the latest security updates, how do you make sure your configuration still works after an upgrade, what if the underlying OS does not receive updates any more, …? This blog post presents a set of related ideas and one possible approach how it could be done.

Lightweight Semantic Markup for Software Manuals

April 02, 2017 – tagged Docbook, Scala

Like most software developers, once in a while I need to write not only program code, but also text for humans to read, for example README files, tutorials, or software manuals. This post presents requirements that a markup language should fulfill to be usable for software documentation and presents one possible approach using Docbook XML generated from Scaml.

Parsing timestamps from Apache log files in Python

October 29, 2013 – tagged Apache, Programming

Timestamps in Apache access log files have, by default, the format 27/Oct/2013:06:33:40 +0100. This can not be parsed in Python using the strptime() function from the time/datetime modules because there is no %z placeholder in strptime() to match the timezone (only %Z). Also, using the parse() function from dateutil.parser ...

Welches Ziel hat Angela Merkel in der NSA-Affäre?

October 28, 2013 – tagged Politik, Datenschutz

Seit Juni wird Deutschland von den Enthüllungen Edward Snowdens umgetrieben. Die deutsche Bundeskanzlerin hat sich dazu in den ersten Monaten fast gar nicht geäußert und ihre Minister vorgeschickt, die Affäre kleinzureden, zu beschwichtigen und sich von einem amerikanischen Geheimdienst, der das eigene Parlament belügt, mündlich und schriftlich versichern zu lassen, ...

Kundenservice bei Fonic

September 26, 2013 – tagged Japan

Gerade bin ich für einige Monate in Japan, aber die Servicewüste Deutschland verfolgt mich bis hierher. Eigentlich wollte ich nur gelegentlich mit meinem deutschen Handy, das ich mit einer Fonic-SIM-Karte benutze, SMS in Japan empfangen – das hat auch einen guten Monat lang geklappt. Danach habe ich allerdings von einen ...

Prism und Tempora – „Neuland“?

June 24, 2013 – tagged Datenschutz, IT Security, Politik

Durch Deutschland geht gerade ein Sturm der Empörung über unsere angelsächsischen Verbündeten, vornehmlich wegen Prism und Tempora. Ein paar Anmerkungen dazu: Falls Tempora tatsächlich das gesamte Internet abfangen und speichern sollte, ist das die Voraussetzung, von der man beim Design sämtlicher sicherer Internetprotokolle ausgeht und ausgehen muss. Beispielsweise hat ...