Jun 25

How to make The Breakfast

I wouldn’t have posted this if the comment thread on “The sad truth about toasters” hadn’t extended to an almost ridiculous length, but…

I dearly love classic American breakfast food. I delight in the kind of cheap hot breakfast you get at humble roadside diners. I think it’s one of the glories of our folk cuisine and will cheerfully eat it any time of the day or night.

I posted a fancy breakfast-for-two recipe a while back (Eggs a la ESR). What follows is the slightly plainer breakfast I make for myself almost every morning. It’s the stable result of a decades-long optimization process – I haven’t found a way to improve it in years.

Continue reading

Jun 24

The sad truth about toasters

I bought a toaster today.

I didn’t want to buy a toaster today. About ten years ago I paid $60 for what appeared to be a rather high-end Krups model in accordance with my normal strategy of “pay for quality so you won’t have to replace for a good long time”, an upper-middle-class heuristic that I learned at my mother’s knee to apply to goods even as mundane as light kitchen appliances.

I had reason for hope that I would get a well-extended lifeline for my money. I recalled the toasters of my childhood, chrome and Bakelite battleships one just assumed would last forever, being passed down generations. “Luke, this toaster belonged to your father…an elegant weapon from a more civilized age.”

Alas, it was not to be.

Continue reading

May 12

Draining the manual-page swamp

One of my long-term projects is cleaning up the Unix manual-page corpus so it will render nicely in HTML.

The world is divided into two kinds of people. One kind hears that, just nods and says “That’s nice,” having no idea what it entails. The other kind sputters coffee onto his or her monitor and says something semantically equivalent to “How the holy jumping fsck do you think you’re ever going to pull that off?”

The second kind has a clue. The Unix man page corpus is scattered across tens of thousands of software projects. It’s written in a markup – troff plus man macros – that is a tag soup notoriously resistent to parsing. The markup is underspecified and poorly documented, so people come up with astoundingly perverse ways of abusing it that just happen to work because of quirks in the major implementation but confuse the crap out of analysis tools. And the markup is quite presentation oriented; much of it is visual rather than structural and thus difficult to translate well to the web – where you don’t even know the “paper” size of your reader’s viewer, let alone what fonts and graphics capabilities it has.

Nevertheless, I’ve been working this problem for seventeen years and believe I’m closing in on success in, maybe, another five or so. In the rest of this post I’ll describe what I’m doing and why, so I have an explanation to point to and don’t have to repeat it.

Continue reading

May 05

Friends of Armed & Dangerous gathering 2018

The 2018 edition of the annual Friends of Armed & Dangerous FTF will be held in room 821 of the Southfield Westin in Southfield, MI between 9 p.m. and 12 p.m. this evening.

If you are at Penguicon, or in the neighborhood and can talk yourself yourself in, come join us for an evening of scintillating conversation and mildly exotic refreshments.

Apr 03

Fthagn to you too

I learned something fascinating today.

There is a spot in the South Pacific called the “Oceanic pole of inaccessibility” or alternatively “Point Nemo” at 48°52.6?S 123°23.6?W. It’s the point on the Earth’s ocean’s most distant from any land – 2,688 km (1,670 mi) from the Easter Islands, the Pitcairn Islands, and Antarctica.

There are two interesting things about this spot. One is that it’s used as a satellite graveyard. It’s conventional, when you can do a controlled de-orbit on your bird, to drop it at Point Nemo. Tioangong-1, the Chinese sat that just crashed uncontrolled into a different section of the South Pacific, was supposed to be dropped there. So were the unmanned ISS resupply ships. A total of more than 263 spacecraft were disposed of in this area between 1971 and 2016.

It’s just the place to dump toxic fuel remnants and radionuclides because, in addition to being as far as possible from humans, the ocean there is abyssal desert, surrounded by the South Pacific Gyre so it’s hard for nutrients to reach the place. Therefore there’s probably no local ecology to trash.

However…

According to the great author and visionary Howard Phillips Lovecraft, Point Nemo is the location of the sunken city of R’lyeh, where the Great Old One Cthulhu lies dreaming.

The conclusion is obvious. The world’s space programs are secretly run by a cabal of insane Cthulhu cultists who are dropping space junk on Cthulhu’s crib in an effort to wake him up. “When the stars are right”, hmmph.

