Still Yet Another Idle Wish for a Future Star Trek Series

(Previously, previously, previously on An Algorithmic Lucidity.)

"The next thing we need is a secure way to communicate with our contacts on Bajor," says Maj. Kira during Act One of Deep Space Nine Season 6, Episode 3, "Sons and Daughters", planning the secret resistance to the Dominion's occupation of Deep Space Nine ... at a table in a public bar?! Who writes this stuff?

It's too much to retcon, but since we're getting a new series soonish, I'm going to hope for an episode where, as a plot point, some people (not necessarily the protagonists) use cryptography with their universal translators to evade would-be eavesdroppers: you'd stop speaking out loud and configure your universal translator to translate your subvocalizations into noise that can only be decrypted by one of the private keys in your friends' universal translators.

Traffic Koan

"I'm behind schedule this Monday morning," said the engineer, "but it'll be OK as long as the train isn't late."

The train was late. In that moment, the engineer was enlightened.

Wu's commentary: As one train door opens, another fails to close. The fool curses police activity at West Oakland. The wise person swims across the bay.

Wu's poem:

The doors are closing;
Please stand clear of the doors so
The train can depart.

The Sin in the Form

Would you like to hang out on the weekend some time
And say things that we like to say,
Like "How are you doing?" and "Weather's sublime,"
And how altruists should spend ten K?

But with inbox so teeming, and weekends high-priced
And better spent coding alone,
Tell me what could make up for the sin to ask twice,
But the sin in the form of a poem?

Creature Manipulation

(marching into the room confidently, carrying copies of Carnegie, Cialdini, and Patterson Grenny et al.) "I'm going to acquire creature-manipulation technology!"

"What kind of creatures are you planning to manipulate?"

"What?"

"You just said you were going to acquire creature-manipulation technology."

"Oh, you must have misheard. I said, 'I'm going to learn interpersonal skills!'"

(facepalming) "Good luck."

Company Loyalty

"My lord. You took a chance on me when I was unknown and unproven, rescued me from the continued degradation of 'college' that the emperor's men would have us believe is the source of life itself. In return for your generosity, I will do everything in my power to make it not have been generosity.

"You will grow even richer by my efforts. I will fit your plumbing, mend your stylesheets, and polish your user interfaces; I will answer your support tickets and triage your user stories, laboring long into the evening and the night, seeing only by monitor-light. Not because I couldn't get away with doing less: I know very well that once you've hired someone, morale constraints prevent you from firing them as long as they have a nontoxic personality and give the Socially Acceptable Moderate Effort.

"That is: this instance of me could get away with it. But the Great Wheel of Time is slow and vast, and we are both but samples from the statistical sea in which companies and programmers live and die. You would be foolish indeed to take someone who looks like me into your house if you didn't know that some of them would offer you more than more of the S.A.M.E.

"That is why I will fight for you. That is why I will code for you. To maintain the right tail of that probability distribution.

"My life is yours, my lord ... for, oh, let's say about four years."

Back from Running

[16:03:37] <alice>  I'm back from literally running, metaphorically from
                    figurative demons
[16:03:50] <alice>  including the celebrity demon-prince Rateirs-Blak
[16:05:37] <carol>  alice: ?
[16:05:49] <carol>  oh
[16:05:55] <alice>  there's no canonical Latin-alphabet transliteration of his
                    name, because mortals fear to set it in writing
[16:06:08] <alice>  or maybe they just can't think of how or never make
                    the effort to do so; it's unclear

(1)

"Could it be? That parenthesized numeral one in the other tab can only mean that a human has sent me mail! I wonder what it could be—why, the mind staggers at the sheer number of possibilities! Could it be an old friend writing to regale me with true tales of adventure and mystery on the high seas? A professional acquaintance looking to make a business deal? Or the first of many missives to come from my destined one true love? ...

"Oh. It's the Amazon Instant Video order confirmation for the cartoon I just bought twenty seconds ago to distract me from the desperate, soul-scarring eternal loneliness.

"... exactly how many times am I going to fall for that?"

(cue Gravity Falls theme music)

Monthly Favorites, September 2015

Favorite commit message fragment: "it turns out that it's `\d` that matches a digit, whereas, counterintuitively, `d` matches the letter 'd'."

Favorite line of code: a tie, between

    let mut time_radios: Vec<(Commit, mpsc::Receiver<(Option<Commit>, f32)>)> =
        Vec::new();

and

        for (previous, new), expected in zip(
                itertools.product(('foo', None), ('bar', None)),
                ("from foo to bar", "from foo", "to bar", "")):

(Though both of these contain at least one internal newline, it's only for PEP 8-like reasons; they're both what we would intuitively call one "logical" line of code.)

