Brent Huisman

The world-wide home of Brent Huisman. Enjoy your stay!

Particle Physics, Proton Therapy, Treatment verification.

C++, Python, Numpy, Dicom, Qt.

Get in touch.

Black hole paradoxes

At Quanta Magazine there’s an article on black hole paradoxes: in very short the relationship between charge and mass radii, and how the study of those slowly but surely seem to be advancing black hole science in particular, but now perhaps also science in general. Charge and mass occur also outside of black holes after all.

I’ll not summarize here what I have understood, because that is probably rather little. Instead, I want to give a shout-out to Quanta Mag, which is producing fantastic posts such as on this subject, which is hard theoretical science, but presented in such a way even I can almost believe I know what is going on without seeing much of the math (which I would not understand). Great writing! Pretty much the only science reporting I read these days, reporting that is both in depth enough but still comprehensible. You will to take some time to sit down if you want to digest properly.

When Simcity got serious

Een van mijn favoriete games, Simcity. 2000 was de eerste versie die ik speelde, toen nog op de computer beneden in de woonkamer. Zie je nu ook nooit meer, bureau’s met computers in de woonkamer. Later vertelde een oom, die heel wat jaren in de Amsterdamse gemeenteraad heeft gezeten, dat dit spel verplichte kost moest zijn op scholen. Zo konden kinderen immers leren hoe een stad werkt. Ik denk dat hij zelf het spel nooit gespeeld heeft, want ik heb bij hem thuis nooit een computer gezien.

Gisteren kwam er een mooie retrospective langs over de business simulations kant van Maxis, de studio achter Simcity. Ik wist niets van die business simulations kant af natuurlijk, maar het kernprincipe van Sim-games (van vele actoren met simpele regels complex gedrag vinden, en begrijpen hoe veranderingen op grote schaal samenhangen met veranderingen in die simpele regels.) lijkt inderdaad iets wat je niet alleen op een stad kunt toepassen, en dat is dus ook gebeurd. SimRefinery, SimHealth zijn wat ‘titels’ uit die helft van Maxis, onder bewind van John Hiles. Voor meer moet je maar het artikel lezen. Deze quote wil ik in elk geval even aanhalen:

In this new game, SimHealth, Hiles wanted to take that idea to another level. He wanted players to have to explicitly state their beliefs about health care – about individual liberty, or the importance of community – then see if they could overhaul the American health care system in a way that matched their ideals. He wanted the player to have to confront their own ideology and understand what that ideology looked like as a real policy.

Dat klinkt nog steeds als iets dat ontzettend nuttige scholing voor alle burgers zou zijn!

Noise and productivity

And interesting paper on the relationship between noise pollution and decreased productivity: Noise, Cognitive Function, and Worker Productivity. This paper relates a 10dB noise increase to a 5% productivity decrease, lending credence to the idea that noise is in fact pollution like any other, unfortunately a rather novel and therefore not broadly accepted thesis. A half year ago, Dutch The Correspondent published an article trying to present literature that links noise pollution with decreased (mental) health.

Bartle taxonomy and The Baloney Detection Kit

Game science, never thought of that! Apparently I’m a spade! Long live ♠!

Then, Carl Sagan’s nine-component Baloney Detection Kit:

  1. Wherever possible there must be independent confirmation of the “facts.”
  2. Encourage substantive debate on the evidence by knowledgeable proponents of all points of view.
  3. Arguments from authority carry little weight — “authorities” have made mistakes in the past. They will do so again in the future. Perhaps a better way to say it is that in science there are no authorities; at most, there are experts.
  4. Spin more than one hypothesis. If there’s something to be explained, think of all the different ways in which it could be explained. Then think of tests by which you might systematically disprove each of the alternatives. What survives, the hypothesis that resists disproof in this Darwinian selection among “multiple working hypotheses,” has a much better chance of being the right answer than if you had simply run with the first idea that caught your fancy.
  5. Try not to get overly attached to a hypothesis just because it’s yours. It’s only a way station in the pursuit of knowledge. Ask yourself why you like the idea. Compare it fairly with the alternatives. See if you can find reasons for rejecting it. If you don’t, others will.
  6. Quantify. If whatever it is you’re explaining has some measure, some numerical quantity attached to it, you’ll be much better able to discriminate among competing hypotheses. What is vague and qualitative is open to many explanations. Of course there are truths to be sought in the many qualitative issues we are obliged to confront, but finding them is more challenging.
  7. If there’s a chain of argument, every link in the chain must work (including the premise) — not just most of them.
  8. Occam’s Razor. This convenient rule-of-thumb urges us when faced with two hypotheses that explain the data equally well to choose the simpler.
  9. Always ask whether the hypothesis can be, at least in principle, falsified. Propositions that are untestable, unfalsifiable are not worth much. Consider the grand idea that our Universe and everything in it is just an elementary particle — an electron, say — in a much bigger Cosmos. But if we can never acquire information from outside our Universe, is not the idea incapable of disproof? You must be able to check assertions out. Inveterate skeptics must be given the chance to follow your reasoning, to duplicate your experiments and see if they get the same result.