EDIT: I was misled by an error in Wikipedia that claims Tiangong-1 was deliberately dropped there, and jumped to a conclusion. Now corrected.

Mar 03

upside wants a firmware dev

The UPSide project, announced here two weeks ago, has come together with amazing speed.

We now have:

* A hardware lead – A&D regular Eric Baskin – with thirty years of experience as a power and signals engineer. He is so superbly qualified for this gig that my grin when I think about it makes my face hurt.

* A high-level system design (about which more below) that promises to be extremely capable, scalable, flexible, and debuggable.

* A really sharp dev group. Half a dozen experts have shown up to help spec this thing. critique te design docs, and explain EE things to ignorant me.

* Industry participation! We have a friendly observer who’s the lead software architect for one of the major UPS vendors.

* A makerspace near me where the owner recruited himself onto the project and is looking forward to donating bench time and skilled hands to the hardware build.

All this helpfulness almost – but not quite – fills in my deficits as a designer/implementer. I don’t really know from hardware design, so I’m attacking the problem with the modularity and information-hiding principles I know from software.

Here is how the design looks:

An I2C bus that ties together a “forebrain” which is a Unix SBC, almost certainly at this point an Olimrx LIME2, with a “midbrain” that is an Arduino-class microcontroller.

The midbrain is mechanism – a simple state machine whose job is to control the high-power subsystem (inverters, battery, AC input and output). Policy decisions and stuff like battery state modeling will live in the forebrain. It will also run the USB and Ethernet interfaces, and host the development environment for the firmware

The forebrain will talk to a 20×4 LCD panel over I2C, and various other controls like alarm mute and self-test buttons via GPIO pins.

I’ve actually written the spec for the I2C bus messages already. And here’s your cute hack for the day…

I realized early on that one of the first things I needed to do was draw a state/action diagram for the system so I could pin down its behavior in response to any given transition in its environment (mains power up, mains power down, battery dwell limit approaching, those sorts of things). So I reached for one of my favorite tools, a graph-drawing DSL called dot.

Only when I write the first version of the graph, I found the dot markup cluttered and repetitive. So I wrote a couple of cpp macros named “state” and “action” that expand to dot markup, and expressed the graph as a sequence of macro calls.

Then I blinked, looked again, and realized…hey, I could compile these calls to C source code for a state machine! And now it is done – I can already generate the tricky part of the application logic for the midbrain directly from the state/action diagram. (The action functions are stubs but the control flow is all there.)

(If the fact that I just solved a design problem by writing a DSL to generate code in another DSL and provably correct equivalent C application logic seems weird to you, you must be be new here. This is how I think all the time. It is obedience to the Unix wisdom: never hand-hack code you can generate from a higher-level description.)

This, however, does not solve the entire firmware problem by any means. The midbrain’s going to need system logic to do things like receive and send I2C messages, poll A2D converters from sensors watching the mains and battery voltage, and so forth.

Accordingly, we need a firmware developer. I’ll learn how to do this if nobody steps up (which is why I said “wants” in the post title) but the whole process will doubtless go faster and more smoothly if we have someone with experience. So:

WANTED: One firmware hacker. Must be familiar with AVR-class microcontrollers and the Linux toolchains for them. Experience with I2C and low-level programming of USB endpoints would be a plus. Perks of the job include getting one of the first UPSides made, your name in lights, and working with a dev crew that is impressive even by my elevated standards.

EDIT: Well, that didn’t take long. A&D regular Jay Maynard has signed on.

Feb 26

How elites are blind about immigration

I had been thinking about posting about immigration recently, because some facts on the ground have caused me to move away from a pure laissez-faire position on it. A few minutes ago I wrote a long comment on G+ that I realized says a lot of what I wanted to. This is a slightly revised and expanded version of that comment.

I am asked, by another member of the educated white elite, why we shouldn’t simply end border enforcement entirely rather than buid a wall or tolerate Joe Arpaio’s squalid detention camps.

Both here and in Europe there’s been a significant spike in communicable diseases that can be traced back to low immunization rates in what Trump may or may not have called “shithole” countries.

