[-] bleistift2@sopuli.xyz 2 points 4 days ago

One of the Ursas could have been The Game of Ur

https://en.wikipedia.org/wiki/Royal_Game_of_Ur

[-] bleistift2@sopuli.xyz 21 points 6 days ago* (last edited 6 days ago)

LF line endings.

3
32

First, some context.

I’ve written a program that starts running when I log on and produces data every two seconds. This daemon keeps all the collected data in memory until it gets terminated (usually when I shutdown the system), when it will dump the collected data to a file on disk.

(These are questionable design decisions, I know, but not the point of this post. Though feel free to comment on them, anyway).

I’ve written another program that reads the data file and graphs it. To get the most current data, I can send the USR1 signal to the daemon, which causes it to dump its data immediately. After restarting the renderer, I can analyze the most current data.

The tech (pregnant women and those faint of heart, be warned)

  • The daemon is written in TypeScript and executed through a on-the-fly transpiler in Node.
  • The data file is just a boring JSON dump.
  • systemd is in charge of starting and stopping the daemon
  • The renderer is a static web page served via a python3 server that uses compiled TypeScript to draw pretty lines on the screen via a charting library.
  • All runs on Linux. Mint, to be specific.

As I’m looking for general ideas for my problem, you are free to ignore the specifics of that tech stack and pretend everything was written in Rust.

Now to the question.

I would like to get rid of the manual sending of the signal and refreshing the web page. I would like your opinions on how to go about this. The aim is to start the web server serving the drawing code and have each data point appear as it is generated by the daemon.

My own idea (feel free to ignore)

My first intuition about this was to have the daemon send its data through a Unix pipe. Using a web server, I could then forward these messages through a WebSocket to the renderer frontend. However, it’s not guaranteed that the renderer will ever start, so a lot of messages would queue up in that pipe – if that is even possible; haven’t researched that yet.

I’d need a way for the web server to inform the daemon to start writing its data to a socket, and also a way to stop these messages. How do I do that?

I could include the web server that serves the renderer in the daemon process. That would eliminate the need for IPC. However, I’m not sure if that isn’t too much mixing of concerns. I would like to have the code that produces the data to be as small as possible, so I can be reasonably confident that it’s capable of running in the background for an extended period of time without crashing.

Another way would be to use signals like I did for the dumping of data. The web server could send, for instance, USR2 to make the daemon write its data to a pipe. But This scenario doesn’t scale well – what if I want to deliver different kinds of messages to the daemon? There are only so many signals.

592
[-] bleistift2@sopuli.xyz 107 points 2 weeks ago

Phew! For a moment I thought you were talking about the steam compatibility thingy.

234
[-] bleistift2@sopuli.xyz 123 points 3 weeks ago* (last edited 3 weeks ago)

Damn, this got long. A while back, I read “Only a trillion”, a collection of science essays by Dr Isaac Asimov (yes, the Isaac Asimov; he was professor in biochemistry). I found it mind-blowing how animals evolved out of water and back, and by what traces we can infer that. So here’s a longish excerpt from chapter 9 of that book.

Consider the manner in which life-forms moved out of the sea […] into fresh water and onto land. That involved not only the familiar morphological evolution, but biochemical evolution as well. In the sea, cells developed in a liquid containing certain ions […] in certain concentrations.

Life made the adjustment to those concentrations once and apparently that was it for all time.

When animals grew more complicated and became a group of cells enclosed in some form of shell, skin, protective membrane or what have you, the individual cells remained immersed in an inner liquid resembling sea water in ionic composition. The outer portions of the body, as well as many other things, changed to suit altered conditional liquid, the liquid with which the cells were in actual contact, remained about the same. Our own blood […] is remarkably like a quantity of trapped sea water, and so is the interstitial fluid that exists in the spaces between our cells.

In other words, we’ve never left the sea; we’ve taken it with us.

[…]

Primitive sea creatures have no trouble maintaining the ionic composition of their internal fluids because it is mostly in even balance with sea water, and they have learned, with the millions of years, to tolerate slight changes that may develop in sea water and hence in their own fluids. But when a sea creature invades the fresh water (which, biochemically, is as difficult a feat as the invasion of land) a completely new situation develops.

When a sea creature tries to live in fresh water, it must somehow counteract the natural tendency of the ions within itself to leak out […].

It is considered that any creature that can keep a surplus of ions inside its body against a deficiency on the outside must have had some ancestor that adapted itself to fresh-water. All vertebrates apparently come into this classification and so it is deduced biochemically that the original vertebrate from which all others are descended developed in fresh-water.

To be sure, a number of fresh-water vertebrates migrated back to the sea, to become the ancestors of the marine fish and […] sharks […]. They had the reverse problem now; to keep surplus ions from entering […].

You can find details […] in an excellent little book by Ernest Baldwin called Comparative Biochemistry, published by the Cambridge University Press in 1948.

The conquest of the dry land involved a whole new series of biochemical modifications. One of these concerned the matter of waste-disposal.

[…]

Now for any creature living in fresh water, there is no problem. Carbon dioxide and ammonia are soluble in water, and water is just water. Dump all three substances into the river.

[…]

