I’m still ramping back up to a normal level of experimentation, but I saw some decent hops forward, this time through.
I also added a default “Bicker” user who is now responsible for the URL previews. It currently uses a default Libravatar, since I wasn’t about to try to add a special case.
Like I said last time, the clock was ticking down the seconds until Miniboost needed another feature. This week, the feature was displaying images correctly in the exported HTML. Boost Note uses a placeholder image path (
:storage), which I just needed to replace with a path to the images.
Development on Uxuyu is coming along. Worker threads are kind of stupidly handled, but once I had a thread set up, it was easy to hack out some code to make requests for every feed the current user follows (the configuration file being parsed with the ini package) every few minutes, ship the feeds’ contents back to the main thread, and update the state to change the display.
(If anybody needs it, I wrote up some of the basics in using worker threads on Wednesday.)
So, other than the continued lack of word wrap on Proton Native interfaces, Uxuyu is already no worse than the
twtxt timeline command, which isn’t useful, but is a decent start.
Ignoring the shoddy fill-in-the-blank grammar from un-normalized sources and the mismatched coordinate systems where many locations are hundreds of miles away from where they’re expected to be—for example, picking a location near to New York City on the map and seeing it identified as Canadian—one of the more unpleasant aspects has been not attaching a flag emoji to the city’s location.
Fortunately, I needed to work out how to get the flag emoji when I worked on the original version of the code, just not here. The process is to take the two-letter country code (
za, and so on), convert the letters to lowercase, and convert each of the two letters into the emoji equivalent of the letter.
Straightforward, but the code is admittedly ugly.
Array .from(country.toLowerCase()) .map(l => String.fromCodePoint( l.charCodeAt() + 127365 ) ).join('')
This snippet takes the variable
country with a country code in it—for example, “
- Converts it to lowercase,
- Turns the string into an array of characters,
- For each character in the array…
- Get the numerical code for the character,
- Add the magic letter-to-regional-indicator-letter-emoji number (127365),
- Convert that number back into a character, and
- Turn the array back into a string.
US, which becomes
['U','S'], which becomes
['🇺','🇸'], which finally becomes 🇺🇸…or rather, assuming your emoji font understands the flag-related ligatures, then you’ll see that last step as a flag. If it doesn’t—in a Linux terminal window, for example—you’ll just see the emoji letters, instead.
I tried to follow a similar process for state flags when they’re relevant (for example, when the country is the United States), but they’re not well supported across platforms, yet, and showing people black flags with nonsense characters didn’t seem productive on the chance that browsers someday support the full Unicode standard.
I also found a handful of bugs that should now be fixed. Country choices should now be far more accurate with far fewer people being from the middle of the ocean. Men should have a much greater chance of receiving a male name. It might even not crash when you don’t have SSL keys prepared.
Next time, I hope to see a lot more Uxuyu, at least—the thread should loop every few minutes to update the messages or start scraping the registries—and spend more time on Bicker, especially figuring out how best to work with the URL previews. There are a couple of more tweaks that should probably be made to the background generator. I’m also falling a bit behind on those little automatic security updates.
Credits: The header image is My written Chinese by Pablo BM, made available under the terms of the Creative Commons Attribution 2.0 Generic license, and chosen in honor of the United Nations’ Chinese Language Day, a holiday for which I am utterly unprepared…
Tags: programming project devjournal bicker uxuyu font