Spent basically the entire day (except for the mandatory walk) fighting with Python’s type hints. But, the result is that my widget toolkit now passes mypy --strict.
I really, really don’t want to write larger pieces of software without static typing anymore. With dynamic typing, you must test every code path in your program to catch even the most basic errors. pylint helps a bit (doesn’t need type hints), but that’s really not enough.
Also, somewhere along the way, I picked up a very bad (Python) programming style. (Actually, I know exactly where I picked that up, but I don’t want to point the finger now.) This style makes heavy use of dicts and tuples instead of proper classes. That works for small scripts, but it very quickly turns into an absolute mess once the program grows. Prime example: jenny. 😩
I have a love-hate relationship with Python’s type hints, because they are meaningless at runtime, so they can be utterly misleading. I’m beginning to like them as an additional safety-net, though.
(But really, if correctness is the goal, you either need to invest a ton of time to get 100% test coverage – or don’t use Python.)
./bin/mu -B -o ... -p muos/amd64 ... target.
Whohoo! 🥳
You have no idea how great a feeling this is! This includes the Mu stdlib and runtime as well, not just some simple stupid program, this means a significant portion of the runtime and stdlib “just works”™ 🤣
Btw @movq@www.uninformativ.de you’ve inspired me to try and have a good ‘ol crack at writing a bootloader, stage1 and customer microkernel (µKernel) that will eventually load up a Mu (µ) program and run it! 🤣 I will teach Mu (µ) to have a ./bin/mu -B -o ... -p muos/amd64 ... target.
I’m trying to implement configurable key bindings in tt. Boy, is parsing the key names into tcell.EventKeys a horrible thing. This type consists of three information:
- maybe a predefined compound key sequence, like Ctrl+A
- maybe some modifiers, such as Shift, Ctrl, etc.
- maybe a rune if neither modifiers are present nor a predefined compound key exists
It’s hardcoded usage results in code like this:
func (t *TreeView[T]) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive)) {
return t.WrapInputHandler(func(event *tcell.EventKey, setFocus func(p tview.Primitive)) {
switch event.Key() {
case tcell.KeyUp:
t.moveUp()
case tcell.KeyDown:
t.moveDown()
case tcell.KeyHome:
t.moveTop()
case tcell.KeyEnd:
t.moveBottom()
case tcell.KeyCtrlE:
t.moveScrollOffsetDown()
case tcell.KeyCtrlY:
t.moveScrollOffsetUp()
case tcell.KeyTab, tcell.KeyBacktab:
if t.finished != nil {
t.finished(event.Key())
}
case tcell.KeyRune:
if event.Modifiers() == tcell.ModNone {
switch event.Rune() {
case 'k':
t.moveUp()
case 'j':
t.moveDown()
case 'g':
t.moveTop()
case 'G':
t.moveBottom()
}
}
}
})
}
This data structure is just awful to handle and especially initialize in my opinion. Some compound tcell.Keys are mapped to human-readable names in tcell.KeyNames. However, these names always use - to join modifiers, e.g. resulting in Ctrl-A, whereas tcell.EventKey.Name() produces +-delimited strings, e.g. Ctrl+A. Gnaarf, why this asymmetry!? O_o
I just checked k9s and they’re extending tcell.KeyNames with their own tcell.Key definitions like crazy: https://github.com/derailed/k9s/blob/master/internal/ui/key.go Then, they convert an original tcell.EventKey to tcell.Key: https://github.com/derailed/k9s/blob/b53f3091ca2d9ab963913b0d5e59376aea3f3e51/internal/ui/app.go#L287 This must be used when actually handling keyboard input: https://github.com/derailed/k9s/blob/e55083ba271eed6fc4014674890f70c5ed6c70e0/internal/ui/tree.go#L101
This seems to be much nicer to use. However, I fear this will break eventually. And it’s more fragile in general, because it’s rather easy to forget the conversion or one can get confused whether a certain key at hand is now an original tcell.Key coming from the library or an “extended” one.
I will see if I can find some other programs that provide configurable tcell key bindings.
@lyse@lyse.isobeef.org It’s not super comfortable, that’s right.
But these mouse events come with a caveat anyway:
ncurses uses the XM terminfo entry to enable mouse events, but it looks like this entry does not enable motion events for most terminal emulators. Reporting motion events is supported by, say, XTerm, xiate, st, or urxvt, it just isn’t activated by XM. This makes all this dragging stuff useless.
For the moment, I edited the terminfo entry for my terminal to include motion events. That can’t be a proper solution. I’m not sure yet if I’m supposed to send the appropriate sequence manually …
And the terminfo entries for tmux or screen don’t include XM at all. tmux itself supports the mouse, but I’m not sure yet how to make it pass on the events to the programs running inside of it (maybe that’s just not supported).
To make things worse, on the Linux VT (outside of X11 or Wayland), the whole thing works differently: You have to use good old gpm to get mouse events (gpm has been around forever, I already used this on SuSE Linux). ncurses does support this, but this is a build flag and Arch Linux doesn’t set this flag. So, at the moment, I’m running a custom build of ncurses as a quick hack. 😅 And this doesn’t report motion events either! Just clicks. (I don’t know if gpm itself can report motion events, I never used the library directly.)
tl;dr: The whole thing will probably be “keyboard first” and then the mouse stuff is a gimmick on top. As much as I’d like to, this isn’t going to be like TUI applications on DOS. I’ll use “Windows” for popups or a multi-window view (with the “WindowManager” being a tiny little tiling WM).
Vacation: Doing crazy things like C on DOS, lots of Rust, bare-metal assembly code, everything is fine.
Back at work: How the fuck do I move an email in this web mail program? Am I stupid? 😮💨
@bender@twtxt.net They’re not completely impossible, but C makes it much easier to run into them. I think the key point is that in those “safe” languages, buffer overflows are caught and immediately crash the program (if not handled otherwise) instead of silently corrupting memory, not being noticed right away and maybe only later crashing at a different location, where it can be very hard to find the actual root cause. This is a big improvement in my book.
Some programmers are indeed horrible. I’m guilty myself. :-)
I like the article.
I came across this on “Why Is SQLite Coded In C”, which I found interesting:
“There has lately been a lot of interest in “safe” programming languages like Rust or Go in which it is impossible, or is at least difficult, to make common programming errors like memory leaks or array overruns.”
If that’s true, then encountering those issues means the programmer is, simply, horrible?
@movq@www.uninformativ.de I quite like this part:
Many people write programs, but few stick with a program long enough to distill it.
I think this is finally a good metaphor to talk about “simple” software:
https://oldbytes.space/@psf/115846939202097661
Distilled software.
I quote in full:
principles of software distillation:
Old software is usually small and new software is usually large. A distilled program can be old or new, but is always small, and is powerful by its choice of ideas, not its implementation size.
A distilled program has the conciseness of an initial version and the refinement of a final version.
A distilled program is a finished work, but remains hackable due to its small size, allowing it to serve as the starting point for new works.
Many people write programs, but few stick with a program long enough to distill it.
I often tried to tell people about “simple” or “minimalistic” software, “KISS”, stuff like that, but they never understand – because everybody has a different idea of “simple”. The term “simple” is too abstract.
This is worth thinking about some more. 🤔
And now the event loop is not a simple loop around curses’ getch() anymore but it can wait for events on any file descriptor. Here’s a simple test program that waits for connections on a TCP socket, accepts it, reads a line, sends back a line:
https://movq.de/v/93fa46a030/vid-1767547942.mp4
And the scrollbar indicators are working now.
I’ll probably implement timer callbacks using timerfd (even though that’s Linux-only). 🤔
More widget system progress:
https://movq.de/v/87e2bce376/vid-1767467193.mp4
I like the oldschool shadow effect. 😅 Not sure if I’ll keep it, but it’s neat.
The menu bar is still fake.
Had to spend quite a bit of time optimizing the rendering today. This can get really slow really quickly.
Unicode is Pain.
I might be able to start porting my first program (currently uses urwid) soon. 🤔
Nice! 😊 Here are the startup latencies for the simplest Mu (µ) program. println("Hello World"):
- Interpreter: ~5ms
- Native Code: ~1.5ms
@movq@www.uninformativ.de Yeah, I see. Just crudely checked on my computer, with around 0.013 seconds, Python 2.7 seems a tad faster than Python 3.14’s 0.023 seconds in this little program.
The lazy imports sound not too bad, but I just skimmed over them. There are surprisingly many exceptions, but yeah, no way around them. :-)
mu (µ) now has builtin code formatting and linting tools, making µ far more useful and useable as a general purpose programming language. Mu now includes:
- An interpreter for quick “scriptinog”
- A native code compiler for building native executables (Darwin / macOS only for now)
- A builtin set of developer tools, currently: fmt (-fmt), check (-check) and test (-test).
I assume you made the thing load quickly, didn’t you?
That’s the problem with Python. If you have a couple of files to import, it will take time.
I want this to be reasonably fast on my old Intel NUC from 2016 (Celeron N3050 @ 1.60GHz) and I already notice that the program startup takes about 95 ms (or 125 ms when there are no .pyc files yet). That’s still fine, but it shows that I’ll have to be careful and keep this thing very small …
Python 3.14 will bring lazy imports, maybe that can help in some cases.
Well, you girls and guys are making cool things, and I have some progress to show as well. 😅
https://movq.de/v/c0408a80b1/movwin.mp4
Scrolling widgets appears to work now. This is (mostly) Unicode-aware: Note how emojis like “😅” are double-width “characters” and the widget system knows this. It doesn’t try to place a “😅” in a location where there’s only one cell available.
Same goes for that weird “ä” thingie, which is actually “a” followed by U+0308 (a combining diacritic). Python itself thinks of this as two “characters”, but they only occupy one cell on the screen. (Assuming your terminal supports this …)
This library does the heavy Unicode lifting: https://github.com/jquast/wcwidth (Take a look at its implementation to learn how horrible Unicode and human languages are.)
The program itself looks like this, it’s a proper widget hierarchy:
https://movq.de/v/1d155106e2/s.png
(There is no input handling yet, hence some things are hardwired for the moment.)
@lyse@lyse.isobeef.org I’m toying with the idea of making a widget/window system on top of Python’s ncurses. I’ve never really been happy with the existing ones (like urwid, textual, pytermgui, …). I mean, they’re not horrible, it’s mostly the performance that’s bugging me – I don’t want to wait an entire second for a terminal program to start up.
Not sure if I’ll actually see it through, though. Unicode makes this kind of thing extremely hard. 🫤
The compiler technique I’m using here is to not “emit” most of the runtime if it’s actually never used in your program, and also dropping dead code in the SSA pass.
@prologic@twtxt.net That might be a challenge, at least in 16-bit Real Mode: The OS follows the model of COM files on DOS, i.e. the size of the binary cannot exceed 64 KiB and heap+stack of the running program will have to fit into that same 64 KiB. 😅 (The memory layout is very rigid, each process gets such a 64 KiB slice.)
And in 64-bit Long Mode, there is no “kernel” yet. The thing in the video is literally just a small bare-metal program.
But some day, maybe. 😃
My little toy operating system from last year runs in 16-bit Real Mode (like DOS). Since I’ve recently figured out how to switch to 64-bit Long Mode right after BIOS boot, I now have a little program that performs this switch on my toy OS. It will load and run any x86-64 program, assuming it’s freestanding, a flat binary, and small enough (< 128 KiB code, only uses the first 2 MiB of memory).
Here I’m running a little C program (compiled using normal GCC, no Watcom trickery):
https://movq.de/v/b27ced6dcb/los86%2D64.mp4
https://movq.de/v/b27ced6dcb/c.png
Next steps could include:
- Use Rust instead of C for that 64-bit program?
- Provide interrupt service routines. (At the moment, it just keeps interrupts disabled.)
@kiwu@twtxt.net Assembly is usually the most low-level programming language that you can get. Typical programming languages like Python or Go are a thick layer of abstraction over what the CPU actually does, but with Assembler you get to see it all and you get full control. (With lots of caveats and footnotes. 😅)
I’m interested in the boot process, i.e. what exactly happens when you turn on your computer. In that area, using Assembler is a must, because you really need that fine-grained control here.
I’m seeing crashes in the 3D subsystem. (Gallium? Glamor? Whatever other Mesa thing they have? No idea.) In the logs I find this:
malloc(): unaligned tcache chunk detected
And that’s why I still care about Rust and want to learn more about it, even though it’s giving me so much headache and I’ve given up so many times. Because Rust currently seems to be the only popular systems programming language that tries to eliminate these error classes.
And of course “the Rust experiment” in the Linux kernel has recently been concluded as “successful”, so that alone is reason enough for me:
I just completed “Secret Entrance” - Day 1 - Advent of Code 2025 #AdventOfCode https://adventofcode.com/2025/day/1 — However I did it in my own toy programming language called mu, which I had to build first 🤣
Ahh that’s because I forgot to call main() at the end of the source file. mu is a bit of a dynamic programming language, mix of Go(ish) and Python(ish).
$ ./bin/mu examples/aoc2025/day1.mu
Execution failed: undefined variable readline
Searching the web a bit brings up lots of threads where people hate WebP. The problem being that browsers support WebP but other programs tend to be problematic … ? 🤔
@prologic@twtxt.net Nothing stops you from programming while in Vietnam. 😏😈😅
FTR, I see one (two) issues with PyQt6, sadly:
- The PyQt6 docs appear to be mostly auto-generated from the C++ docs. And they contain many errors or broken examples (due to the auto-conversion). I found this relatively unpleasent to work with.
- (Until Python finally gets rid of the Global Interpreter Lock properly, it’s not really suited for GUI programs anyway – in my opinion. You can’t offload anything to a second thread, because the whole program is still single-threaded. This would have made my fractal rendering program impossible, for example.)
@prologic@twtxt.net Hm, same startup delay. (Go is not an option for me anyway.)
It’s hard to tell why all this is so slow. Maybe in this particular case it has something to do with fonts: strace shows the program loading the fontconfig configs several times, and that takes up a bulk of the startup time. 🤔 (Qt6 or Java don’t do that, but they’re still slow to start up – for other reasons, apparently.)
To be fair, it’s “just” the initial program startup (with warm I/O caches). Once it’s running, it’s fine. All toolkits I’ve tried are. But I don’t want to accept such delays, not in the year 2025. 😅 Imagine every terminal window needing half a second to appear on the screen … nah, man.
Be it Java with Swing or PyQt6, it takes ~300 ms until a basic window with a treeview and a listbox appears. That is a very noticeable delay.
Is it unrealistic to expect faster startup times these days? 🤔
Once the program is running, a new second window (in the same process) appears very quickly. So it’s all just the initialization stuff that takes so long. I could, of course, do what “fat” programs have done for ages: Pre-launch the process during boot, windowless. But I was hoping that this wasn’t needed. 😞 (And it’s a bad model anyway. When the main process crashes, all windows crash with it.)
@prologic@twtxt.net Let’s go through it one by one. Here’s a wall of text that took me over 1.5 hours to write.
The criticism of AI as untrustworthy is a problem of misapplication, not capability.This section says AI should not be treated as an authority. This is actually just what I said, except the AI phrased/framed it like it was a counter-argument.
The AI also said that users must develop “AI literacy”, again phrasing/framing it like a counter-argument. Well, that is also just what I said. I said you should treat AI output like a random blog and you should verify the sources, yadda yadda. That is “AI literacy”, isn’t it?
My text went one step further, though: I said that when you take this requirement of “AI literacy” into account, you basically end up with a fancy search engine, with extra overhead that costs time. The AI missed/ignored this in its reply.
Okay, so, the AI also said that you should use AI tools just for drafting and brainstorming. Granted, a very rough draft of something will probably be doable. But then you have to diligently verify every little detail of this draft – okay, fine, a draft is a draft, it’s fine if it contains errors. The thing is, though, that you really must do this verification. And I claim that many people will not do it, because AI outputs look sooooo convincing, they don’t feel like a draft that needs editing.
Can you, as an expert, still use an AI draft as a basis/foundation? Yeah, probably. But here’s the kicker: You did not create that draft. You were not involved in the “thought process” behind it. When you, a human being, make a draft, you often think something like: “Okay, I want to draw a picture of a landscape and there’s going to be a little house, but for now, I’ll just put in a rough sketch of the house and add the details later.” You are aware of what you left out. When the AI did the draft, you are not aware of what’s missing – even more so when every AI output already looks like a final product. For me, personally, this makes it much harder and slower to verify such a draft, and I mentioned this in my text.
Skill Erosion vs. Skill EvolutionYou, @prologic@twtxt.net, also mentioned this in your car tyre example.
In my text, I gave two analogies: The gym analogy and the Google Translate analogy. Your car tyre example falls in the same category, but Gemini’s calculator example is different (and, again, gaslight-y, see below).
What I meant in my text: A person wants to be a programmer. To me, a programmer is a person who writes code, understands code, maintains code, writes documentation, and so on. In your example, a person who changes a car tyre would be a mechanic. Now, if you use AI to write the code and documentation for you, are you still a programmer? If you have no understanding of said code, are you a programmer? A person who does not know how to change a car tyre, is that still a mechanic?
No, you’re something else. You should not be hired as a programmer or a mechanic.
Yes, that is “skill evolution” – which is pretty much my point! But the AI framed it like a counter-argument. It didn’t understand my text.
(But what if that’s our future? What if all programming will look like that in some years? I claim: It’s not possible. If you don’t know how to program, then you don’t know how to read/understand code written by an AI. You are something else, but you’re not a programmer. It might be valid to be something else – but that wasn’t my point, my point was that you’re not a bloody programmer.)
Gemini’s calculator example is garbage, I think. Crunching numbers and doing mathematics (i.e., “complex problem-solving”) are two different things. Just because you now have a calculator, doesn’t mean it’ll free you up to do mathematical proofs or whatever.
What would have worked is this: Let’s say you’re an accountant and you sum up spendings. Without a calculator, this takes a lot of time and is error prone. But when you have one, you can work faster. But once again, there’s a little gaslight-y detail: A calculator is correct. Yes, it could have “bugs” (hello Intel FDIV), but its design actually properly calculates numbers. AI, on the other hand, does not understand a thing (our current AI, that is), it’s just a statistical model. So, this modified example (“accountant with a calculator”) would actually have to be phrased like this: Suppose there’s an accountant and you give her a magic box that spits out the correct result in, what, I don’t know, 70-90% of the time. The accountant couldn’t rely on this box now, could she? She’d either have to double-check everything or accept possibly wrong results. And that is how I feel like when I work with AI tools.
Gemini has no idea that its calculator example doesn’t make sense. It just spits out some generic “argument” that it picked up on some website.
3. The Technical and Legal Perspective (Scraping and Copyright)The AI makes two points here. The first one, I might actually agree with (“bad bot behavior is not the fault of AI itself”).
The second point is, once again, gaslighting, because it is phrased/framed like a counter-argument. It implies that I said something which I didn’t. Like the AI, I said that you would have to adjust the copyright law! At the same time, the AI answer didn’t even question whether it’s okay to break the current law or not. It just said “lol yeah, change the laws”. (I wonder in what way the laws would have to be changed in the AI’s “opinion”, because some of these changes could kill some business opportunities – or the laws would have to have special AI clauses that only benefit the AI techbros. But I digress, that wasn’t part of Gemini’s answer.)
tl;drExcept for one point, I don’t accept any of Gemini’s “criticism”. It didn’t pick up on lots of details, ignored arguments, and I can just instinctively tell that this thing does not understand anything it wrote (which is correct, it’s just a statistical model).
And it framed everything like a counter-argument, while actually repeating what I said. That’s gaslighting: When Alice says “the sky is blue” and Bob replies with “why do you say the sky is purple?!”
But it sure looks convincing, doesn’t it?
Never againThis took so much of my time. I won’t do this again. 😂
“Computação e o ensino superior artístico português: currículos e práticas nos cursos de graduação públicos”
“Computing and the Portuguese higher arts education: curricula and practices in public undergraduate programs”
https://www.scielo.br/j/ep/a/dmVzQzqPXTjdPn7dBFtsvnw/?lang=pt
Java’s Swing is allegedly in “maintenance mode”, so I doubt it’s a good idea to use it for new programs. For example, I very much doubt that it will ever support Wayland.
The replacement is supposed to be JavaFX, but that’s not included in JREs – anymore! It used to be, now it’s not, even though it’s well over 15 years old now.
This whole thing (“Java GUIs”) appears to have stagnated a lot. Probably because everything is web stuff these days …
https://www.oracle.com/java/technologies/javafx/faq-javafx.html#6
@movq@www.uninformativ.de Uh, that actually looks not that terrible. Somehow, I remember Swing GUIs being way uglier.
As for Visual Basic, I only had to use VBA once in my life. That was in the beginning of my career when I inherited a project from a leaving coworker. Fuck me, was that awful. Just alone the damn compiler error dialog box popping up in my face all the time while editing and the compiler already trying to parse the unfinished and hence of course uncompilable code. Boy, that left a lasting impression on me. I ported everything to Java very quickly. Luckily, the code base wasn’t all that large at that point in time. I had to add a bunch of new features after that, so I was very glad that I convinced my workmate/project manager to do that first. We didn’t even need a GUI, the button in Excel was transformed to a command line program that just generated the large file.
But I cannot comment on the VB GUI designer, I never used that. Your screenshot looks very similar to the Delphi one, though. Only towards the end of my Delphi days I found out about the possibility to make the widgets snap to window edges and corners (I don’t remember how that was called), so that resizing the windows was actually possible without messing up their entire contents.
Switching to Linux, Delphi wasn’t an option anymore. For some reason I couldn’t use Kylix. Maybe it was already dead by the time I changed OSes. Or I couldn’t get it to run. I just don’t remember. I just recall that the unavailability of Delphi was the reason it took me a while to actually settle on Linux. I then fully switched to Java. The GridBagLayout was my absolutely favorite Swing layout manager. I reckon I used it 98% of the time, because it was so powerful and made the windows resize properly, just as I had learned to do in Delphi shortly before.
Up until discovering Swing, I used Java’s AWT for a short amount of time. That was very limited I think and I hit the limits fairly quickly. Later at uni, we had one project making use of SWT. Didn’t convince me either. I could be wrong, but I think there was also a SWT GUI designer plugin for Eclipse. If there really was, that one wasn’t in the same street as Delphi’s (there must be a reason I forgot about it ;-)).
The one for Delphi was quite good.
It was! I didn’t use Delphi for long, though. Dunno why, I always gravitated towards Visual Basic back then. 😅
These days I don’t deal with GUI programming anymore.
I also avoid it when possible, because … it’s exhausting, because … the tools that I have/know are “subpar”. Doing anything regarding GUIs always feels like a chore. That wasn’t the case in the VB days.
Well, I made this in ~2009 with Java/Swing and it was pretty nice to work with, custom widgets and all:
https://movq.de/v/de26d5edb3/s.png
I wouldn’t dare doing this with GTK.
@movq@www.uninformativ.de The one for Delphi was quite good. But JCreator (I don’t remember exactly) was awful and I never looked back to GUI designers. Always layed out the GUI by hand in code myself since then. These days I don’t deal with GUI programming anymore.
Theming on Qt6 is a bit unusual (you have to install qt6ct and then set an environment variable for every Qt program?), but at least pcmanfm-qt doesn’t look like brain damage anymore now. 🤔 (Except there’s no darkmode. What is this, 1980?)
Oregon State University Teaches “White Rage” as Computer Science
OSU’s Computer Science program — which had a $1 Million Dollar grant for “Gender-Inclusive Open Source” — teaches about “White Supremacy” and “Reparations” instead of programming. ⌘ Read more
@dce@hashnix.club Arch is the most stress-free OS I’ve ever run (I last reinstalled it 14 years ago, only rolling updates since then) – but to be honest, I sometimes wonder what role my general choice of software plays. I mostly run minimalistic software or programs that I wrote myself. I guess that greatly reduces the chance of breakage. 🤔
Account Take Over | P1 — Critical
It started off like any other day until I got an unexpected email — an invite to a private bug bounty program. Curious, I jumped in. The…
[Continue reading on InfoSec Write-ups »](https://infosecwriteups.com/account-take-over-p1-critical-5468ce8218b9?sour … ⌘ Read more
22. How to Get Invites to Private Programs
Unlock the secrets to landing exclusive private program invites and level up your bug bounty journey.
[Continue reading on InfoSec Write-ups »](https://infosecwriteups.com/22-how-to-get-invites-to-private-programs-9bbb5166 … ⌘ Read more
Beyond the AI Hype: Guido van Rossum on Python’s Philosophy, Simplicity, and the Future of Programming
Comments ⌘ Read more
Carney announces long-awaited automatic tax filing, makes school food program permanent ⌘ Read more
Programming in the sun with Vim and DC1 ⌘ Read more
It happened.
“Can you help me debug this program? I vibe coded it and I have no idea what’s going on. I had no choice – learning this new language and frameworks would have taken ages, and I have severe time constraints.”
Did I say “no”? Of course not, I’m a “nice guy”. So I’m at fault as well, because I endorsed this whole thing. The other guy is also guilty, because he didn’t communicate clearly to his boss what can be done and how much time it takes. And the boss and his bosses are guilty a lot, because they’re all pushing for “AI”.
The end result is garbage software.
This particular project is still relatively small, so it might be okay at the moment. But normalizing this will yield nothing but garbage. And actually, especially if this small project works out fine, this contributes to the shittiness because management will interpret this as “hey, AI works”, so they will keep asking for it in future projects.
How utterly frustrating. This is not what I want to do every day from now on.
Lobsters Interview with Zdsmith
I had the pleasure of interviewing, befriending @zdsmith whose passions are very close to my heart. He explores the different forms of notation (Iverson, Naur), makes combinatory programming approachable, ported J to Janet, created an ergonomic notation for requirements gathering, designed his own [shorthands](https://blog.zdsmith.com/series/sh … ⌘ Read more
[$] Gccrs after libcore
Despite its increasing popularity, the Rust programming language is still
supported by a single compiler, the LLVM-based rustc. At the 2025 GNU Tools\
Cauldron, Pierre-Emmanuel Patry said that a lot of people are waiting
for a GCC-based Rust compiler before jumping into the language. Patry, who
is working on just that compiler (known as “gccrs”), provided an update on
the status of that project and what is coming next. ⌘ Read more
Python 3.14.0 (final) is here
This is the stable release of Python 3.14.0
Python 3.14.0, the newest major release of the Python programming language is here!
Shutdown Threatens Food Aid Program Relied on By Millions of Families
Associated Press Reporters, - MedPage Today | Associated Press
_Stephan: Trump is a psychopath, and so are a number of his vassals like Stephen Miller. They demonstrate their mental illness every day, and it just gets nastier. They obviously care nothing for the wellbeing of American families as this report details. And, meanwhile, the Republican Congressmembers just docilely watch … ⌘ Read more
New program allows parents of kids with complex needs to take a break
An Australian-first pilot program gets underway in WA in the hope of not only giving the parents of children with complex needs a break, but helping them navigate the maze of different support systems. ⌘ Read more
A case for learning GPU programming with a compute-first mindset – Maister’s Graphics Adventures
Comments ⌘ Read more
Wheat diversity discovery could provide an urgently-needed solution to global food security
Wheat has a very large and complex genome. Researchers have found that different varieties can use their genes in different ways. By studying RNA—the molecules that carry out instructions from DNA—researchers can see which genes are active and when. By mapping this gene activity for the first time, researchers are able to accelerate international wheat breeding programs, developing new varieties of … ⌘ Read more
@movq@www.uninformativ.de I never programmed with Tkinter myself and it’s been ages that I ran a program which used it. I always thought that it looks awful. But maybe there are nicer themes these days. I just wanted to give the demo python3 -m tkinter a try, but this module doesn’t exist. I was always under the wrong impression that Tkinter is bundled with Python.
@lyse@lyse.isobeef.org Xfce is nice, but it’s also mostly GTK. I don’t really know the answer yet. For now, I’ll just avoid anything that uses GTK4.
For my own programs, I might have a closer look at Tkinter. I was complaining recently that I couldn’t find a good file manager, so it might be an interesting excercise to write one in Python+Tkinter. 🤔 (Or maybe that’s too much work, I don’t know yet.)
2 Ways to Install Homebrew in MacOS Tahoe
Homebrew is a powerful command line package manager that allows you to easily install, update, and manage popular command line programs and tools, as well as traditional graphical apps with cask (and third party tools like Applite help you manage cask through the GUI too). It’s a popular tool with advanced Mac users and those … Read More ⌘ Read more
Spec-driven development: Using Markdown as a programming language when building with AI
I coded my latest app entirely in Markdown and let GitHub Copilot compile it into Go. This resulted in cleaner specs, faster iteration, and no more context loss. ✨
The post [Spec-driven development: Using Markdown as a programming language when building with AI](https://github.blog/ai-and-ml/generative-ai/spec-driven-development-using-markdown-as-a-p … ⌘ Read more
Tiny RISC-V Development Board with WCH CH32V317WCU6 Available from $6.80
The nanoCH32V317 is a compact development board created by MuseLab to simplify prototyping and embedded system development. It integrates USB connectivity, Ethernet support, and a straightforward programming interface through USB Type-C, providing an accessible platform for engineers and hobbyists working with RISC-V microcontrollers. The board is powered by the WCH CH32V317WCU6, a RISC-V microcontro … ⌘ Read more
First Beta of iOS 26.1, MacOS Tahoe 26.1 is Available for Testing
Apple has issued the first beta versions of iOS 26.1, MacOS Tahoe 26.1, iPadOS 26.1, and the rest of the OS 26 suite. The first betas are available for any user registered in the developer beta program, and soon after for public beta testers too. It’s not entirely clear what the focus of iOS 26.1 … [Read More](https://osxdaily.com/2025/09/22/first-beta-of-ios-26-1-macos-tahoe-26-1-is-available-for-testin … ⌘ Read more
This thing about making software run on other people’s computers can be pretty hard!
No wonder I think I’ve heard this is one of the things that distinguishes professional software development from [my preferred domain of] things such as “end-user programming” etc.
The problem is that when you start sharing code in the context of a FLOSS project you almost immediately get enmeshed in concerns about packaging and how other people will install stuff, when sometimes you just don’t want to be a professional software developer! 😿
I’m always borrowing terms (learning ideas) from @lr like: incidental complexity. I hate incidental complexity or maybe I just fear incidental complexity. Can we escape incidental complexity? I guess not.
«Welcome to the #AutomatingGIS processes course! Through interactive lessons and hands-on exercises, this course introduces you to #GeographicDataAnalysis using the #Python programming language. If you are new to Python, we recommend you first start with the Geo-Python course (geo-python.readthedocs.io) before diving into using it for GIS analyses in this course.
Geo-Python and Automating GIS Processes (‘#AutoGIS’) have been developed by the Department of Geosciences and Geography at the University of Helsinki, Finland. The course has been planned and organized by the #DigitalGeographyLab. The teaching materials are openly accessible for anyone interested in learning.»
«Welcome to the #AutomatingGIS processes course! Through interactive lessons and hands-on exercises, this course introduces you to #GeographicDataAnalysis using the #Python programming language. If you are new to Python, we recommend you first start with the Geo-Python course (geo-python.readthedocs.io) before diving into using it for GIS analyses in this course.
Geo-Python and Automating GIS Processes (‘#AutoGIS’) have been developed by the Department of Geosciences and Geography at the University of Helsinki, Finland. The course has been planned and organized by the #DigitalGeographyLab. The teaching materials are openly accessible for anyone interested in learning.»
https://autogis-site.readthedocs.io/en/latest/
(via Paul Walter no linkedin)
«… It all went well until 1980 or so, when Ronald Reagan appointed a new head of the EPA. The lady didn’t like her stationery we had designed and with a simple “I want my daisy back” undermined the overall graphic system. If the Queen doesn’t like it, we don’t like it became the attitude, and the program began to crumble. The old logo was fully reinstated and the graphic system was abandoned. A decade later, nobody at the EPA could find a copy of the Graphic Standards System, except a bunch of legalese that you will find on its website.
I’m a fan of the EPA and all its efforts and hope that we helped in some small way for this agency to communicate within itself, to other government agencies, and with the American people. I’m very grateful and appreciative that Jesse Reed and Hamish Smyth of Standards Manual, and Julie Anixter of AIGA, brought this document to life again. Have fun revisiting.»
(from the introduction by Steff Geissbühler)
@lyse@lyse.isobeef.org @dce@hashnix.club It’s pretty cool, I won’t argue that, but also really simple, to be completely honest. 😅 The BIOS already provides all you need to send data to the printer:
https://helppc.netcore2k.net/interrupt/bios-printer-services
The BIOS actually does provide a great deal of things, which, to me, was one of the most surprising learnings of this project (the project of writing a little 16-bit real-mode OS, that is). It often doesn’t feel like I was writing an operating system – it felt more like writing a normal program that just uses BIOS calls like we would use syscalls these days.
(I’ve also read a lot of warnings, like “don’t use the BIOS for this or that”. Mostly because it tends to be very slow.)
We use all the Microsoft programs at work - Teams and Outlook especially.
After all kinds of technical problems with Teams, that sometimes go unresolved for over a year, Microsoft shifted their priorities away from fixing things and towards adding an annoying AI Copilot button, that just takes up space and all it does, is loads the website in Teams, so I disabled it. Soon they just add it back, but in a different row of icons, therefore it’s now a different button, you have to disable (I think they added yet another one, to the Teams, on my work phone and I had to disabled that too). Not too long after, the desktop one just enabled itself, because of “an error” and I can disable it, but doing so activates a popup, that begs you to turn it back on, every once in a while. You can’t disable the popup and can only click “Yes” or “Not now” on it. I still keep it disabled, out of principle, but yesterday I noticed yet another Copilot button, this time in the top right corner of my Outlook and this one cannot be disabled, on the business version of Outlook and even on the personal one, it’s only possible to do it through hidden privacy settings, by prohibiting the program from connecting to Microsoft servers, for extra “features”.
There’s people complaining about it online, so it’s clear nobody really wants it, but at this point Microsofts position is that you will have at least one useless AI button on your screen, at any given time, and you will be happy. And yes, their AI sucks and if I absolutely have to use AI for something, there’s already 2 better options, we have access to, at work.
** To the surprise of literally no one, I’m working on implementing a programming language all my own **
Inspired by conversation at a recent Future of Coding event, I decided I’d write up a little something about the programming language I’ve been working on (for what feels like forever) before I’ve gotten it to a totally shareable state. I have a working interpreter that I’m pretty pleased with, but I don’t yet have an interact … ⌘ Read more
Back to Win16 8-) New arrivals of fixed programs for Win31. A big collection of tested network software for Win31. gopher://shibboleths.org/1/win31
This is why I love tech from that era.
Write bytes to a parallel port and stuff happens. If it’s just ASCII bytes, then it will print ASCII text. Even the simplest programs can use a printer this way.
With a little bit of ESC/P, you can print images and other fancy stuff. That’s what I did this morning – never worked with ESC/P before, now I can print images. It’s not that hard.
Hayes-compatible modems are similar: Write some AT commands to the serial port and the modem does things. This isn’t even arcane knowledge, it’s explained in the printed manual.
Maybe I’m wearing rose-tinted glasses here, but I think with all this old stuff, you get useful results very quickly and the manuals are usually actually helpful. It’s so much easier to get started and to use this hardware to the full extent. Much less complexity than what we have today, not a ton of libraries and dependencies and SDKs and cloud services and what not.
@thecanine@twtxt.net Wow. I’m not an artist in any way, but I have tried to make icons for programs or fonts every now and then. Making something that is still recognizable at so few pixels is hard. Hats off!
Video: C Programming on System 6 - VCFMW, CMaster ⌘ Read more
I have a #CreativeCoding course at Domestika, teaching the first steps of #Python and #py5. The feedback from students always makes me happy!
Check out this work by a student:
https://www.domestika.org/en/projects/1841169-programacion?ttag=a_b_a_villares
And other testimonials:
I have a #CreativeCoding course at Domestika, teaching the first steps of #Python and #py5. The feedback from students always makes me happy!
Check out this work by a student:
https://www.domestika.org/en/projects/1841169-programacion?ttag=a_b_a_villares
And other testimonials:
Updating my #Processing + #Python tools table:
After some years, things changed and my opinions changed a bit too:
#py5 is going supper strong and the “new snake_case names” are not an issue for me anymore. I used to worry a lot about all the Processing Python mode examples and teaching materials out there, and some of my own, with “CamelCase Processing names” I’m not worried at all about it anymore!
For the record, Processing Python mode is just a legacy thing, no one should start anything with it.
The great pure Python Processing implementation project #p5py seems stalled, latest release in Dec. 2023 :((( Advancing it was always going to be an uphill battle…
The unrelated Brython based site
p5py.comseems to be gone, so I removed it from the table.I added a link to my own #pyp5js hack py5pjs/py5mode because this is what I’m using most nowadays.
Updating my #Processing + #Python tools table:
After some years, things changed and my opinions changed a bit too:
#py5 is going super strong and the “new snake_case names” are not an issue for me anymore. I used to worry a lot about all the Processing Python mode examples and teaching materials out there, and some of my own, with “CamelCase Processing names” I’m not worried at all about it anymore!
For the record, Processing Python mode is just a legacy thing, no one should start anything with it.
The great pure Python Processing implementation project #p5py seems stalled, latest release in Dec. 2023 :((( Advancing it was always going to be an uphill battle…
The unrelated Brython based site
p5py.comseems to be gone, so I removed it from the table.I added a link to my own #pyp5js hack py5pjs/py5mode because this is what I’m using most nowadays.
Updating my #Processing + #Python tools table:
After some years, things changed and my opinions changed a bit too:
#py5 is going super strong and the “new snake_case names” are not an issue for me anymore. I used to worry a lot about all the Processing Python mode examples and teaching materials out there, and some of my own, with “CamelCase Processing names” I’m not worried at all about it anymore!
For the record, Processing Python mode is just a legacy thing, no one should start anything with it.
The great “pure Python” (no Java required) Processing implementation project #p5py seems stalled, latest release in Dec. 2023 :((( Advancing it was always going to be an uphill battle…
The unrelated Brython based site
p5py.comseems to be gone, so I removed it from the table.I added a link to my own #pyp5js hack py5pjs/py5mode because this is what I’m using most nowadays.
Updating my #Processing + #Python tools table:
After some years, things changed and my opinions changed a bit too:
#py5 is going super strong and the “new snake_case names” are not an issue for me anymore. I used to worry a lot about all the Processing Python mode examples and teaching materials out there, and some of my own, with “CamelCase Processing names” I’m not worried at all about it anymore!
For the record, Processing Python mode is just a legacy thing, no one should start anything new with it.
The great “pure Python” (no Java required) Processing implementation project #p5py seems stalled, latest release in Dec. 2023 :((( Advancing it was always going to be an uphill battle…
The unrelated #Brython based site
p5py.comseems to be gone, so I removed it from the table.I added a link to my own #pyp5js hack py5pjs/py5mode because this is the version of pyp5js I’m using most nowadays.
You can explicitly use colors in manpages. I saw this in the apt manpage of Ubuntu recently, which, for some reason, uses blue text in one place:
https://movq.de/v/de5ab72016/s.png
Makes little sense to me. I’m glad that most manpages don’t do this. I wouldn’t want unicorn vomit all over the place.
Using colors can be done using the low level commands \m and \M:
.TH foo_program 3
\m[blue]I'm blue\m[], da ba dee.
\m[red]\M[yellow]I'm red on yellow.\m[]\M[]
This is quite horrible.
@kat@yarn.girlonthemoon.xyz On the one hand, all these programs have a very long history and the technology behind manpages is actually very powerful – you can use it to write books:
https://www.troff.org/pubs.html
I have two books from that list, for example “The UNIX programming environment”:
https://movq.de/v/c3dab75c97/upe.jpg
It’s a bit older, of course, but it looks and feels like a normal book, and it uses the same tech as manpages – which I think is really cool. 😎
It’s comparable to LaTeX (just harder/different to use) but much faster than LaTeX. You can also do stuff like render manpages as a PDF (man -Tpdf cp >cp.pdf) or as an HTML file (man -Thtml cp >cp.html). I think I once made slides for a talk this way.
On the other hand, traditional manpages (i.e., ones that are not written in mandoc) do not use semantic markup. They literally say, “this text is bold, that text over here is italics”, and so on.
So when you run man foo, it has no other choice but to show it in black, white, bold, underline – showing it in color would be wrong, because that’s not what the source code of that manpage says.
Colorizing them is a hack, to be honest. You’re not meant to do this. (The devs actually broke this by accident recently. They themselves aren’t really aware that people use colors.)
If mandoc and semantic markup was more commonly used, I think it would be easier to convince the devs to add proper customizable colors.
In 1996, they came up with the X11 “SECURITY” extension:
https://www.reddit.com/r/linux/comments/4w548u/what_is_up_with_the_x11_security_extension/
This is what could have (eventually) solved the security issues that we’re currently seeing with X11. Those issues are cited as one of the reasons for switching to Wayland.
That extension never took off. The person on reddit wonders why – I think it’s simple: Containers and sandboxes weren’t a thing in 1996. It hardly mattered if X11 was “insecure”. If you could run an X11 client, you probably already had access to the machine and could just do all kinds of other nasty things.
Today, sandboxing is a thing. Today, this matters.
I’ve heard so many times that “X11 is beyond fixable, it’s hopeless.” I don’t believe that. I believe that these problems are solveable with X11 and some devs have said “yeah, we could have kept working on it”. It’s that people don’t want to do it:
Why not extend the X server?
Because for the first time we have a realistic chance of not having to do that.
https://wayland.freedesktop.org/faq.html
I’m not in a position to judge the devs. Maybe the X.Org code really is so bad that you want to run away, screaming in horror. I don’t know.
But all this was a choice. I don’t buy the argument that we never would have gotten rid of things like core fonts.
All the toolkits and programs had to be ported to Wayland. A huge, still unfinished effort. If that was an acceptable thing to do, then it would have been acceptable to make an “X12” that keeps all the good things about X11, remains compatible where feasible, eliminates the problems, and requires some clients to be adjusted. (You could have still made “X11X12” like “XWayland” for actual legacy programs.)
I wasn’t really aware until recently that programs can’t choose their own window’s position on Wayland. This is very weird to me, because this was not an issue on X11 to begin with: X11 programs can request a certain position and size, but the X11 WM ultimately decides if that request is being honored or not. And users can configure that.
But apparently, this whole thing is a heated debate in the Wayland world. 🤔
New World Chaos 7: Program of Life-and-Death | https://nilfm.cc/mixes.html
@prologic@twtxt.net Cool! What program do you use to draw this up?
I wish I could watch this (maybe they’ll record it… but I’m not sure):
“From #Fortran to #Python: A Conversation Across Generations of #ScientificComputing” #PyOhio
https://www.pyohio.org/2025/program/talks/from-fortran-to-python/
@movq@www.uninformativ.de Huuuhhh?! Did I get this correctly? There are programs installed that miss (some of) their dependencies?! What the heck! O_o
gomdn: Yet another Static Site Generator
Yet another Static Site Generator (SSG), but this one is mine.
It’s a stupidly simple Go program ( wc says 229 lines), more like a
hack, really, but I don’t need something like Hugo. Most of the real
work is done by the goldmark package, of course. This is mostly just a
wrapper, deciding if something needs to be rebuilt.
I’ve been using a Perl script together with cmark (originally
Markdown.pl) since forever. And before that the old [txt2tags](htt … ⌘ Read more
setpriv on Linux supports Landlock.
Another example:
$ setpriv \
--landlock-access fs \
--landlock-rule path-beneath:execute,read-file:/bin/ls-static \
--landlock-rule path-beneath:read-dir:/tmp \
/bin/ls-static /tmp/tmp/xorg.atom
The first argument --landlock-access fs says that nothing is allowed.
--landlock-rule path-beneath:execute,read-file:/bin/ls-static says that reading and executing that file is allowed. It’s a statically linked ls program (not GNU ls).
--landlock-rule path-beneath:read-dir:/tmp says that reading the /tmp directory and everything below it is allowed.
The output of the ls-static program is this line:
─rw─r──r────x 3000 200 07-12 09:19 22'491 │ /tmp/tmp/xorg.atom
It was able to read the directory, see the file, do stat() on it and everything, the little x indicates that getting xattrs also worked.
3000 and 200 are user name and group name – they are shown as numeric, because the program does not have access to /etc/passwd and /etc/group.
Adding --landlock-rule path-beneath:read-file:/etc/passwd, for example, allows resolving users and yields this:
─rw─r──r────x cathy 200 07-12 09:19 22'491 │ /tmp/tmp/xorg.atom
The WM_CLASS Property is used on X11 to assign rules to certain windows, e.g. “this is a GIMP window, it should appear on workspace number 16.” It consists of two fields, name and class.
Wayland (or rather, the XDG shell protocol – core Wayland knows nothing about this) only has a single field called app_id.
When you run X11 programs under Wayland, you use XWayland, which is baked into most compositors. Then you have to deal with all three fields.
Some compositors map name to app_id, others map class to app_id, and even others directly expose the original name and class.
Apparently, there is no consensus.
@prologic@twtxt.net Yeah, this really could use a proper definition or a “manifest”. 😅 Many of these ideas are not very wide spread. And I haven’t come across similar projects in all these years.
Let’s take the farbfeld image format as an example again. I think this captures the “spirit” quite well, because this isn’t even about code.
This is the entire farbfeld spec:
farbfeld is a lossless image format which is easy to parse, pipe and compress. It has the following format:
╔════════╤═════════════════════════════════════════════════════════╗
║ Bytes │ Description ║
╠════════╪═════════════════════════════════════════════════════════╣
║ 8 │ "farbfeld" magic value ║
╟────────┼─────────────────────────────────────────────────────────╢
║ 4 │ 32-Bit BE unsigned integer (width) ║
╟────────┼─────────────────────────────────────────────────────────╢
║ 4 │ 32-Bit BE unsigned integer (height) ║
╟────────┼─────────────────────────────────────────────────────────╢
║ [2222] │ 4x16-Bit BE unsigned integers [RGBA] / pixel, row-major ║
╚════════╧═════════════════════════════════════════════════════════╝
The RGB-data should be sRGB for best interoperability and not alpha-premultiplied.
(Now, I don’t know if your screen reader can work with this. Let me know if it doesn’t.)
I think these are some of the properties worth mentioning:
- The spec is extremely short. You can read this in under a minute and fully understand it. That alone is gold.
- There are no “knobs”: It’s just a single version, it’s not like there’s also an 8-bit color depth version and one for 16-bit and one for extra large images and one that supports layers and so on. This makes it much easier to implement a fully compliant program.
- Despite being so simple, it’s useful. I’ve used it in various programs, like my window manager, my status bars, some toy programs like “tuxeyes” (an Xeyes variant), or Advent of Code.
- The format does not include compression because it doesn’t need to. Just use something like bzip2 to get file sizes similar to PNG.
- It doesn’t cover every use case under the sun, but it does cover the most important ones (imho). They have discussed using something other than RGBA and decided it’s not worth the trouble.
- They refrained from adding extra baggage like metadata. It would have needlessly complicated things.
** Om nom nom LLMs, in which I respond to Simon Willison’s analogy **
I am hesitant to wade into the tumultuous waters that are the discourse around generative AI and LLMs, but this morning I came across a thing that so thoroughly melted my brain I feel uncontrollably compelled to respond.
This morning, at evidently 4:10 AM (no mention of timezone), Simon Willison shared the following blog post, quoted here in full:
Quitting programming as … ⌘ Read more
Just realized: One of the reasons why I don’t like “flat UIs” is that they look broken to me. Like the program has a bug, missing pixmaps or whatever.
Take this for example:
https://movq.de/v/8822afccf0/a.png
I’m talking about this area specifically:
https://movq.de/v/8822afccf0/a%2Dhigh.png
One UI element ends and the other one begins – no “transition” between them.
The style of old UIs like these two is deeply ingrained into my brain:
https://movq.de/v/8822afccf0/b.png
https://movq.de/v/8822afccf0/c.png
When all these little elements (borders, handles, even just simple lines, …) are no longer present, then the program looks buggy and broken to me. And I’m not sure if I’ll ever be able to un-learn that.
I did a “lecture”/“workshop” about this at work today. 16-bit DOS, real mode. 💾 Pretty cool and the audience (devs and sysadmins) seemed quite interested. 🥳
- People used the Intel docs to figure out the instruction encodings.
- Then they wrote a little DOS program that exits with a return code and they used uhex in DOSBox to do that. Yes, we wrote a COM file manually, no Assembler involved. (Many of them had never used DOS before.)
- DEBUG from FreeDOS was used to single-step through the program, showing what it does.
- This gets tedious rather quickly, so we switched to SVED from SvarDOS for writing the rest of the program in Assembly language. nasm worked great for us.
- At the end, we switched to BIOS calls instead of DOS syscalls to demonstrate that the same binary COM file works on another OS. Also a good opportunity to talk about bootloaders a little bit.
- (I think they even understood the basics of segmentation in the end.)
The 8086 / 16-bit real-mode DOS is a great platform to explain a lot of the fundamentals without having to deal with OS semantics or executable file formats.
Now that was a lot of fun. 🥳 It’s very rare that we do something like this, sadly. I love doing this kind of low-level stuff.
** Of fairies, compost, and computers **
Lately I’ve buried myself in reading fiction. Stand outs from among the crowd are, of course, Middlemarch but also a lot of sort of scholarly fairy fiction; works that follow the scholastic adventures of studious professorial types in vaugely magical settings. Namely Emily Wilde’s Encyclopedia of Faeries’, Heather Fawcett and The Ten Thousand Doors of January, Alix E. Harrow.
I’ve also been working on a handful of personal utility programs. I … ⌘ Read more
Saw this on Mastodon:
https://racingbunny.com/@mookie/114718466149264471
18 rules of Software Engineering
- You will regret complexity when on-call
- Stop falling in love with your own code
- Everything is a trade-off. There’s no “best” 3. Every line of code you write is a liability 4. Document your decisions and designs
- Everyone hates code they didn’t write
- Don’t use unnecessary dependencies
- Coding standards prevent arguments
- Write meaningful commit messages
- Don’t ever stop learning new things
- Code reviews spread knowledge
- Always build for maintainability
- Ask for help when you’re stuck
- Fix root causes, not symptoms
- Software is never completed
- Estimates are not promises
- Ship early, iterate often
- Keep. It. Simple.
Solid list, even though 14 is up for debate in my opinion: Software can be completed. You have a use case / problem, you solve that problem, done. Your software is completed now. There might still be bugs and they should be fixed – but this doesn’t “add” to the program. Don’t use “software is never done” as an excuse to keep adding and adding stuff to your code.
Okay, here’s a thing I like about Rust: Returning things as Option and error handling. (Or the more complex Result, but it’s easier to explain with Option.)
fn mydiv(num: f64, denom: f64) -> Option<f64> {
// (Let’s ignore precision issues for a second.)
if denom == 0.0 {
return None;
} else {
return Some(num / denom);
}
}
fn main() {
// Explicit, verbose version:
let num: f64 = 123.0;
let denom: f64 = 456.0;
let wrapped_res = mydiv(num, denom);
if wrapped_res.is_some() {
println!("Unwrapped result: {}", wrapped_res.unwrap());
}
// Shorter version using "if let":
if let Some(res) = mydiv(123.0, 456.0) {
println!("Here’s a result: {}", res);
}
if let Some(res) = mydiv(123.0, 0.0) {
println!("Huh, we divided by zero? This never happens. {}", res);
}
}
You can’t divide by zero, so the function returns an “error” in that case. (Option isn’t really used for errors, IIUC, but the basic idea is the same for Result.)
Option is an enum. It can have the value Some or None. In the case of Some, you can attach additional data to the enum. In this case, we are attaching a floating point value.
The caller then has to decide: Is the value None or Some? Did the function succeed or not? If it is Some, the caller can do .unwrap() on this enum to get the inner value (the floating point value). If you do .unwrap() on a None value, the program will panic and die.
The if let version using destructuring is much shorter and, once you got used to it, actually quite nice.
Now the trick is that you must somehow handle these two cases. You must either call something like .unwrap() or do destructuring or something, otherwise you can’t access the attached value at all. As I understand it, it is impossible to just completely ignore error cases. And the compiler enforces it.
(In case of Result, the compiler would warn you if you ignore the return value entirely. So something like doing write() and then ignoring the return value would be caught as well.)
We really are bouncing back and forth between flat UIs and beveled UIs. I mean, this is what old X11 programs looked like:
https://www.uninformativ.de/desktop/2025%2D06%2D21%2D%2Dkatriawm%2Dold%2Dxorg%2Dapps.png
Good luck figuring out which of these UI elements are click-able – unless you examine every pixel on the screen.
pledge() and unveil() syscalls:
@movq@www.uninformativ.de That sounds great! (Well, they actually must have recorded the audio with a potato or so.) You talked about pledge(…) and unveil(…) before, right? I somewhere ran across them once before. Never tried them out, but these syscalls seem to be really useful. They also have the potential to make one really rethink about software architecture. I should probably give this a try and see how I can improve my own programs.
@prologic@twtxt.net I’m trying to call some libc functions (because the Rust stdlib does not have an equivalent for getpeername(), for example, so I don’t have a choice), so I have to do some FFI stuff and deal with raw pointers and all that, which is very gnarly in Rust – because you’re not supposed to do this. Things like that are trivial in C or even Assembler, but I have not yet understood what Rust does under the hood. How and when does it allocate or free memory … is the pointer that I get even still valid by the time I do the libc call? Stuff like that.
I hope that I eventually learn this over time … but I get slapped in the face at every step. It’s very frustrating and I’m always this 🤏 close to giving up (only to try again a year later).
Oh, yeah, yeah, I guess I could “just” use some 3rd party library for this. socket2 gets mentioned a lot in this context. But I don’t want to. I literally need one getpeername() call during the lifetime of my program, I don’t even do the socket(), bind(), listen(), accept() dance, I already have a fully functional file descriptor. Using a library for that is total overkill and I’d rather do it myself. (And look at the version number: 0.5.10. The library is 6 years old but they’re still saying: “Nah, we’re not 1.0 yet, we reserve the right to make breaking changes with every new release.” So many Rust libs are still unstable …)
… and I could go on and on and on … 🤣
OpenBSD has the wonderful pledge() and unveil() syscalls:
https://www.youtube.com/watch?v=bXO6nelFt-E
Not only are they super useful (the program itself can drop privileges – like, it can initialize itself, read some files, whatever, and then tell the kernel that it will never do anything like that again; if it does, e.g. by being exploited through a bug, it gets killed by the kernel), but they are also extremely easy to use.
Imagine a server program with a connected socket in file descriptor 0. Before reading any data from the client, the program can do this:
unveil("/var/www/whatever", "r");
unveil(NULL, NULL);
pledge("stdio rpath", NULL);
Done. It’s now limited to reading files from that directory, communicating with the existing socket, stuff like that. But it cannot ever read any other files or exec() into something else.
I can’t wait for the day when we have something like this on Linux. There have been some attempts, but it’s not that easy. And it’s certainly not mainstream, yet.
I need to have a closer look at Linux’s Landlock soon (“soon”), but this is considerably more complicated than pledge()/unveil():