Haupz Blog

... still a totally disordered mix

Mini Profiler

2024-11-10 — Michael Haupt

Profilers are power tools for understanding system performance. That doesn’t mean they have to be inherently complicated or hard to build. Here’s a great little specimen, in just a couple hundred (plus x) lines of Java code, including flame graph output.

Tags: hacking, the-nerdy-bit

Old Standard Textbook, Renewed

2024-10-24 — Michael Haupt

Back in university, one of my favourite courses was the one on microprocessor architecture. One of the reasons was that the lab sessions involved building logic circuits from TTL chips with lots of hand-assembled wiring (imagine debugging such a contraption). Another reason was the textbook, which explained a RISC processor architecture (MIPS) in great detail and with awesome didactics. This book was “The Patterson/Hennessy” (officially, it goes by the slightly longer and also a bit unwieldy title “Computer Organization & Design: The Hardware/Software Interface”).

This was the Nineties. Fast-forward 30 years to today, and we have a new and increasingly practical RISC architecture around: RISC-V. The good thing about this architecture is that it is an inherently open standard. No company owns the specification, anyone can (provided they have the means) produce RISC-V chips.

Guess what, that favourite book of mine got an upgrade too: there is a RISC-V edition! This means that students, when first venturing into this rather interesting territory, can learn the principles of CPU design on an open standard basis that is much less convoluted than certain architectures, and - unlike certain others - entirely royalty-free.

Makes me want to go to university again ...

Tags: the-nerdy-bit, hacking

PlanckForth

2024-10-03 — Michael Haupt

I had shared some discoveries I had made in Forth territory. Since these systems of minimal abstraction really fascinate me, I took a deep dive into the PlanckForth implementation and dissected the 1 kB ELF binary down to the last byte.

This is indeed a tiny Forth interpreter that does just the most basic things in machine code. It provides the foundation for a very consequential bootstrap to be executed on top of it. The bootstrap builds the actual Forth language from first principles in several waves.

In case you’re interested, here are the binary source and bootstrap with my comments. Note that I stopped commenting in the bootstrap once it gets to the point where the minimal Forth supports line comments.

What next? Part of me wants to build a handwritten RISC-V binary for the basic interpreter ...

Tags: the-nerdy-bit, hacking

More Forth

2024-10-03 — Michael Haupt

The Forth programming language is a thing I’ve previously written about. I recently came across this little gem of a talk, wherein the author points to some interesting resources about Forth. In particular, the slides put emphasis on how minimal a Forth implementation can be.

The point about Forth is that it heavily depends on threaded code. That’s a simple technique to implement an interpreter on the bare metal. In a nutshell, code to be executed by a threaded interpreter is mostly addresses of implementations of logic, that the very simple interpreter “loop” just loads and jumps to, following a “thread” of addresses through its implementation.

Indeed, Forth source code consists of just “words” that are concatenated to express semantics. These human-readable words are mere placeholders for the memory addresses where the words' implementations can be found. In other words, a Forth compiler is simplistic: it boils down to dictionary lookups.

To demonstrate the minimalism, the PlanckForth interpreter is just a 1 kB hand-written ELF binary. The syntax of the basic language this interpreter understands is a bit awkward, but sufficiently powerful to bootstrap a full-fledged Forth in just a couple hundred lines.

JonesForth is a richly documented Forth implementation. (You’ll have to go through the snapshot link to get the source code.) Reading the code is highly instructive.

Tags: the-nerdy-bit, hacking

Historical Source Code Every Developer Should See

2024-09-21 — Michael Haupt

This piece lists some historical source code that today’s engineers, in the opinion of the author, should read and know. The artifacts in question are the WWW demo source code, an early C compiler, pieces of the early Unix research code bases, the first Linux release, and Mocha, the first JavaScript engine.

While all of these (maybe, and forgive the snark, with the exception of Mocha) are relevant, I cannot help but wonder about the author’s rationale for choosing these particular specimen. The author argues these “built the foundation of today’s computer technology”. I beg to differ.

Graphical user interfaces are quite a thing in today’s computer technology, one should think. These owe a lot to BitBlt, the Xerox Alto machine, and, consequently, Smalltalk (that programming language had an IDE with a GUI back in the 1970s). So, for source code, I’d add to the list this memo from 1975 describing BitBlt, and the Computer History Museum’s page on the Xerox Alto source code.

Tags: hacking, the-nerdy-bit

Interpreted or Compiled?

2024-09-15 — Michael Haupt

What would you say: is Java an interpreted or a compiled language? What about C, C++, Python, Smalltalk, JavaScript, APL?

Laurie Tratt has written two (1, 2) absolutely wonderful (read: scientifically and technically nerdy) blog posts about the matter. He uses the Brainfuck programming language (it is less NSFW than the name suggests, but I will continue to use its name in abbreviated form, i.e., “bf”) and a series of implementations thereof that increasingly blur the boundary between interpreted and compiled.

The blog posts resonate with me especially because I use bf myself whenever I want to learn a new programming language: I just write an interpreter (or compiler?) for bf in that language.

These are two rather entertaining reads, and they will leave the reader in a better shape for the next inevitable discussion of whether this or that language is interpreted or compiled.

Tags: hacking, the-nerdy-bit

Musical Languages Galore

2024-06-21 — Michael Haupt

Quite a while back, I had written about musical languages. Somewhat more recently, I came across this repository of programming languages for music. I’m impressed by the sheer amount of different languages, and by the different aspects of music they support.

Some of the languages are for notation. Heck, I’ve used Lilypond myself already. Some others are for sound synthesis, some for composition, some for MIDI programming, ...

It’s a treasure trove.

Tags: music, the-nerdy-bit

In Touch With Old Languages

2024-05-24 — Michael Haupt

This list of the ten most(ly dead) influential programming languages is a fun trip to olden times. Even though I’m not old enough to have used COBOL “back in the day”, no less than four of these languages play quite important roles in my life.

My first programming language was indeed BASIC, and the one I learned most with during my early programmer days was PASCAL. While I don’t have any emotional attachment whatsoever to the former, I fondly recall learning about structured programming in the latter. The BASIC dialects I had used solely relied on line numbers, and consequently calling subroutines had to happen using GOSUB plus line number. Parameter passing and returning results was awkward. PASCAL with its named procedures and functions made such a tremendous difference - it was a true relief. (Remember: this was the late Eighties / early Nineties of the past century.)

Java happened in 1995, and I was an early adopter at university. I came across true object orientation only in 2003 or so, when I first looked into Smalltalk as part of my doctoral research. That was really eye opening. If I had to pick one programming language to spend the remainder of my programming work in, it would be Smalltalk. There simply is no other language that molds programming environment, application, and runtime environment like that.

Finally, APL became important in around 2014, when I was looking into optimised implementations of array programming languages as part of my work on an implementation of the R programming language. The loop-free way of programming with large vectors and (sometimes multi-dimensional) matrices was another eye opener. Also, the quirky syntax and terseness made APL appealing to this programming languages nerd.

The list features six more. I’ve heard / read about them all for sure. If I had to pick one to look into next, it would be COBOL, simply because it’s still around and running a lot of production systems around the world.

Tags: the-nerdy-bit, hacking

Squeaking Cellular Automata

2024-03-24 — Michael Haupt

My favourite programming language is Smalltalk, and I used to do a lot of work in the implementation of the language named Squeak, back in my post-doc days. Over the years, I’ve gone back to Squeak on and off, to do some little fun projects. Some time ago, I dabbled a bit with its low-level graphic operations to implement some machinery for playing with cellular automata (more precisely, elementary cellular automata).

Building this was a nice and refreshing experience applying TDD, die-hard object-orientation, some extension of the standard library (heck yeah!), and live debugging. Especially the latter is not easily possible in languages other than Smalltalk, where the IDE and runtime environment are essentially the same.

Eventually, I was able to generate some images for the rule 30 cellular automaton, which exhibits a nice dichotomy of order and chaos. Here are two examples, one for the standard initial generation with just one pixel set, and one for a random initialisation. It’s interesting to see how order seems to prevail on the left-hand side, while the right-hand side looks more chaotic (there are patterns there though, if you look closely).

The source code is here, in case you’re interested.

Tags: hacking, the-nerdy-bit

Pinocchio for Adults

2024-03-10 — Michael Haupt

Guillermo del Toro, creator of such amazing masterworks as The Shape of Water, has made an adaption of the Pinocchio story. I came across this by chance, and was immediately captivated.

