Auto-start user service in screen on Debian 11

I have a QNAP with container station. It allows me to essentially have a number of single-purpose simple linux servers running on a single small nice headless computer.

It is annoying to start everything up on each container whenever the QNAP is restarted. It is quite easy to start things automatically, but as usual, a few steps of configuration can take a while to get 100% correct before it works properly.

In my case I have:

  • Debian 11 container
  • A user named zo0ok
  • zo0ok shall run screen, and in screen run the service (in this case sonarqube)

This is what I needed to do (assuming screen and sonarqube are already in place):

Create /etc/rc.local

This is my /etc/rc.local file (it does not exist before):

#!/bin/bash
sudo -u zo0ok screen -d -m /home/zo0ok/screen-startup.sh

This will run the screen-startup.sh script as zo0ok (not root) when the Debian starts.

Enable rc-local

Lets not complain about systemd and systemctl, but this shit has go be added to a new file

/etc/systemd/system/rc-local.service
----------------------------------------------------

[Unit]
 Description=/etc/rc.local Compatibility
 ConditionPathExists=/etc/rc.local

[Service]
 Type=forking
 ExecStart=/etc/rc.local start
 TimeoutSec=0
 StandardOutput=tty
 RemainAfterExit=yes
 SysVStartPriority=99

[Install]
 WantedBy=multi-user.target

And the service needs to be enabled:

# systemctl enable rc-local.service

Create screen-startup.sh

Finally, as your non privilaged user, create the file (with your content, of course):

screen-startup.sh 
----------------------------------------------------------

#!/bin/bash
cd /home/zo0ok/opt/sonarqube-9.4.0.54424/bin/linux-x86-64
./sonar.sh console

Conclusion and final words

This is obvioulsly more convenient than logging in and running screen manually, and obviously if you need any kind of error handling or restart-management that is a different story.

An alternative to systemd/systemctl is to use cron.

It looks very easy, but I had minor errors in all steps above that were a bit tricky to find, before it all worked.

PowerBook Titanium G4 867MHz in 2022

My PowerBook G4 has been in a box for a few years. Last posts on this blog about it are from 2015. It is a special computer to me and I started it up this summer 2022. It is configured as good as possible at 1024MB RAM, SuperDrive and 320GB HDD.

I stopped using my G4 actively in 2015 (kind of, I know I replaced it a few years earlier with a 2012 MacBook Pro, but I kept the G4 alive). There are still people on the internet using Apple PowerPC computer (search for PowerPC challenge on YouTube).

The fastest G4 computers were about 1600MHz, mine is just 867MHz. However my G4 can officially run the last MacOS X 10.5.8 that was ever released for PowerPC (not sure if G5 was somehow supported on 10.6). Released in 2002 and last Leopard release in 2009 it got 7 years of supported life. That is bad, but not horribly bad. Some later PowerPC Macs released in 2005 also turned unsupported in 2009 and that is criminally bad. (I currently write this on a MacBook Air 2014, Big Sur, it still receives updates but can not run latest macOS, so that is 8 years supported and counting).

JavaScript killed it!

Why is it not really useful today? Because internet – a web browser – does not work. The root of the problem is that Googles V8 was never ported to G4, and no modern (optimized) JavaScript engines were. As the internet was modernised with more and more JavaScript, G4 computers simply could not take part of it.

Today, starting up Safari of 10.5.8 is even worse. I can not even connect to my local broadband router. Two problems I think:

  • No support for modern SSL/TLS (old versions are rejected by server for security reasons)
  • No valid certificates

These problems could be worked around, but the JavaScript problem is harder.

TenForFox and InterWebPPC

Official Firefox and Safari are since long obsolete. However there has been a Firefox version: TenForFox (10.4 fireFOX), that was abandoned in 2021 but picked up again as InterWebPPC. That is probably the best browser you can on a G3/G4/G5 computer. It has surprisingly good JavaScript support when it comes to compability/features, but performance is not good on my 867MHz G4. That is, for no/low JS sites (like this blog) it works pretty good (for reading – editing this text was not possible at all with WP 6). For you general news site (like BBC, CNN) it is bad, and Youtube or Facebook are essentially useless.

General impression and useability

Web browing aside, I am quite impressed with both the machine and 10.5.8. To me it feels (kinf of) modern and fast, and there is not much I miss in MacOS X 10.5 itself. However I really have not really tried to download, install and use many standard programs from the time. When I start doing multiple things att the same time though, things get slow.

What I have done is to rip/backup DVDs I own. I have no other computer with a DVD-player. It seems MacOS X up to 10.5 had the best DVD-rip-program ever: MacTheRipper. It is super smooth. And when ripping is done (to a VIDEO_TS folder with MPEG2 data and all the DVD-menues in place) I can use standard unix command line tools to copy the files to my NAS over GBit ethernet. I have little to complain about at all.

Installing it

Just seeing the installation CDs/DVDs almost make me more nostalgic than the computer itself.

Top row is 10.0 (USD 129, essentially a public beta) and 10.1 (USD 19 upgrade), these were never used with this PowerBook. Next row is 10.3 (USD 199). Last row is 10.2 that came with the PowerBook and 10.5 (USD 19 upgrade). The missing disk is 10.4 (USD 199), that I bought together with a friend and he kept the original and I made a copy for myself.

When I took my PowerBook out of the box I found it with Debian. That was perhaps a smart choice in 2015 when Debian was supported and MacOS X was not. Now in 2022 they are equally unsupported and perhaps MacOS X makes more sense. Unfortunately the 10.5 DVD is upgrade-from-10.4-only, so I had to install 10.4 from my DVD-copy and the upgrade to 10.5. This (availability of old and new macOS version) is obviously something that has become much nicer with Apple and MacOS X since the PowerPC days.

Using it for programming

I like to program, and sometimes I find it useful to use an older or a different machine for unit testing and debugging. Occationally problems occur on a slower machine or on a different architecture. Unfortunately, most of my programming nowadays is JavaScript and Node.js, which can not run on the G4.

I downloaded and installed X-code, I suppose I got an old working GCC. The package manager of NetBSD is called pkgsrc and I it can be used on most systems, including MacOS X G4. However, people have given up building and distributing binaries so you either need to use binaries from inoffical archives from 2017, or build from source (which i not that fast on a 20 year old laptop – and perhaps that would eventually kill it). I gave pgksrc a try (to install xz and git, to start with). Those did not compile. pkgsrc does not come with its own compiler, so perhaps if I start downloading and building a more recent gcc, I can use that gcc for pkgsrc. However, the errors were related to structs in this version of darwin not containing expected fields. I guess Mac OS 10.5.8 comes with some version of some C standard library, and that is probably not so easy to get around.

Macintoshgarden

There is a site, Macintoshgarden.org, full of MacOS abandonware (for like 8.6 – 10.5, perhaps even older). Now I was never really an application-guy, but this is a treasure and a time capsule to computing 20 years ago. There are many games. The most sensible use for this Powerbook is probably to focus on enjoying native apps from the time it was current.

Other OS than Mac OS

There are some Linux distributions that can be used, and there are top-10-distro list for PowerPC linux found if you Google. Most are abandoned (like Debian and Ubuntu). There is something called Adelie Linux, which could be worth trying. Debian Sid seems to be “supported” (what that means). Also NetBSD is supported (but I would not expect too much laptop-features on NetBSD).

Finally MorphOS can run. That is an Amiga-like OS, that benefits from the fact that it is PowerPC.

Conclusion

This machine is now very old. The fact that I can use it for DVD-purposes, and that it actually is particularly suitable, is cool, and I will probably keep the machine for that purpose as long as it works.

Whisky tasting notes 2022

Links: Previous Tastings , Whisky Ranking

Chivas Regal 18 vs Strathmill 24 (1994-2018): Strathmill slighly darker, and with a much sweeter sherry-like aroma. Chivas is rather subtle on the nose in comparison, it has a more classic whisky aroma, but more sweet than salty and malty. I taste Chivas, sweet, round and nice, caramel, somewhat bitter. Strathmill is both more distinct in its sweet fresh sherry character and also saltier and maltier. Since I know what I am drinking it is not hard to explain what I experience with the blend being very smooth and produced while the the single malt tastes more like the raw product. I prefer Strathmill.

Bergslagen Gast vs Longrow 13 Red: Longrow is darker, more red, and Bergslagen is more yellow. Bergslagen has a fruity, slightly salty, peaty smell. Longrow is a bit heavier, sweeter, less peated I think. Bergslagen has a more fire-peat-smell. I taste Longrow, very nice saltiness and sweetness at first, it lingers nicely but unfortunately finishes with what I call sulphur. Bergslagen, well now after Longrow it smells a bit of raw young wood (as many young, especially swedish whiskies do). I add more water to Longrow, that usually help with the sulphur and it does to some extent. Bergslagen is rather thin, a bit sour and bitter. More water and the sulphur is kind of gone. I think Longrow is slighly better, and I guess most people would find Longrow clearly better.

Hibiki Harmony vs Springbank 15 Rum PC#629: Springbank is much paler, really pale. I find rather desert wine than rum in the Springbank aroma, but it is also rather heavy oily smelling. Hibiki is more mellow, balanced, caramel, perhaps flowery. Back and forth with the nose, Springbank is the one that benefits from the comparison. Hibiki tastes really nice, soft, malty, a bit salty, caramel and nuts, it lingers, very easy to enjoy. Springbank is a different beast, salty, not so little peat, a bit rougher. The difference between japanese craftmanship and scottish raw tradition is obvious. Back to Hibiki, it is a bit thin after Springbank, with some bitterness. Springbank has a more full and powerful body. I think Springbank is better, head to head, but Hibiki is the safe choice. Springbank wins.

