Die wunderbare Welt von Isotopp

Tracing Python

Kristian Köhntopp - March 14, 2023
Based on a discussion on IRC and Mastodon: “How can I get access to the return values of my (Python-) programs functions?” And more generally, how can I trace function execution in Python, showing function parameters and return values? PyCharm builtin method Of course, you can always simply turn on this in the PyCharm debugger: PyCharm, Debug Window, Gear Icon, “Show Return Values” Do it yourself: @logging You can also implement such a thing from first principles, in Python:

MySQL: Selecting random rows

Kristian Köhntopp - March 6, 2023
Given a table named tbl with one million entries, we want to select a random row from this table, fast. Our table definition looks like this: create table tbl ( id INTEGER NOT NULL, d VARCHAR(200) NOT NULL, INDEX(id) ); Dense id space We can generate some test data using a recursive CTE: mysql> set cte_max_recursion_depth = 100000; mysql> insert into tbl -> with recursive c(n, u) as ( -> select 1, uuid() -> union all -> select n+1, uuid() from c where n < 100000 -> ) select * from c ; The Recursive CTE will generate 100k pairs of (number, uuid()).

Rotating Accounts or Passwords?

Kristian Köhntopp - February 20, 2023
Some applications allow you to have multiple passwords. For example, in MySQL, since 8.0.14 you can dual passwords for an account . Also, Redis 6 allows you to have multiple passwords on an account ACL . Personal Accounts and Machine Accounts. When running services in a production system, the services sometimes have personal accounts (PAs) that allow humans to login and perform actions on the service. Often, these accounts are very limited in number (in production), and privileged.

This is not a Drill, this is just Tuesday

Kristian Köhntopp - February 18, 2023
Master of Disaster With a previous employer there was the requirement to implement business continuity management and patch management. Specifically, there was a requirement to be able to lose a region completely without loss of business. The other requirement was to be able to have all systems CVE-free within 30 days (in emergencies: 3 days), and to be able to blackstart them. That was of course impossible to implement.

Minecraft: unable to create native thread

Kristian Köhntopp - February 17, 2023
A minecraft server has problems creating threads. The error message reads: java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached at java.lang.Thread.start0(Native Method) ~[?:?] at java.lang.Thread.start(Thread.java:802) ~[?:?] at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:945) ~[?:?] at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1353) ~[?:?] at java.util.concurrent.Executors$DelegatedExecutorService.execute(Executors.java:721) ~[?:?] at org.bukkit.craftbukkit.v1_19_R2.scheduler.CraftAsyncScheduler.mainThreadHeartbeat(CraftAsyncScheduler.java:73) The server in question has 32 GB of memory (6 GB used), 8 cores, and processes threads running. It is mostly idle. There is no reason at all why this machine should be out of resources.

Service Directories, and what they are good for

Kristian Köhntopp - February 6, 2023
At a previous job we had a home-grown application “Service Directory”, which allowed a team to declare a service or deployed application. The record for a service not only declared the application with pointers to the source code repository, artifacts and documentation. It also pointed to the operational facts, such as criticality, the owning teams, the SLO, the alerts, and the collected stats and dashboards. And, most importantly, you had to declare dependencies – which other services you depend on.

Mastodon Interaction Counters

Kristian Köhntopp - January 25, 2023
In this post , SirSquid@toot.io asks: Can someone explain to me why seeing retoots and likes is wildly different across Mastodon servers? From toot.io, a toot from @gamingonlinux@mastodon.social shows hardly anything. But when viewing it on mastodon.social, it has tons of both. This is one thing I would love to see properly cleaned up on Masto. Mastodon is using ActivityPub, a federated protocol. Nodes exchange articles, and each node caches articles.

I don't hate Let's Encrypt anymore

Kristian Köhntopp - January 4, 2023
So, Rachel is in a bad mood: Why I still have an old-school cert on my https site and I feel her. Like her, for my own sites I have always been running Apache. There was never much need to upgrade, the software was available, stable, and fast enough. At some point in time, I needed TLS and started to use Let’s Encrypt . That was messy: Running dehydrated , a bunch of haphazard shell scripts trying to get certificates authenticated and installed, through a wild chain of callbacks and sourced scripts all over the system, driven by Cron, and with bad alerting.

MySQL: Ways to run mysqldump

Kristian Köhntopp - January 3, 2023
This text exists mainly so that I paste the URL into the #mysql channel in Libera IRC. The mysqldump tools allows you to convert a MySQL database server or individual schemas back to SQL. You are left with a script that is supposed to be loadable into a target server and gives you back the full database, including all objects in it. You can read that SQL as a script into an empty server to create a new instance, or process it with different tools for different purposes.

Was mein Kind in der Schule so macht

Kristian Köhntopp - December 30, 2022
Die Niederlande sind ja ein Land, das mit WhatsApp funktioniert. “Ik stuur je snel een appie” und wenn WhatsApp mal down ist, wird das Land vorübergehend geschlossen. Damit kann man einverstanden sein oder nicht, aber Metcalfe’s Law ist mächtig und wenn man das Land nicht in Hard Mode spielen will, dann legt man sich besser ein WhatsApp zu. An ungefähr jedem zweiten Wohngebiet findet man ein solches Schild an der Einfahrtstraße.

Chromebooks in der Schule