Crime is a real issue. Legal immigrants have a slightly higher criminal propensity than the native born (the difference is small enough that its significance is disputed) but illegals’ propensity is much higher, to the point that 22% of all federal incarcerees are illegals (that’s 92% of all jailed immigrants).

But the elephant in the room is the impact of illegal immigration on social trust.

Continue reading

Feb 18

In the face of uncertainty, buy options.

Yesterday I posted about how the streetlight effect pulls us towards bad choices in systems engineering. Today I’m going to discuss a different angle on the same class of challenges, one which focuses less on cognitive bias and more on game theory and risk management.

In the face of uncertainty, buy options. This is a good rule whether you’re doing whole-system design, playing boardgames, or deciding whether and when to carry a gun.

Continue reading

Feb 17

System engineering for dummies

I’ve been getting a lot of suggestions about the brand new UPSide project recently. One of them nudged me into bringing a piece of implicit knowledge to the surface of my mind. Having made it conscious, I can now share it.

I’ve said before that, on the unusual occasions I get to do it, I greatly enjoy whole-systems engineering – problems where hardware and software design inform each other and the whole is situated in an economic and human-factors context that really matters.

I don’t kid myself that I’m among the best at this, not in the way that I know I’m (say) an A-list systems programmer or exceptionally good at a couple other specific things like DSLs. But one of the advantages of having been around the track a lot of times is that you see a lot of failures, and a lot of successes, and after a while your brain starts to extract patterns. You begin to know, without actually knowing that you know until a challenge elicits that knowledge.

Here is a thing I know: A lot of whole-systems design has a serious drunk-under-the-streetlamp problem in its cost and complexity estimations. Smart system engineers counter-bias against this, and I’m going to tell you at least one important way to do that.

Continue reading

Dec 18

C, Python, Go, and the Generalized Greenspun Law

In recent discussion on this blog of the GCC repository transition and reposurgeon, I observed “If I’d been restricted to C, forget it – reposurgeon wouldn’t have happened at all”

I should be more specific about this, since I think the underlying problem is general to a great deal more that the implementation of reposurgeon. It ties back to a lot of recent discussion here of C, Python, Go, and the transition to a post-C world that I think I see happening in systems programming.

(This post perhaps best viewed as a continuation of my three-part series: The long goodbye to C, The big break in computer languages, and Language engineering for great justice.)

Continue reading

Aug 07

Hey, Democrats! We still need you to get your act together!

Six months ago, I wrote Hey, Democrats! We need you to get your act together!, a plea to the opposition to get its act together.

A month ago, a Democratic activist attempting a mass political assassination shot Steve Scalise through the hip. Today, Gallup’s job creation index at +37 in July—a record high.

In my previous post I stayed away from values arguments about policy and considered only the practical politics of the Democrats’ positioning. I will continue that here.

In brief: Democrats, when you’re in a hole, stop digging!

Continue reading

Aug 01

Three easy pieces

I’m back from vacation – World Boardgaming Championships, where this year I earned laurels in Ticket To Ride and Terra Mystica..

Catching up on some releases I needed to do:

* Open Adventure 1.3: Only minor bugfixes in this one, it’s pretty stable now. We gave 100% coverage in the test suite now, an achievement I’ll probably write about in a future post.

* ascii 1.18: By popular demand, this can now generate a 4×16 as well as 16×4 table, This is especially useful in conjuction with the new -b option to display binary code points.

* Things Every Hacker Once Knew: With new sections on the slow birth of distributed development and the forgotten history of early bitmap displays.

Jul 10

Managing modafinil

For the last year or so I have been deliberately experimenting with a psychoactive, nootropic drug.

You have to know me personally (much better than most of my blog audience does) to realize what a surprising admission this is. I’ve been a non-smoking teetotaller since I was old enough to form the decision. I went through college in the 1970s, the heyday of the drug culture, without so much as toking a joint. I have been open with my friends about having near enough relatives with substance-abuse problems that I suspect I have a genetic predisposition to those that I am very wary of triggering. And I have made my disgust at the idea of being controlled by a substance extremely plain.

Nevertheless, I have good reasons for the experiment. The drug, modafinil (perhaps better known by the trade name Provigil) has a number of curious and interesting properties. I’m writing about it because while factual material on effects, toxicology, studies and so forth is easy to find, I have yet to see useful written advice about why and how to use the drug covering any but the narrowest medical applications.