Oh par2cmdline

Small update: Version 1.9.4 now includes libpar2! Also, a fresh installer for Windows is available here!

I write a tool that makes so-called forward error correction of file trees easy to manage, par2deep. At least, I think it makes it easy, you can (and do!) send me your own opinions on that, I’m always looking for improvements!

One such improvement I have been looking at today and yesterday is seeing if I can create a Python library out of the par2cmdline project, because right now I just generate the commandline options with which to run par2, the compiled executable of the par2cmdline project. It works, but it requires the user to ensure the executable is in their PATH or point par2deep to wherever they have it. Not the best or most robust way to do things, right?

So, a library is what I need, but alas, there wasn’t really one. Although the par2cmdline (auto)makefile creates a static library of (nearly) all of its sources, and then links them up with the main() in par2cmdline.cpp, the interface to that library is not explicitly defined anywhere. At first I thought exposing the functions in libpar.h with pybind11 would be a good idea, but it takes a whole bunch of arguments of which I have no idea, and I also don’t really want to have an idea. I want the commandline interface, I understand its switches because they are defined and documented in the manpage.

commandline.h converts your arguments into the right input for libpar.h. So, I must reuse commandline.h/cpp to interface with the functions in libpar.h. Not hard, turn main() in par2cmdline.cpp into extern "C" par2cmdline() and presto! Woah woah woah, not so fast! I spent the night educating myself on automake, trying to modify into doing what I want, but after some time it because clear, for shared libraries, automake needs external tooling, libtool. Okay… sudo apt install libtool. Nope. No /usr/bin/libtool. Ah, sudo apt install libtool-bin. Still nope. Hmm, must run libtoolize in the source dir. Oh and add LT_INIT to configure. O, and no LDADD, but LIBADD to link libpar2.a. The generate makefile still did not specify a LIBTOOL, so manually adding it seemed to generate something. Nope, it didn’t, more errors in the generated makefile. Well, here I gave up. I’m not interested in build scripts much, I never quite understand them, and they seem to have as much ceremony as using PGP with its 6 trust levels. I just want a shared library, why is that so tricky?

I then tried to make the static library work, but that does not play well with Pythons ctypes CDDL interface. It must be a shared library. It is what I’m used to as well, I’ve written libraries with C interfaces before (medimage and dosia feature them), so what other options do I have? Cutting out the build script. That of course means cutting out the linking of the various seperately compiled object files that the build script generated for each source file in par2cmdline’s /src

Include all the things! The main challenge here was figuring out the right order, because the par2cmdline coding style does not feature a consistent include for every dependency, it lets the linker make sure all the symbols are present. The function signature fortunately is already C-proof (argc,argv), so all I need to do is prepend a fake executable name that the CommandLine class scans for. Presto, libpar2!

I chose not to edit any par2cmdline/src code, such that it will remain straightforward to follow upstream updates. Building does not really require any script anymore, and the interface is just the commandline interface we already know and love.

Have fun! Would be interesting if anyone likes or even uses it! I’ll see to the integration into par2deep shortly.

Oh Jekyll

This website is generated using Jekyll, a popular static site generator. What’s nice that it’s very well supported by services like Github Pages and Netlify, in the sense that you can generate the pages using their servers, and you just add your contect to a git repo and push to deploy.

Jekyll is a bit hairy in places though. It ships with a markdown plugin, kramdown, which contrary to the ‘official’ markdown syntax (which is famously not official) does not like inline html, a very useful feature in a static site generator, wouldn’t you say? Another half-baked thing in Jekyll is the includes functionality. Even though it’s an ancient ticket, the authors missed that you’d like to apply layouts to your includes as well. I‘d like to use it for sections with similar meta-data and formatting, but nope, seems I have to write my own plugins for that.

Well, that said, how do you like the new look? Oh wait, this look isn’t new at all, is it?

Qt and par2deep

I wrote par2deep to make working with the par2 command easier. The tool helps you protect a file tree recursively by providing bulk reporting and options. For instance, if you modify your file tree (add some files, remove some, edit others, and perhaps experience some bitrot) you can easily get an overview of these changes and options for handling them (restore, recreate, etc.).

The tool started out as a cli tool but I quickly added a tkinter GUI, because when reviewing changes to thousands of files, the command line may get a bit cramped, especially if you want to handle changes to groups of files separately. tkinter made sense because the tool is written in Python, and although functional, on KDE, my main platform, it is thoroughly alien looking, as well as hard to read if you use any dark themes. In another project, dosia, I therefore chose to use Qt, through PyQt5 (PySide2 is actually also perfectly usable). Building the GUI is much easier and consistent than tkinter.

