Not boring, and a bit of a condescending prick
219 subscribers
31 photos
115 links
Semi-digested observations about our world right after they are phrased well enough in my head to be shared broader.
Download Telegram
The Rust community in the near future will not be those C++ folks converted.

It will be the Golang and Java/Python folks who had to enter the low-latency high performance world, liked it, and decided to stay.

What I mean is that if you are a JVM or a Golang person today, who is eyeing Rust to play a role in your future career, getting your hands dirty with C++ first will likely deal more harm than good.

The reason is not in the language. The reason is in the community.

C++ and ex-C++ people tend to keep things nontrivial, and often look down at those who “can’t code right”. I believe this stance is wrong, despite being a C++ person myself.

“Make a tool a fool can use and only fools will use it” is a very, very bad idea. Instead, we should strive for building tools so that experts and amateurs can work hand by hand, productively, enjoying the process and learning from each other in the meantime.

Even though on the emotional level my inner Dr. Gregory House disagrees vividly — my personal learning curve was full of “Dima, what an imbecile you are!” and I love and cherish these experiences — such a hardcore approach just does not scale in the industry today.

The Rust folks understand this well. Before them, the Golang folks understood it well. The Java folks get this too.

The C++ crowd is largely different. Mostly for good reasons, and I can empathize quite a bit. But it is very different indeed

And the future of the industry belongs to those who want to foster seamless collaboration between industry experts and pure beginners from day one.

And this is why I believe the Golang-to-Rust transitions will be far greater and far smoother than the Cpp-to-Rust ones.

Just phrased this over breakfast, and want to have it journaled to check back some ten years from now.
"Seymour Cray (of Cray Supercomputers) loved sailing on the Great lakes. He loved sailing so much that every year he built a new sailboat to sail. He would design an engineer them and also participate in building them by hand.
In the summer he would sail the boats. But then in the fall he would burn them. And start the process all over again.

He did so because he doesn’t want to become a prisoner of his old boat design. He wanted to start with a blank sheet of paper the following year."
Seriously?

Think what you want about the maturity of Terraform / OpenTofu, but this is such a low play by HashiCorp.

What next? Confluent claiming RedPanda are the “bad guys”? Redis Labs arguing that Amazon has copied their product after AWS does offer an in-house version of Redis?

Folks, if you are unable to provide a for-profit service _to such a degree_ that just _a community of enthusiasts_ is a tangible threat to your market share … maybe do your job better first, to win this market and to keep playing a positive-sum game?

As opposed to openly and explicitly playing a negative-sum game hoping to make your founders and investors slightly less unhappy?

While I am less optimistic about open source today compared to where I was some ten years ago, personally I’d love open source to keep thriving. Hence this post.

Let me know if there’s any petition worth signing, although keep in mind I don’t use OpenTofu myself.

~ ~ ~

OpenTofu Project was recently made aware of a letter by HashiCorp’s lawyers, alleging that OpenTofu was not respecting the terms of its BSL license governing its Terraform codebase. OpenTofu vehemently disagrees with any suggestion that it misappropriated, mis-sourced, or otherwise misused HashiCorp’s BSL code. Indeed, it seems that HashiCorp may be conflating code that it had previously been open-sourced under the MPL and more recently developed code it published under the BSL. OpenTofu’s maintainers have investigated this matter, and intends to issue a written response providing a more detailed explanation of its position in the coming days.

~ ~ ~

Hope this is just a misunderstanding of some sort, which will be resolved quickly; ideally by HashiCorp apologizing publicly for raising eyebrows unnecessarily.
So, with C++, I got briefly exposed in practice to the world of Linux processes, zombies, termination sequences, etc.

(Ref. popen2 test and its example with the test runner, scroll to the very bottom if you are curious.)

One thing I've learned/confirmed is that exit(0) will:

⒈ Call the destructors of global objects and singletons,
⒉ *Not* call the destructors of locally- and scoped- allocated variables,
⒊ Has nothing to do with threads, and thus
⒋ Will overall leave the program in a weird semi-dysfunctional state if at least one thread refuses to cooperate.

In order to handle the above properly, the solution I am leaning towards is:

