July 12, 2024

Ten Thousand Lines of VBA



Hello!

Welcome to the third popey newsletter. Another week closer to Christmas!

It'll be even closer once you finish reading this lot!



-[ Contrafibularities ]-
Unsolicited email. The good kind.

Back in April 2024, I wrote a blog post about my personal "focus struggles" over the years, which led me to get an ADHD diagnosis recently. Since then I've head a steady trickle of private responses. Obviously, I will not share the details of those private messages, but wanted to call out the fact I'm still getting them.

I recived one this week, from another middle-aged person who realised something wasn't quite right. After they read the blog post, they were inspired to get some help and sent me a quick 'Thank you'.

Every time I get a mail like that it gives me the warm fuzzies. Not because someone was struggling, obviously. But, like me, they've started the process of understanding things around them a bit better. That can only be a good thing. Any doubts I had over sharing the personal blog post are long gone.




-[ Create ]-
Rem Nuclear Power Station Simulator

Uh, actually, it's a "Pressurised Water Reactor (PWR) Simulator", or "MiniSim" as it's colloquially known. This is an Excel spreadsheet (!) I've been playing with.

Written by Colin Tucker at EDF Energy between 2011 and 2018, MiniSim is a PWR training environment inside an Excel workbook coded in around ten thousand lines of VBA macros and two thousand comments! It's clearly a labour of love.

A while back Will from Late Night Linux sorted a jolly-boys day out to Sizewell B - a Pressurised Water Reactor in the UK. It was a great afternoon of nerdery! Ben wrote up some notes.

While we were at the station, Dave (and the other trainers) showed us MiniSim, which is used for some training scenaios in the power plant. In MiniSim, you're presented with a graphical representation of panels, indicators, electrical systems and more, as a cut-down generic simulation of a PWR like Sizewell B.

I try to keep images to a minimum in this newsletter. So if you'd like to see MiniSim, check out page 14 of this (PDF) IAEA Operational Safety Review Team (OSART) report into safety at Sizewell B.

This week I was attempting to get MiniSim running on my work Mac, as that's the machine I had with me at the time. The MiniSim manual recommends using Excel 2010 on Windows - which works fine - but newer versions of Office don't, and on the Mac, it's much worse. It also doesn't work directly on Linux at all as none of the Office products you're thinking of actually support VBA macros. I didn't try Office under WINE.

I signed up for a 'Free Trial' of Microsoft Office, which I will have to start paying for soon, or cancel.

Launching MiniSim in a modern Microsoft Office on macOS just errors immediately, popping up a Windows-style dialog box pointing a finger at USER32.DLL. I hacked and slashed the VBA macros to try and get it running. I got it semi-functional by ripping out some Windows-specific code, and replacing it with hard-wired values that worked on the Mac. MiniSim does some interesting window management on startup, and plays audio with Windows system calls. None of that works on macOS.

I've never written a line of VBA in my life, and am far from an Excel whizz. The code is somewhat complex, perhaps unsurprisingly, given what it's simulating, with a lot of terminology and formulas I don't yet understand. But it's also relatively simple in a way, taking input, doing some maths, and lighting up alarms when errors occur.

The complexity mostly comes from the model of VBA code reading from and writing to cells across a dozen sheets, updating the user interface by poking colours and values in cells, while Excel is also calculating forumlas in other cells. This foray into Microsoft macOS Madness has been fun, but I don't really need VBA macro knowledge in my life. There's a nerd gremlin on my shoulder, suggesting I port MiniSim to some other platform or language. Maybe...




A drive-by fruiting

At work, this week Syft v1.9.0 was released! An interested user asked when the homebrew package would get updated, which got me wondering, from the upstream perspective, how up-to-date the packages are everywhere.

I don't often (if ever) use it, but repology lists syft across a bunch of repositories. There's a real mix of versions available! At the time of writing only homebrew and Scoop were on the latest release. There is some irony that the most updated packages are predominantly used on macOS and Windows. Probably the least-used platforms for all of our Open Source tools.

Aside: Syft has a 'curl piped to bash' installer which just grabs the latest binary, and a lot of people seem to use that.

Many of the Linux distros either have a bot which bumps the release, or an enthusiast individual (or team of) maintainer(s). I pondered how hard it might be to contribute an update to one of the distros that I've never previously touched. So I dived head-first into the world of Void Linux - which I've never used - or contribted in any way.

It didn't take long to spin up a Void Linux VM in Quickemu. I didn't have much to do beyond update the version and checksum in the package definition, then build and test it. Everything worked first time. The package updates process is both well documented, and searchable online. I had no real issues beyond unfamiliarity.

So I did a drive-by PR. It was a fun and stress-free contribution and learning exercise. I'll keep the VM around, in case I want to update Syft or any of our other packages in the future. This got me wondering, would I have done this drive-by contribution if the repo was not on GitHub?