Before I continue, a caveat that may save both your butt and mine. In the U.S., modafinil is a Schedule IV restricted drug, illegal to use without a prescription. I use it legally. I do not – repeat, do not – advise anyone to use modafinil illegally. I judge the legal restriction is absurd – there are lots of over-the counter drugs that are far more dangerous (ibuprofen will do as an example) – but the law is the law and the drug cops can flatten you without a thought.

Another caveat: Your mileage may vary. This is a field report from one user that is consistent with the clinical studies and other large-scale evidence, but reactions to drugs can be highly idiosyncratic. Proceed with caution and skepticism and self-monitor carefully. You only have one neurochemistry and you won’t like what happens if you break it.

Continue reading

Jun 05

Open Adventure ships

Colossal Cave Adventure, that venerable classic, is back and better than ever! The page for downloads is here.

The game is fully playable. It would be astonishing if it were otherwise, since it has been stable since 1995. One minor cosmetic change a lot of people used to the non-mainline variants will appreciate is that there’s a command prompt.

The most substantial thing Jason Ninneman and I have done to the code itself is that the binary is now completely self-contained, with no need for it to refer to an external adventure.text file. That file is now compiled to C structures that are linked to the rest of the game at build time.

The other major thing we’ve done is that the distribution now includes a pretty comprehensive regression-test suite. We do coverage analysis to verify that it visits most of the code. This clears the way to do serious code cleanup (gotos and stale FORTRAN idioms must die!) while being sure we’re not breaking things,

We gratefully acknowledge the support of the game’s original authors, Don Woods and Will Crowther.

Jun 04

Correction to: “Set the WABAC machine…”

Henry Spencer, upon reading my previous post, had this to say by email:

I won’t argue with Eric about the significance of that little event, but I do have to interject a few corrections about the historical details.

For this, I’ve got a couple of advantages over him. First, being somewhat of a packrat, I still have my notes from conferences 30+ years ago! (Not in digital form, alas.) And second, being the one who saved most of what we have of Usenet’s early days, I also have some relevant old Usenet postings to consult.

The precise date was 19 January 1984, in the second morning session of the Uniforum conference (a joint meeting of the Usenix Association and the /usr/group trade association). Kathleen Hemenway of Bell Labs gave a talk on work she and Helene Armitage had done: “A proposed syntax standard for UNIX system commands”. This was basically an attempt to codify and slightly tighten the rules already implemented several years earlier by AT&T’s getopt() library function.

As you might gather from that wording, getopt() wasn’t actually new then: it had existed within Bell for some time, but hadn’t made it out in any widely-available Unix release. In late 1981, I’d seen a Bell-internal Unix manual page describing it. I wanted it, and I couldn’t have it, so I wrote my own. It was indeed quite helpful, and on 11 Jan. 1982, I posted it to Usenet newsgroup net.sources. By the time of that conference, a fair number of people were using it.

Ms. Hemenway’s talk was mostly about the syntax issues, but she did mention that there were plans for enhancements to getopt() to help support the new spec. And during Q&A, she was indeed evasive about availability of the enhanced code — probably nobody had made any decisions about that. So I got up and said that I would upgrade my public-domain implementation to match any enhancements AT&T made. Didn’t seem like a big deal; to be honest, I was a bit surprised that it got cheers and applause. I guess a lot of people hadn’t yet grasped that we *had a choice* about this.

No…no, we hadn’t. And my having got the date wrong explains the particularly high anxiety about the Bell breakup; the consent decree would have taken effect not nine months previously but just eight days before.

Ever since, on the occasions that I remembered this before returning to a busy life, the second or third thought in my mind was always that I ought to find Henry and let him know what an influence he had on me in that moment.

Henry Spencer, you set an example that day for all of us, and we cheered you not for promising to write a few lines of code but because we heard the call behind the promise. The details grew dim in my memory, but the power of that example struck me again each time I recalled it. Value your craft and pursue excellence in it; share what you create; never fear to go up against a monopolist; be loyal to your peers in the work. This is how a hacker – how any kind of maker, really – does his duty to the future.