∙ Some globally-implemented KillSwitch,
∙ Some globally-implemented thread-watching singleton,
∙ Create all std::thread-s from under a proper wrapper, which would journal which of those threads are currently alive,
∙ Extend our WaitableAtomic to support notifying other WaitableAtomic-s that it's time to die, so that even the threads wait()-ing on conditional variables will be awoken by the kill signal coming from within the binary,
∙ Introduce some gentle "two-phase" exit, which is exit(0) followed by some small-ish wait for those "monitored" threads to die, followed by kill(getpid(), SIGKILL).

Coupled with proper logging, the above looks reasonable to me. I could also add a global manager (or re-use the threads one) to keep track of popen2()-ed sub-processes too, even though with processes exit(0) seems to successfully kill them. (TODO(dkorolev): To confirm with a proper clean test.)

Still, kill(getpid(), SIGKILL) looks like a major overkill to my taste.

EDIT: exit(0) followed by abort() after a timeout in a detached thread seems to work best so far. I'd have to instrument all threads and popen2()-s and singletons, and probably construct all potentially offending singletons in different threads so that they can all be destructed in parallel, but the price seems reasonable so far.

Any system programmers among my readers? What would you recommend?

Thanks in advance!

PS: My binaries generally run as restartable by some outer service (the cron + flock combo is a safe version of it), and thus dying is a relatively standard behavior for them, since dying and properly restarting is safer than failing to recover from a weird error. This may be suboptimal, but it is what it is. However, this means that a) leaving zombies is very much undesirable, and b) failing to die as instructed is just the fatal blow to the stability of the system. Looks like (a) is not an issue in my case, while (b) truly is.
The more I read about Section 174 — very un-American to my taste, btw — the more I come back to the “trivial” question of money management.

Say one is consulting through a legal entity. Let’s assume for the sake of this thought experiment that whoever is paying for the services is not concerned about where this legal entity is registered.

Let’s further assume that one needs no disposable income from this consulting project for some period of time. Maybe they have a day job, or savings, or partner working, or some other company paying their expenses while they travel for business, etc.

So, the natural instinct would be to save that money made through consulting and invest it, right?

Surely, once this earned+invested money is cashed out it will be subject to taxation, there’s no question about it. But for the time being, if the return on investment is reasonable and the amount of time is large enough, receiving this money as personal income is just … suboptimal.

What jurisdictions are good to:

• Register the legal entity,
• Reveive the money and keep it there for 1+ years,
• Pay corporate tax on it if applicable, as long as the rate is reasonable,
• Have investment options available for legal entities, so that one could, say, buy $MSFT or short $NVDA,
• Trust the jurisdiction and the banks to know the money is safe, and
• Ultimately “withdraw” this money, paying the income and/or capital gain tax required by one’s personal tax residence.

Where should one look into among established reputable countries, so that US- or Europe-based companies would be comfortable paying “there”? Emirates? Cyprus? Singapore? Japan?

Thanks in advance!
Folks, just for my sanity, if the goal is to generate unique auto-incrementing uint64_t IDs in multithreaded C++ code, then:

1) std::atomic::fetch_add() is guaranteed to do the job correctly,
2) Also, if x is std::atomic_uint64_t, then uint64_t next_id = x++ is guaranteed to do the job correctly,
3) Furthermore, next_id = ++x would also work correcty,
4) Although, of course, mixing next_id_1 = ++x and next_id_2 = x++ is definitively buggy code.

Right?
Sorry in advance for bugging y'all with my work setup topic. It still interests me though, I'm counting on some help from the lazy web, and the thoughts may benefit others. So here they are.

Basically, what I'm looking for is a portable work setup where 𝘁𝗵𝗲 𝘀𝗰𝗿𝗲𝗲𝗻 𝗶𝘀 𝘀𝘂𝗯𝘀𝘁𝗮𝗻𝘁𝗶𝗮𝗹𝗹𝘆 𝗮𝗯𝗼𝘃𝗲 𝘁𝗵𝗲 𝗸𝗲𝘆𝗯𝗼𝗮𝗿𝗱. The number one objective is to prevent myself from looking down all the time.

From experience I know my neck and back and posture are immensely grateful when I manage to work straight. And, obviously, using the laptop with its built-in keyboard is an almost sure way to always look down neck-wise.

And I work from various random places a lot, so the setup should be portable. We're not living in a world where there's a decent coworking chain present in all the places I am finding myself in where I could just have a membership for a standing desk with my favorite keyboard. So, "Starbucks-friendly" is a good way to formulate this requirement.