I have a soft spot for stop-motion animation, and enjoy it when the technique is applied to stories that aren’t meant for young children. Shaun the Sheep is awesome (as is anything coming from Aardman), but look at The Nightmare before Christmas, Corpse Bride, and Coraline.

And now, Pinocchio. The Disney adaption was, of course, family entertainment, with lots of singing and talking animals. Del Toro’s version has both of these, too: after all, a certain cricket plays a central role in the story. However, this new Pinocchio movie deliberately focuses on the darker sides and themes of the story. Geppetto’s loss of his son Carlo, his desire to carve a child out of the pine tree growing on Carlo’s grave, Pinocchio’s inability to die and subsequent encounters with Death … an amazing perspective on the story. Not for young children.

The music is, thankfully, of generally high quality. It serves the overall dark atmosphere whilst putting an accent of brightness here and there (Pinocchio is a joyful character after all). The cast of voice actors is well chosen. This film is a pleasure to watch.

Tags: the-nerdy-bit

Time Complexity

2024-03-03 — Michael Haupt

Time is a really complex topic. More complex than you think. No, really: even if you’ve been looking into time zones and calendar management, there’s probably a subtlety or two you haven’t come across yet. I found this piece a fascinating (and, at times, chilling) treasure trove.

Tags: hacking, the-nerdy-bit

"AI" to Replace Programming

2024-03-02 — Michael Haupt

On Twitter, Grady Booch commented on a tweet mentioning that the Nvidia CEO had said that programming languages could now be replaced “with human language prompts thus enabling everyone to be a programmer” like so:

AI will kill coding in the same way that compilers killed coding. What kind of human language prompts would have sufficient detail, clarity, and precision to permit the creation of useful, evolvable, and maintainable executable assets? We call those "programming languages".

This resonated with me because I had been thinking about these very questions for a while. I commented on Grady’s remark with three short tweets myself, that I’d like to expand on a bit here (oh, character limits …).

The history of programming is one of adding layers upon layers of abstraction. Things started with punching cards and plugging cables, and then there was binary machine language and assembler. That was complicated and tedious, so higher programming languages and compilers entered the game.

These higher programming languages provided an abstraction from the machine level, making it easier for humans to express their intent for what the machine was meant to do in a more human readable and writable way. All the way from low-level languages like C to abstraction behemoths like SQL, the ability of these languages to express human intent whilst being easily processible by machines increased. SQL, in particular, reads a lot like English, if a highly stylised variant thereof. (Maybe even more so does COBOL.)

(Abstractions were added in other places, too, but things like operating systems and graphical user interfaces are not on topic here - this is about programming. Also don’t get me started on “low code” or “no code” so-called “programming” environments right now - maybe another day.)

The thing to keep in mind is that any abstraction inevitably hides away details of the lower level it abstracts over from the higher level it provides an interface to. Any abstraction thus inevitably introduces a gap between the intent humans express with its help, and the lower, more detailed, level. In a nutshell, that’s why we have bugs, and debugging: the “do what I mean” statement does not exist.

Now, AI. With SQL and COBOL, there are two programming languages that are somewhat close to human languages, but AI … you just ask it nicely what to do in plain ol' English, and there you are.

Right?

No: wrong. Wronger than you think.

It’s another layer of abstraction altogether, one that feigns human ability to understand intent by looking human. When instructing these AIs, it’s just like talking to another human. Only it isn’t: the AI does not understand, it does not get what the “programmer” means. It merely infers, using statistics (lots of it) an approximation of what a likely intent could be, and then statistically approximates a response.

What’s the last piece of bug-free software you used? Written with a “normal” programming language? Oh, sure, most of the time it works, until it doesn’t.

Programming is tricky already, and it’ll be more tricky with these AIs. Because it looks like plain ol' English, everyone and then some will believe they can just “prompt” the AI to “do what I mean” for them. However, the AI will miss human intent by more than the usual debuggable bit; the gap will be bigger. Since very few if any understand how those huge statistical networks we call AIs really work, debugging will be much, much harder.

Oh sure, most of the time it’ll work, until it won’t - and since the group of people “writing” this software will be orders of magnitude larger, and the group's expertise level orders of magnitude lower, the consequences will be amplified and more wide-spread.

Call me a pessimist, but I believe when this is the new programming model, the “do what I mean” statement will be farther away, not closer.

Tags: the-nerdy-bit

A Radio Show on the History of Programming Languages

2024-02-04 — Michael Haupt