Kristian Köhntopp - December 29, 2022
In Mein Sohn sitzt vor dem Computer und in Schulen digitalisieren ging es schon einmal um den Einsatz von Computern in der Schule, in Deutschland und in den Niederlanden. VWO Jetzt stand bei uns letzten Sommer nach dem Ende der 8. Grundschulklasse (der deutschen 6. Grundschulklasse) der Schulwechsel auf die VWO an. VWO steht für “Voorbereidend wetenschappelijk onderwijs”, studienvorbereitender Unterricht, und entspricht noch am ehesten einem deutschen Gymnasium. So wie es in Deutschland Gymnasien mit unterschiedlicher Ausrichtung gibt, gibt es das auch in den Niederlanden und der Name “Gymnasium” steht für eine VWO mit altsprachlicher Ausrichtung, der Name “Atheneum” für VWO mit einer technisch-naturwissenschaftlichen Ausrichtung, und es gibt noch ein paar weitere Geschmacksrichtungen.

MySQL: The command line client

Kristian Köhntopp - December 28, 2022
When asking for help in Libera Chat , in the #mysql channel, people will ask you to use the mysql command line client. They will also point you to dbfiddle.uk for asking questions. Specifically, when using phpMyAdmin, you will get hate. Why is that? When asking for help, it is almost impossible to help a GUI user, because they will need to paste screenshots in order to document what they did.

Meditations on Quitting

Kristian Köhntopp - December 27, 2022
I quit often. At least once a year, but there have been years when I have been quitting four times. Every time before a performance evaluation, or before important meetings, I sit down and write myself a notice. I pull up a word processor, start the empty business letter template, fill in the details and the date, and then write the three or four sentences necessary to inform my employer that the time has come to part ways.

From Hadoop to HTAP?

Kristian Köhntopp - December 23, 2022
For the last 15 years, one popular way to persist large amounts of data has been Hadoop, if you needed them persisted in such a way that you can still process them. Of course, from a database point of view, brute forcing a result by scanning compressed CSV files in parallel, and then building giant distributed Hash Joins is not very elegant. But two facts were true in 2006 influenced Hadoop’s design, and which allowed it to process data at all at a scale where all other things failed:

Tying the BI pipeline together

Kristian Köhntopp - December 22, 2022
In Of Stars and Snowflakes we have been looking at the “normal Form” for Data Warehouses/BI structures, and how it differs from normal forms used in transactional systems. In ETL from a Django Model we looked at one implementation of a classical offline DWH with a daily load. The normal BI structure is a fact table, in which an object identifier (the one we collect facts about) is paired with a point in time to report facts about the object at a certain point in time.

Ansible: List Cross-Join

Kristian Köhntopp - December 12, 2022
A friend asked in Discord: I need a pointer to a solution in Jinja. Given two lists, x: [a,b,c] and y: [d,e,f], I need the cross-join ["a.d","a.e","a.f","b.d",…,"c.e","c.f"]. I know how to cross-join, but that then is a list of lists, and I want join the inner lists. After some experimentation the result was a set of nasty templating loops. There has to be a better way. There are two: Ansible Custom Filters in Python Playbook We want a custom filter cross, which produces the desired result.

ChatGPT and Limits

Kristian Köhntopp - December 11, 2022
Like everybody else, I have been playing with ChatGPT from OpenAI . Specifically, I wanted to test how it could be used as a coding assistant, and what the limits are in terms of size and complexity. Code Generation I have been using the Labyrinths example as a base. My goal was to have ChatGPT write the Labyrinth class for me. I did so interactively. Kris: Write an empty Python class named Labyrinth

2FA für Mastodon

Kristian Köhntopp - December 10, 2022
Multi-Factor Authentication (Identifikation mit mehreren Faktoren) oder 2FA (Two-Factor-Authentication) sind ein Weg, einen Account vor der Übernahme durch Dritte zu schützen. Statt sich mit Usernamen und Passwort anzumelden ist zusätzlich noch eine wechselnde Pseudozufallszahl notwendig. Diese wird von einem Seed-Wert generiert, der durch eine Buchstabenfolge oder einen QR-Code repräsentiert wird. Authenticator Anwendung installieren Das Verfahren ist standardisiert und wird von vielen Tools unterstützt. Dazu gehören Google Authenticator, Bitwarden und viele andere Passwortmanager.

Change Data Capture

Kristian Köhntopp - December 5, 2022
Change Data Capture is a way to capture, well, events from a system that describe how the data in the system changed. For a system that does business transactions that may be at the lowest level Create, Update, or Delete of entities or relationships. Systems that emit this kind of events are called Entity Services and are kind of the lowest level of events that you can have in such a system.

USENET und Tiernetze

Kristian Köhntopp - December 2, 2022
Vor ziemlich genau 30 Jahren gab es in Deutschland die Anfangsgründe des Internet , aber es gab auch Netze, die auf anderer, viel älterer Technologie betrieben wurden – die Mailboxnetze. Das sind dezentrale Netze, bei denen denen lokale Rechner mit Modems ausgestattet wurden, bei denen man anrufen und dann Nachrichten a la Mastodon online lesen konnte. Oder man hatte Software daheim, die bei der Mailbox anrief, die Nachrichten heruntergeladen hat. Dann konnte man offline lesen, Antworten schreiben und ein zweites Mal anrufen.