docker build -t relent .

For a long while I've made a point of avoiding Docker and Kubernetes. While I worked at Canonical I had no use for it, and outside work I have always been a VMs or bare metal kinda guy. I have heavily used LXD over the years to quickly spin up containers, but they were typically ephemeral. I never really deployed anything using LXD.

Since started at Anchore, it's Docker, Kubernetes, Docker, Docker, Docker all day long! This is having an effect, Docker is growing on me. It's still super weird, causes timeouts on my workstation, and collides with other software on my Linux machine. But I'm learning to tolerate it more each day. I'm seriously considering migrating all the weird stuff I have on my home HP MicroServer to Docker containers.

It's mostly a load of random python and shell scripts running via cron, or left running in a loop in a tmux session. That's one reason why I never turn it off!

 alan@earth.local:~$ uptime
 13:40:29 up 345 days, 18:36, 15 users,  load average: 1.26, 1.46, 1.68

Time to get organised, I think! I will need to audit all the nonsense on that box first and see if I still need any of it.

Make a list, that's always step one!




-[ Consume ]-
Hey Siri, find my ear trumpet

I listen to quite a few podcasts, mostly while commuting, cooking or failing to sleep. The audio production on some of them is highly variable. I'm not going to point fingers, because, we're keeping things positive around here. I will say this doesn't apply to any of the Late Night Linux family of shows. grin

I had a private low-impact, side-moan in Joe's vicinity. Joe produces Linux Matters along with all other the Late Night Linux family of shows. Joe explained some of the steps in his podcast processing pipeline that perhaps other audio engineers don't do. He does a great job, especially if you heard the shocking source files we sometimes send him! (sorry Joe) Maybe one day we'll do an outtakes episode. It would be full of audible mirth and naughty words, I suspect.

--AD-------------------
Late Night Linux Patreon supporters (of which I am one) can get the show a little early and without adverts for a small consideration. If you are already a supporter, we appreciate it. Without your support, we couldn't make those shows. Thank you.
-------------------/AD--

This led me to ask a simple question on the socials Mastodon, Threads and BlueSky. I wasn't looking specifically for Linux, or even 'Tech' podcasts. I just wanted something new that wouldn't annoy me to listen to.

Happily I got a bunch of suggestions on Masto, and mostly tumbleweed on the other platforms. I'm going to spend a bit of Friday going through these to find something new to listen to. You may want to take a look and listen as well. Enjoy.




-[ Comment ]-
Engage

Not the "Take us out of here" kind of "Engage 👨🏼‍🦲👉 ", but the modern social media ★engagement★ kinda thing. In the last few years, social media has (in my perspective) morphed. On networks other than Mastodon, the only way to post something which generates clicks is to ask questions.

Yes, I hear you, 'Always has been' meme. Maybe.

These fall into a few main categories from the genuine "How do I do / What is this thing / Why does this happen", through the often global rage-bait "Why do $REGIONAL_POPULATION do $THING_I_AM_UNFAMILIAR_WITH?!" and often in the style of "I already have a baked opinion on this, but I am going to ask anyway" to trigger arguments ★engagement★ to the more obvious, and sometimes fun "How do you do $COMMON_ACTIVITY, wrong answers only."

Clearly I get why people do this, from naive curiosity to an obvious attention grab, or trigger a response, get clicks, raise their profile, increase brand awareness, trolling and so on.

Recently, sadly, I noticed, that some of my Internet Friends have found it necessary to reply with negativity, chastising the questioner or suggesting they 'Google' the answer, whatever that means. I'm here to tell you, this is not the way, my friends.

Some might say it's best to dis-engage and continue scrolling or close the window, and perhaps shut the computer down, and then go and live in a commune.

I chose another path. I have taken it upon myself to "combat" (or contribute to) this scourge with vaugely nonsensical, barely comical responses to the OP. Maybe the OP will see my friendly reply, rather than the comative negativity of my friends. I can dream.

You may be surprised how often "Borland Turbo Pascal for DOS" is the correct answer to many of these questions asked on the Internet. It passes the time to try, at least, and rarely generates rage, mostly just confusion. A man's gotta have a hobby. Week 28's is this. I honestly can't see it lasting though. Because now I have an overwhelming urge to install Turbo Pascal and make a ★Turbo Vision★ app.



Thanks for making is this far through the stream of consciousness newsletter.

-- popey


You are receiving this email because you have been subscribed to the popey newsletter. If you have any questions, feel free to contact me.

Newsletters may contain 'smart' Amazon links. As an Amazon Associate, I earn from qualifying purchases.

© Copyright 2024 Alan Pope. All rights reserved



EOF