A lot of us have been trying to live out that lesson ever since. Thank you, Henry. I think the world owes you more than it knows for that inspiration.

Apr 18

You shall judge by the code alone

I support the open letter by Drupal developers protesting the attempted expulsion of Larry Garfield from the Drupal commmunity.

As a Drupal contributor who has never in any respect attempted to tie the project to his beliefs or lifestyle, Garfield deserves the right to be judged by his code alone. That is the hacker way; competence is all that matters, and no irrelevance like skin color or shape of genitals or political beliefs or odd lifestyle preference should be allowed to matter.

That I even need to say this in 2017 is something of a disgrace. The hacker culture already had judge-by-the-code-alone figured out forty years ago when I was a n00b; the only reason it needs to be said now is that there’s been a recent fashion for “social justice” witch hunting which, inevitably, has degenerated into the sort of utter fiasco the Drupal devs are now protesting.

Thomas Paine said it best: “He that would make his own liberty secure, must guard even his enemy from oppression; for if he violates this duty, he establishes a precedent that will reach to himself.”

It doesn’t matter how much you dislike Larry Garfield’s personal kinks. If you don’t defend him now, you may have nobody to defend you when some self-declared commissar of political and sexual correctness – or just a censorious project lead like Dries Buytaert – decides that you should be declared an unperson.

You shall judge by the code alone. That is the only social equilibrium that doesn’t degenerate into an ugly bitchfest with expulsions controlled by whatever happens to be politically on top this week. It was the right community norm forty years ago, and remains so today.

Apr 16

The wreck of the Edmund Fitzgerald: the *science* version

My last G+ post reported this:

Something out there kills about one oceangoing ship a week.

It is probably freakishly large waves – well outside the ranges predicted by simple modeling of fluid dynamics and used to set required force-tolerance levels in ship design. Turns out these can be produced by nonlinear interactions in which one crest in a wave train steals energy from its neighbors.

Much more in the video.

So go watch the video – this BBC documentary from 2002 on Rogue Waves. It’s worth your time, and you’ll learn some interesting physics.

As I’m watching, I’m thinking that the really interesting word they’re not using is “soliton”. And then, doing some followup, I learn two things: the solutions to the nonlinear Schrödinger equation that describe rogue waves are labeled “Peregrine solitons”, despite not actually having the non-dissipative property of your classical soliton; and it is now believed that the S.S. Edmund Fitzgerald was probably wrecked by a rogue wave back in ’75.

In a weird way this made it kind of personal for me. I used to joke, back when people knew who he was, that Gordon Lightfoot and I have exactly the same four-note singing range. It is a fact that anything he wrote I can cover effectively; I’ve sung and played The Wreck of the Edmund Fitzgerald many times.

So, I’m texting my friend Phil Salkie (he who taught me to solder, and my reference for the Tinker archetype of hacker) about this, and we started filking. And here’s what eventually came out: Wreck of the Edmund Fitzgerald, the science! version:

The lads in the crew saw that soliton come through
It stove in the hatches and coamings
Her hull broached and tore, she was spillin’ out ore
That rogue put an end to her roamings.

Does anyone know where the Gaussian goes
When the sea heights go all superlinear?
A Schrödinger wave for a watery grave
It’ll drown both the saint and the sinner.

That is all.

Apr 13

From molly-guard to moggy-guard

In ancient lore, a molly-guard was a shield to prevent tripping of some Big Red Switch by clumsy or ignorant hands. Originally used of the plexiglass covers improvised for the BRS on an IBM 4341 after a programmer’s toddler daughter (named Molly) frobbed it twice in one day

The Great Beast of Malvern, the computer designed on this blog for performing repository surgery, sits to the left of my desk. This is Zola the cat sitting on it, as he sometimes does to hang out near one of his humans.

What you cannot quite see in that picture is the Power Switch of the Beast, located near the right front corner of the case top – alas, where an errant cat foot can land on it. Dilemma! I do not want to shoo away the Zola, for he is a wonderfully agreeable cat. On the other hand, it is deucedly inconvenient to have one’s machine randomly power-cycled while hacking.

Fortunately, I am a tool-using sophont and there is an elegant solution to this problem.

Continue reading