The idea to have a built-in power bank is theretore optional. Originally I was assuming the setup would need some heavy & solid foundation to be stable, and the best thing to fit into this foundation was a power bank plus some USB-C KVM adapter. Batteries are good these days though, so this requirement is probably redundant.

What I'd love to have though is a MagSafe/Qi2-like magnet. These things rock these days. But then again: magnets are good even without the charging capability.

Stand-wise thus, I'm looking at some hybrid of the two attached images. Tall enough on the one hand, but nicely looking and compactly foldable on the other hand. It should not be embarrassing to set it up in a few seconds in a coffee shop, and it should fit the backpack nicely.

So, for the physics / geometry question, if you have suggestions for the above part, I'd be delighted to hear them.

Now, for the actual work part, as in, the computer. My setup will include an external keyboard. regardless. Mouse optional, I'm a vim user, and most screens these days are touch screens. With an external keyboard though, I'm finding myself to be OS- and platform-agnostic: even Android would do, as long as I can install a version of it that supports multiple users, to not mix my personal stuff with work, social media, banking apps, etc.

Now, at this point, I'm open to many options. It could even be a Microsoft Surface (!), which is lying flat at the bottom as the base (!!), so that what's magnetically mounted to the stand that butterflies out up and above is a portable external monitor (!!!). Seriously, I'd be fine buying a powerful "keyboard-equipped tablet" and sentencing it to be forever used "face-down", as the portable CPU + GPU + battery + LTE.

(Yes, I've looked into portable computers, but they do not come with batteries and are of the wrong shape. If there is a way to buy a "screenless" and "keyboardless" laptop, I'm down.

However, with modern-day glued-up-anything magnetic stripes, I don't think I'd be sacrificing the very Surface-et-al tablet if I take this path. Yes, I'd glue four thingies at the corners of its back side, and yes, in my backpack it'd stay "magnetically mounted" to the stand that unfolds, so that I could take it out with one move and put up the external screen with another one. The external screen could also be mounted magnetically. Heck, it could even be one of those foldable screens, so I get double the diagonal once it's opened up.

We're on to something with this thought experiment. But then again, power and cables. They would be a pain. Maybe then my "business machine" should "just" be a powerful Android phone, with an external monitor and a KVM switch + power bank remaining in my backpack for the duration of the "Starbucks work session".

What do you think? Have you seen / wanted / built anything similar? If so, please let me know. I'm down to experiments, up to and including ordering something custom-made from a local mechanical shop enthusiast and/or from Kickstarter.

Two pics in the comments.
If you are seriously considering an academic career, esp. in Europe, please do watch this video by Sabine.

To make it super clear: I personally believe Sabine is what a scientist should be attitude-wise and mindset-wise. Unfortunately, this breed of people is pretty much extinct from academia, "thanks to" incredibly effective negative natural selection.

So next time I politely ignore arguments that have to do with peer review and the number of citations, that's about the best way to explain my views of the field.
Tried on my Windows — true indeed!
My licensed copy of Windows (tm) 11 does not have a functional spreadsheets app out of the box. Excel does open ... and then it closes immediately as it is not "registered".

Lol and rofl that under Windows Subsystem for Linux (tm) there is ... drum rolls ... LibreOffice Calc, which works out of the box, and is even suggested from the Start (tm) menu as I've used it several times.

I mean, really, why can't we have nice things? Are PC consumers that indifferent these days?

The bottom line is that I did sincerely give Windows a try, but will be going back to Linux now. I spend most of my time in WSL regardless, and have to refer back to Chromium / Google since Edge / Bing are not perfect for tricky queries. Plus, the Copilot pop-up is annoying, and it's not easy to turn off (I've edited the respective registry key and now instead of opening Copilot Win+C "just" opens Edge, hehe).

And the fact that the "Recall" feature is even considered for development is already a red flag to my taste. Because even if MSFT walks back from it now, I know how corporations work — the product itself will not go anywhere, and even if they promise they've scraped it it'll keep lurking here, there, and everywhere.

Also, in some 2000s and 10s you would imagine the company's stock to tank after such an announcement, while today I actually believe it will go up — investors love "AI" and what is Recall if not more training data for next gen "AI" models?

Alas, so long, and thanks for all the fish.

The only thing I'll really miss is single-digit millisecond end-to-end mouse responsiveness, but oh well.

And there's always dual-boot. I'll still use Windows to record Full HD videos (several times a year) and to play Starcraft (several hours per year, sigh).