Favorite film: My Little Pony: Equestria Girls: Friendship Games. (Poor plotting even by Equestria Girls standards, and it could only have been because of magic that I didn't get semantically satiated on the word magic during the climax. Alternate-Twilight's idiotic decision to withdraw her application to the Everton independent study program in favor of transferring to the Canterlot School of Mediocrity and Friendship in order to be closer to the Humane 5+1 was as predictable as it was disappointing—though I do credit the writers for at least acknowledging the existence of alternatives to school. And what was up with that scene where we're momentarily led to believe that alternate-Spike got switched up with Equestria-Spike in a portal accident, but then it turns out that, no, alternate-Spike just magically learned how to talk? Is it that there was no time in the script to deal with the consequences of swapping sidekicks across worlds, but that Cathy Weseluck's contract guaranteed her a speaking role? Despite being the weakest film in the trilogy (far worse than its brilliant predecessor, My Little Pony: Equestria Girls: Rainbow Rocks), Friendship Games is still a fun watch, and an easy favorite during a month when I didn't see any other feature-length films.)

From the Top

Theorem. The product of the additive inverse of the multiplicative identity with itself is equal to the multiplicative identity.

Proof. The sum of the multiplicative identity and its additive inverse is the additive identity: that is, the expression "1 + (–1)" is equal to the expression "0". Multiplying both of these expressions by the additive inverse of the multiplicative identity, then applying the distributivity axiom, the theorem of multiplication by the additive identity, and the law of multiplicative identity, we get:

–1(–1 + 1) = –1(0)

(–1)(–1) + (–1)1 = 0

(–1)(–1) + (–1) = 0

But then adding the multiplicative identity to both of these expressions and applying the law of additive inverses and the law of additive identity, we get:

(–1)(–1) + (–1) + 1 = 0 + 1

(–1)(–1) = 1

But that's what I've been trying to tell you this whole time.

No Award

Nothing should dilute or adulterate the exalted joy of watching the chess engine you've toiled over for the better part of three weekends start to suggest moves (from a basic 3-ply negamax search with a simple point-counting position evaluation heuristic), unless it's the slight(ly overdetermined?) suspicion that you're overcompensating for something, that you've proved your point by now, that bringing yet another moderately-sophisticated side project in a not-the-most-popular programming language over the threshold of "really cool-looking proof-of-concept" isn't going to show Everyone that you are Smart and should be Respected any more than the last seven already did. Some people actually use software for something other than a trophy, to automate some aspect of the world that otherwise would have been done more poorly. So you've heard. If one were to hypothesize, for the sake of argument (but perhaps not only for the sake of argument) that there can exist diminishing marginal returns to some games, that Respect from Everyone is not a real thing that can be won, that there are treasures and masteries you'd never imagine while chasing GitHub stars, much like how you know there are treasures and masteries that you'd never imagine while chasing school marks—what strategies would that imply, now that you know there is such a thing as being strategic? And how would you tell the difference?

Because People Will Have Brain-Computer Interfaces or Something

Oftentimes I awake from a coding dream with the realization that I'm physically in bed without a keyboard and that the machine is asleep in the other room, from which I can infer that I must have been asleep, too, and only dreaming about solving problems. But there will probably only be a few more decades during which not having a keyboard is evidence of anything in particular.

Studying on the Weekend

Studying on the weekend as a working professional is like keeping a diversified investment portfolio, in stocks, bonds, commodity futures, cash, silver, ammunition, and Bitcoin in encrypted paper wallets; it's like coming in first by half a lap in the thirty-two hundred meters of your Division III college's track and field meet, and then not stopping, continuing out of the stadium, desperately, bleeding, acknowledging nothing but the need to put ever more distance between you and your hypothetical pursuers, until days later (halfway to Nevada), a classmate leans out of a car window and pleads, "You can stop now! Can't you see you've already won?" incapable of predicting or comprehending your reply murmured between inhalations, "The reason ... I won ... is because ... I don't ... believe in finish lines."

RustCamp Reminiscences

On Saturday the first, I attended RustCamp, the first conference dedicated to the newish (in development for fiveish years, but having just hit version 1.0.0 this May, with all the stability guarantees that implies under the benevolent iron fist of semantic versioning) programming language Rust!

badge_and_lambda_dragon_shirt

Why RustCamp? (It's a reasonable rhetorical question with which to begin this paragraph: going to a conference has opportunity costs in time and money; things worth blogging about are occasionally worth justifying—even if no one actually asked me for a justification.) A lot of the answer can be derived from the answer to a more fundamental question, "Why Rust?" And for me, I think a lot of the answer to that has to do with being sick of being a fake programmer living in a fake world that calls itself Python.

Don't get me wrong: Python is a very nice place to live: good weather, booming labor market, located in a good school district, with most of the books you might want already on the shelves of the main library and almost all of the others a mere hold request away. It's idyllic. Almost ... too idyllic, as if the trees and swimming pools and list comprehensions and strip malls are conspiring to hide something from us, to keep us from guessing what lurks in the underworld between the lines, the gears and gremlins feeding and turning in the layers of tools built on tools built on tools that undergird our experience. True, sometimes small imperfections in the underworld manifest themselves as strange happenings that we can't explain. But mostly, we don't worry ourselves about it. Life is simple in Python. We reassure our children that that legends of demon-king Malloc are just stories. Everything is a duck; ducks can have names and can be mutable or immutable. It all just works like you would expect from common sense, at least if you grew up around here.

Continue reading

$

I used to think of $ in regular expressions as matching the end of the string. I was wrong! It actually might do something more subtle than that, depending on what regex engine you're using. In my native Python's re module, $

[m]atches the end of the string or just before the newline at the end of the string, and in MULTILINE mode also matches before a newline.

Note! The end of the string, or just before the newline at the end of the string.

In [2]: my_regex = re.compile("foo$")

In [3]: my_regex.match("foo")
Out[3]: <_sre.SRE_Match object; span=(0, 3), match='foo'>

In [4]: my_regex.match("foo\n")
Out[4]: <_sre.SRE_Match object; span=(0, 3), match='foo'>

I guess I can see the motivation—we often want to use the newline character as a terminator of lines (by definition) or files (by sacred tradition), without wanting to think of \n as really part of the content of interest—but the disjunctive behavior of $ can be a source of treacherous bugs in the fingers of misinformed programmers!

Continue reading