Hacking Life
Ahh it must be the yearly update-the-blog time. I will go check ... early July last year, so a little late but not far off. I usually think about posting because a) I'm depressed more than usual, and; b) winter sucks. The two usually conincide anyway.
Been a long year.
I was spending way too much time and money out of the house all summer. I guess it had it's moments but ultimately it was pretty empty, and beers at the pub are getting expensive. I have a few good friends but they seem to be dwindling and I can't seem to make any new ones. Or somehow end up with whomever's left over and find out they've been left-over for a reason. Then things went downhill a bit.
Death in the Family
The old lady died about 3 months ago and while I hadn't seen her for years watching her dying in the hospital was pretty traumatic, plus it had me thinking about things like our childhood, my two dead brothers, and that I never really had a father because he died so young. Plus I had to identify the body twice which was a whole barrel of fun. Caught up with some brothers and other family I hadn't seen in years which was something I suppose.
That sort of indirectly lead to a bit of a burn-out and I stopped going out for weeks and I've spent a lot of the time since just around the house. Longest I went was 3 weeks without leaving the house or yard at all but I'm trying to get out at least once a week at the moment even if I don't always enjoy it a lot (it's had it's moments). I hadn't been riding much anyway because of the weather and I've been doing even less since. Lost a bit of weight (5%?) — which is mostly ok but I don't really need to lose any more. Saved quite a bit of money. Bought a 3D printer.
Hacking
Since I've been home a lot I've been doing lots and lots of programming, in part because I just feel shithouse If I'm not keeping completely busy. A way to pass the time and keep my mind occupied. I should probably include some screenshots and so on down here but I can't be arsed today — I'm just feeling tired and over it.
When I got the 3D printer I spent a lot of time playing around in OpenSCAD and OrcaSlicer. They're such a massive pain to get running on slackware and gentoo I was first using a virtual machine with ubuntu on it - but that was so fucking slow with OpenGL it was barely useable. Eventually I worked out how to get an ubuntu environment running via chroot and that fixed the performance problems at least. They're still a pain to setup - appimage is the best of the worst, but even in ubuntu the python version mess (each minor version breaks comatibility) means i'm running an older version of OpenSCAD. Anyway I got into making some interesting designs for a few weeks; parameterised project boxes, a power button for my pc, and a water-cracker biscuit cutter, amongst other things. OrcaSlicer is almost right but I can't get the first later filled enough. I ordered another 8Kg of different plastics and then built a glass and wood cabinet for the printer out of scrap (and a 3d printed set of hinges) ... and then haven't touched any of it since. Half the house looks like an ali-express delivery truck crashed into it (not that I would get filament from there, it's one of those odd products that's cheaper just getting locally).
Because the CAD software was a bit pants I looked into that quite a bit, played with manifold some, worked a lot on trying to get signed distance fields to create a high res high quality manifold in reasonable time and space. I failed so far; it's a hard problem and marching cubes doesn't cut it. I did generate some interesting arty pictures though, especially in the 2D versions.
As an aside all the big numerical packages are going heavily into templated C++. It's a massive pita when you try to compile anything that uses them - incredibly slow build times, cascading graphs of obscure dependencies, and then there's cmake. Why, just why. It barely works outside of the original developers environment and then the cmake version bumps and breaks even that. What a disaster for free software and software reusability.
JavaFX
I hit an annoying performance bug in JavaFX along the way and ended up spending a few late nights on a wet weekend finding out why. I can't believe it uses gdk_add_timeout to perform frame timing! Ugh. The man page even says it's completely unsuitable for this, apart from only having millisecond precision it isn't free-running so is guaranteed to drift. There seems to be some logic in JavaFX to handle this sort of timing; but none of it ever seems to get called.
But that wasn't the performance problem; if you add an animation it just runs the animation (and all the update and redraw logic) absolutely flat-chat as described in JDK-8210547. It only appears smooth because the monitor is still only updating at the monitor frame-rate. After a lot of faffing about I worked out how to vsync in OpenGL and a possible place to hook it into the rendering pipeline and wrote a patch for it. It's almost perfectly smooth with the patch on, only runs the animations once per frame and so uses far less cpu time.
It's not perfect because it overrides all animations to run at the video frame-rate (not a bad thing tbh), and the pulse timer is based on some point soon after the vblank wait. Which isn't great because it means maximum latency between calculation and display, but it's an interesting start. And when you don't have an animation active it is still held up by the terribly choice of gdk_timeout timing so occasionally re-runs animations (the animation system does this anyway itself, as is always calls an animation at the start and finish, even if it's a cyclic animation) or visually drops a frame.
Anyway before I spent the weekend on it I sent a questing post to the javafx list but never got a reply because you have to subscribe first (obvious in hindsight but I was being optimistic given the way the page is presented). Not sure if I'll bother trying to subscribe or sending them the patch, the project seems deadish which really sucks as much of the code really is very nice. There's some other odd decisions - each window gets it's own rendering context but there is only a single rendering thread. So once you get high frame-rates and multiple windows the GLContext switching time grows significant. It's also fairly complex so it's hard to work out how to improve it.
notzed.nativez
Thinking about using manifold from java led me to working on on notzed.nativez (aka NativeZ) again for a bit.
I spent a stupid amount of time on it. I've now completely dropped the perl generator - I just never used perl enough to really be proficient in it and all the neat little tricks I managed to work out in the generator I forgot about when I revisited it often years later. The Java version is actually smaller, faster, much easier to follow and even does more; for the most part anyway. I spent (or wasted?) excessive time on code size reduction and re-use just because I could - I think I rewrote the template system about 3 times in a week. I also improved the gcc plugin output a bit.
As part of that effort I also revisited the java.make project. I added support for junit5 and continue to tweak and improve the makefile. I have another related side-project that I've been exploring for a while (years?) to improve compile times and accuracy for Java builds (called 'notzed.buildz'). As part of that I have a javac compile server which can be started and then called locally to run the compiler from a script thus avoiding jvm start-up time. But the old version uses jdk.httpserver and a messy startup mechanism so was a bit clumsy/hard to secure. I explored using java.rmi to run a local server - wasted almost a whole day finding out you need to run the the Registry locally for it to run at all without a now completely-missing security manager (internet search is getting so useless). And when I got it working fine I gave up because it still needs quite a bit of jvm start-up time to run the tiny java.rmi client so just isn't worth it. I ended up writing a single-file-java implementation of a service which listens to a unix domain socket and implements http using it's own simplified implementation (jdk.httpserver can only work on Inet sockets), it's small (under 300 lines, under 130 if you only count ';') and simple and easy to start and stop from a bash script and invoke using curl.
Another part of that code-base is a dependency calculator. I had
(of course) my own simplified ClassFile scanner but now OpenJDK
comes with one so I converted the code over to use that instead -
although the api is quite different in practice it was almost
trivial to change they both mirror the ClassFile format itself in
macro. Actually I rewrote the dependency calculators a couple of
times too and am still not really happy with them - the code is
straightforward, it's just bulky because there are so many
repeated steps and I can't decided what outputs I ultimately want.
For example I think I can write a fairly small bit of code that
can scan a tree of classes and a tree of sources and determine
which classes are stale and can be deleted. javac
has a module compilation mode but it doesn't perform this step so
it's possible to get inaccurate (stale classes not being deleteD)
and incomplete builds (dependent classes not being rebuilt) that
wont run. I'm still thinking about it, no rush, and nobody else
gives a shit anyway.
I didn't expect it to be nearly as complex as it was to
process a --module-source-path
which can include
bash-like brace
expansions. My final solution compiles it into a simple
programme which describes the graph linearly and then executes it
with a simple stack machine. Still so much code for such a
seemingly simple convenience.
The original project was quite old - at the time they were relatively new or at least I hadn't used them much so I was adding lambdas and streams to everything and it turns out that's messy as fuck when you're dealing with i/o interfaces; so a lot of that went away and greatly greatly simplified everything. As I never really saw the need before and just haven't been hacking a lot for a few years; this also exposed me to some of the newer Java constructs like pattern matching. Which has been more useful than I thought for tightening up code (in normal expressions) and avoiding mis-handled cases (in switch expressions or statements).
mal
The last few days I came across make a lisp (mal) and thought it might be a fun diversion for the weekend. Unfortunately it wasn't nearly as fun nor as informative as I had expected. Like most things lisp-related the guide was written from the perspective of someone who thinks lisp is every computer language, some of it was just not well defined and a lot of the structure suggested didn't make sense when I ran out of steps to perform. Also if you're going to the point of creating a new clean lisp why so many weird hold-overs from decades ago? I've gotten to the point of it self-hosting and even cleaned up and tuned the code a little bit but it hasn't given my any greater insights into lisp than the little I already had. Plus the mal project is basically dead anyway; seems clojure was the last great gasp of the lisps and the language is finally dying. Not sure if i'll bin it, archive it on code.zedzone.au, or archive it as a fork on github, as a potential scripting language for my projects I'm just not sure I GAF.
stuff
There's been other diversions along the way (I do have a LOT of free time); from code tinkering, exploring new software (Netbeans is really giving me the shits lately), to building physical things, exercise because my leg (post hip replacement and lack of riding) seems to have lost a lot of strength and mass, plus my arms are starting to hurt from all the M-x-ing. Walking, drinking. Trying to keep warm; the Reynaud's has been particularly bad this year and i'm generally just feeling miserably cold if it's not warm and sunny. And miserably miserable. Totally isolated and utterly alone. Watching some TV shows (sci-fi), reading books (also sci-fi), a little gardning. Finally cancelled my PS+ subscription - barely touched it for ages and I don't play online. Somehow losing weight seems to have increased my sleep apnoea so that's been bothering me more lately - feeling so tired every time you wake up makes it hard not to just end up having a shit waste-of-a-day. I feel tired. Maybe i'm not eating right.