The Intellectual Wilderness There is nothing more useless than doing efficiently that which should not be done at all.

2019.12.20 10:59

PSA: Reinventing the Wheel

Filed under: Computing,Science & Tech — Tags: , , , — zxq9 @ 10:59

Reinventing the wheel is not always a bad thing, and sometimes it is even called for. If you are engaging in reinvention of some wheels, just ask yourself if you have a reason for doing it.

Good enough reasons:

  • Self education
  • “The existing thingy doesn’t quite do what I want”
  • Creating an open source alternative
  • Simplifying an existing idea
  • Bringing “a lib for X” to a new language
  • You find a particular thing enjoyable to write

Bad reasons:

  • Ego at the expense of project progress
  • Thinking it will win you an argument
  • NIH syndrome (though there can valid reasons for NIH, too!)

The Subversion of the Word “Globalization”

There is an underlying problem with discussions today about globalization. Ideologues have hijacked the term “gloablization” just as they have hijacked the term “diversity”.

“Globalization” is something the Eisenhower administration supported after WWII. The idea was that another massive war would be unlikely if trade were the foundation relationships among nations (particularly nations that have no other strategic reason for interacting).

The basic theory is that while people do not get along well with one another, cultures clash instead of blend easily, and crossing the invisible (but very real) max-mix-rate limit tends to be a prelude to violence, when economic interests align people demonstrate a remarkable ability to suppress political and cultural conflicts in favor of mutually beneficial trade. Free movement of goods combined with a natural self-segregation and general non-interference in internal affairs among nations, therefore, is critical to promoting technology, wealth, and the general advancement of the human condition without forcing people to blindly interact to a degree that makes them uncomfortable.

And that was that[1].

This being an Eisenhower policy, of course, it was based on capitalism. Socialists view capitalism as a Prime Evil and therefore something that must be targeted for subversion, and this is what they have done with the word “globalization”. These days when you see that word in the media it is a reference to “global society”, “global governance”, “global government”, “world law”, “citizens of the world”, “international law”, and related fantasies of the global socialist Left. What is a very, very good thing (voluntary global trade) has been corrupted by this new meaning.

It is important to note that the various flavors of Marxism are “take over the world” ideologies, similar in this way to Islam. If you have ever wondered why Right-leaning political groups are satisfied to allow local issues to be handled by local policy, but Left-leaning political groups always must elevate every village regulation to the national level and then later scream about it as a global problem, this is why.

Trade is good because it flows both directions. Wealthy countries tend to have a “trade deficit” with poor ones because the poor ones have raw goods the rich ones want, and the rich ones have the thing that defines richness: money. Global trade is the greatest “redistributor” of wealth ever devised, and nobody need be coerced to have it work properly.

Free movement of goods is a remarkably powerful strategy both for developed and developing nations, and incidentally does a profound amount of good around the world.

Free movement of people, however, is an absolute aberration and will only result in one of the following ends: impoverishment of the West and eventually the world, a reversal of the trend of ethnic and cultural acceptance in the West, an explosive backlash in the West that will cause a replacement of the leaders the Left screams their heads off as “racist Hitler clones!” with actual racist Hitler clones.

[1. Interesting addendum to this: Eisenhower was the mentor of Richard Nixon. We can see many of Eisenhower’s policies echoed in Nixon’s policies, in particular the brilliant and unexpected ploy to turn Communist Russia and Communist China against one another by “opening” China. Which worked exactly as intended at a time nobody saw it coming, blinded themselves by various ideological rhetoric.]

2019.11.21 17:24

Testing Textually Composed Numbers for Primality

Filed under: Computing,Science & Tech — Tags: , , , , , — zxq9 @ 17:24

Last night on Twitter one of my favorite accounts, @fermatslibrary, put up an interesting post:

Start at 82 and write it down, then 81, write that down, etc. until you reach one, and you’ve written a (huge) prime number. Wow!

This seemed so strange to me, so of course I got curious:

After some doodling around I wrote a script that checks whether numbers constructed by the method above are prime numbers when the number construction is performed in various numeric bases (from 2 to 36, limited to 36 because for now I’m cheating using Erlang’s integer_to_list/2). It prints the results to the screen as the process handling each base finishes and writes a text file “texty_primes-result-[timestamp].eterms” at the end for convenience so you can use file:consult/1 on it later to mess around.

There are a few strange aspects to large primes, one of them being that checking whether or not they are prime can be a computationally intense task (and nobody knows a shortcut to this). To this end I wrote the Miller-Rabin primality test into the script and allow the caller to decide how many rounds of Miller-Rabin to run against the numbers to check them. So far the numbers that have come out have matched what is expected, but once the numbers get extremely large (and they get pretty big in a hurry!) there is only some degree of confidence that they are really prime, so don’t take the output as gospel.

I wrote the program in Erlang as an escript, so if you want to run it yourself just download the script and execute it.
The script can be found here: texty_primes

A results file containing the (very likely) prime constructions in bases 2 through 36 using “count-back from X” where X is 1 to 500 can be found here: texty_primes-result-20191121171755.eterms
Analyzing from 1 to 500 in bases 2 through 36 took about 25 minutes on a mid-grade 8-core system (Ryzen5). There are some loooooooooong numbers in that file… It would be interesting to test the largest of them for primality in more depth.

(Note that while the script runs you will receive unordered “Base X Result” messages printed to stdout. This is because every base is handed off to a separate process for analysis and they finish at very different times somewhat unpredictably. When all processing is complete the text file will contain a sorted list of {Base, ListOfPrimes} that is easier to browse.)