(Warning: the links in this post all go to German content, and I don't know if all of them work for readers outside Germany.)

My favourite radio station, Deutschlandfunk, has a thing they call “long night” ("lange Nacht") where they devote almost 3 hours to one topic. These shows air on weekends, and obviously so late that it’s neither easy to note them happening, nor to listen through without falling asleep. Thankfully, DLF has an audio archive where most content is kept available for some months after broadcasting. Note that this is all free content if you live in Germany (because you’ve already paid).

Here’s one on the history of programming languages. It appears this is a re-cast (maybe modified?) of content from 2019 the complete script for which you can read here.

Tags: hacking, the-nerdy-bit

Spaceship!

2024-01-28 — Michael Haupt

Have you watched The Lego Movie, and do you recall the character Benny, the 1980s spaceman, whose signature quote is “SPACESHIIIP!”? Well, I felt a lot like Benny at a point ...

Guess what and go figure, Lego turned 90 years old last year. Of course, they celebrated the occasion by releasing some excessively wonderful sets. Among those, there was a renewed version of the 1979 Galaxy Explorer. The 2022 revision of the Galaxy Explorer is a bit more … exuberant. At just over 50 cm length, it’s about twice the size of the 1979 model, and has some more bells and whistles.

Since I never owned the original Galaxy Explorer, needless to say, I needed to lay my hands on the new edition. I enjoyed every single minute of the 4-hour building experience. There were lots of flashbacks to the 80s. The astronaut minifigs look just like the ones from back then, with one crucial difference: the chin part of the helmets, which was notorious for breaking (Benny’s, in the movie, is broken), is more stable now.

Here are some impressions.

I really love how the non-rectangular bits are attached to the chassis. That’s some nifty Lego engineering right there.

One new addition is the sliding airlock door between crew compartment and hangar. Awesome construction.

Behold the crew (including a coffee serving robot, thank you) and finished SPACESHIP! - and note how it’s standing slightly elevated above the ground, thanks to newly added landing pads. These are retractable.

The back door opens as back in the 80s, and a small car can slide right out. The boosters can be removed and used as one-person speeders.

Lego really can still do it.

Tags: the-nerdy-bit

Some BASICODE Background

2023-12-23 — Michael Haupt

There is a background story to my previous post on BASICODE that should not be left unshared. It's about the time and place I was introduced to BASICODE, and about the people who gave me that introduction.

Back in September, I took a train trip to the valiant city of Wolfhagen in Northern Hesse. The purpose was for me to attend the annual gathering of a union of people named "Joyce-User-AG" who use a certain kind of 8-bit hardware from the Seventies and Eighties of the past century. Read: nerd meeting.

And that’s what it was. Lots of like-minded people with interesting ideas and approaches to technology. The whole thing was an experience in sustainability and ingenuity: 40-year-old hardware that still works, and instead of relying on floppy disks now boots from USB sticks and other hardware because, you know, tinkering. One even had a WiFi card.

I didn’t bring any of my ancient hardware because I came by train. Those machines are heavy and bulky. I brought my laptop, and learned a lot about emulators that exist for this kind of hardware. I built several of them from the source, and made another run thanks to installing Wine.

Here’s some imag’ry. First, a contraption including a Z80 CPU and an FPGA, as well as a row of memory circuits … this is an ongoing project by one of the gathering participants, and will one day be a usable Z80 based computer.

Next, here’s a certain text processor named LocoScript (the first one I ever used) running on my MacBook Pro in a simulated Windows running the CP/M Box emulator acting as an Amstrad PCW 8512.

Finally, on the right-hand side of the image, an actual Amstrad PCW. This is the kind of machine I learned programming on. The machine to the left is a Russian Z80 clone based computer.

The gathering also involved talks and presentations. One of the Joyce-User-AG members gave a deep introduction to, you guessed it, BASICODE. The details about how that fascinated me are in my previous post. One detail I hadn't given was that he maintains a (mostly German) BASICODE web page at basicode.de, which I highly recommend as a starting point for taking a deep dive.

I’ve been a member in Joyce-User-AG for some ten years now, and had never before made it to the annual gathering. So this was a first, and it was great. I’ll definitely see about being back.

Tags: the-nerdy-bit

BASICODE

2023-12-20 — Michael Haupt

You’ve probably never heard of BASICODE, even if you know one or two programming languages, and even if you know the BASIC programming language. I recently heard about it for the first time, and was surprised and pleased to hear that this existed.

BASICODE started when several nerds in the Netherlands wanted to exchange computer programs written in the BASIC programming language among themselves. Initially, it was a way to encode computer programs as sound, to store them on cassette tape. (This was very common before floppy disks, then CD-ROMs, then USB sticks became popular. If you know more than one of these, thank you.)

So far, so good, however these folks soon found out that being able to transfer code between machines wasn’t everything there was to it. The BASIC dialects on the different machines had different ideas of how to do graphics, sound, I/O, and so forth.

They decided to overcome this by defining a set of subroutines (callable with the common GOSUB statement) for these kinds of things, as well as a set of conventions for how code should be organised to be able to work with these subroutines. The routines would be implemented in the respective machines' native BASIC. These machine-specific implementations of the common standard were called BASCODER. Since BASIC used line numbers back then, one of the conventions said that the BASCODERs would reside in lines below 1000, and applications could start at that line only.

In other words, the BASICODE inventors defined an ABI of sorts, and built a set of virtual machines to support a platform-independent BASIC dialect. The interface included graphics, sound, and I/O. Sound familiar? I find it fascinating that this originated in the 8-bit home computing world, independently of contemporary developments like P-Code and Smalltalk.

Since I have a certain love for 8-bit computing (having learned programming on a Schneider PCW), I was of course interested in exploring BASICODE and the applications that people have built with it. For that, I needed to use the original hardware, install some kind of emulator, or run it in a browser. Neither of those options was particularly satisfying. Being a programming languages nerd, what could have been more likely than me setting out to build a BASICODE myself? So I did.

It's here, built in Java, and it's under the MIT licence.

The BASIC programming language interpreter is built using a grammar written in JavaCC. The interpreter is an AST interpreter. These are very easy to implement and understand, and don’t take much time to build. My objective with the whole thing is simplicity, not design perfection. (How about a sorry excuse for ugliness?)

The GUI is built using the basic Java features, AWT and Swing. I didn't want to include too many dependencies, to be honest. The parser generator aside.

The screen shot below is produced by an actual BASIC program running in the interpreter, producing output on the console. So cool.

Tags: the-nerdy-bit, hacking

Meta Minecraft

2023-12-18 — Michael Haupt

It has long been known that Minecraft, thanks to redstone, is Turing complete. That is, it is possible to run any computation in the game by building the logic with redstone components. People have built CPUs and entire computers in Minecraft.

Consequently, it just had to eventually happen that someone builds a redstone computer that is capable of running Minecraft. It happened. It’s monochrome and slow and somewhat limited, but there it is. I’m baffled by the sheer complexity and achievement.

Tags: the-nerdy-bit

Sandman

2023-11-18 — Michael Haupt

When it first came out, I found myself being drawn into watching Netflix' adaptation of The Sandman, storyline by the great Neil Gaiman. I hadn’t previously read the comic books, so I could judge only from my watching experience.

The series is amazing. It succeeds at creating a mood that’s constantly ever so slightly eerie (with some really gross parts that are however never exaggerated). The mood is sustained by perfectly fitting music, and some really good acting. Visually, it’s stunning, and the stories are surprisingly deep. This is a masterpiece.

I then also checked out the comic books, and that made me appreciate the series even more: it's congenial. This is all fantastic.

Tags: the-nerdy-bit, books

The Secret Life of a Mathematica Expression

2023-11-18 — Michael Haupt

The Mathematica software has been around for quite a while now. It pioneered notebooks (eat that, Jupyter) and was already pretty advanced when it first came out.

Most of the time, Mathematica is seen as that super powerful and rich environment for doing all things math. Which it is. What’s less appreciated is that it comes with a complete programming language that enables all these things. The language is based on just one fundamental principle, pattern matching. It may be a little awkward to appreciate that 3+4 isn’t just simply an addition, but involves some pattern matching before doing the computation.

A former colleague at Oracle Labs, David Leibs, has put together a nice (and increasingly nerdy) presentation on The Secret Life of a Mathematica Expression that I highly recommend. Be warned, it goes pretty deep on the semantics and how they can be used to build that big math brain extension called Mathematica. But it’s also highly instructive as a deep look into how a different and definitely not mainstream programming paradigm works, and how powerful it is.

Tags: the-nerdy-bit, hacking

Google Meet Hardware Support

2023-10-22 — Michael Haupt

You know the feeling: you’re in a Google Meet call, have some relevant things open in several browser tabs on the other monitor, you want to push some button in the Google Meet window (or leave it), but you first have to find that mouse pointer, move it over to the right window, navigate it to the right button, and finally, with an exasperated sigh, click it. Maybe there are keyboard shortcuts, but for those to work, you still have to bring the focus to the meeting window first. If only there was a thingamajig that could do the trick.

Turns out there is. Enter Stream Deck. (Unpaid ad.) Add to that a dedicated Chrome plugin for Google Meet, et voilà:

So this thing, which connects via USB, has 15 buttons with little LC displays in them that can be programmed to trigger just about any activity by using its standard app. It’s apparently popular amongst streamers, but why should they have all the fun?

The aforementioned Meet plugin is a dedicated thing that directly talks to Chrome’s implementation of WebHID. That’s beautiful because no device driver is needed. The plugin is very well done: it reconfigures the buttons depending on the context Google Meet is in. On the Meet home page, it will show buttons to enter the next scheduled meeting, and to start a new unscheduled one. In the meeting, it shows the buttons you can see in the photo above. They also change when pushed: for example, the image for the mute button (bottom left) will turn red and show a strike-through microphone image while muted; and the button for raising your hand will get a blue background while the hand is up.

Since I took the picture, the features have changed: the Stream Deck now displays more buttons for interacting with the meetings, e.g., switching on/off the emoji reaction bar, and so forth.

Occasionally, Google decides on a whim to change the DOM ID of some of the buttons on the Meet page. That means the respective buttons on the Stream Deck stop working. It's an easy fix, though: simply inspect the page elements with the Chrome built-in tooling, change the plugin JavaScript source in the right place, and reload the plugin.

All in all, this is a productivity booster.

Tags: work, hacking, the-nerdy-bit

C64 Demos

2023-09-20 — Michael Haupt

The C64 is a legendary machine. It contains some ingenious pieces of chip design, such as the graphics and sound chips, which were highly innovative at the time they came out. This was in 1982. That’s 40 years ago - half a human lifetime.

I have a lot of admiration for the C64 demo scene, wherein people write programs that run audiovisual presentations in real time. Take this in: these aren’t animated movies that are computed frame by frame, this is software running and producing imagery and sound as it is running. There’s also a kind of competition to make these programs really small, and it’s frankly amazing what output a small amount of code can produce.

Just browse this page to watch some of the demos. Yes, you can watch these play in real time in a C64 emulator running in the web page. That’s what today’s technology has to offer, and you may yawn at the lo-fi audio and lo-res video. But never forget I could pull one of those old C64s out of my closet (five of them are in there, just to make sure) and run the demo on that very, 40-years-old hardware.

Tags: the-nerdy-bit

Unexpected Reading

2023-09-07 — Michael Haupt

Some months ago we got a new car. It’s great, I really like it, but I found myself cautiously reading its actual user manual with a certain degree of anxiety. This is the first car we’ve owned that has a lot of technical gimmicks, and I’m simply not used to this amount of fiddling even being possible.

Setting the car up like I like it used to be straightforward: adjust seat, mirrors, and wheel; tune the heating or A/C and radio; turn the key; done - go. No more. This car is a fierce computer that has all kinds of bells and whistles built right in, and these want to be configured to work in the right way.

OK. So reading the manual was what I needed to do. For a car. As if it was the first time I’d been using one. It certainly felt like that.

I’m getting old.

Tags: the-nerdy-bit

Sharing Pages in Logseq

2023-09-04 — Michael Haupt

Logseq is a real power tool for note taking and knowledge management. I had mentioned I’m using it a while ago already.

I keep my personal logs strictly separate from work related logs, for obvious reasons. However, there is one important part of the knowledge graph that is good to have both in the work and personal hemispheres: my collection of notes about articles and books I read. I’m going to describe now how I’m ensuring I keep this particular info synchronised across the work and personal knowledge graphs.

Thankfully, Logseq has a very simple storage model: Markdown files in directories. That makes it easy to use an independent synchronisation tool like git to synchronise and share parts of the storage. Logseq stores all individual Markdown files in the pages directory. It also has a notion of “name spaces”, where pages can be grouped by prefixes separated by the / character. For example, an article I file under Articles/Redis Explained will have the file name Articles%2FRedis Explained.md - it really is as simple as that.

I’ve made the root directory of my Logseq storage a git repository. I have a .gitignore file that looks like this:

.logseq
.gitignore.swp
.DS_Store

journals/**
assets/**
logseq/**
pages/**

!.gitignore
!pages/Articles*
!pages/Books*

As you can see, it excludes pretty much everything but then explicitly includes the things I want to share across machines: the .gitignore file itself, and any page that has an Articles or Books prefix. Occasionally, I will have to force-add a file in the assets directory, which is where images are stored. That’s manageable. The rest is git add, git commit, git push, and git pull, as usual.

With this setup, I can freely share notes about articles and books across my two Logseq graphs, and reference the articles and books from my personal and work notes easily.

Tags: the-nerdy-bit, hacking, work

THAT

2023-09-03 — Michael Haupt

This is THAT.

THAT (The Analog Thing) is an analogue computer. Other than digital computers, analogue computers do not quantify everything into discrete 0 and 1 values, but use continuous value ranges expressed in voltages. They don’t compute algorithms, but simulate models expressed in differential equations. That means math, a lot of it.

Analogue computers have been around for a long time. While Leibniz was first to propose the binary system in the 17th century, the oldest analogue computer known today is the Antikythera mechanism. This was built more than 2000 years ago for astronomical predictions. The thing with analogue computers is, they don’t need electricity. Cogs and wheels will do, as in the Antikythera mechanism. Or water. (If you have a mechanical wristwatch or classic “grandfather’s clock”, voilà, you have yourself a specialised analogue computer.)

Electronic analogue computers like THAT are meant to be a versatile tool for, as mentioned, modelling and simulating systems expressed as differential equations. They consist of surprisingly simple circuits that sum, multiply, invert, and integrate voltages over time. Programming is done by plugging wires into sockets. Outputs are typically visualised using an oscilloscope.

Here’s a photo of the basic setup - no “code” has been entered. The second photo shows the, well, syntactic elements of the programming language, so to speak.

Let’s look at an example: radioactive decay. (It’s explained on p. 10 in the THAT intro manual.) This is a simple differential equation with two coefficients: initial amount, and decay rate. Here’s the configured THAT. If you look close, you can see that it indeed uses two coefficients (top left), one integrator (top, a bit to the right), and one inverter (right).

And guess what - it works! Some fiddling with the oscilloscope settings later, I was able to see my first analogue computer program run. Messing around with the coefficients a bit, I could also change the result in real time.

Something was odd about the signal though. Taking a close look at the photo below, you’ll notice that the main yellow line is surrounded by a fuzzy yellow shadow.

OK - this is where things get really interesting. Remember we’re in the realm of voltages measured continuously over time, not in the neatly 0-1-compartmentalised world of digital computing. A brief exchange with a friend who’s more of an electrical engineer than I am taught me that signal quality matters, and so does power supply quality.

In my first experiment, I was powering THAT using a standard garden variety USB charger, and apparently it’s not well grounded, leading to a distorted and somewhat modulated voltage. That has an impact on the output signal.

My friend suggested to use a power bank (no AC involved), but I didn’t have a charged one. The highest quality AC/DC power supply I had available was an Apple MacBook one, so I used that. Behold. Now that’s what I call a clean signal.

My next venture took me to the Euler Spiral, which is supposedly a beautiful 2D curve, and even a lot of fiddling didn’t get me anywhere closer to the expected result than this ...

... which is a bit disappointing. It looks like the signal is cut off somehow. I chatted some more with my friend, and delved into the documentation a bit, and observed that THAT is constantly in overload mode while running this simulation. We found the RCA ports on THAT cap voltages for consumption by audio devices as one possible segue to USB oscilloscopes. I will next try to connect the outputs directly to the oscilloscope. Stay tuned.

Tags: the-nerdy-bit

DevTerm

2023-09-02 — Michael Haupt

DevTerm is a small portable Linux device, which alone makes it interesting. What makes it more interesting is that one of the processor units it can come with is a RISC-V one. I’ve long found this open-source processor spec highly fascinating, and have been waiting to be able to lay my hands on a machine running on it. Also, DevTerm can be obtained as a kit, and because I love assembling computer stuff, that was decided right there.

Here’s the box with my trusty iFixIt kit, and the box contents. It’s all very neatly packaged, and the assembly manual is awesome. It has way more level of detail than I had needed, but that means someone with less experience would be capable of assembling the DevTerm with ease.

Here are some close-ups of the box contents. The first image has the more technical parts; from left to right and top to bottom: battery case, display, extension board, SD card (hard disk) and display cable, main board, RISC-V compute module, loudspeakers, thermal printer (oh yes), and keyboard. In the second image, you can see the case parts. Note the orange things at the bottom left? These are used to hold the components in place, no screws involved. That makes for easy maintenance.

Assembly begins with mounting the display to the frame, then the main board, and by then connecting the display using the flat cable. These things are finicky. It took two or three attempts to properly place both ends right.

Next, the compute module is placed in the main board slot. Note that this is the only time during the entire assembly process where I had to use a screwdriver to fix the module in place. You’ll notice the four orange plastic pegs in the corners of the main board: this is how most of the components are held in place.

The WiFi antenna, loudspeakers, and extension board are next. The antenna was, once more, rather finicky to place - it’s essentially a sticky note with some metal and a very sturdy wire soldered to it that connects to the antenna port on the main board. The glue is extremely sticky. The antenna doesn’t sit on the panel in a very neatly aligned fashion, but I was worried to break it by taking it off and placing it right. I’m also not sure whether I placed it on the right side of the panel (this is the one point where the manual wasn’t clear). The loudspeakers are tiny, but there are two of them, which means stereo. I doubt the stereo effects will be noticeable given how close the two are to one another. The extension board fits neatly next to the main board, and has connectors for the loudspeakers on its back side: no cables! (I really like that about the DevTerm: many things connect without cables.)

The two final components are the thermal printer and battery case. I find it funny that the DevTerm comes with a builtin printer - but it definitely gives it a distinct impression of autonomy. With these two components installed, we’re almost done. Turning the whole thing around, the connectors for the keyboard are visible right below the display (those four dots). The keyboard is another one of the components that connect without a cable.

And here it is: the keyboard just sits on top of the case frame. The remaining assembly is to mount the frame with all the components in the case and secure that with the two knobs on the left and right. I need to repeat it: the entire thing can be opened and closed, and assembled and disassembled, without using any tool - with the sole exception of the compute module.

Of course, this isn’t where the excitement ends. Does it work? I had to insert the batteries (standard 18650 lithium batteries) and SD card, and then hold the power button for two seconds.

It’s always very satisfying to see a computer boot that I’ve just assembled. It worked flawlessly: the DevTerm booted a Ubuntu Linux variant, and started up an X11 environment right away, displaying an intro document. The first thing I tried was to set up the WiFi connection, which also worked perfectly fine, and to start a browser (elinks, in this case) to display a certain web page.

It’s time for some critical acclaim.

The RISC-V chip is an early one. Manufacturers are only beginning to implement these, and performance isn’t stellar. Also, not all Linux libraries are available yet for the RISC-V architecture, and some have bugs. This makes the overall experience of using Linux on this DevTerm a bit less pleasant than one might expect - but then it needs to be clear: this is mostly an experimental system. If you want better performance and support, use the 64-bit ARM compute module.

DevTerm’s keyboard has some Sinclair ZX Spectrum vibes. The keys aren’t all 100 % reliable (fun when entering passwords) and have that odd rubber feeling to them. For a keyboard of that size, it’s fine, but if DevTerm is meant to be used more widely, the keyboard needs an overhaul. It does get extra points for the trackball thingy (the white knob at the top) and the gaming console controls.

Oh, you may wonder: does the printer work? Why, yes - mostly by echoing text and commands to a file in /tmp, but as mentioned, it’s an experimental system.

Tags: the-nerdy-bit

Mobile IDE

2023-07-21 — Michael Haupt

iPads are nice, and the iPad Pro is a rather powerful laptop substitute - almost. While it’s really well possible to do office style work on an iPad, anything software engineering becomes hard, because IDEs involving compiling and running code on the device, as well as convenient things command line interfaces, aren’t supported on the platform. The manufacturer wants it so.

There are web IDEs. Unfortunately, they’re a bit frustrating to use when travelling (e.g., on a train in Germany, or on an airplane).

Raspberry Pi to the rescue. Of course. These machines are small, lightweight, don’t consume too much power, and are yet fairly capable as Linux computers. Real IDEs run on them. Compiling and running code on them isn’t a problem either.

The Tech Craft channel on YouTube has this neat overview of a mobile setup that combines the best of both worlds, using the Linux goodness of a Pi and the user interface of an iPad. It’s tempting.

Tags: work, the-nerdy-bit, hacking

Logseq

2023-02-19 — Michael Haupt

In May last year, I’ve started using Logseq for my note taking - both personal stuff and at work. I got interested because some people whose judgment in such matters I trust were quite enthusiastic about Logseq. Giving it a look couldn’t hurt, I thought.

Today, I’m still using it, and have already transferred some of my larger personal note collections to it. I keep discovering new features and possibilities, and let’s just say I’m hooked.

What do I like about it? A random collection:

  • At a high level, Logseq is a lightweight note taking and organisation tool with lots of pragmatic and sensible features.

  • Logseq keeps all the data on the local drive, in Markdown format, unencrypted, accessible.

  • The editor has built-in features for very swift linking from text in a page to external resources, other pages, sections in pages, and even down to single paragraphs (“bullets”).

  • Recurring structures can be easily reproduced using templates.

  • Pages can have alias names, making for nicer linking.

  • Logseq adds, atop the plain Markdown files, an index that allows for extremely swift searching. There’s a powerful advanced query and filtering capability, too.

  • It’s available on desktop, iOS, and Android.

  • There are numerous ways of synchronising across devices, including iCloud and git.

  • The tool is open source, and the monetisation model (yes, it has one, to sustain services and community) is extremely forthcoming: you pay as much as you want in a mode of your choice if you think it’s deserved. (It is.)

Logseq also has a graph visualisation of the page structure - I have yet to discover its true worth but it sure looks nice. A cross-device sync feature has been added and is available in beta mode for paying customers - I'm one of them, and it's pretty usable and stable already.

I have barely scratched the surface. There’s a plugin API allowing for all kinds of power-ups, automation is possible to a considerable extent, and so on, and so on. I believe Logseq is a true power tool.

Tags: the-nerdy-bit, hacking

Badgers

2023-01-22 — Michael Haupt

Gadgets are fun, and even more so when they can make someone’s day.

Back at my previous job, one of my teams (named R2D2) had been working on a long and hairy project. Essentially, it was a complete rewrite of the core piece of Babbel’s language learning experience, the so-called “lesson player”. The project had started well before I joined (that was in August 2020), and was technologically involved. It took the team quite some time to deliver, and the "Universal Lesson Player" has gone live across web, iOS, and Android.

Before leaving, I really wanted to celebrate and acknowledge the success so far by giving a little token of appreciation to everyone who had contributed. It being me, that needed to be appropriately nerdy. I came across a device named Badger 2040: a Raspberry Pi Pico powered little thing with an e-ink display that’s programmed in MicroPython and can be configured as a name tag. Of course this was the right thing.

So I got some 35 of those, and went on a fun ride to prepare all of them until they looked like this (for the technically interested, there’s also a photo of the back):

It’s e-ink, so the display just stays like that. But if a user so desires, they can connect a battery pack and augment the code on the device to, for instance, react to pushing one of the buttons by displaying a QR code with contact information instead of an image. After all, it’s a programmable computer right there, and it even has a variant of the Raspberry Pi’s infamous GPIO capabilities. The possibilities are “endless” once one knows a little Python.

I was able to hand over most of the Badgers at a little release party, and needless to say, people loved it.

Tags: work, the-nerdy-bit

Musical Languages

2023-01-03 — Michael Haupt

I like languages - human and programming languages alike. And I have a sweet spot for “constructed” human languages, such as Esperanto. (I don’t speak any Klingon or Quenya though.)

One interesting niche in the constructed languages corner is the one where the languages are musical.

Olivier Messiaen (one of my favourite composers) used a “communicable language” wherein he mapped letters of the alphabet to note pitches and values. He later added patterns for grammatical aspects and certain frequently used words. The principle of mapping letters to tones, however, only goes so far: essentially, the language heard when playing the notes is still the language in which the original text was written - the musical notation is “just” a different writing system. A sophisticated one, granted, but a writing system.

François Sudre did a more consequential design when he came up with Solresol. Here, patterns of notes represent linguistic concepts. The first note of a pattern denotes one of seven categories; repetition adds topicality; and so forth. There are also rules for grammar. Now there’s a language.

Texts in Solresol don’t sound particularly melodic, but mostly harmless because they only use the seven tones of the scale that are on “white” keys. If I was to give a critique, I’d raise the concern that Solresol doesn’t make use of all twelve tones, making it lack in expressiveness somewhat.

My old colleagues at Babbel have a nice article on Solresol.

Tags: music, the-nerdy-bit

Z80 Memories

2022-12-15 — Michael Haupt

Chris Fenton has built a machine. It’s a multi-core Z80 monster in a beautiful laser-cut wooden case. I have nothing but deep admiration for this kind of project and the drive that lets people drive and complete it. It also brings back a lot of memories.

The Z80 was the first CPU I learned how to program assembly for, back in the Nineties, on an Amstrad PCW. The operating system on that one was CP/M Plus, but you could also boot (boot!) a text processor named LocoScript. The programming language of choice ended up being Turbo Pascal 3.0.

What bothered me was that I couldn’t let stuff run “in parallel”, so I hacked my way into something resembling that. Pretty much all low-level functions would make calls to the operating system entry point, at memory address 0005. (The assembly instruction for that was CD 05 00. Yes, I still remember that.) So I inserted a jump table at that address that would call all the Pascal procedures I wanted to run in parallel before proceeding with the low-level operating system call.

I quickly figured out (the hard way) that those Pascal procedures better contain no calls to low-level operating system routines, because ... infinite loop. Oopsie.

Tags: the-nerdy-bit, hacking

Caffeine Informer

2022-12-03 — Michael Haupt

So I’m a bit (a bit?) of a coffee nerd, to the degree that I do my own roasting. Obviously, the Caffeine Informer struck a chord. This web page provides all kinds of information around my favourite drug.

One thing I learned is that I should drink no more than 2 cups of Starbucks Grande Caffe Americano to avoid suffering from caffeine overload. That’s OK, I don’t like Starbucks coffee that much anyway.

My maximum safe daily caffeine intake is somewhere north of 500 mg. Now that’s interesting, but where can I get those? The page thankfully has overview tables for both food and drink. For instance, one Kit Kat bar contains 6 mg of caffeine (who’d have thought?), and Fritz Kola (somewhat popular in Berlin) has more than twice the amount of caffeine than classic Coke.

While all of that is fun to play with, the page also has some very thorough information on caffeine effects, benefits, and risks.

Tags: the-nerdy-bit

Keyboard

2022-11-16 — Michael Haupt

After having assembled my Reform laptop, I had found its keyboard to be pretty amazing despite its unusual layout. Its space key is separated, and the two alt keys are tucked in between the two halves. On the one hand, this has the effect of allowing the keyboard to be built with only two different key sizes. On the other, it requires a bit of adjustment when typing. The quality of the keys though makes it a pleasant experience, and some high-speed typing is definitely possible. I like the keyboard very much.

Thankfully, MNT Research have released the keyboard as a standalone component with USB-C connectivity. The keyboard has an anodised aluminium case. That means it's comparably heavy given its size, which is good, because it rests well on surfaces. It comes in different colours (mine is yellowish).

Of course, the keyboard is entirely maintainable using a screwdriver and programming skills. The former comes in handy to move the little tilting bar between the four different positions on the sides of the case, which allows for different typing angles. The latter is good for changing the keyboard firmware, which is, of course again, open source. Like the Reform laptop, the keyboard sports the "circle key" (top right) and accompanying OLED display to go to the firmware menu and, e.g., control the brightness of the backlights.

I really like the product portfolio these folks are building. It's open hardware that sets standards.

Tags: the-nerdy-bit

Tripods

2022-11-07 — Michael Haupt

Back in the 80s, we didn't have video streaming services, so TV series binge watching was not so much of a thing, but TV series we had. There's one I was particularly fond of, to the degree that I arranged my calendar around the time each new episode would air on Tuesday, Wednesday, or Thursday afternoons (my memory is a bit blurry here).

It's a BBC production based on a sci-fi trilogy (a prequel fourth book was added later) by John Christopher, called The Tripods.

The slightly eerie mix of a humanity thrown back to mediaeval lifestyle and high-tech alien invaders controlling them from their large walking machines totally fascinated me. Never mind the utterly slow pace of the TV series. Never mind the obviously bad make-up and costumes (BBC is a bit notorious for that). Never mind the strange-looking compositing of tripods into the scenery (those were really early CGI days). It was cool, and the story of some kids making their way from England to the Alps and beyond on a quest to free humankind from oppression was just captivating.

Sadly, the third season, supposed to bring the final book in the trilogy to the TV screens, was never produced. Sometimes the BBC makes stupid decisions.

Thanks to DVDs, I could recently binge-watch the entire series with my son. And he loved it. If a 21st century kid can appreciate a TV series that was produced roughly 40 years ago, that's quality.

Tags: the-nerdy-bit

Mini Lambda

2022-11-04 — Michael Haupt

Justine Tunney has built a plain lambda calculus interpreter that compiles down to just 383 (as of this writing) bytes of binary (on x86_64). That's Turing completeness in just under 400 bytes of machine code, and by default "instant awesome". The documentation is extensive, contains lots of examples, and such gems as a compiler from a symbolic representation of lambda calculus to the interpreter's binary input format using sed. If you have any interest in minimal abstraction, do yourself a favour and check this out please.

Tags: hacking, the-nerdy-bit

Anki

2022-07-27 — Michael Haupt

At the beginning of this year, I took a two-week intensive course to learn some basic Chinese. The intense vocabulary and letter memorisation that came with this refreshed my interest in flash cards. Preferably in an electronic form that synchronises across devices.

Thankfully, there's Anki. Note that this is an unpaid and unsolicited ad. I'm just very excited about this.

Anki runs in the browser, on desktop, and mobile. It synchronises flash card decks across all of these seamlessly. It has a price tag on mobile, but it's worth it.

What makes Anki really strong is that the design of flash cards is up to the user. There are HTML and CSS templates. It also automatically generates multiple cards from any entered content; that is, if you have a note describing a front and back side of a card, it'll generate two cards so that you can exercise the memorisation both ways. Of course, the note formats are also editable.

In my case, with Chinese, my notes have three aspects: the German word, the Pinyin transcription of the Chinese word, and the Chinese letter. I've built three card templates - each of the three aspects can be the front side so that I can memorise everything in every way possible. When I add a new piece of vocabulary, three cards will be generated, and next time I go through the deck, I'll be given those three questions.

The spaced repetition logic in Anki, too, is configurable, of course. The amount of daily new cards is limited to a low number at first, but it can be changed for times of super intense learning (like these) to have a higher limit - and that's even possible to configure per deck.

Anki is a bit idiosyncratic at first, and takes some getting used to, but it's a true power tool. Definitely worth the price. Did I mention it has a plugin interface?

Tags: the-nerdy-bit

Programming and the Fine Arts

2022-07-09 — Michael Haupt

There's a certain kind of "strange" programming language that could be called "poetic". This is because programs written in these languages read like texts from altogether unexpected genres.

Expressed in the Shakespeare programming language, for instance, programs read like dramatic plays by a certain famous English poet. And Rockstar makes programs look and feel a lot like heavy metal ballads.

Of course that's all a bit nuts. What's wrong with that? After all, English author Tom Holt, in his novel Flying Dutch, notes that Wagner's opera Der fliegende Holländer is actually part of an accounting software system. (If I recall correctly.)

Tags: music, books, the-nerdy-bit

Watchy

2022-06-25 — Michael Haupt

As you may know, I love tinkering with electronics, and I like looking into crowdfunding projects that bring new tech on the table.

Some time ago, I assembled a Watchy. This is a wrist-watch with an e-paper display, sporting an Arduino-compatible open-source hardware and software platform. Here goes.

I ordered the Watchy kit, and the aluminium case (I like the metal more than the plastic case). The box with the main kit is neatly arranged and has visual instructions for the plastic case assembly. The ones for the aluminium case were easy enough to find. Since the display is an e-paper one, it came "stuck" in the last state from testing it was in (I like this about e-paper: it consumes energy only when it's updated, and then just stays that way).

The unboxing proceeded. Laying out all the parts in front of me, I got ready for the adventure. The first task was to connect the display to the logic board. The flat cable is a bit tender, so that required attention, but it worked just fine in the end.

Next, the battery had to be connected, and then there was a minute of anxiety waiting for the display to update from 00:00 to 00:01 - and it worked! I also tested the four buttons to see if they worked properly: I entered the system menu, navigated around in it a bit, and left it again. So much for the first-stage integration testing.

The next step was to mount the electronics in the aluminium case. I taped the battery to the bottom, which was really helpful because it would slide out and get in the way of the cable and logic board.

I then discovered that the logic board didn't fit neatly into the case, because there were some edges that protruded from it (remnants of production). I filed those off carefully, and gave the plastic buttons a similar treatment so that all parts had the smooth edges they needed for the case to be closeable.

Closing the case was rather finicky because the buttons kept moving about, but I got it done eventually.

The next discovery was that the four screws must not be tightened too much because otherwise the buttons will get stuck when pushed. That was an unpleasant discovery. I ended up tightening them only ever so lightly beyond the point where I can turn them with a fingertip. The top of the case sits firmly on the bottom, and nothing wobbles, but it's not a very safe feeling either. The parts don't fit too neatly overall. That's fine and tolerable for a crowdfunded hacking project.

Of course, the final step of assembly was to attach the straps, which have a nice mechanism for that.

Done. Next, I might write some software for this thing, and will probably adapt my nerdy Pebble watchface.

Tags: the-nerdy-bit

Reply-All

2022-04-01 — Michael Haupt

(Warning: maybe because it's 1 April, the post below contains a bit of irony. When you find it, feel free to keep it.)

You've seen them - congratulatory e-mails flooding your inbox, even if you're not on the receiving end of the celebration but merely a member of the cheering crowd. Thanks to "reply-all", they happen. I personally don't mind them much, but some people do take mild offence in being faced with the challenge of having to mark swathes of "congrats!" messages as read.

There's something to be said for both sides here. On the one hand, such a broadcast message, e.g., a promotion announcement, can be seen as primarily meant to notify the crowd of the news. Reply with heartfelt congrats, rejoice in the fact, cool, move on. On the other, the broadcast does have a social aspect to it in that it encourages the crowd to cheer, and he cheering gets amplified by itself.

Of course, there's an easy remedy. Instead of putting all recipients on CC, putting them on BCC and keeping just the intended recipient of the congratulations in the "To:" field will reduce the recipients of the "reply-all" flood to just the subject of the celebration and their manager (or whoever sends the message). The parties put on BCC can be mentioned in the message, for transparency.

I sense an actual research question in this: Will CC-reply-all flooding incentivise more people to congratulate the person, or will the ones who want to do this do it anyway? Is there an amplification effect in "reply-all"? If so, what does it amplify more, cheering, or grumbling? Does BCC-messaging have a contrary effect?

Who's in for doing an empirical study?

Tags: work, hacking, the-nerdy-bit

Nanoloop

2022-03-31 — Michael Haupt

The Nanoloop is a truly interesting thing. It's an 8-bit synthesiser-sequencer with an interesting and innovative user interface. Nanoloop started out as a Gameboy cartridge, and has since been released as apps for Android and iOS, and as a piece of hardware called Nanoloop FM. Documentation is scarce, and the whole thing invites to experimentation. Cool.

Tags: the-nerdy-bit, music

Magical Turing

2022-03-25 — Michael Haupt

A while back, I had written about Alan Turing's work, and how Turing completeness is the ultimate level for any programming language or abstraction - enabling any algorithm to be expressed in it. Hold tight.

It turns out that the very popular card game Magic: The Gathering by Richard Garfield is actually, provably Turing complete. There is a scientific paper that proves it.

I've got to take some rest now.

Tags: the-nerdy-bit

Contemporary CPU Architecture

2022-03-25 — Michael Haupt

Building a CPU (or other hardware device) emulator is a fun endeavour - I've built myself half a Z80 emulator in Smalltalk once, test-driven development and all.

However, writing comparatively low-level code in the 21st century is really old-school. You have to use contemporary technology for everything now. That includes building emulators.

Consequently, David Tyler has built an 8080 emulator complete with computer and CP/M operating system to run on the CPU. It being "today", he has of course applied what is en vogue. That means microservices (one for each opcode supported by the CPU, just in case you were wondering), Docker, and the like. It's super hilarious. In fact, it's a more than valid successor to this wonderful enterprise Java implementation of FizzBuzz.

Tags: hacking, the-nerdy-bit

A Makeshift Observatory for a Partial Solar Eclipse

2022-03-15 — Michael Haupt

One of the distinctly more nerdy things I've ever done was to optimise the machinery for observing a partial solar eclipse.

This was back in the Nineties. I was at a weekend workshop with some fellow students of electrical engineering and computer science, where we were preparing to be first-semester student tutors. As heavenly mechanics would have it, a partial eclipse was scheduled for that weekend, and we lacked the necessary equipment to observe it.

Being engineers, we came up with a makeshift solution. The key component was an overhead projector (you know these, don't you) the upper end of which we directed at the sun. With some fiddling, that gave us an image of the sun on the area where the foils are usually placed. We used a sheet of paper as the screen for our observations, and of course the intensity of the sun's image set that on fire instantly. OK, that didn't work.

I suggested to use a cup of plain black tea (no milk, no sugar). It had all the features that we needed: white surface, not easily inflammable, and the liquid had just the right amount of opacity to make the image clearly visible. A cup of tea was quickly obtained from the (somewhat puzzled) kitchen personnel of the place where we were staying (there was a narrow time window, so speed was required).

And it worked! We could see that sun cookie, with a piece bitten out by the passing moon, very clearly.

Sadly, I don't have any photographs of the experiment any more.

Tags: the-nerdy-bit

The Times

2021-12-05 — Michael Haupt

Date and time formats, oh, date and time formats. Having grown up in Germany, I was obviously used to DD.MM.YYYY, and sported the usual snobism when encountering that odd MM/DD/YYYY thing that just gets everything wrong. Yes, it enables fun things like "Pi Day" and "May the Fourth" (imagine me rolling my eyes), but it's too darn disorderly. I mean, doesn't even try to be consistent, going from somewhat specific to specific to unspecific in the date - and don't even get me started on the AM/PM mess.

Eventually, I came across the thing called ISO 8601, and, being the nerd that I am, grokked it instantly. I've been using it ever since, only taking the liberty to drop the first two Y from the YYYY (the century can usually be inferred) in handwritten notes. This beautiful little article uses all the right arguments I've always wanted to make, including endianness, so I'm done here.

Tags: the-nerdy-bit

Building Reform

2021-11-10 — Michael Haupt

It's about time I post some imagery from my Reform laptop building experience. (This happened months ago.) I'll document this mostly by sharing the images in chronological order below, and dropping in an occasional comment.

So it begins ... the Reform box and my beloved Ifixit kit. The second image shows all of the components, each meticulously wrapped in paper.

Here are the components. After the bird's-eye view, there are the trackball, OLED display unit, power supply, acrylic case bottom, the mostly pre-assembled case itself (closed and opened), keyboard and keyboard frame, mainboard, and miscellanea (including such important things as SSD and WiFi card).

It begins. The batteries need to be removed from the case, because they come somewhat pre-powered, and it's not a good idea to work inside the case with the batteries inserted.

Of course, I needed to ground myself prior to dealing with any of the more sensitive components. This was not a mindfulness exercise or something, but involved connecting myself to a power plug. Don't worry. I just connected to the ground pin. All is well.

First, I mounted the mainboard and trackball.

The keyboard came next, and after connecting some wires, it could right away be mounted into the case, followed by the OLED board. The keyboard frame completed the top, and I could return to the innards, to connect the keyboard to the mainboard.

SSD and WiFi card fit neatly into the provided slots. The final touch before mounting the acrylic case bottom was to reinsert the battery cells and connect the power to the mainboard.

A little bit of inspection revealed that I had broken one of the side panels by tightening one screw too much. Not a biggie. A quick check of the batteries showed seven fine cells and one that still needs to be calibrated.

Time to get real: booting up, connecting to the home WiFi, starting Firefox, and loading the Babbel homepage were entirely straightforward. Success!

The assembly was a breeze, mostly because of the perfect instructions. What I find remarkable about this machine is that it's entirely maintainable with just a screwdriver. The acrylic case bottom makes it quite a sight.

One other bit I really like about the machine is the "circle" key (top right of the keyboard), which is a direct gateway to the lowest level of the machinery. Pressing the circle key, followed by 1, turns the machine on, 0 will turn it off. Circle B will show the battery status in the small OLED display right above the keyboard - down to the level of the voltages of the eight individual cells. And so forth.

I've been working my way into the machine, exploring the Sway desktop (quite amazing, honestly), making sure some of the favourite software runs on the machine, et cetera. Stay tuned.

Tags: the-nerdy-bit

Code Pwnership

2021-11-08 — Michael Haupt

code pwnership: being in charge of a code base multiple clients depend on, having exclusive commit and release rights, and totally refusing to fulfil requests or consider pull requests.

Tags: the-nerdy-bit, work, hacking

Christopher Alexander

2021-11-08 — Michael Haupt

Christopher Alexander is an architect some of whose work is widely known in and has had considerable influence on the computer science / programming communities. Why is that?

Alexander coined the notion of design patterns and pattern languages, most prominently collected in his books The Timeless Way of Building and A Pattern Language. The idea of patterns - recurring abstract solutions for specific problems that can be applied to likewise abstracted problems - has percolated to the object-oriented programming research community, and a group of researchers called the "Gang of Four" subsequently published their seminal book titled Design Patterns: Elements of Reusable Object-Oriented Software. This book has spawned a wealth (some would say: plethora) of research in software design, first in object-oriented programming, and then reaching out to other paradigms.

If you've ever come across a Java class named SomethingSomethingFactory, you've seen a piece of the outcome of this.

Anyway, here's a documentary on Alexander and his work and thinking.

Tags: the-nerdy-bit

HOPL IV

2021-09-05 — Michael Haupt

The HOPL (History of Programming Languages) conference is a rare event - in 2021, it's only seeing its fourth instalment. The talks and papers at HOPL are typically larger descriptions of how certain programming languages came to be, or have developed over time. Many of the authors and presenters at HOPL are key players in the field, with long and impactful careers.

HOPL 2021 does not disappoint, and the pre-recorded talks are a treasure trove. There are talks from people who know about Logo, Clojure, JavaScript, MATLAB, C++, VHDL, ... to name just a few. Due to my own past, I'm sort of personally attached to this presentation on Smalltalk by Dan Ingalls. The Smalltalk programming language and its implementation were my main research area for several years, and I used Smalltalk VMs in my academic teaching. Dan Ingalls is one of the creators of Smalltalk who has been working with and on several generations of the language and its implementation since the Seventies.

To see a truly different language for a change, don't miss the presentation on APL.

And finally, there's a talk by James Noble and Robert Biddle. Just this much: these two never disappoint. Give it a try.

Tags: the-nerdy-bit

The Language Lover's Puzzle Book

2021-07-12 — Michael Haupt

A former colleague recommended me this book by Alex Bellos: The Language Lover's Puzzle Book. So far, I've only skimmed it, so I cannot give a fully formed opinion. What I've seen is really good though.

It's indeed a puzzle book. Every chapter begins with a vocabulary quiz. Each of the chapters, in turn, explains some things around broadly language-related matters. For instance, family relationships, ciphers, ancient languages, alphabets, computer languages, and so forth. The fun part is that many of the explanations, again, come in the form of quizzes. That should make reading - or rather, working - through the book really challenging and interesting. Of course, the appendix has all the solutions.

Tags: books, the-nerdy-bit

Turing Machines

2021-07-04 — Michael Haupt

The Turing Machine is a theoretical abstraction for the discussion of computability problems, and one of the absolutely key fundamental ideas in computer science. They were introduced by Alan Turing in a paper titled On Computable Numbers, with an Application to the Entscheidungsproblem, which was published in 1936. Any algorithm that can be represented as a Turing machine can be processed by a computer, and vice versa. Turing machines are the simplest abstraction for computability there is. Notably, there are Turing machines that describe Turing machines, proving they're, well, computable.

Any programming language that is Turing complete can be used to express any possible algorithm. Elegance is not implied, just sheer possibility. Thus, considerable sophistication, such as in languages like Haskell, isn't needed. A simple language like Brainfuck is Turing complete as well. Arguably, the "hello, world" source code in Brainfuck is not readily intelligible, but that's not the point.

++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.

Turing machines are such a fascinating idea that people have even built Lego versions of them.

Anyway. I wanted to point to a really interesting book. Turing's seminal paper, while groundbreaking, is a bit hard to access because of its mathematical style. Charles Petzold has thankfully set out to take the paper and write a book around it that explains everything in great detail for a much broader audience. The Annotated Turing is a really fun read.

Tags: the-nerdy-bit, books

Ostersemmel Time

2021-04-09 — Michael Haupt

Happy Easter!

In my home town, Attendorn, there's a wealth of Easter traditions.

I particularly love the tradition of baking "Ostersemmel", i.e., rye/wheat/sourdough bread with generous amounts of caraway seed (good for digestion at the end of Lenten fasting, and oh so very tasty), shaped in a way vaguely resembling a fish (an ancient Christian symbol). Traditionally, those breads are formally blessed on Holy Saturday, and can be eaten only thereafter, or else. They taste best with butter and hard-boiled sliced egg or bacon.

If you're interested and can read German, check this out, otherwise ask me.

Ever since I live far away from Attendorn, I bake a pair of these myself for Easter. This year, again, mine were every bit as tasty as they had to be, and of course the family and me indulged big time.

Tags: the-nerdy-bit

Know Your E-Mail Address

2021-04-02 — Michael Haupt

I have an e-mail address at a large e-mail provider. A lady somewhere in Mecklenburg-Vorpommern with whom I share some naming details accidentally misused my e-mail address to buy some clothes online. Now I have her address and phone number, because the company chose to put all of those into the order confirmation e-mail.

In fact, things like this happen a lot, and since we're talking about personal data after all, I normally take some steps to sort this out. In some cases, I'd use postal addresses to send those people a friendly letter. This lady, I gave a call - her reaction was quite bewildered but she immediately saw the point. I've deleted that e-mail now.

While is may be funny, it's actually quite serious: people can easily expose personal data just by mistyping their e-mail address.

Some guy in the Ruhrgebiet has a freakin' phone contract with Vodafone that runs through my e-mail address. While Vodafone hasn't shared any address details in e-mail and also not exposed other things, I've still called them about the matter, only to be met with utter incompetence. The call center agent didn't understand the problem. His supervisor, to whom I ended up talking, promised to see about things but nothing has changed.

I was also once sent the personal retirement data, including birth date, address, and SSN, of someone in the US. This kind of thing is scary.

The most recent incident of the sort is, you guessed it, Covid-19 related. Some student at a university on the North American continent had accidentally used my e-mail address to register for a vaccination slot. Obviously, it was me who got sent the confirmation, date and time, and more details about the procedure. Happily, the notification e-mail also contained the student's phone number, so I sent a text message with the details, and things were good. Still, the whole thing made me cringe.

It's OK when someone misspells their e-mail address and accidentally uses mine. However I do believe companies should take measures to make it very hard for such accidents to have data privacy consequences, or for the accidents to be remedied. If I have to send in a lawyer to sort such things out (this can be interpreted as impersonation, even though it's somewhat inversed), that's a pretty high threshold.

Tags: the-nerdy-bit

I am ...

2021-03-28 — Michael Haupt

Once the connection clicked, this was too obvious to not be done. (Check this earlier post for a hint.)

Tags: the-nerdy-bit

Metropolis

2020-11-22 — Michael Haupt

Movie time. Fritz Lang's Metropolis (1927, watchable here) is a masterpiece. Your mileage may vary regarding the story, but take in the imagery. This movie inspired C-3PO, one Bat Man movie, and it has a Really Evil Frankenstein style Supervillain. And the sound track. The sound track! This is a silent film, but it features a large-scale orchestra playing a more than two hours long symphonic poem score that can easily be enjoyed without the images. Gottfried Huppertz, the composer (whose name I'm pretty sure you haven't heard unless you know the movie) was a genius. I fondly recall one occasion in Nikolaisaal Potsdam where the movie was shown, and an actual orchestra was performing the score live.

Tags: the-nerdy-bit, music

Catchy Music Openings

2020-11-15 — Michael Haupt

Do you know that feeling when a piece of music captivates you with the first few notes? I experience this in two different ways. One is that a piece of music just goes BAM! and ties me to the spot so that I can't stop listening. The other is that it gives me that "oh, this is interesting" feeling and makes me curious. Here are some examples. What are yours?

BAM!

"Oh, this is interesting."

Tags: the-nerdy-bit, music

Thesaurus Rex

2020-11-08 — Michael Haupt

For us language lovers, here's a nice hefty brick of a book that will make you chuckle and think. Thesaurus Rex is a dictionary of sorts. It's a bit in the tradition of Douglas Adams' masterpiece The Meaning of Liff (available in German as Der tiefere Sinn des Labenz), wherein Adams used the names of cities to ascribe to them meanings and concepts that we all know exist but didn't have words for so far. While Liff/Labenz originate in English, Thesaurus Rex originates in German, and, while doing a similar thing for naming as yet unnamed concepts, uses puns to that end. In that, it's more Joycean in its approach, which doesn't make it any less good.

One of my favourites is "Dellfin". To appreciate it, you need to know that "Delle" is a German word for "dent". Now, a Dellfin can be one of two things: (a) a dented dolphin, (b) the end of a computer manufacturer.

Thesaurus Rex is full of such goodness.

Tags: the-nerdy-bit, books

Laptop Purchase

2020-08-29 — Michael Haupt

A while ago, I backed the CrowdSupply campaign for Reform, an open-source laptop. There's a small Berlin based company behind this, the founder of which, Lukas F. Hartmann, is a genius. He likes to build things from scratch in an open source fashion. One example is an operating system. Another is the Reform laptop. Lukas and friends have designed the entire machine from the ground up, PCB layout, keyboard, case, and all that. The open source philosophy goes as far as making 3D printing instructions for the case parts available. The laptop is a bit clunky, but completely maintainable (no hardwired battery!). It's also a bit pricey and comes with little memory, but the idea as such has my greatest sympathy.

Future editions of the laptop might go even further open source. The current processor is still based on (proprietary) ARM architecture, but Lukas is already thinking about a RISC-V based machine.

In backing the campaign, I chose the package that involves me assembling the laptop from its parts. This is going to be so much fun. I've also agreed with Lukas to save him the shipping cost, and will pick up the box in person in Berlin, hopefully in December.

Tags: hacking, the-nerdy-bit

Conlon Nancarrow

2020-08-29 — Michael Haupt

YAML indentation patterns inspired this.

They did not inspire Conlon Nancarrow, who passed away well before YAML was even conceived of. Nancarrow wrote, or rather, punched, music for player piano. That's the kind of piano that will play music on its own from punched tape. Composing for this instrument, instead of for human piano players, can do interesting things because you don't really have to pay attention to the music being playable with human hands. You can experiment with very precise timing, geometrical patterns, and so forth. Nancarrow wrote about fifty "Studies for Player Piano".

Here's two examples.

Study no. 5 made me think of YAML, or YAML made me think of it. I wonder what happens if you feed this to Kubernetes. It sounds like crazy ants.

Study no. 3a is a bit more conventional. It's Boogie Woogie on steroids.

Tags: music, the-nerdy-bit

Pi Crunching

2020-07-05 — Michael Haupt

One of my numerous Raspberry Pis is now part of IBM's World Community Grid, crunching data to support finding a Covid-19 treatment.

Tags: the-nerdy-bit

Coding Lullaby

2020-06-21 — Michael Haupt

I thought I'd share a little ditty I once wrote. It's disgraceful but funny, I think. You might know the tune.

Coding Lullaby

Hush, little test suite, don't you break,
coder's gonna fix that bug ere you awake.
If that fix ain't gonna make you pass,
coder's gonna slap you right up the ... version history.

Tags: the-nerdy-bit