As it turns out, tomorrow is International Nurses Day (chosen to coincide with Florence Nightingale’s birthday), and I think we can agree that a job that shoulders a lot of the medical system’s burdens—especially where it comes into direct contact with patients—without nearly the recognition of other medical professionals is one worth recognizing.

Surgery

This year’s theme is Nursing the World to Health, which…is either a recent choice or disturbingly appropriate.

Background Generator

Like I mentioned last time, I’ve had some thoughts on adding features to my background generator, including finally giving the silly thing a name so that I can stop calling it “that background generator thing.” It’s now the Character Profile and Recorded Events (Provisional) or CPREP.

In addition, other than some minor cleanup, I added the barest skeleton of a system to recommend the character’s personality. In this case, it uses astrological signs—Western/Hellenic and Chinese—to produce a set of words and phrases that people might use to describe the character.

You can, of course, complain that astrology is a pseudoscience, but it’s a well-documented pseudoscience with a lot of moving parts and centuries of material in the public domain, which also happens to be used to describe a person’s personality in broad strokes. A personality test would cost money to license, would be more tedious to implement, and would be no more scientific.

I’m sure there are other kinds of astrology out there, too, so this can potentially expand into a more robust system that doesn’t just dump out a bunch of vague compliments.

One curiosity that I wasn’t able to nail down: Somehow, I’m generating random numbers out of range. For example, I’m generating a day of the year with this:

const jday = Math.floor(Math.random() * 365);

As is true on just about every system, Math.random() produces a number greater than or equal to zero, but less than one. Multiplying by 365 should produce a number greater than or equal to zero, but less than 365. Applying Math.floor() to that result should produce an integer in the 0–364 range. And yet, I occasionally get numbers outside the range, like 380, which throws the application off. Right now, the “fix” is to just pick a random sign, but that seems like just a second chance to make the same error.

It might be due to what appears to be a syntax error that doesn’t manifest when I run the program locally. That’s better than arithmetic being somehow broken, but troubling that I can’t trust tests run on my own computer. It’ll need to be investigated further, at some point.

Uxuyu

I managed to rig up the ability to post messages from Uxuyu. Getting the timestamps formatted correctly required moment.js, which I already had installed for the incoming posts. For executing the after-post script, I’m using open, which I’ve also needed to open any URLs in posts.

Frustratingly, that “open” library thinks the right thing to do with a shell script is to edit it in vi, so I needed to be more specific by adding a { app: 'bash' } parameter, which is probably going to make Uxuyu less portable, unfortunately.

On top of that, there’s something inconsistent in how lines are appended to the feed. Sometimes I need a new-line character before the post, sometimes I don’t. Right now, I’m solving the problem by reading the file into memory (not a great idea as the file gets longer) and just checking to see if it needs another line.

Marcos Marado was kind enough to submit a pull request, as well, pointing out that best practice is to specify a minimum version of Node.js, especially when dealing with worker threads.

And speaking of worker threads, I’m setting up for a second thread to handle gathering messages from non-followers. My plan is to store the known users (found from registries and posts) in an SQLite database, so that Uxuyu doesn’t clutter the configuration file and to make it easier to share the information between threads.

Stack Overflow Antics

Since I had a few minutes to spare, I answered a couple of questions on Stack Overflow that might be useful to readers, since they’re roughly the sorts of problems that I sometimes post about for Wednesday tech tips.

Any of those might eventually get fleshed out into a story for a Wednesday tech tip, if I can find a further angle to work with.

Next

I need to settle up the CPREP issues, and may start on creating a bunch of new issues by prototyping another klutzy feature, but I suspect that most of this upcoming week will revolve around retrieving non-followed twtxt feeds in Uxuyu. Doing that will allow for notifications when someone you don’t know @mentions you.

As mentioned, my plan is to run this out of a separate thread and store any acquired account information (handles and URLs) in a database. I haven’t decided if it’s worthwhile to do so, yet, but with the database comes the possibility of tracking each feed’s last post and availability, which would make it possible to optimize the network traffic to check feeds less frequently if they’re less likely to be relevant.


Credits: Untitled header photograph from PxHere, made available under the CC0 1.0 Universal Public Domain Dedication.