So yesterday I completed the port of the par2deep GUI to Qt. It looks much better now on KDE 😃. This rewrite will also make it easier implementing the currently open issues, mainly per file or per sub-directory modification of actions, which I kind of stranded halfway about a year ago with tkinter. Version 2.0.0 should be here soon with all that good stuff implemented. What did I learn doing this?

  1. That my par2deep class was a well chosen separation of concerns, because I did not have to change a single line to the core logic of the program just to change the GUI. This class is now used by three different interfaces (cli,tk,qt).
  2. Qt and Python’s threading library do not work together. Apart from the GUI, I had to shift the threads I was using to keep the UI responsive during long actions to Qt’s QThreads. Fortunately that is ultimately easier and cleaner than threading, at the cost of having to be very clean about shared resources (you can’t!). I therefore pass the par2deep instance around, which in my case is fine because there is no concurrent activity on it. The par2deep class is single threaded, it relies on your version of par2 being multithreaded.
  3. I had some experience with Qt so that came in handy, but googling Qt docs/examples is a bit of a pain. You’ll run into plenty of Qt4 stuff, including official docs. Qt is a huge project, and a great strength (object-oriented composability makes total sense for GUI components) is also a weakness: Qt itself is thusly layered and sometimes you will have to stumble by chance over the existence of a more specialized widget (QTreeWidget) of a very generic prototype (QTreeView).

All in all a huge improvement, composing your own widgets is so much nicer in Qt than tkinter. The downside is that it’s a huge package (PyQt5 is 60MB, PySide2 166MB!) and both packages ship only with a limited selection of themes (Windows and Fusion, the latter of which doesn’t look native on any platform). My distro, KDE Neon, ships with PyQt5 and a theme to match KDE (Breeze), so that’s actually the main reason I use PyQt5. But replacing those imports to PySide2, and renaming pyqtSignal to Signal works fine, so if the packaging situation for PySide2 improves, I can jump ship in a heartbeat.

Bronzen van Benin

In de Groene van 26 maart staat een artikel over de terugkeer van roofkunst, of althans het begin van het bewustzijn van de eerlijkheid daarvan, en de voorzichtige stapjes daartoe. Die stapjes bestaan uit mensen uit landen die kolonie waren en uiteraard graag hun erfgoed terug willen, of in elk geval die niet voor eeuwig in hoofdsteden ver van hun land willen zien verstoffen. Een goed punt natuurlijk, het is toch ook een beetje jammer als je Nederlandse werken in het buitenland ziet hangen bijvoorbeeld. Stel je nu eens voor dat zo’n beetje alle Nederlandse kunst op andere continenten was, en vaak gestolen door landen aldaar. Dat kan natuurlijk niet. Daarnaast zou het mooi zijn als we ook voor kunst naar Afrika konden gaan, en niet alleen voor leeuwen en olifanten.

De andere stapjes zijn westerse overheden of musea die hun beleid aanpassen op het afstaan van roofkunst, wat kennelijk heel ‘lastig’ is. Een Nederlandse museumdirecteur heeft dat gedaan maar in de 12 maanden sinds geen formele verzoeken tot teruggave ontvangen. Wel is bekend dat er stukken zijn die sommigen terug willen, maar niet de door het museum geschapen procedure zijn gaan belopen. Een aardig punt in het stuk is de kritiek is dat dat slechts de macht van de bezitter, kolonisator, enfin, de macht aantoont. Immers, waarom is het aan de ‘dief’ te definiëren wat ‘de juiste’ procedure is?

Doet mij aan iets heel anders denken, of eigenlijk niet zo anders: het verschil tussen eerlijkheid en correctheid (als in de regels, de wet) is macht. Als jij een contract met een verzekeraar of reisorganisatie sluit, zit daar een berg regels bij waar je niets over te zeggen hebt. Die heb je te accepteren als je de dienst of product wil afnemen. Dat doe je eigenlijk niet vrijwillig, immers is het vaker niet dan wel mogelijk alternatieve aanbieders van een dergelijke dienst maar met betere voorwaarden te vinden.

Of denk aan arbeiders die meer loon willen, terwijl de werkgever wijst op regelingen waar weinig arbeiders voor getekend hebben.