Nevis Dew Deluxe 12YO vs Chivas Regal 18: Nevis is paler yellowish, Chivas a more amber color. On the nose Nevis is very subtle, it smells fine whisky but not much. Chivas is a bit heaver, a bit sweeter, and the sweetness is more fruity than caramel. I taste Nevis, it has a fine nutty, malty flavour that is rather light, but there is also something blend-alcohol about it. Chivas is a bit softer and sweeter. Nevis is on the brink between a very nice maltiness and a rather lousy blend. Chivas wins, a quite narrow victory.

Bergslagen Gast vs Glen Scotia Victoriana: Bergslagen a little paler, with a rather raw woody peatiness. Glen Scotia is so much bourbon on the nose, but also a bit fruity. Bergslagen is more powerful on the nose, but if I had to pick a winner without tasting it would be Glen Scotia. I taste Glen Scotia and even if I have added a splash of water to it I find it too strong, quite sweet and some sulphur. Bergslagen has a gentle peatiness. I taste Victoriana again, and att more water again. Bergslagen is quite easy to enjoy. Glen Scotia is trickier. Enough water now to get rid of the sulphur but I can not say what Glen Scotia tastes like, it is just bitter-sweet without balance or complexity. Victory to Bergslagen.

Longrow vs Raasay 1st Release: Raasay a bit darker, more powerful on the nose, more peated, and more young raw wood. I taste Raasay and it is both sweet and fire-smoke type of peat, quite typical for a young whisky. Longrow is a bit more malty, delicate, balanced, though peated. I find a hint of sulphur in Raasay. Raasay goes to the peated list, losing to Longrow.

Mackmyra Svensk Rök vs Raasay 1st Release: Mackmyra lighter in color and on the nose. In a way they are quite similar on the nose, Raasay is just more heavy, a bit sweeter, and more peated. Mackmyra has some fruitiness. It tastes quite good though Mackmyra, quite fresh and with some balance. Raasay is much more in the mouth, but with some sulphur. Without the sulphur Raasay would definitely win so I add plenty of water to it: most everything about it disappeared. I prefer the more dry, light spirited, Mackmyra.

For Peat’s Sake vs Raasay 1st Release: Raasay is more pale. For Peat’s Sake is a bit thinner, more alcoholic, on the nose. Raasay is heavier, dirtier. Tasting For Peat’s it is a bit synthetic, artificial. Not entirely convinced I give victory to Raasay.

Longrow 14 Sherry vs Raasay 1st Release: Longrow is much darker, it smells older, saltier and more powerful than Raasay. Raasay is very little to compete with, except less sulphur. Longrow wins.

Glen Moray Peated vs Raasay 1st Release: Glen Moray much paler. Also the aroma is pale… it is like getting in to an old underground warehouse and just smelling dust and emptiness. Raasay is sweet and young on the nose. I taste Glen Moray and think there must be something wrong with it, it is like medicine – flouride for your teeth (?) – but then there is some maltiness and peat there. So I am about to write that Raasay is another experience richer and more complex, but I cough with the sulphur. I add more water to Raasay, it gets better, and at least it has some depth. Raasay wins.

Bowmore 18 vs Longrow 21: Bowmore is more red and Longrow more brown. Bowmore has a balanced malty peated aroma, very nice. Longrow is more sour. I taste both, Longrow is more powerful and rough, Bowmore softer and more balanced. On this occation I am not so impressed with either of them, though I prefer Bowmore.

Dalwhinnie 15 vs Glenlivet 18: Dalwhinnie much paler. On the nose Dalwhinnie is a bit like white wine, fresh, fruity. I do not find much cask aroma in Dalwhinnie. Glenlivet is darker, sweeter, more powerful, raisins, dadles that kind of red fruitiness. Tasting Dawhinnie it is very fresh, reminding of yellow fields of barley. It has a nice complexity, lingers for a while, and leaves a good feeling. Glenlivet is more powerful and more sweet. I assume there is some sherry and there is more cask flavours in Glenlivet. And it is more bitter. I came to prefer Dalwhinnie. It tastes very nice, it is more open and has a bit more complexity, I think. What should not quite decide the winner is that I find Dalwhinnie a more interesting and pure expression of scotch speyside whisky.

Lagavulin 12 Distillery Single Cask vs Lagavulin 16: 12YO is much paler. On the nose 12YO is more fire and hints of raw wood. 16YO is more soft, balanced on the nose. Tasting 12YO it is crisp, burnt, peated and quite flawless. Not heavy at all. Also in the mouth 16YO is more soft. Clearly, 12YO is the more spectacular whisky here and 16YO is more safe play. 12YO wins.

Lagavulin 12 Distillery Single Cask vs Laphroaig 16: Perhaps Laphroaig is a bit darker. Lagavulin is more raw, Laphroaig is more oily, on the nose. Laphroaig is rather salty, quite perfect. Alcohol is a more dominant flavour of Lagavulin so I add a splash of water. Laphroig again, it is a bit sweet, some caramel and even bourbon there. Before I tasted Lagavulin for the last time I was leaning towards Laphroig, but the extra water more out of it, and it got really difficult. I pour up a little bit more of both, and settle in favour of Laphroaig.

Mackmyra Reserve Förlagrat Refill Gravity vs Old Pulteney Vintage 2006 (11YO): Very similar color. Old Pulteney is very classic malty, hint of bourbon and caramel. Not so much salt and see as I would like to think. Mackmyra is more strange, it tastes ok, but the Mackmyra signatory pear-smell and flavour is there, and it also tastes a bit of anis. And bourbon, it is not all bad. But Old Pulteney is better.

Chivas Regal 18 vs Glen Scotia Victoriana: Glen Scotia is slightly paler, at least after adding some water to it (it was much stronger in the first place). These whiskies are ranked similarly, but I have a better feeling about Chivas. Lets see. Chivas has a soft sweet classic whisky aroma, hint of smoke, and a hint of chemical blend. Victoriana is surprisingly similar, I would say a bit more sherry-sour and a bit more raw, perhaps. Chivas tastes nice, it tastes like it smells, nothing more to say. Victoriana has a more authentic and crude sherry touch, it tastes less crafted. Back to Chivas it is less impressive and more dull now. Victoriana is a bit more challenging, a bit more of an acquired taste, but I think it is worth it. Glen Scotia wins.

Deanston 15 Organic vs Springbank 15 Rum Private Cask #629: Both are pale, yellow (as in no greenish at all). Deanston slightly darker. I put my nose in Deanston and find a dry, slightly burnt, fresh grain type of whisky – not a lot of bourbon. Springbank is much sweeter, thicker, heavier, also a bit sour and peated. Deanston is first light in the mouth, it grows though, with a gentle sweetness. Springbank has more different flavours, a sweet and sour fruitiness. Back to Deanston it is less flavourful, but very fine. I add a bit water to both. Springbank has a slightly peculiar flavour, a little bit for good and for bad. But the milder Deanston does not quite have enough to offer to stand up against Springbank, even if Deanston is an excellent 15 YO highland expression.

Deanston 15 Organic vs Tobermory 12: Tobermory is darker in color, sweeter and richer in both aroma and flavour. Deanston is rather pale and thin, a bit blend/industry-alchol tasting. Tobermory wins.

Deanston 15 Organic vs Glenfarclas 17: Glenfarclas is darker in color, and a bit sweeter on the nose, more Bourbon aroma in Glenfarclas. Deanston has a light smell, of some wood, but not so bourbon-like. I taste Deanston and find a simple and straight whisky, some lingering bitterness. Glenfarclas tastes more bourbon-sweet, and that comes with more bitterness I think. I would think Deanston is matured on old bourbon casks that are more or less depleted, and that it would have benefited from more maturation. The easy choice is to go with Glenfarclas, it is a bit softer and sweeter. Deanston not being sweet, salty or peated is very pure whisky-like at it heart, somehow reminding of a blend. I must prefer Glenfarclas.

Mortlach 13 2021 Special Relaease vs Mortlach 20: 13YO is much paler (and cask strength). On the nose 13YO is very classic, 20YO is a more powerful on the nose, more sweet but not the sherry-way. Tasting both, 13YO has a bit more bitterness, but it does not taste less powerful as was the case with the nose. 13YO is more interesting as it has more different flavours, it is more undeveloped and has more potential (to develop). 20YO tastes like it is done maturing, perhaps by a year or two, very very soft, with a nice sweetness and no bitterness. Perhaps 13YO is more interesting, both are rather flawless, but in the end 20YO is the better whisky.

Dufftown 18 vs Mortlach 13 2021 Special Release: Dufftown is much darker, both rather classic aroma, Dufftown a bit sweeter. Tasting Mortlach it is dry, slightly salty, quite classic flawless. Tasting Dufftown, I find it thinner and not so refined. Mortlach wins with a more solid experience.

Highland Park Cask Strength vs Springbank 12 Cask Strength: A little bit more color in (the stronger) Highland Park. Springbank is deep and mellow on the nose, not really peated, a bit woody in a nice way. Highland Park is less heavy, less sweet, more sour. I taste Springbank without water, very solid. HP is more burnt, peated. With water, HP softens up a bit, surprisingly sweet and rich. Springbank didn’t respond quite as good to the water, a bit thin at first taste. I taste Springbank again, not so impressed, a bit raw wood and a bit sour. HP is less sweet, but more balanced and complex. Quite surprised here, I prefer the NAS HP to the 12YO Springbank (which is probably more than twice the price).

