Einträge über Computer

I had my first computer with 5 and started C programming when I was 13. Then I made some simple websites using PHP which grew into ever more complex ones. In 2007, I created some Java applications, some of them are still among the portfolio on this page. While I was an intern at the DLR, I started to learn Python and IDL, which introduced me to matrix based languages. For the numerical methods lecture and especially my bachelor’s thesis I used C++. During my master’s thesis I have learned Haskell for fun. Later on for my PhD thesis I also learned R and the Wolfram Language.

See my portfolio of programming projects.

My most popular hobby project is the Vigilant Crypto Snatch, a little program that buys crypto currency whenever the prices fall.

This section of my site is for articles about programming practices and performance tests. Also various stuff about computer hardware and software.


Making Adapter Code More Testable

Part of my Vigilant Crypto Snatch project are the marketplaces. The most popular is the Kraken one. I use the krakenex Python library to interface with that. In the UML diagram you can see how the KrakenexMarketplace directly uses the krakenex library:

In order to instantiate the KrakenexMarketplace, one needs to supply the API key. One does this via the KrakenConfig, which is just a data class that contains the API key and associated secret.

Weiterlesen…

Component Facade without Incomplete Imports

My current hobby Python project is the Vigilant Crypto Snatch. This has grown to a size which made me refactor it a few times by now. Recently I've refactored it towards the clean architecture. I have introduced a two-level module structure such that I have components like configuration, marketplace, telegram and so on.

In a very reduced way, each of these components contains interface classes, concrete implementations and factory functions. They are then used from outside. This is what the dependency graph looks like (made with PlantUML), although I cannot show free functions in UML:

There are a few ways that one can do the import statements in Python. And I have been bitten by cyclic imports and got frustrated about that. When searching the web for cyclic imports in Python, one will find many articles about dumb incarnations of the problem. Somebody really has a cyclic dependency in their components, and then there is no way to get it right. But with Python one can get cyclic imports even when one doesn't have cyclic dependencies. And this is what this post is about.

Weiterlesen…

Garmin HRM-Dual Herzfrequenzmesser-Brustgurt

Ich habe bisher bei Radtouren und Joggen nur meine Position aufgenommen. Damit kann man dann Entfernung, Geschwindigkeit und Zeit auswerten. Strava schätzt daraus dann auch noch die verbrannten Kalorien ab.

Um das etwas zu erweitern, habe ich mir einen Pulsmesser gewünscht. Dabei gibt es die Uhren, und auch die Brustgurte. Generell sind Brustgurte genauer, und unter Handschuhen ist eine Uhr vielleicht nervig. Daher habe ich einen Brustgurt ins Auge gefasst. Der HRM-Dual von Garmin schien mir eine gute Option zu sein, da er Bluetooth unterstützt. So kann ich ihn direkt an mein Handy koppeln und mit einer App nutzen. Zumindest in der Theorie.

Weiterlesen…

Camera Tether and Preview

I occasionally take selfies, because it is much easier than to go to a professional photographer. The results are not as good, but at the same time I can learn more about photography myself. The problem with selfies is that one doesn't really see what is going on, unless one takes them with a smartphone. But my arm is too short to give a natural distance between camera and myself. So I take a tripod. But the selfie camera in my phone has a small focal length, so it doesn't really work on longer distances.

Therefore I take my DSLR camera, an ancient Canon EOS 350D. I have an infrared remote for it, but one cannot see the pictures that I have taken. I can go behind the camera, and take a look, but that's not really suitable for adjusting a single light a little bit. Also I have no idea whether my face was within one of the focus points.

Luckily one can attach the camera via USB to the computer. Then one can take a picture and directly download it. For this I use gphoto2 on Linux. With a little Python script (see below), I just periodically take pictures and download them to the laptop.

Weiterlesen…

Diagram Creation Tools

There are various programs to create diagrams, and so far I haven't found the one which really satisfies me. I want to create flow charts, UML diagrams and sequence diagrams. Also I want to layout arbitrary graphs that come up with say game theory projects.

In this article I will take a look at a few graph systems that I have used over the time:

  1. GraphViz
  2. PlantUML
  3. Blockdiag
  4. Dia
  5. Draw.io
  6. Umbrello

Weiterlesen…

Ausfälle bei 1&1 DSL

Wir haben unser Internet als VDSL 50 mit Vectoring, aktuell über 1&1. Und das klappte auch wunderbar, bis zu jenem Tag. Da kam ein DSL-Techniker vorbei, um den Nachbarn anzuschließen. Das Haus ist ein Mehrparteienhaus, mit einem wahrscheinlich furchtbar unübersichtlichen Verteilerkasten im Keller. So einem, in dem Zig Klingeldrähte ankommen, und die irgendwie notdürftig organisiert sind. Der Techniker hat beim Festschrauben des einen Kabels unser Kabel gelockert, jedenfalls war dann die Internetverbindung komplett weg.

