Automated updates: 2020-05-25

This commit is contained in:
John Colagioia 2020-05-25 07:12:27 -04:00
parent 51848bf2ee
commit 014b365f39
2 changed files with 106 additions and 1 deletions

View File

@ -29,7 +29,7 @@ This should go without saying---even though I'm going to repeat it with every Bo
## Seeds — First Chunk of Three
If you haven't already watched it, here's your opportunity to catch up!
If you haven't already read it, here's your opportunity to catch up!
Unfortunately, there's no easy way to embed the media, so you'll want to click through to read the [Prologue](https://floraverse.com/comic/seeds-a-mini-story/seeds/prologue/), [Chapter 1](https://floraverse.com/comic/seeds-a-mini-story/seeds/chapter-1/), [Chapter 2](https://floraverse.com/comic/seeds-a-mini-story/seeds/chapter-2/), and [Chapter 3](https://floraverse.com/comic/seeds-a-mini-story/seeds/chapter-3/).

105
2020-05-25-afday.md Normal file
View File

@ -0,0 +1,105 @@
---
layout: post
title: Developer Journal, Africa Day
date: 2020-05-25 07:12:12-0400
categories:
tags: [programming, project, devjournal, bicker, uxuyu]
summary: Progress on assorted projects
thumbnail: /blog/assets/Africa_and_Europe_from_a_Million_Miles_Away.png
offset: -45%
---
Today is [Africa Day](https://en.wikipedia.org/wiki/Africa_Day), commemorating the African Union's founding.
![Africa](/blog/assets/Africa_and_Europe_from_a_Million_Miles_Away.png "Africa")
If you want to be *that* person, it's apparently also [Geek Pride Day](https://en.wikipedia.org/wiki/Geek_Pride_Day), but since so-called "geek culture" revolves so much around big-corporate-controlled media franchises...eh.
Probably more importantly where I live, it's also [Memorial Day](https://en.wikipedia.org/wiki/Memorial_Day) in the United States, where we mourn those who have died in the line of military duty. It'd be nice if we could stop adding to their ranks. It'd also be nice if politicians could just once remember what the holiday is for and not wish us a "happy" one and opining about who is blessing the country, but baby steps, I guess...
For my own part, I didn't get nearly as much accomplished as I wanted.
## Uxuyu
The boring part is that I updated the `.gitignore` file to ignore the database.
I also took the first steps towards storing the currently known set of feeds, by sending the data (which I have been keeping track of for this purpose) to the new account-management thread.
```javascript
this.state.threadAccount.postMessage(this.state.knownUsers);
```
Since worker threads continue to be slightly more useful than [I expect]({% post_url 2020-04-15-worker %}), receiving that message is exactly symmetric to receiving a message in the main thread.
```javascript
parentPort.on('message', (message) => {
// Process the message
});
```
This was a big enough breakthrough that it warranted its own commit, this time through.
## CPREP Background Generator
I've been fixing small issues with **CPREP**, like formatting and display, and adding some comments.
Because the map of skin tones is---bluntly---pretty terrible, I've added a supplemental set of skin colors that are less stupid from [this image](https://commons.wikimedia.org/wiki/File:Felix_von_Luschan_Skin_Color_chart2.svg) by [A7N8X](https://commons.wikimedia.org/wiki/User_talk:A7N8X).
![Von Luschan scale](/blog/assets/Felix_von_Luschan_Skin_Color_chart2.svg "Von Luschan scale")
To work with this, I added a simple function to just pull apart the red, green, and blue values and finds the nearest color on the chart. Why use RGB instead of HSL like I recommended in [my post on colors the programming way]({% post_url 2020-03-11-colors %})? Because the hues are in the red-to-orange space and saturations are two-thirds to three-quarters, since skin colors are just different kinds of brown.
In the future, it might be worth doing the analysis and weighting the HSL components in a useful way, but until then, it comes down to something like this:
```javascript
list.forEach(c => {
const ccb = c[1] & 0x000000FF;
const ccg = (c[1] & 0x0000FF00) >> 8;
const ccr = (c[1] & 0x00FF0000) >> 16;
const dr = ccr - cr;
const dg = ccg - cg;
const db = ccb - cb;
const dist = dr * dr + dg * dg + db * db;
if (dist < minDist) {
minIndex = idx;
minDist = dist;
}
idx += 1;
});
```
(Actually, I need to patch the colors; I just realized that I got the order of operations wrong in the version on GitHub.)
You should recognize `dist` as (the square of) the [Euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance) between two points. You *might* not recognize JavaScript's bitwise operators. A single ampersand (`&`) is a binary-AND, which takes each bit in a number and produces an answer where the resulting bit is on ("1") only when the corresponding input bits are on; don't confuse this with the double-ampersand (`&&`), which is a *logical*-AND, doing the same for two conditions. There's a corresponding binary-OR (`|`), of course. The right-shift operator (`>>`) drops the least-significant bit in the number of times mentioned in the second operand, so it *basically* divides by 2<sup>n</sup>.
So, `ccb` is the number representing a color with the non-blue components zeroed out, and bumped down to wipe out the lower four zeroes, if that makes sense.
Oh, and I also fixed the date. Somehow, I never noticed that the earliest day of the year was mysteriously going to be New Year's **Eve**.
## Bicker
I bumped a couple of libraries to their latest versions for security reasons. Nothing much exciting, there.
## Menial Changes
Not yet (and maybe never) for the blog, but I've shifted over to [Victor Mono](https://rubjo.github.io/victor-mono/) in my IDEs and code editors. It has most of the same ligatures as the excellent [Fira Code](https://github.com/tonsky/FiraCode), but the italic forms are designed to resemble cursive letters. If your editor/environment supports displaying comments in italics, that emphasizes the comments nicely, with a less structured look than the surrounding code.
![Victor Mono in Action](/blog/assets/screenshot-2020-05-25-07-08-21.png "Victor Mono in Action")
The idea has been making the rounds for a couple of years, at this point, but this is the first of the Free Software fonts that I've seen with both feature sets.
## Next
You know the song, at this point. Mostly, **Uxuyu** still clearly needs attention to get where I want it, specifically storing the account information and using that to search *all* feeds while only displaying posts from people the user follows.
I have also hit enough minor snags in testing that I think it's past time to add [ESLint](https://eslint.org/) to the **Uxuyu** project. I'm not sure whether it's Proton Native, the worker threads, or both, but minor syntax errors (the kind that Node.js usually ignores) have been causing fatal errors with no error message, so I'd rather have a tool shoulder some of this load than waste more time guessing what I did wrong the next time. That will probably mean at least a couple of days cleaning up possible issues.
Unfortunately, it looks like the SVG snippets in [Character Creator](https://charactercreator.org/) have a non-commercial license, which (in my eyes) disqualifies them from use in **CPREP**. It's a shame, since it was looking to be easy to generate a simple random headshot. So, now I'm on the hunt for an "*actually* Free" set of facial features.
However, I also have the seed of a new (unrelated) idea that might be interesting. We'll see if I can pull together enough of a design to launch the project this week.
* * *
**Credits**: The header image is [Africa and Europe from a Million Miles Away](https://www.nasa.gov/image-feature/africa-and-europe-from-a-million-miles-away) by NASA, dedicated to the public domain by policy.