Longrow vs Springbank 12 Cask Strength: Very similar color. Longrow has a rather dry aroma with some peat. Springbank is less peated, more sweet and winey. I taste Springbank, quite balanced with some woodiness, like its been bourbon for too short time on those casks. Longrow has more saltiness and a bit more freshness to it. Back to Springbank I am just not so impressed with the flavour. Longrow wins, being both softer, saltier and richer.

Glen Scotia Victoriana vs Springbank 12 Cask Strength: Glen Scotia is darker, on the nose some peat and some sherry. Springbank is more neutral, honey and caramel, on the nose. I taste Victoriana (cask strength), a bit of a firework of different flavours (peat, salt, oldish, sherry), more interesting than balanced (and good). I also taste Springbank cask strength, and it is more balanced than interesting. Some water to Springbank and it has a nice sweet and fresh combination. I was about to write that the safe conservative choice is Springbank, but I have a hard time finding arguments. Glen Scotia wins.

Deanston 15 Organic vs Springbank 12 Cask Strength: Deanston is paler, with a light almost blend-like aroma. Springbank more solid, a bit more sweet, on the nose. Deanston is quite thin in flavour, not bitter, but bitter-ish. Springbank is more solid, powerful, some peat, sweeter and it lingers nicely. Back to Deanston, it just does not taste very nice. Springbank wins.

Deanston 15 Organic vs Mackmyra Brukswhisky: Both rather pale, I can not say for sure there is any difference. On the nose, after a while Mackmyra is fruity, classic Mackmyra pear, but it smells whisky too. Deanston is more chemical, thinner, and less sweet – like a typical cheap blend. I taste Deanston and it is quite light, some maltiness, some bitterness in the end. Mackmyra is immediately sweeter, then immediately more bitter, and that is kind of the lingering impression. Back to Deanston it is softer, more complex, more salty and more malty. Deanston wins, better taste. If it was just up to the nose it would perhaps be different.

Deanston 15 Organic vs Johnny Walker White Walker: Deanston is paler. JW has a smell of sour blend. Deanston even more so, back to White Walker it is kind of a bit sweet and fruity. White Walker has an unusual sweetness (like some liqeur, punch), not so much whisky flavour. Deanston has some saltiness and maltiness that is a bit nice. Hard to pick a favourite. JW kind of stands out in an original way. Deanston is more mediocre in an average way. Victory has to go to JW.

Springbank 11 Madeira vs Springbank 15 Rum PC#629: Madeira is much darker in color, och more like a desert wine on the nose: sweet with some classical Springbank notes. Rum has a more dirty, soil-like, raw Springbank character with just a hint of rum. Tasting Madeira, it is a good balance between desert wine and Springbank whisky, not very complex and overwhelming but rather soft and easy to enjoy. Springbank Rum is more of an acquired taste, and a bit metallic, and in this case I can not see myself prefer it. 11 Madeira wins.

Bushmills 21 vs Springbank 11 Maderia: Bushmills is very slightly darker. Bushmills is a ridiculously soft whisky with desert wine, fruit, bourbon and even some flowery notes. Springbank is more two-fold, first sweet, then more raw. It is also more powerful and a bit metallic. I think it is safe to say that this is really down to preference. Those who like very soft and easy to drink (yet rich and complex) chose Bushmills. Those who like to be challenged more, and who enjoys the duality of Springbank will chose it. Tonight, I pick Bushmills.

Arran Quarter Cask CS vs Deanston Oloroso Finish 9YO: Arran is paler, with a fruity aroma, not so little bourbon. Deanston, also surprisingly much bourbon on the nose, given the name. I taste Arran at cask strenght, and the sweet fruitiness dominate, and I add water. I taste Deanston and it has more Sherry (sulphur unforunately – but that may go away with water). Back to Arran with water, nice malty caramel flavour. Deanston is a bit more raw, still some sulphur unfortunately. I think Arran is really nice, better than Deanston.

Arran Quarter Cask CS vs Bushmills 16: Bushmills is darker, richer and sweeter on the nose. Arran is more dry and raw in the mouth, Bushmills more sweet and even a bit flowery. Arran a bit bitter now. I prefer the softer Bushmills, but Arran is close.

Mackmyra Första Utgåvan vs Svensk Whisky för Ukraina: Mackmyra is paler, lighter and more fruity (typical pear) on the nose. Mackmyra is quite balanced, a bit burnt, not very complex. Ukraina is quite thick, complex, a bit raw (wood). Back to Mackmyra, a bit sharp and bitter. Ukraina wins.

Glenlivet 21 Archive vs Mortlach 20: Very similar, quite dark red color, if anything Glenlivet is darker. Glenlivet is a on the nose, like ripe red fruits. Mortlach a bit more malty. Tasting is a little the other way around. Mortlach is sweet, soft, burnt sugar and balanced. Glenlivet a bit saltier, maltier and some more complexity. Both are very good, as in flawless and easy to drink, but a bit boring. Glenlivet wins.

Redbreast 12 vs Tobermory 12: Similar, not so pale color. At first quite similar nose, but Redbreast is more bourbon and Tobermory more malty. This becomes more apparent when drinking them. Redbreast has a bit of the genuin bourbon rawness and almost like perfume. Tobermore, is more wine-like, softer and maltier. Tobermory wins.

Bladnoch Adela 15 Oloroso vs Longmorn 16: Bladnoch is darker, somewhat sweet and quite mature aroma. Longmorn is a bit lighter, more dry hay on the nose. I taste Longmorn and find some burnt caramel and a bit of bourbon. Bladnoch has a quite nice sherry flavour, also a bit burnt and slightly bitter in the end. Longmorn is softer and maltier, and I prefer Longrow but it is quite close, and those who generally prefer sherry would probably pick Bladnoch.

Bladnoch Adela 15 Oloroso vs Glendronach Batch #9: Bladnoch a bit darker, with a bit dark-sweet mellow aroma. Glendronach is more sherry-in-your-face, and a bit more raw. Tasting Glendronach, yes I find it a bit raw and not quite so balanced. Bladnoch is softer, more complex.

Bladnoch Adela 15 Oloroso vs Longrow 13 Red: Similar color, equally dark but Longrow is more brownish. On the nose Longrow is rather salty and peated. Bladnoch also a bit raw, but more fruity. I taste Bladnoch and it has a nice friendly sherry-flavour, which is not too much. Longrow is interesting and has much quality, unfortunately also some sulphur, so it is easy to say that Longrow is both better and worse. I try to water it down, and it helps. Bladnoch is still more sweet and soft and Longrow more salt and peated. With enough water, Longrow wins.

Andalusia Tripled Distilled vs Bladnoch Adela 15 Oloroso: Bladnoch a bit more red. Andalusia a bit bourbon-sweet on the nose. Bladnoch (of course) more sherry, and a bit dirtier. Andalusia tastes a bit burnt, dry, but also with some sweetness, a bit thin but also complex. Bladnoch is more one thing, its sherry thing, and it is perhaps more powerful. Andalusia is good, but it fails to quite know what it wants to be, and it simply is not so… appealing… Bladnoch wins.

Bladnoch Adela 15 Oloroso vs Macallan 12 Sherry Oak: Very similar color, Macallan surprisingly dark and perhaps the darker one. Similar sherry aroma as well, Bladnoch a bit dirtier and more mellew, Macallan a bit fresher. Macallan, soft and balanced but without too much character. Bladnoch has a bit more raw sherry character. Back to Macallan it is really smooth and quite rich, very balanced. Bladnoch is more the-real-sherry-thing but Macallan is more the-real-smooth-whisky-thing. Very similar quality here. I am no sherry fan, but to me Bladnoch has does its thing better, it is more interesting.

Longrow 14 Sherry vs Longrow 11 Sherry Society Bottling: 14 is much darker, and also heavier on the nose, more sherry. 11 is a bit dry, some sherry notes but not very dominating. 14 is a thicker experience, unfortunately quite much sulphur/margarine in the sherry and I try to water it down more to see what happens. Actually, the bad flavours almost disappears. I anyway prefer 11, less sherry and less questionable flavours.

Longrow 13 Red vs Longrow 11 Sherry Society Bottling: Red is darker than sherry, and it has a fruitier aroma with more bourbon, sherry is more malty and peated. I try the sherry cask strenght and it is rather dry, not many sherry notes there. Red tastes a bit of sulphur and I add more water. 11 Sherry is quite ok, but it is not very interesting or tasty, uncharming. Red, with more water, still sulphur. Finally I get Red down to below sulphur warning, and then it is a more rich, smooth and complex whisky than 11 sherry. So Red wins, if correctly watered down.

Bladnoch Adela 15 Oloroso vs Longrow 11 Sherry Society Bottling: Bladnoch is darker, and with a softer more bourbon-aroma, and a bit sherry. Longrow is much more like rough and raw Longrow, and less sherry. Bladnoch, at first, quite much bourboun flavour, nice. Longrow tastes more raw – it is stronger too. I like the bourbon-sherry balance in Bladnoch, but overall there is something missing. However, it beats Longrow nevertheless.

Glen Scotia Victoriana vs Longrow 11 Sherry Society Bottling: Longrow more brownish, Victoriana slightly darker, with a quite nice bourbon-sherry aroma. Longrow is drier, no bourbon and some sherry. Victoriana is not bad, and I like that sherry-kick. It beats the more dry and bitter Longrow.