Dat is nu macht: het vermogen de regels te bepalen. Misschien begreep de directeur niet dat niet iedereen speler van andermans spel wil zijn. En dat misschien niet gewend is. Elke samenleving kent regels, maar het is vrijheid wanneer die regels zo beperkt mogelijk zijn. Regels omtrent klederdracht kennen we minder dan vroeger, religie ook, maar staat en commercie zijn daar misschien voor in de plaats teruggekomen. Waarom is er een beleid nodig, een procedure voor de teruggave van roofkunst? Wanneer iemand uit Nigeria aangeeft een Benin brons terug te willen, dan kun je toch aan de slag? Dat beleid kun je intern hebben, daar hoef je anderen die mee lastig te vallen. Procedures idem. Dat lijkt dan weer op wat ik bemerk als een bureaucratie je formuliertjes laat invullen, meestal met velden die ze allang kennen. Waarom doe ik dit, en niet het bedrijf of overheid? Waarom is het aan ons de juiste balie te vinden? Is dat niet het externaliseren van je bureaucratie? Is dat niet lui en verkeerd, misschien zelfs oneerlijk?

Dat je Nigeria vraagt om te vertellen waarom ze die beelden terug willen en wat ze ermee gaan doen is niet gek, wel ze dat op jouw manier, jouw formulier te laten invullen. De angst voor willekeur die aan regels ten grondslag ligt keert zich dus om: de regels creëren juist willekeur, de willekeur van de machthebber, die wel even bepaalt hoe je met hem interacteert. Dat is slechts consistent, en zelfs dat kun je je afvragen. Met een ingevuld formulier kun je immers nog veel kanten uit. Het geeft slechts een indruk van systematiek.

Misschien is het geen verassing dat ik in een bordspel vaak regels die me niet aanstaan aanpas. Regels moeten het leven van de speler makkelijker maken, niet moeilijker. De spelmaker moet geen al te grote rol hebben.

Welk nieuws ik lees

Sla eventueel de volgende alinea over als je gewoon een lijst wilt hebben.

Deze week besloot ik dat de Haagse Zaken podcast van de NRC me toch te oppervlakkig is. Dat gevoel had ik al veel langer, maar nu heb ik hem mijn lijst uitgekieperd. Het is natuurlijk soms prettig een blik in de gangen van onze hoofdstad te werpen, om beter sommige besluitvorming of drama te begrijpen, maar de Haag-watcher is zoals elders al vaker beschreven vaak wat te nauw met haar object verbonden en daardoor wat te nauw kwa blik. Dat laatste geldt in extremis voor bijvoorbeeld de NOS, zoals Lubach afgelopen zondag nog maar weer eens pijnlijk blootlegde. De NOS en ook de betere kranten zitten helaas gevangen in de news-cycle, en nieuws is een show. De titel van dit bericht is dus misleidend: ik probeer geen nieuws tot mij te nemen, want dat is gewoon zeer inefficiënt. Daarom een lijst van publicaties die je tijd niet verdoen. De Nederlandse journalistieke prijzen rouleren ook meestal onder een van dezen.

Verder lees ik nu en dan de/the Correspondent, waar ondanks het onderzoek de opinie meestal belangrijker is. Vooral de nieuwe Engelse versie is teveel een echokamer nu. Ondanks dat, samen met VK/NRC/Trouw een bron van leuke nieuwe inzichten zo nu en dan.

QOwnNotes and Markor

Warning, bikeshedding ahead.

Only recently I switched my personal note taking / wiki workflow from Joplin to Zim-wiki. I did that because the Joplin app, especially on mobile, could be quite sluggish, especially when I wanted to jot a quick note down. Also, including images was problematic: Joplin always re-encodes and resizes images upon import, and it does not work with local files that you include via the appropriate markdown tag. Still an open issue. Zim does the latter correctly, but it has not mobile app, or any app that is compatible with it’s custom syntax.

So, I once again changed my workflow. Keeps a man off the streets, right? Really good timing too. So I did at one point have a look at NextClouds Notes app. Similarly sluggish in mobile use. It works on a dir with markdown files, so that’s nice, but didn’t seem to show images or allow for easy navigation through local links (Joplin neither!, but Zim of course does). Using an editor like Sublime or VSCode on a dir with markdown files works too, but for following local links (or showing images) you need to find the right extensions and this proved not very stable.

Not even that recently, must have missed it the last time, there’s a companion app the NextCloud Notes, QOwnNotes. Its GUI can be slightly daunting at first, there’s a ton of functionality and configurability, but proves a powerful tool for this purpose. You point it to a dir, it allows you to navigate all .mds therein (or any other .ext you configure, and edit them, navigate local links, including any non-md files, and if they’re images, they’re previewed in the optional markdown render (so not inline like Zim). I quite like it, more than Zim. For the mobile companion app, I use Markor. Open dir, edit markdowns, it does so fast. And the optional markdown renderer shows images! Yes! Together with a Resilio synced dir, I think I have a very nice setup now.

A few essential tweaks to QOwnNotes:

Read more in the archive.