An interesting phenomenon I observed while doing this is that some numeric bases seem simply unsuited to producing primes when numbers are generated in this manner, bases that themselves are prime numbers in particular. Other bases seem to be rather fruitful places to search for this phenomenon.

Another interesting phenomenon is the wide number of numeric bases in which the numbers “21”, “321”, “4321” and “5321” turn out to be prime. “21” and “4321” in particular turn up quite a lot.

Perhaps most strangely of all is that base 10 is not a very good place to look for these kinds of primes! In fact, the “count back from 82” prime is the only one that can be constructed starting between 1 and 500 that I’ve found. It is remarkable that anyone discovered that at all, and also remarkable that it doesn’t happen to start at 14,562 instead of 82 — I’m sure nobody would have noticed this were any number much higher than 82 the magic starting point for constructing a prime this way.

This was fun! If you have any insights, questions, challenges or improvements, please let me know in the comments.

2019.10.17 10:58

“Kintergarten Cop”: Amazing Efficiency

Filed under: Films and Media — Tags: , — zxq9 @ 10:58

I recently re-watched Kindergarten Cop, a 1990’s action comedy with Arnold Schwarzenegger where he (duh) plays a hard-boiled cop who becomes a kindergarten teacher for a while.

Aside from the kid in class who utters the infamous line about how one can identify between boys and girls (his father is a gynecologist, see?) and how utterly EVIL such a statement of common sense knowledge being uttered by a child would be in today’s world of identity warfare, the main thing that stuck out to me was how incredibly efficient the story was.

The movie followed the law of Chekhov’s Gun to the extreme. Every single device introduced was actually followed up on. Every setup had a payoff. Every joke had a setup (whoa!). Every bit of “Oh, I wonder if…” detail in the movie was actually used. It was sort of amazing to watch just how incredibly tidy the entire production was.

I haven’t looked into who was involved in the production, but the level of skill involved in creating such a tight, concise bit of storytelling (even if predictable and leaning hard on a few somewhat worn-out character tropes, even by 1990’s standards) indicates a vast experience in either writing efficient stories or maybe a master editor involved at the end.

I wish I was that clean about designing systems!

2019.09.11 12:09

H-IIB No.8: Fire on the launch pad

Filed under: Space — Tags: , , , , , — zxq9 @ 12:09

There was a fire on the launch pad today during the final preparation for launch of MHI’s H-IIB No.8, sending HTV-8 to the International Space Station.

Not much is known about the cause yet, but the really amazing thing is that the rocket didn’t blow up, safety systems all worked as designed, and they will get a chance to try again soon.

A (very poor) screen capture from a printout given at the post-cancellation debriefing showing the location of the fire relative to the rocket.

Video of the launch attempt (indexed just before the fire becomes visible):

Press conference (Japanese language only — if you have any questions ask in comments and I can translate):

2019.08.3 05:20

Building Erlang 22.0 on Debian/Ubuntu

Filed under: Computing,Science & Tech — Tags: , , — zxq9 @ 05:20

Every time I switch to a new system and have to build a new release of Erlang with kerl I sit and scratch my head to remember which dependencies are required. Once you’re set up or have a prep script it is just too easy to forget which thing is needed for what over the next few years.

Here is my list of pre-build package installs on Ubuntu 18.04 — note that they are in three groups instead of just being a single long apt install command (why apt couldn’t manage to install these all at once is beyond me…):


  • gcc
  • curl


  • g++
  • dpkg-dev

Group 3:

  • build-essential
  • automake
  • autoconf
  • libncurses5-dev
  • libssl-dev
  • flex
  • xsltproc
  • libwxgtk3.0-dev

2019.07.23 08:56

Erlang: R22.0 doc Mirror Updated

Filed under: Computing — Tags: , , , , , — zxq9 @ 08:56

The Erlang doc mirror linked here has been updated to include the R22.0 docs.

Note that some of the internal links and labels say “ERTS-10.4” and “Version 10.4” instead of “ERTS-11.0” and “Version 11.0”. This is an error. The docs refer to ERTS 11.0 but that detail seems to not have been updated when these docs were generated (whoops!). I was looking at fixing that throughout the docs and links, but it turns out to be a lot more complicated than I’m willing to deal with because of the number of references that include the string “10.4” (and some of them are in PDFs and other things more annoying to update than HTML pages). When the R22.1 docs come out that will probably be fixed and I’ll update to avoid confusion in the distant future.

2019.06.26 09:40

Before the Fall

Filed under: Society — Tags: , , , , — zxq9 @ 09:40

Times are bad. Children no longer obey their parents, and everyone is writing a book.

Marcus Tullius Cicero (106-43 BCE)

2019.06.22 23:20

Social Prophecy

If you want to feel creeped out in 2019…

Backstory setting for the Cyberpunk 2020 game rulebook Neo Tribes: The Nomads of North America, published in 1994.
Sagan nailed it in The Demon Haunted World.


Filed under: Uncategorized — zxq9 @ 14:29

After updating the MySQL tables to a UTF8 multibyte encoding…


Hopefully that isn’t just a bunch of nonsense.


WOW! Now things work like they are supposed to!
Unfortunately, however, it seems that all of my previous posts that used UTF-8 are lost… and I have no idea how to recover them. That’s super disappointing.

« Newer PostsOlder Posts »

Powered by WordPress