In fact the only suspicion of risk involves ammonia which is highly poisonous. One part in 20,000 in blood is enough to kill.

[…]

The sharks […], after migrating from their fresh-water origin back to the sea, were faced with keeping ions from the ocean surplus from invading their body. Instead of developing ion-excreting mechanisms as the marine fish did, they worked out the trick of breaking down nitrogen compounds to urea instead of ammonia. Then they allowed urea to concentrate in the blood as they could never have done with ammonia.

In fact they allowed urea to accumulate to a concentration of 2 per cent, which is enough to kill other creatures. Through the ages, shark tissue acclimated itself to urea. The urea in the blood acted as the ions did, in a way, and made the total ion content of shark blood higher than that of the ocean. The problem was therefore once again to keep the ions from leaking out and the sharks could use their old fresh-water adaptations for the purpose instead of having to invent new mechanisms, as the sea fish did.

Incidentally, some sharks migrated back to fresh water after having developed the urea-waste mechanism. Once in fresh water, the presence of urea in the blood was not only unnecessary, it was down right embarrassing. It made the ion content of the blood artificially high so that it was harder than ever to keep it steady against the ion-free fresh water. The fresh-water sharks did the best they could by cutting down the urea concentration in blood from 2 percent to 0.6 per cent, but there they reached their limit. Shark tissue had grown so accustomed to urea, it had become positively dependent upon it. Shark heart, for instance, won’t beat in blood containing no urea. (Our hearts would do fine.)

[…]

As is well known, morphological evolution can be traced in embryos. At various times during development, a human embryo passes through a unicellular stage, an invertebrate stage, and a cartilaginous stage. It shows at various times gills, a tail and a pelt of body hair. In the same way, biochemical evolution can be traced.

The developing chick excretes mostly ammonia for the first four days, when the total excretion is so small and the egg so large in comparison to the tiny embryo that dangerous concentrations are not reached. Then for the next nine days, nitrogen wastes are mostly in the form of urea, there still being a reasonable amount of water to keep the urea concentration low enough. Finally, during the last eleven days when things are getting tight, the wastes are mostly in the form of uric acid.

176
submitted 3 weeks ago* (last edited 3 weeks ago) by bleistift2@sopuli.xyz to c/programmer_humor@programming.dev

[Meme transcription:]

– Hey, why is the shell prompt on the production server red now?
– Earlier: me@prod:~$ docker container remove --force the-application

Protip: If you’re used to shutting down your computer via the CLI, make it a habit to use an alias like off.

This way you will never, ever turn off a remote server by accidentally using throwing poweroff at a residual SSH connection.

463
IEEE 754 (cdn.fosstodon.org)

cross-posted from: https://lemmy.ml/post/24332731

~~Stolen~~ Cross-posted from here: https://fosstodon.org/@foo/113731569632505985

64
Title (lemmy.blahaj.zone)
297
378
263
submitted 1 month ago* (last edited 1 month ago) by bleistift2@sopuli.xyz to c/programmer_humor@programming.dev
[-] bleistift2@sopuli.xyz 183 points 1 month ago* (last edited 1 month ago)

When you try to hit on someone but your charisma is −5.

246
Huge if true (sopuli.xyz)
6

Image transcription: A lengthy source code comment. The details are irrelevant. Github Copilot autocompletes: “This is a bit of a hack, but it works.”

[-] bleistift2@sopuli.xyz 100 points 6 months ago

I’m sure that’s a study in psychology about how survey results are significantly better with dog pictures just waiting to be written.

[-] bleistift2@sopuli.xyz 110 points 6 months ago* (last edited 6 months ago)

Döner Kebab isn’t even a Turkish specialty. In Turkey, Döner (referring to the meat that turns) is served on a plate with salad and bread. It’s not fast food like the German Döner Kebab, and it’s not meant to be taken to go.

Döner Kebab was invented in Germany by a Turkish immigrant whose traditional Döner didn’t fare well, because Germans were always in a hurry.

Or so the story goes that I heard in a documentary on German TV about 15 years ago.

[-] bleistift2@sopuli.xyz 107 points 6 months ago* (last edited 6 months ago)

LaTeX is soo great! You don’t have to worry about formatting ever again.

Puts image I’m talking about 8 pages away from the section that talks about the image

Writes not only over the margin, but over the goddamn page boundary because adding a page was not fashionable that day

Moves a table left by 1 cm on every other compilation, moves it back in the other compilations (happened to a colleague)

So instead of worrying about formatting you worry about learning the incantations that force LaTeX at gunpoint not to fuck up the formatting.

[-] bleistift2@sopuli.xyz 116 points 7 months ago

The author should be killed for indentation alone.

[-] bleistift2@sopuli.xyz 111 points 7 months ago* (last edited 7 months ago)

Hey, IT, I imported this data set twice, and now there are a lot of duplicates. Is there something wrong with the tool?

– Yes, that happened.

[-] bleistift2@sopuli.xyz 152 points 7 months ago* (last edited 7 months ago)

Chocolate production is infested with slave labor, child labor and child slave labor.

https://www.youtube.com/watch?v=FwHMDjc7qJ8

view more: next ›

bleistift2

joined 8 months ago