Glücklicherweise habe ich das rechtzeitig gemerkt und konnte den Techniker noch vor dem Wegfahren ansprechen. Er hat dann noch unser Kabel wieder festgeschraubt. Seit dem hatten wir aber regelmäßige Ausfälle. Also nicht so regelmäßig, aber grob einmal die Woche. Und mit der Zeit wurden sie immer häufiger, bis sie aktuell grob täglich auftreten.

Ich habe dann bei 1&1 angerufen und wollte die Störung behoben haben. Mir scheint auch die Ursache recht klar zu sein, jemand muss den Verteilerkasten unten nochmal aufräumen. Jedoch sagte man mir, dass bei derart selten auftretenden Störungen nichts gemacht werden kann. Es bräuchte so 5 Störungen in 26 Stunden, damit man das überhaupt diagnostizieren könnte.

Weiterlesen…

Besucherstatistik (November 2021)

Ich werde immer mal wieder gefragt, wie viele Besucher ich auf dieser Webseite habe. Ich weiß es nicht so recht. Mir ist die Privatsphäre meiner Besucher:innen wichtig. Also nicht so wie das immer in den Cookie-Bannern steht, direkt bevor man abnicken soll, dass man alle Cookies von Drittanbietern akzeptiert. Ich habe hier auf der Webseite weder Google Analytics, noch Matomo. Von daher bleibt mir nur das Log des Webhosters, und dort sind die IP-Adressen auch alle durch einen Standardwert ersetzt. Ich kann also maximal eine Höchstgrenze für die Seitenaufrufe abschätzen.

Vom Hoster bekomme ich die Logs auch nur für grob zwei Wochen, mehr liegt dort nicht auf dem FTP-Server. Diese Logs habe ich:

Datei Von Bis
web.log-20211107.gz 31.10.2021 07.11.2021
web.log-20211114.gz 07.11.2021 14.11.2021
web.log 14.11.2021 16.11.2021

Weiterlesen…

Rewriting ColorHug ALS Script

Five years ago I bought an ambient light sensor (ALS) such that I could automatically adjust the brightness of my computer screen, just like smartphones do. For this I have written a Python script. It is all written up in the blog post from 2016.

By now I have tweaked the script here and there, but somehow it just doesn't quite work right. I have also moved the sensor to a different position, but still I struggle to find the right model to map from sensor readings. I want to take new measurements, gather more data, find a better model. Also I want to have some clean architecture with that script.

So I start to clean this up. It turns out that I have multiple copies of that script, bin/brightness, bin/brightness-ng-runner, brightness, brightness-bin, brightness-ng.py and ddc-save-brightness, as well as a Python module externalbrightness. This is a mess. And I want to clean it up.

Weiterlesen…

Clean Architecture for Vigilant Crypto Snatch

I have recently finished Clean Architecture1. In the book Robert C. Martin presents a certain way to organize components of a program. It consists of a series of concentric rings, where dependencies are only inward. There is a core of central business rules in the middle, depending on nothing else. Then there are use-cases around that, depending only on the core business rules. And then even further out are adapters to other libraries and interfaces. Since there are no dependencies on concrete things, these can easily be exchanged for something else, be substituted for tests and so on.

For years I wanted to improve the design of the software that I work on, so I have been reading books like that. And today I want to apply the ideas to my hobby project Vigilant Crypto Snatch to get some experience with the architecture. The idea is to first draw the architecture of the current system, then clean it step by step.

Weiterlesen…

Clean Architecture and Social Networks

I'm currently reading Clean Architecture: A Craftsman's Guide to Software Structure and Design by Robert C. Martin, which came out in 2017. It is a book about software architecture and design. And today I was able to put something that annoys me about social network and messaging services into new words.

A clean architecture consists of entities at the core. These are important business rules which would even exist if they are not implemented with a computer, but with a paper file system. Then around that are use cases. These manipulate the entities, but have no specific dependence on any implementation. Around those are components for user interface, data presentation and data storage. The dependencies are only inward, the core doesn't depend on any specifics. This is achieved by letting the inner layer control the interface, the outer layer implements it. A use case might need to store data, so part of that component will be an interface for data storage. A data storage implementation will implement that interface, but live in a different component. The implementation will just be one of many possible ones, the use case doesn't depend on anything specific.

Transfer that to content in social media. I have the text of my blog posts, I have the tracks I rode with the bike, I have taken images, and I want to send messages to friends. All these exist independent of the actual medium that I publish them on. The file formats (Markdown, JPEG, GPX) which I use are an implementation detail. And now I want to post them, that is my use case. And I want to post images to an image service, I want to post blog posts to a blog service, and GPS recordings to such a service.

Weiterlesen…