Chivas Regal 18 vs Longrow 11 Sherry Society Bottling: Chivas is redder and darker. Chivas is sweeter and much softer on the nose, and Chivas is softer on the mouth, boring though. There is a freshness and vitality to Longrow that I prefer to Chivas. Quite close in quality, but Longrow wins.

7 dlight Ichiro Mizunara Reserve vs Macallan 12 Sherry Oak: I have really no idea what this Ichiro is, but it is slighly paler than Macallan. Ichiro has a quite light fresh and clean aroma, some bourbon. Macallan is more sherry, more sweet and a bit more flower/perfume than Ichiro, on the nose. I taste Ichiro, and I have no idea what this Mizunara wood is but I can feel it is different from what I am used to, tastes good, surprisingly sweet and a bit like syrup in the mouth. Macallan is lighter in the mouth first, more refined and balanced, but with a hint of sulphur in the end (I add water and see if it goes away). Back to Ichiro, quite intensive this (I guess tropical) wood. For the curious enthusiast Ichiro is more interesting, and for the careful casual drinker Macallan is the safe choice. I taste both of them and think… but it is not quite good enough to win. I find Macallan better after the water. To me, Ichiro is too intense and not only in a good way. Narrow victory to Macallan.

7 dlight Ichiro Mizunara Reserve vs Bushmills Black Bush: Quite similar color, perhaps Ichiro is more orange but Bushmills more intense. Bushmills has a kind of grassy aroma, that could be really sweet vanilla or white chocolate or something. Ichiro is more sweet and bourbon. Tasting Bushmills, I first find the aroma fruity (almost candy), the flavour is soft caramel and a coffee finish. Ichiro is a bit more intense, more locked in (as the complexity of the flavours not quite developed) so I add water. Black Bush, not being very sophisticated or advanced, is at least tasty and easy to enjoy. Ichiro, it is harder to understand what it is, what it wants to be, or what it is about to become. I prefer Bushmills.

7 dlight Ichiro Mizunara Reserve vs Jameson Black Barrel: Ichiro a bit paler. Jameson has a sweet aroma, making me think of some desert cake drowned in alcohol. Ichiro is less open, harder to pick out different aromas. Jameson is like coffee and cream in the mouth. Ichiro a bit more pepper and intensity. After Ichiro, Jameson smells and tastes a bit cheap, chemical and artificial. I prefer Ichiro, quite close though.

Whisky visit to Islay

In April 2022 I visited Islay with a few friends to visit distilleries and try whisky. I will write a bit about the distilleries.

Ardbeg

Ardbeg has a more uneven, spectacular and even experimental range of whiskies compared to other distilleries on Islay i would say. In the store you can buy a 3×20 cl kit of Beastie, An Oa (their kind of introduction whisky) and 10YO (the Ardbeg classic). Limited sale of bottles in distillery.

Because of Covid-19 things were not quite normal. In Ardbeg the shop sold a 5×2.5ml tasting that you could try in their café, in their garden or bring home. I brought most of it home and did head to head tasting (I think it is really hard to do something with 5 whiskies at the same time). I rank the from best to worst:

  1. 22 year old Twenty Something
  2. Auriverdes
  3. Traigh Bhan (batch #3)
  4. Dark Cove
  5. Perpetuum

Very short notes follow:

22YO beats Traigh Bhan. 22YO is ligh, fresh, salty with a lingering flavour. Traigh Bhan is more sweet and woody.

22YO beats Auriverdes: Auriverdes is very slightly darker in color, a bit less peated, and a bit more fruity (but not sweet) and winey. 22YO is more aggresively peated on the nose, and has a softer saltier more sea-like complex flavour. Auriverdes is a bit bitter.

Auriverdes beats Dark Cove: Dark Cove is darker and sweeter, richer, with a hint of sherry on the nose. Auriverdes is more ash-dry. Tasting Dark Cove it is both sweet and raw peat, with an unfortunate hint of sulphur in the end. Auriverdes more elegant, integrated and fresh.

Traig Bhan beats Dark Cove: Dark Cove is dark with a hint of sulphur. Traigh Bhan is ashy, very dry.

Dark Cove beats Perpetuum: Dark Cove is sweeter with a hint of sulphur. Perpeteeum is drier, more malty, fresh but more bitter.

22YO beats Perpetuum: 22YO is classic, winey, malty and complex. Perpetuum is pale, malty fresh and dry.

Traigh Bhan beats Perpetuum: Perpetuum is rather dry wood, bitter. Traigh Bhan is light, soft sweet, burnt and a bit sour.

I also made short tastings against other whiskies.

Bowmore 18 beats 22YO Ardbeg: Bowmore is darker, mellow, malty, soft yet peated in the mouth. 22YO Ardbeg is more peated, has more salt and sea, some freshness, but hints of bitterness and rather burnt.

The Ileach vs Ardbeg Perpetuum: Ileach is daker, soft, salty, a bit bitter and the easier whisky to drink. Perpetuum is more dry, ashy and has a strong flavour of petroleum.

Ardbeg Dark Cove vs Bowmore 15: Bowmore is darker, with a rather sweet and fruity aroma with some vanilla. Ardbeg is also a bit fruity, but more dry, sour and peated. Bowmore quite easy to drink, not so overwhelming. Ardbeg has a bit more punch, more petroleum, perhaps more sulphur. Bowmore may be more easy but Ardbeg has more character and Bowmore is not that good to beat it.

Ardbeg 22 beats Longrow 18: Longrow is darker, with a somewhat sweet aroma. Ardbeg is more dry and peated on the nose, and with a fine elegant full peated flavour. Longrow is thicker, more sour, more dirty.

Bunnahabhain 8 Heavily Peated beats Ardbeg Traig Bhan: Very similar color. Bunnahabhain has on old closet smell. Ardbeg more sour peated. Bunnahabhain is soft, rich complex and peated. Ardbeg is lighter , less soft and complex, and more thin.

Ardbeg Auriverdes beats Bunnahabhain 8 Heavily Peated: Bunnahabhain a bit darker, with a softer less peated aroma. Tasting both Ardbeg has a more solid consistent flavour, salty, peated and balanced. Bunnahabhain is a little sour and a litte bit everywhere.

Laphraoig beats Ardbeg Auriverdes: Laphroig a little darker, and with a slightly heavier aroma. Auriverdes a hint of fruitiness on the nose, a bit burnt in the mouth, more ashy and dry. These whiskies are quite similar, Laphroaig being a bit softer in the mouth. Auriverdes is more spectacular.

Kilchoman Machir bay beats Ardbeg Auriverdes: Machir Bay is paler, and with a more sweetish synthetic aroma. Ardbeg is more straight peated. In the nose, Kilchoman is a bit oily, quite soft, and sweetish. Ardbeg is saltier with a hint of petroleum. Auriverdes is more spectacular.

Ardbeg Corrywreckan beats Ardbeg Dark Cove: Dark Cove slightly darker, and with a sweet sherry aroma. Corrywreckan is more dry, and rather salty, reasonably complex. Dark Cove has a fruity taste of sulphur.

Ardbeg Dark Cove beats Longrow 13 Red: Longrow has a more red (unusual) whisky color. Both have a powerful fruity sherry aroma. Longrow is rather nice salty first, followed by some old margarine. Ardbeg is saltier, less balanced. Longrow is more mature in flavour, but too much sulphur.

Ardnahoe

As I understand it Ardnahoe is as of April 2022 not selling any whisky, just busy producing, so we just stayed for a photoshoot in the morning.

Bowmore

Bowmore is the oldest licenced warehouse on Islay and their facilities indicate “premium” (as Lagavulin). Age statements is important for Bowmore marketing and be aware that Bourbon/Sherry mix varies a lot between ages (with 15YO being pure Sherry). In the distillery I tried a (budget) Bowmore #1 (not available where I live) and I find it preferable to Bowmore 12.

We did a Vault Secret Tour of the distillery ending in tasting directly from two casks in their oldest warehouse and being permitted to fill up a 10cl bottle ourselves and bring home. That was nice.

Bruichladdich

We just did a quick gift store stop in Bruichladdich. I have to admit I am not a very big Bruichladdich fan and we had not planned to do very much there. It seems the Gin brand Botanist (which is excellent) that is manufactured and sold by Bruichladdich is perhaps a bigger business than whisky nowadays.

In Bruichladdich you can fill your own (well, I guess they supply the) bottle from a cask in the store.

Bunnahabhain

Also in Bunnahabhain we just did a stop i the gift shop and strolled around a bit. Bunnahabhain has by far the best shop on Islay for the tourist fan (but check out Lagvulin too). There were several distillery-exclusive whiskies available as 70cl, 20cl or 5cl which is quite perfect when you are on whisky-tour on Islay. They also serve free tastings of those whiskies in the store so you can try before you buy.

Coal Ila

We did not visit Coal Ila.

Kilchoman

In Kilchoman we did a tour and a tasting. Kilchoman opened in 2005, and the thing about them is that they do everything locally. 30% of the barley comes from their own farmland around the distillery – and that goes into the 100% Islay Malt. The rest of the malt is bought from Port Ellen Malteries. Kilchoman is not about age statements, and perhaps there will be occational aged whiskies, but never in the core line. Machir Bay is 90% bourbon cask and 10% sherry cask, it is also the one I like the most. The visiting centre was nice and the shop had some smaller bottles for sale for tourist (20cl, 5cl) which I appreciate.

Lagavulin

In Lagavulin we did a tasting of 6 whiskies in their warehouse lead by legend Ian McArthur. The whiskies we tried were from 10 to 25 years old. For “drivers” or the careful drinker it was possible to get samples home instead of drinking in the warehouse. Ian explained that 16YO is the main expression. Everything else is limited, gimmic. Lagavulin offers a premium standard product, the 16YO, and that is how they want things to remain. 16YO is (as I remember it) is heavier and sweeter than other things I tasted in th Distillery, so 16YO is kind of different. This means that when you encounter a peated whisky that does not taste like Lagavulin 16, it may very well be a Lagavulin nevertheless. The Distillery store, which was very elegantm had plenty of whiskies to buy, Lagavulin and other brands (like Mortlach). Everything in 70cl bottles though so no purchases for me.

Laphroaig

We did a nice standard tour of Laphroaig. I asked and they dont make 15YO Laphroaig anymore and the 10YO is their very popular main whisky. They have plenty of variations: Select, Quarter Cask, and some sherry options. Select is a mix of different things. Quarter Cask is finished an a 125L Quarter Cask, which makes it sweeter. Lore is a more premium old rich mix. Distillery store has a very basic range of Laphroiag bottles for sale, and when it comes to smaller bottles just a 35cl 10YO.

Port Ellen

Port Ellen is under (re)construction and we had the opportunity to take photos of the stills.

Springbank

We finished our journey taking a trip to Campbeltown and Springbank. We did no take a guided tour in Springbank but we ordered a whisky tasting to our table, and they had good choices of tastings! The store was kind of crappy with expensive clothes (like they do not want poor people to wear their brand), and very limited selection of whisky to bring home. I tried the blended whisky Campbeltown Loch which was a surprisingly nice experience (but do not expect miracles of course).

Springbank also hides the bourbon/sherry-ratio as age statements: 10YO is 60/40, 12YO is 100/0, 15YO is 0/100 and 18YO is 50/50. For us bourbon fans it means that the 12YO cask strength is the reasonable choice.

Buying bottles

As a tourist from outside UK I can bring 1L whisky home duty free (that is, paying tax in UK and not paying it again when I get home). I would have been very happy if more distilleries offered 5, 10 and 20cl bottles of interesting whisky in their stores. If you visit Islay and you visit the distilleries in some order it is not so easy to know where to spend your money. So my advice for shopping whisky in the distilleries:

  • If you want a nice 70cl unusual, perhaps even exclusive and expensive bottle, buy it in Lagavulin
  • If you want good selection of smaller bottles, and being able to tast, go to Bunnahabhain
  • If you want something unique – hand filled – buy it in Bruichladdich
  • If you just want to bring home 1L of a good scotch whisky, buy it duty free in the airport on your way home

Practical Fullstack approach to Vue3

I am a fullstack developer. I do user support, requirement analysis, nginx configuration, backup handling, integrations and css. Much of my work is centered around Node.js and Vue.

I do not love Vue and I am not fascinated with it, nor interested in its internal working. It is a tool to write reactive (2-way-binding) web applications and to modularize web code (write small reusable components).

I started using AngularJS (v1) years ago. That changed the way I thought of web development and I became more productive making better web applications. However AngularJS is kind of abandoned now, and it is a much heavier framework than need. So I started transitioning to Vue2 some years ago thinking of it as AngularJS-light. In most ways Vue2 is nicer than AngularJS, except sometimes it (the reactivity system) does not work (predictably). Well, Vue2 probably works exactly as it is written to work, but for me as a developer I think I do what works, and then it fails for some delicate detail that I can figure out if I have time, maybe. That is waste of time and it adds uncertainty to my job.

I have this feeling with Vue2 that I need a plan (a design pattern) and I still have not found one that works well. Now I started migrating Vue2 to Vue3 and things change a bit (and things break a bit). So now I really want to find simple design principles for my Vue3 applications, that I can follow so everything works without me thinking about it.

State

The real challenge when writing an (single page web) application is managing the state:

  • Information about session
  • I/O and error handling
  • Incoming data, updating state and UI, avoiding conflicts
  • Application settings, like filters and user choices
  • Data validation and invalid-data-feedback to user
  • Data modelling

This is harder than writing a good user interface. So the client-side-design needs to be state-first, not UI-first. Also

  1. I am migrating things from Vue2 to Vue3 that were originally AngularJS. If the state, business logic, I/O, were dependent on AngularJS-stuff I would be stuck in AngularJS.
  2. I can write this state in generic JS (not specific for web/UI) and thus make it possible to also run it on a server, exposing it as APIs and do automated testing

So I am not interested in Veux. Perhaps it can run backend, I do not care. This is how I think of my architecture:

  1. GUI (as thin layer as possible)
  2. Web component business logic (plain JS, no Vue, can run in Node.js)
  3. State (plain JS, no Vue, can run in Node.js)
  4. Server Side (Node.js)

Most code can (ideally) run in 2-4, and can thus be tested in Node.js. Vue is only about (1).

State – Vue – Interface

Some applications are large and state consists of many modules. Some are small. For a simple example I think of state as (this is, admittedly based on Vue2-experience, where you need to consume state data in a way that makes it reactive in Vue).

STATE = {
  ro : { ... things that are readonly to Vue (like server data) ... }
  rw : { ... things that Vue can change (like filter choices or user input) ... }
  api: { ... functions that can do stuff with state ...}
}

Typically I would get this from a plain JS factory function where I can supply dependencies that are possibly implemented (for I/O) differently on Browser and Node.js:

function MyStateFactory(libIO, lib1, lib2) {
const state = { ro:{} , rw:{} , api:{} };
... set up state ...
return state;
}

How do I make this state available (and reactive) in my Vue application and Vue components? I can admit that in the past I have been lazy and done things like (pseudo code):

Vue.Component({
  data : function() {
    return { state : STATE };
  },
  ... more stuff
});

That kind of works in many cases! But I have also ran into problems. In a real application you have 3 types of components:

  1. Those that depend only on supplied props
  2. Those that depend only on state
  3. Those that depend on a mix of props and state

In theory, all components should be (1) and all other design is rotten (you may think). In practice 2 and 3 are useful too.

So the real questions are:

  1. How do you expose state, as data and functions, so changes can be picked up by the right components?
  2. How do you design components so they update when they should?

AngularJS – Vue2 – Vue3

AngularJS has a function that recalculates everything, over and over again until it gets the same result twice. Then it updates the DOM accordingly. AngularJS does not detect changes to data automatically, however when you use its api to manipulate data, you are also telling AngularJS that you are changing data, and the function mentioned before can run. If you change data from outside angular you may need to use $scope.$apply() to tell Angular to refresh.

In Vue2, when you make an object part of “data” in a component, it becomes “reactive”. This is very implicit and it has some limitations (with Arrays, for example). What if a prop changes? What if you have a method that uses external data (as a state outside Vue), does that trigger refresh of the component? If a parent refreshes does that refresh the children? What if a child element deep down in data/prop changes? What if properties in data are replaced/added rather than modified? All I say is that to someone so stupid and ignorant as me it is not obvous how to make Vue2 just work.

Vue3 is more explicit (I interpret that as Vue2 was unpredictable not only for me, and that the Vue2 abstraction was leaky). While AngularJS and Vue2 hide the mechanism that drives reactivity Vue3 has the very explicit functions:

  • ref
  • reactive
  • readonly
  • shallowRef
  • shallowReactive
  • shallowReadonly

These functions are what connects the Vue controllers to the outside-of-Vue-world, and makes it possible for Vue to detect changes.

Vue3 – a first simple practical design

So, now we can think that we have something like this:

var state = { a:1 };
state = Vue.reactive(state);

Vue.component({
  props : { /* parameters to component here */ },
  data : { /* component local data here */ },
  methods : { /* access state via functions here */ }
});

Lets explore what happens and what works!

Vue.reactive()

We need to understand – exactly – the difference between the argument and the result of Vue.reactive():

var state_reactive = Vue.Reactive(state_original)

I have experimented (test0) and found that:

  • They share the same data, that is, the data lives in state_original
  • If you add/delete/modify data in one of them, it is immediately available in the other
  • state_orginal, and none of its children, will ever be reactive
  • state_reactive, and all of its children, will always (more on this later) be reactive
  • state_orginal and state_reactive (and all of its corresponding children) are never the same object (everything in state_reactive is Proxy to state_orginal)

The consequence of this is that your state-library must modify data in state_reactive, if you want Vue to be notified of the change (when Vue anyway refreshes for any reason, it will get the changes).

So the problem becomes:

var state = StateFactory();

// will not work because the internal state of StateFactory is not affected
state = Vue.reactive(state)

// this has severe implications:
//  1) Vue is modifying something inside the state library
//     (that was explicitely supposed to be read-only)
//  2) How does the state library protect itself?
//     possibly keeping an internal ro, and replacing the state.ro regularly
state.ro = Vue.Reactive(state.ro)

So I would say that you will need to design your state library with this in mind.

  1. Be clear that state.ro, state.ro can be made reactive this way, or
  2. Expose something else that can be made reactive (state.updated), or
  3. If the “Vue” object is present, the library could use it and take care of making the right things reactive itself, or
  4. The library has some way to notify of updates (an update callback function), and in the Vue-world, you let that callback be a function that updates something that IS reactive already.

Regardless of this little problem it is a much better situation than the Vue2-way of adding external objects in data and hoping for the best.

What Vue3 Components are updated?

Now that we know what data outside of the component that is reactive, the questions are:

  • what changes trigger the component to be updated?
  • when do child components update?
  • can any number of components, independently, be triggered by the same reactive variable?
  • if a reactive variable is used in a method, does that trigger an update
    • even if the method is not always called
    • even if the variable is not always used in the method (only some branches)
    • even if the result of the method does not change
    • even if the result of the method is not rendered
    • when the method called on any other occation (like polling)
  • is there any risk that some components are updated multiple times (in one cycle)?
  • in what order are the components updated, and can it matter?
  • what is enough to trick/force a component to update?
  • can a component update only partly?

I do not really want to know. I just want a way of designing my components so they work predictably. What I have found in the past is that when I write one big Vue-component (or application) I have no problems. But when I start modularizing it, with components that are sometimes but not always nested, that is when problems start. I have asked myself questions (with Vue2) like:

  • can one component override/replace what triggers another component, making the earlier “trigger-subscriber” dead?
  • can I end up with deadlocks, infinite recursion or mutual dependencies?
    (it has happened)

We kind of can not keep all these details in mind when building an application. We need to have a simple design that just works every time.

Single Application

I have written a simple test (test1) application with no child components. I want to explore how little reactivity works.

// Start with a STATE:
  STATE = { lines: [] };

  setInterval(() => {
    updateLines(STATE);  // implemented elsewhere somehow
  }, 2000);

// Make reactive
  STATE.lines = Vue.reactive(STATE.lines);

// Make a simple app (not showing everything)
  Vue.createApp({
    data: {
      function() {
        return { lines : STATE.lines }
      }
    }
  });

// In HTML Template, do something like
  <tr v-for="l in lines">...</tr>

This works (as expected) IF updateLines does not replace the lines array. So I have experimented and found:

Vue.reactive(STATE.lines)updateLines keeps linesworks
Vue.reactive(STATE.lines)updateLines replaces linesweird behaviour
Vue.reactive(STATE)updateLines keeps linesworks
Vue.reactive(STATE)updateLines replaces linesweird behaviour
Vue.shallowReactive(STATE)updateLines keeps linesnot at all
Vue.shallowReactive(STATE)updateLines replaces linesnot at all

The problem here is that when STATE.lines becomes a new array, the data:function in createApp does not re-run, so we keep track of and old array that STATE no longer cares about (the weird behaviour is that updateLines kept part of the old lines-structure and that “garbage” is still reactive).

It is clearly a sub-optimal situation that the implementation of state, and not just what STATE looks like, matters. 4 alternatives do not work, 2 work but are bad design. What about:

  STATE = Vue.shallowReactive(STATE);

// Make a simple app (not showing everything)
  Vue.createApp({
    data: {
      function() {
        return { state : STATE }
      }
    }
  });

// In HTML Template, do something like
  <tr v-for="l in state.lines">...</tr>

This works also sometimes:

Vue.shallowReactive(state)updateLines keeps linesnot at all
Vue.shallowReactive(state)updateLines replaces linesworks
Vue.reactive(state)updateLines keeps linesworks
Vue.reactive(state)updateLines replaces linesworks

The only thing that works regardless how updateLines is implemented, is to make all of STATE recursively reactive and make all of it data in every component. Exactly what I admitted above that I had been doing with Vue2.

shallowReactive is appealing, but it depends on the inner implementation of state, and that kind of design will quite possibly give you nasty bugs later when something changes.

So, making your data embrace STATE, or part of states works only if you know how state updates itself, unless you make exactly all of STATE recursively reactive. I think more people than I find that sledgehammer approach unsatisfying.

How about state signalling that something is updated, by updating a primitive variable (value, to avoid using ref and then ending upp with value anyway)? Note that updated.value is truthy from the beginning, and it will alwasy be truthy (++ only operation on it ever), but Vue does not know that so it needs to read and check.

  STATE = { updated: {value:1} , lines: [] };

// Make just updated reactive
  STATE.updated = Vue.reactive(STATE.updated);

  setInterval(() => {
    updateLines(STATE);
    STATE.updated.value++;
  }, 2000);

// And in Vue.createApp
  data : function() {
           return {
             lines : STATE.lines,
             updated : STATE.updated
           }
         }

Now, we can not rely on

  • lines, because it is not reactive at all
  • updated in data because it is not used in the template

However, there are some things that work. First it seems nice to replace lines in data with a method:

  methods : {
    getLines : () => { return STATE.lines; }
  }

  <tr v-for="l in getLines()">...<tr>

However, that is not enough because lines is still not reactive. But here are 3 simple little hacks that do work (and of course there are or more):

  <-- output updated in the template - not typically wanted -->
  Updated: {{ updated.value }}

  <-- display table (parent of lines) "conditionally" (always truthy)-->
  <table v-if="updated.value">

  // use updated.value in getLines()-function
  getLines() => { return STATE.updated.value ? STATE.lines : []; }
  getLines() => { console.log(STATE.updated.value); return STATE.lines; }
  // assuming devnull exists and does nothing
  getLines() => { devnull(STATE.updated.value); return STATE.lines; }

You can use this.updated.value if you use function() instead of ()=>{}. I find it quite a positive surprise that the above works even if neither lines nor updated is in data:

  STATE.updated = Vue.reactive(STATE.updated);

  data: {}
  methods: {
    getLines : () => { return STATE.lines; }
  }

  <table v-if="updated()">
    <tr v-for="l in getLines()">...</tr>
  </table>

This is beginning to look like something that appeals to my sense of simplicity. The conclusion for simple application, external state, and no components is that you have two (simple to explain) options:

  1. Make all of STATE (the exposed data, not functions) recursively reactive. Use it directly from everywhere.
  2. Make only one variable, STATE.updated, reactive. Make sure to poke (++ is probably ok) that variable whenever you want anything else to update.

Beware of doing things like value = STATE.some.child.value for anything that is expected to work beyond the next “tick”. Please note that I have not build a big single-application-zero-components application this way. So for now, this is just a qualified hypothesys.

You can check out the final result as test1.

Application with components

I split my application into three components. The application itself has no data or methods.

  • Application (test2)
    • Market
    • Portfolio
    • Copyrigh notice (nothing reactive, should fail to update)

This worked fine with no changes to reactivity compared to test1. So I got confident and made components for the lines:

  • Application (test3)
    • Market
      • Market-quote
    • Portfolio
      • Portfolio-stock

This did not immediately work. The template in Market had this content:

  <test-market-quote v-for="q in getQuotes()" :q="q">

getQuotes is still depending on update.value and is called every time, but it “happens” to return the same, modified, quote-lines every time. So the test-market-quote does not realise anything changed:

  APP.component('test-market-quote',{
    props : {
      q : Object
    },
    data : function() { return {}; },
    template: '#test-market-quote',
    ...

So I needed to replace (in a method in the test-market-quote component):

  return API.valueOf(stock) < STATE.trader.cash;
//with
  return STATE.updated.value && API.valueOf(stock) < STATE.trader.cash;

in order to make sure some method in the child component also is dependent on updated.value. This was not needed when there were no child components, becuase the parent component had another dependency on updated.value and that cause the update of the entire component (but obviously not forcing its children to update). That worked in one component, but the other component had no methods to add a dependency to, so I successfully replaced

  <td>{{ s.name }}</td>
<!-- with -->
  <td>{{ upd(s.name) }}</td>

//and added
  methods : {
    upd : (v) => { return STATE.updated.value ? v : 0; }
  }

Reality check!

This is beginning to be ridiculous. How many obscure hacks are we going to use to not have to rely on the reactivity system that is at the heart of Vue? These kind of hacks are also a source of (subtle) bugs and can make refactoring harder. The problem I have experienced with Vue is that I need to understand how things work under the hood. But with these different updated.value hacks the cure is getting as bad as the disease (that said, these hacks are probably anyway things you need to do, if components do not update when you want them to).

So I was thinking about a universal fix for updated.value (test4):

// first a reusable function
  API.yes = () => { return !!updated.value; }

// second every (child) component makes it part of its methods
  methods: {
    yes : API.yes
  }

// third, every component template has a root element, add a v-if
  <div v-if="yes()">
    .. component template body ..
  </div>

This works! It is rather simple.

Two working practial design choices

So, we have arrived at two rather simple (conceptually) ways to build predictable Vue3 applications that rely on external (Vue-independent) state code:

  1. Make all state recursively reactive, from the root
  2. Only make an update-variable reactive, and make all components depend on it

Obviously there does not have to be exactly ONE state. There can be some log-state, some io-state, some user-setting-state, some data-state and they could possibly work differently.

Regardless, it is important to understand that if there is an exposed state, the code responsible for the state may update objects, replace object, reuse objects and move objects around in the state (tree), unless the state is very clear and strict about this.

How is the recursive reactivity-tree updated?

We have a plain object:

  x1.a.b.c.d = 5;

// make it recursively reactive

  x2 = Vue.reactive(x1); 

// we add something in x1

  x1.a.b.c2: {d : 3.14} };

// NOW c2 and c2.d can not possibly be reactive, because if
// Vue could know that we did that to a child of x1, we would
// not need to make a reactive copy (proxy) of x1 in the first
// place. The above operation does not trigger anything in Vue.

// How does it happen that c2 and c2.d *eventually* end up
// begin reactive?, that is
//   isReactive(x2.a.b.c2.d) => true

// Well I think when you do that (isReactive) you are accessing
// x2, x2.a, x2.a.b and eventually x2.a.b.c2. That means, you
// are asking the Proxy b to give you its child c2 - which it was
// not aware of. But now it is!
// So it can find c2, make it recursively reactive before giving it
// to you so you can resolve x2.a.b.c2.d and pass it to isReactive().

That is how I think it works.

Vue2 vs Vue3

I really have not code very much in Vue3 yet. But I have done enough research to write this post. I think Vue3 seems to be MUCH better.

In Vue2 I ended up doing:

STATE = { ro:{}, rw:{}, api:{} };

Component({
  data : function() {
    state_ro : STATE.ro
  },
  methods : {
    stuff : function(
      state_ro.foo ...     // is there any difference?
      ... STATE.ro.bar     // does it matter if I use
    )                      // state_ro or STATE.ro?
  }

This mess is GONE with Vue3. Making things reactive is 100% explicit. data can be used exclusively for local variables to that component instance. methods can be used to get external state data, and if it is reactive that methods will trigger and the component will update.

I can imagine that this can essentially be done with Vue2 as well. But with the implicit reactivity system based on putting external state in data I never managed to figure it out.

When my code is migrated to Vue3 I will never look back at Vue2. I think.

Performance

I get a bad feeling when I think of thousands of lines, where each line is a complex object (like an invoice), and everything is made reactive, recursively. And that there are thousands of components on my web page, that each depend on several objects/properties in every invoice. And that these thousands of lines may just be discarded when something new arrives over the network, garbage collector trying to make sense of it, and new complex lines comes in to be made reactive. Perhaps it takes 0.05s and it is no problem. Perhaps it always works.

To just render everything again is usually no problem, very predictable, and rather easy to optimize if needed.

But I think like I did with AngularJS. Use the reactivity-system inside the components. But do not let the components, or the Vue Application for that matter, be made aware of everything. Give to it what it needs to do, to render everything and to allow for user input/edit where required.

A second thought…

I wrote a minesweeper game (test5) with the intention of abusing the reactivity system and see if performance got bad. It turned out I wrote a too good implementation, and the reactivity system worked perfectly. So I failed to prove my idea, but I learnt something on the way: that the reactivity system is better than I first thought – not the implementation in Vue but the idea, fundamentally.

My fear was that I essentially have two trees of objects

  • Data, nested data, deeply nested data, complicated data and separated data
  • UI, nested components, deeply nested components and separate components

My fear was that data consists of tens of thousands of reactive nodes, and each of them will trigger an update to hundreds or thousands of UI-components. However…

…in reality the data-tree will much resemble the ui-component-tree. Often there will be 1-to-1 relationships. This means that nothing will be updated in vain, and everything (and only that) which should be updated will be updated, typically each triggered by one or a few reactive “events”.

What would be wasteful?

  • If a single small component depends on a lot of spread out data – but that is already wasteful design because everything needs to be calculated every time – which is probably a bigger problem than the reactivity system
  • If the data tree is much larger than needed (for the current presentation). Lets assume we have a game with a few AI players. Each AI player is just presented as name, score and a few more fields. But the AI implementation may be several megabytes of complex data in memory. There is NO reason to make that data reactive out of laziness.

My basic design in AngularJS was:

  STATE ==> Presentation Data ==> Apply Filters ==> Apply Paging ==> Give to Angular

This means that the Presentation data is already structured quite much as the UI and its components, and it does not contain more data than necessary (or it does not have to, if it gives problems).

Disclaimer

I will be doing work based on this “reasearch” in the near future. I will update this post if I discover something relevant.

Apples Mac-lineup finally makes sense

It is great to see not only that M1 seems to be a fantastic chip, but also that Apple finally, after many years, seem to get their entire lineup in sensible order.

iPhone        A15
iPad Mini     A15
iPad Air            M1
iPad Pro            M1
MacBook Air         M1
MacBook Pro               M1Pro    M1Max
MacMini             M1
iMac                M1
MacStudio                          M1Max   M1Ultra
Mac Pro                                    ??????? ???????

I have intentionally omitted the 13 inch MacPro. I doubt we will see much more of it.

So we have all consumer models with M1 standard as only configuration. And the simplified way of understanding the pro models is:

  • M1
  • M1 Pro – “M1 2x”
  • M1 Max – “M1 4x”
  • M1 Ultra – “M1 8x”

The important thing here is that the standard M1 is powerful enough for most everything. It is when you do serious media editing, computations, gaming, or large development projects that a pro model make sense.

MacMini vs MacStudio

MacMini is for consumers, MacStudio is for professionals. I don’t know if we should expect or even ask for the M1 Pro in either of them. Different models of the M1 chip have different USB-port capabilities. I suspect an M1 Pro would be “wasted” in a MacMini, and would not be able to deliver the ports of a MacStudio. I think it is a nice thing that ports are consistent for different CPU models of MacMini and MacStudio. The MacStudio is expensive, but compared to historical Pro desktop macs, it is quite ok.

iMac

iMac is back where it started: an entry consumer model, with an M1. I think it makes much more sense than 27-inch iMac Pros.

MacBook Air

MacBook Air is both the consumer, most afforadable, and most portable laptop. I doubt we will see the consumer iBook back, in colors and everything, but why not?

MacBook Pro

When it comes to Pro laptops, USB-port options and heat becomes more important than for other models. The Ultra probably does not “fit”, and the M1 Pro model offers many advantages to the M1 standard here.

Mac Pro

My guess is that with MacStudio out, the demand for a MacPro is significantly reduced. I would not be surprised if it comes as a rack-mountable industrial Mac.

RAM, SSD and lack of expansion options

I have complained in the past about the lack of expansion options (replacing SSD in MacMini and MacBook for example) in modern macs. Currently M1 can be equiped with 8GB or 16GB of RAM. I think that is just fine for the consumer, working consumer or prosumer. The advantage of the close integration of CPU-RAM-GPU appears to be part of the M1-success, so there is no point in complaining about RAM.

I would have wanted to replace SSD-drives with time. It mostly disturbs me that I cannot repair a broken drive. But on the other hand I don’t know if they actually fail. I have not read that failing SSDs is a huge problem in Macs last years. Fast USB-ports essentially elimate the need for extra internal storage.

Gaming

It seems to me the MacStudio is the suitable gaming computer. How it compares to a similarly priced Windows PC I do not know.

Elemental Dice 1-4

I have received Elemental Dice 4, and will now make a post about all the 25 dice. I have previously posted about 1-3 and Silver. Lets start with a picture of all 25 (it is hard with light and reflections).

I have measured the density of all the dice on a kitchen scale with 1g precision.

EDAtomic WeightElementDens (g/cm)Dice Weight (g)Weight quoteActual Density (g/cm)Quote
46C2.2673.101.7175.62%
12Mg1.73874.031.7198.33%
13Al2.7114.072.6999.46%
22Ti4.5184.004.3997.66%
424Cr7.19283.896.8495.08%
26Fe7.874303.817.3293.02%
427Co8.9353.938.5496.01%
28Ni8.9353.938.5496.01%
29Cu8.96364.028.7998.09%
30Zi7.133253.506.1085.57%
439Y4.47173.804.1592.85%
440Zr6.49264.016.3597.81%
441Nb8.57333.858.0694.01%
442Mo10.2403.929.7795.74%
45Rh14.4352.438.5459.34%Plated
46Pd11.9352.948.5471.81%Plated
X47Ag10.49413.9110.0195.42%
448Cd8.7333.798.0692.61%
50Sn7.31293.977.0896.85%
464Gd7.9313.927.5795.80%
74W19.3773.9918.8097.40%
78Pt21.45341.598.3038.70%Plated
79Au19.25351.828.5444.39%Plated
482Pb11.29433.8110.5092.99%
83Bi9.78383.899.2894.86%

A “4” in the first column is that they are new for the Elemental Dice 4 series and not included in my previous article. Densities seem quite fine, most of them well above 90% (which means I have no imminent reason to think the dice are not what they say they are). Carbon (C) has a lower density than expected (for graphite) but Carbon is not a metal and it makes sense to me that manufacturing method affects the atomic configuration.

The box states “pure elements can change color over time as the result of long term air chemical reactions with the […] air”. I sorted them from darkest to lightest and took a picture:

10 dice, sorted by shade of grey

This is difficult. Pb is more blue/cold. Cr is very shiny. Gd & Y changes position depending on light and perspective. But it gives you a hint.

Fe, Co, Ni (26,27,28) are all magnetic, as is Gd. The plated dice are slightly magnetic due to the material in the core, not the plating.

Elemental Dice Silver vs Silver

I wrote a post about my Elemental Dice a little while ago and the Silver dice got an entire section for themselves. I had owned the plated one longer and it had been in the aluminium stand. This is what they used to look like:

Plated silver to the left, severely oxidized after months, solid silver to the right, somewhat oxidized.

So, my guess was that the aluminium stand did something bad to the silver.

Since then the solid silver has been standing in the “faux leather dice roll mat” (available in E.D.2) and the plated silver has been standing in the aluminium stand. Now, a month and a half later I found that if any of them had any miscoloration it was the solid one, on the 6th face, that had been exposed to the faux leather.

I washed them both carefully in warm water and manual dish washer (which typically is used for utensils of metal), and took a few photos (with my new TX-158 “microscope”):

Solid Silver
Plated Silver

What you can clearly see here is that the solid one is laser engraved leaving the letters matte. The plated one is plated after the laser engraving, so also the letters are shiny. You can see this with your eye if you just look at them so this is an easy way to tell them apart (you can also determine that the solid one is a bit heavier, but it is not so obvious when you have them in your hand).

I took another picture of both of them at the same time.

Solid silver to the left, plated to the right

You can very clearly see that the inside of the “g” shines on the plated one and is matte with the solid.

But I also now see that more things are different. The plated one has had a thin layer of silver added afterwards, and that silver seems to have attached in a naturally shiny (almost liquid) way. The solid die on the other hand seems to have been polished to be shiny, leaving a very fine brushed surface.

To the naked eye, they also do not look exactly the same. The solid one appears to be more grayish and the plated one more warm yellow and perhaps even more shiny. If this is a matter of different age (time in the poluted air), different surface structure, or slightly different silver alloys I can not tell. Also the solid one seems to be blackish on 6th face.

Here is a picture of the 6th face of both dice. The solid die, to the right, has some black stains, and I suppose that is silver oxide (left one has been 45 days in aluminium stand, right one has been 45 days on faux leather).

Plated silver to the left, solid silver to the right.

But for now, it seems I was wrong about the aluminium oxidizing silver. I washed them today and I will put them back as they were, solid on faux leather and plated in the aluminium stand.

Technaxx TX-158 Microscope Review

I just got this idea that I want a Microscope. There are very many to choose from, and the prices vary much as well. I have no professional or real need of a Microscope, I am just a nerd. One thing I wanted to do is to have a close look at my Elemental Dice.

When I was quite young I had a childrens microscope that was 100x, 200x, 300x magnification. It was not so easy to use, and obviously it was not capable of capturing digital pictures. After doing some research I decided to buy a very simple cheap USB/Wifi microscope, knowing that it would probably not be so amazing.

Technaxx TX-158 basics according to marketing:

  • Live view for PC or smartphone (so I can use my iPad as a screen)
  • Photo/Video (I just care about photo)
  • With a stand
  • LED illumination
  • Magnification up to 1000x (as I see it, it is max 40x magnificaiton, see below)
  • Full HD resolution

This is mostly true. What is absolutely not true is 1000x magnification. The stand is on the cheap (light, flappy) side. The pictures are 1920×1080 and then the question is: are they that sharp? You will see for yourself below. All pictures below are straight from the TX-158, no editing.

Basic usage and features

It is easy to get started (with iOS, only thing I tried).

  1. Charge it using USB (cable but no power supply included)
  2. Download the iWeiCamera App from Apple App Store.
  3. Turn TX-158 on.
  4. Connect your iOS device to the unencrypted WiFi network called Cam-something
  5. Start iWeiCamera
  6. Use the wheel on TX-158 to focus
  7. Use the button in the App or on TX-158 to take a picture.

That is kind of it. You export the pictures from the iWeiCamera to Photos (in iOS), and then send them to your Mac with AirDrop (or something else you find convenient).

Optical Capability

TX-158 has 8 LED lights that can be adjusted (pressing the on-button repeatedly). This is convenient. It also has a transparant plastic shell around the lens. I have found that the shortest possible focal depth is “kind of” the distance you get if you place TX-158 on a surface. You may be able to focus on something that is slightly closer, but not much. If a small coin fits inside the plastics shell you are probably fine. My 16mm dice also fit inside, that does not work.

You may however photograph items more far away. This picture of a 16mm metal die is taken (horizontally) from almost 10cm (click the image to open the full resolution).

The noise around/behind the die looks a bit strange, but it is probably reasonable given how I mounted the die between white postit notes. If I open this picture on my computer display the object is about 16cm large (with no digital zoom). The actual object is 16mm, so to me this is about 10x magnification.

I then moved the die as close as possible and focused on “13” in the top left corner.

I would say this picture is about 4x more magnified than the previous one (just measuring the height of “13”.). Compared to the real object I would say we have about 30-40 times magnification. Anything “more” than that is just digital zoom, and I do not think the picture quality allows for much digital zoom.

Zoom & Focus

The box that comes with TX-158 states on the backside: “Up to 1000x magnification / Magnification adjustable with turning wheel”. In the little booklet however I read: “Zooming: turn the focus wheel until you reach the personal best view option”. So it is a focus wheel and the marketing about “adjustable magnification” is a lie. The good thing is that it is obviously a “fixed” or “prime” lens which is better for image quality than a zoom lens. Adjusting magnification is easy (within 10-40x something) by simply moving the TX-158 closer or more far away from the object. But when the object gets too close to the lens it can not focus anymore.

The little booklet also mentions Autofocus. I am not 100% sure, but I don’t think it has any autofocus.

More pictures

All the below pictures are taken by simply placing the TX-158 on top of whatever I photograph and manually adjusting the focus.

Dust on a plastic surface
The surface of a worn Teflon or Ceramic frying pan

An oiled wooden table

One of my hairs
Worn wooden surface
A leaf, cut off from a pineapple (stainless surface at top of picture)
A blanket made of wool
Fake/faux leather
A piece of dirt – wax from a cheese probably – on a stainless surface
A piece of linen cloth
The text TECHNAXX, on the image of TX-158 printed on the box it came in
Pineapple
3cm mark on an aluminium ruler (the lines to the right are mm lines)
A drop of honey on what I thought was a black metal surface (the 8 LED lights reflect in the drop)
An iPhone connector
Tip of a knife
Grains of salt in a blue porceline bowl
A safety match
Letters svERige on a coin

Conclusion

After having played with an analog childrens microscope at 100-300x when I was little, I kind of hesitate to call the TX-158 a microscope at all. To me it is more a macro-photo-camera.

When you get to “real” 300x magnification you can start seing things that this device do not at all reveal. I would say it is 40x magnification (and then I am quite generous), but perhaps that is the wrong way to measure it.

The practical thing is that 40x is not THAT much, so it is quite easy to move around the TX-158, find your object and adjust the location of things manually. For a higher magnification you probably need a much more stable stand, and being able to move the microscope or the sample in a controlled way. TX-158 is more point and shoot.

Anyway, when you read about different microscopes for sale on Amazon and other places, if it mentions magnification in the range of 1000x, just do not trust it. I doubt any real microscope can be 100-1000x magnification or anything like that.

The iWeiCamera-App is very rudimentary. Copying images from the App to Photos gives me a message in Chineese. But connecting the iPad via WiFi and getting started is very simple.

I guess for soldering work or other very delicate work, it is a useful digital magnification glass. Then the stand probably more comes to its right too.

Qnap, SonarQube and Elastic Search

Update 2021-10-20: Solution in the end of the post

I use SonarQube (and SonarScanner) to analyze my JavaScript source code in a project that has almost 200k lines of code.

SonarQube is a non-trivial install and it should be on a server so different developers can access it. Thus, SonarQube is an application that it would make sense to put in a packaged container, easy to set up.

I have a QNAP, with Container Station installed. That allows me to run Docker images and Linux (LXC/LXD) image. To me, this sounds like a perfect match: Just install a SonarQube Docker container on the QNAP and be happy!

Well, that was not how they thought it.

Last time I checked the SonarQube docker image did not come with a database. That would have been the entire point! Most work related to setting up SonarQube is related to the database. Docker support data folders, so it would be easy to configure the docker container with a single datafolder for the database and everything. No. You need two docker images.

The next problem is that SonarQube comes bundled with ElasticSearch which has some remarkable system requirements. Your operating system needs to be configured to support

  • 65535 open file descriptors (link)
  • 262144 vm.max_map_count (link)

Now the first problem is that Docker in QNAP does not support this. However it works with LXC.
The second problem is that QNAP is getting rid of LXC in favour of LXD, but you cant have 65535 open file descriptors with LXD (on QNAP – hopefully they fix it). So I am stuck with unsupported LXC.

But the real problem is – who the f**k at Elastic Search thought these were reasonable requirements?

I understand that if you have hundreds of programmers working on tens of millions of code you need a powerful server. And perhaps at some point the values above make sense. But that these are minimum requirements to just START ElasticSearch? How f***ing arrogant can you be to expect people to modify /etc/security and kernel control parameters to run an in-memory database as a priviliged user?

The above numbers seem absolutely arbitrary (I see that it is 2^16-1 of course). How can 65535 file descriptors be kind of fine, if 32000 are not? Or 1000? I understand if you need to scale enormously. But before you need to scale to enormous amounts of data, it would be absolutely wasteful, stupid and complicated to open 50k+ files at the same time. And if 32000 file descriptors are not enough for your clients big data, how long are you going to be fine with 65535? For a few more weeks?

This is arrogant, rotten, low-quality engineering (and I will change my mind and apologize if anyone can provide a reasonable answer).

All the data SonarQube of goes to a regular database. ElasticSearch is just some kind of report-processing thing serving the frontend. I did a backup of mine today, a simple pg_dump that produces an INSERT line in a text file for every database entry. Not very optimized. My database was 36Mb. So if Elastic Search would use just 36000 file descriptors, each file correspond to 1k of actual data.

I don’t know if I am the most disappointed with the idiots at ElasticSearch, or the idiots of SonarQube who made their quite ordinary looking GUI dependent on this tyrannosaurus of a dependence.

Hopefully the QNAP people can raise the limits to ridiculous values, so nobody at ElasticSearch needs to write sensible code.

And if anyone knows a hack so you can make ElasticSearch start with lower values (at my own risk), please let me know!

Solution!

QNAP support helped me with the perhaps obvious solution. Log in as admin with ssh to the QNAP and run:

[~] # sysctl -w vm.max_map_count=262144
[~] # lx config set deb11-sonarqube limits.kernel.nofile 65535

The first command I already knew. You have to run it whenever the QNAP has restarted.

The second command is for setting the file limit in the particular container (deb11-sonarqube is the name of my container). I guess you just need to do it once (and then restart the container), and that the setting remains.