10 December 2013

BCPL pointers were not zero indexed because of compile time issues.

Re: Citation Needed - blarg?

Mike has done a bit of research, but not enough. Reading and understanding the BCPL manual (let alone having any experience with '60s and '70s compiler technology) would have made this jump from Martin Richard's comment (which says nothing about the cost of optimizing the code) to "in that context none of the offset-calculations we’re supposedly economizing are calculated at execution time" obviously wrong.

First, the yacht thing is a complete red herring. You always had to limit your job run times because computers were just plain unreliable. They could easily go down several times a day, forcing the restart of a job. Higher priority jobs could always show up and bump you, and getting bumped was not all that big a deal... you'd just get run again once it was done, if by chance you happened to be late in the queue you'd run a day or so later at the most... and that could happen anyway if jobs before you ran into problems or there was too much maintenance downtime. A handicapping run a few times a year? that's nothing.

Second, you could have expressions on both sides of the dyadic "!" operator. "V!I" was exactly the same as "I!V" ... Richards spells that out explicitly in the text Mike quoted! There's no reason to treat it as a compile-time-only issue.

Third, of course BCPL had pointers. It was completely typeless, an address was just a number. When you wrote

LET V = VEC 5

You create both a pointer variable "V" and allocated a 5 element array to it. Yes, it really allocated a total of six cells. As far as I recall, "V" could be reassigned to point to another vector, or incremented within itself.

Fourth, local variables were dynamically created on the stack. So a local

LET V = VEC X

could be at any address in the stack, depending on the call history.

Fifth, and backing up my recollection in the third point, the BCPL manual has an example of pointers being initialized on page 27:

LET IOV = VEC 650
LET IOVP, IOVT = IOV, IOV + 650

Sixth, he's applying 21st century reasoning about compilers to the '60s. When you wrote:

V!1

it's virtually certain that the compiler would actually generate the code to fetch "V" and add one to it. I would be staggered to learn that the compiler optimized away this extra indirection, ever, because that would have required tracking the state of every variable used as an lvalue to know when that optimization was safe.

Finally, seventh, and most critically, using 1 index on the dyadic "!" operator would have caused extra complexity for *programmers*, because suddenly "!(V+I)" would mean something different from "V!I", and having "!(V+I)" mean "the memory at V + I + 1" would be just nutty.

BCPL arrays, like C arrays, were zero-origin because it fell naturally out of the unification of pointers and other values in a low level language.

13 August 2013

Hipster NSA

Hipster NSA was into data before they got big.
Hipster NSA only taps underground cables.
Hipster NSA says you don’t really collect data until you listen to it.
Hipster NSA stopped 50 terrorist attacks. You’ve probably never heard of them.
Hipster NSA stalked you before you were cool.


28 June 2013

Onward Sauron’s Soldiers

Just leaving this here...

Onward Sauron’s Soldiers

Words by Richard Tatge, Al Kuhfeld and Ken Fletcher. Sung to the tune of 'Onward Christian Soldiers'

Onward Sauron’s soldiers,
Marching as to war,
With the eye of Sauron
Going on before
Darkness like a banner
shadows all the foe.
Forward into battle see the Nazgul go.

CHORUS:
Onward Sauron’s soldiers,
Matching as to war,
With the eye of Sauron
Going on before.


Trolls and Balrogs mangle
Dragons burn and bite!
With us you must tangle
Or run and scream in fright.
Evil is our watchword,
Pain is our delight;
Middle-Earth must crumble,
Under Mordor's might.

CHORUS

From the dread dark tower.
To the black Khazad-dum.
We’ll send elves and hobbits
Shrieking to their tomb.
Men and dwarves together
Go down in defeat.
In the hunger after the battle.
They’ll be nice to eat.

CHORUS

Conquer every village!
Yell out the battle cry!
Murder, rape and pillage,
Then spit in their eye!
See the craven victims
Quivering with fear:
We’ll be leaving Mordor
Sometime late next year.

17 June 2013

Teal Deer has a new buddy! PW;DR

Via @Skud RT @NeuroPolarbear Proposed new internet slang: BPW;DR. Means, "behind paywall, didn't read".

I'm just going to use "pw;dr".

The Teal Deer has a new buddy. What do we call this one? Power Deer?

05 June 2013

Oh dear where can the matter be...

Just leaving this here for reference...

Oh dear, where can the matter be?
When it's converted to energy,
There is a slight loss of parity.
Johnny's so long at the fair.

He promised to buy me a second-hand Morris,
A matched set of H-Bombs that go off in chorus,
A musically-talented agile slow loris,
And other delights that are rare.

Oh dear, where can the matter be?
When it's converted to energy,
There is a slight loss of parity.
Johnny's so long at the fair.

He promised to buy me a used weeping willow,
A pair of chrome booties for my armadillo,
A hand-tatted, plaid, pterodactyl-down pillow,
And other delights that are rare.

He promised to buy me a magical locket,
A miniature couerl to keep in my pocket,
A duocorn stallion, a Saturn-V rocket,
And other delights that are rare.

He promised to buy me a positron beauty,
A lit'rally minded transistorized cutie,
A chrome-plated robot that does double-duty,
And other delights that are rare.

He promised to buy me an incomplete wizard,
A red-headed genie, a hexapod gizzard,
A house-broken dragon, a musical blizzard,
And other delights that are rare.

He promised to buy me a microwave oven,
Some witches from Karres arrayed in a coven,
Some teflon extrusions to further our lovin',
And other delights that are rare.

11 May 2013

Keeping Presidents in the Nuclear Dark (from wayback machine)

CDI.ORG is now owned by a domain squatter, so I'm just going to leave this article in its entirety here:

Taken from here.

Keeping Presidents in the Nuclear Dark
(Episode #1: The Case of the Missing “Permissive Action Links”)
Bruce G. Blair, Ph.D, CDI President, bblair@cdi.org
Feb. 11, 2004
Last month I asked Robert McNamara, the secretary of defense during the Kennedy and Johnson administrations, what he believed back in the 1960s was the status of technical locks on the Minuteman intercontinental missiles. These long-range nuclear-tipped missiles first came on line during the Cuban missile crisis and grew to a force of 1,000 during the McNamara years — the backbone of the U.S. strategic deterrent through the late 1960s. McNamara replied, in his trade-mark, assertively confident manner that he personally saw to it that these special locks (known to wonks as “Permissive Action Links”) were installed on the Minuteman force, and that he regarded them as essential to strict central control and preventing unauthorized launch.

When the history of the nuclear cold war is finally comprehensively written, this McNamara vignette will be one of a long litany of items pointing to the ignorance of presidents and defense secretaries and other nuclear security officials about the true state of nuclear affairs during their time in the saddle. What I then told McNamara about his vitally important locks elicited this response: “I am shocked, absolutely shocked and outraged. Who the hell authorized that?” What he had just learned from me was that the locks had been installed, but everyone knew the combination.

The Strategic Air Command (SAC) in Omaha quietly decided to set the “locks” to all zeros in order to circumvent this safeguard. During the early to mid-1970s, during my stint as a Minuteman launch officer, they still had not been changed. Our launch checklist in fact instructed us, the firing crew, to double-check the locking panel in our underground launch bunker to ensure that no digits other than zero had been inadvertently dialed into the panel. SAC remained far less concerned about unauthorized launches than about the potential of these safeguards to interfere with the implementation of wartime launch orders. And so the “secret unlock code” during the height of the nuclear crises of the Cold War remained constant at OOOOOOOO.

After leaving the Air Force in 1974, I pressed the service, initially by letters addressed to it and then through congressional intermediaries, to consider a range of terrorist scenarios in which these locks could serve as crucial barriers against the unauthorized seizure of launch control over Minuteman missiles. In 1977, I co-authored (with Garry Brewer) an article (click here to view) entitled “The Terrorist Threat to World Nuclear Programs” in which I laid out the case for taking this threat more seriously and suggesting remedial measures including, first and foremost, activating those McNamara locks that apparently he and presidents presumed had already been activated.

The locks were activated in 1977.

It is hard to know where to begin, and end, in recounting stories like this one that reveal how misinformed, misled, and misguided on critical nuclear matters our top leaders have been throughout the nuclear age. A multitude of such examples can, and will, be described in forthcoming columns.

08 May 2013

Dear Twitter...

Dear Twitter: if you're going to continue to be jerks about letting people write new twitter clients, please can I have an official twitter client for the Mac that:

1. Puts the latest tweet at the bottom of the page, not at the top.
2. Puts the box to enter a new tweet at the bottom of the page, below the most recent tweet, not in its own window.
3. Keeps track of last tweet read, oldest tweet not seen, and so on, and lets me jump easily and reliably to each of these points.
4. When I uncheck "When new tweets arrive, scroll to top", then when new tweets arrive, don't scroll to the top. (in fact it'd be nice to have a visible toggle (like a pushpin) that controlled scrolling, because that's something I like to tweak on and off, but just having that work would be a start)
5. When I click on a link, just send it to my browser, don't go "hey, that's a picture, let me open it in my crippled picture viewer that doesn't let you copy images, image locations, or see commentary".

Yes, I know this is a long list. It's also incomplete. These are just the most annoying things, the ones that make me go "I can't DEAL with this before I've had my coffee".

There's more. Lots more. Like, how about showing me the display name of a poster inline instead of their cute little picture, and displaying retweets as "@friend: RT @gonzo: blag blah blah" instead of "@gonzo: Blah blah blah" with "retweeted by @friend" in little grey letters underneath.

The bottom line: you really don't do a good enough job of writing client software to call software that does a much better job of interacting with your service "redundant". Get over it. You should be paying these people a bonus, not cutting them off.

[Next week: Linden Lab's passive-aggressive relationship with alternate viewers. or not.]

07 May 2013

Of course!

Once you realize that HTTP is just an extended finger, the Web makes so much more sense!

30 April 2013

History of #!/bin/sh (the 'hashbang' or 'shebang')

I was just reading a message in the XKCD forums, and noticed there were all these comments about how the "#!" was 'interpreted by the shell'. Given that XKCD readers are pretty technical, this surprised me.

Actually, the hashbang is interpreted by the kernel. hashbang was invented in Version 7 UNIX, as a result of the split between East Coast UNIX and West Coast UNIX.

In Version 6 UNIX there was only one shell. It was a pretty horrible shell, too. It didn't have control structures. It didn't have comments. It didn't have file name expansion or wildcards - they were sort of transparently handled by having the shell run a separate program called "glob". You couldn't pipe into shell scripts because the shell interpreted scripts by reading them from standard input. There was no buffering, so it was possible to control the flow of a shell script by seeing around on standard input, looking for a line starting with ":" to indicate a label. ":" wasn't a comment marker, mind, it was a command that didn't do anything, like /bin/true. It may have even been a link to /bin/true.

On the east coast, this fellow at AT&T named Steve Bourne was coming up with a new shell that would end up in Version 7 UNIX.

On the west coast, there were two competing improved shells, the pascal shell (which never took off) and the C shell.

The C shell had control structures and comments and all kinds of cool stuff. The comment character was "#". So when you ran a shell script it forked, opened the file, and looked at the first character, and if it was "#" it execed a new instance of the C shell to interpret it, otherwise it just execed the old /bin/sh with stdin set to the file. OK, that's a lot of jargon, let's just say that the first character was used by the C shell to determine what shell to use to run the script.

Now I'm going to digress into more jargon. When the kernel ran a program, it used the first two bytes of the program to determine how to run it. Originally it just loaded the program and jumped into location zero, but by the time of V6 and V7 there were a number of different things that had to be done to set up the program, so it opened up the file and read the first two bytes. If the first two bytes were a jump to one particular location, it knew it was one kind of program, if it was a jump to another location, it was another kind of program. So this jump instruction became a "magic number" that the kernel used to decide how to run the program. Other magic numbers got created, and they didn't have to be PDP-11 jump instructions, (or even run on a PDP-11) but one number was as good as any other so those just happened to be kept.

Anyway, by this time in UNIX the first 16 bits of the program was a magic number... the kernel read it and used that to decide how to run a program. I could go into more details like "pure text" versus "split I&D", but it doesn't matter... the point is, the feature was there.

So... in Version 7, they defined a new 16-bit magic number whose value looked like "#!" and said "this magic number is interpreted by reading a line of text, breaking it up into two words separated by a space, and calling an interpreter whose name was in the first word, and passing the second word and the name of the file to that interpreter".

This was the hashbang born. Like many great ideas it was simple, brilliant, and extraordinarily useful.

16 March 2013

Lost in Non-Translation

I was just referred to this article by Aaron Diaz (creator of Dresden Codak).

One of Isaac Asimov's most important essays is entitled "Lost in Non-Translation", published in the unfortunately out-of print collection "The Tragedy of the Moon". It points out that simply presenting stories and parables in a historical context robs them of the power that they had for people for whom that context wasn't history.

http://www.asimovreviews.net/Books/Book144.html

http://www.amazon.com/The-Tragedy-Moon-Isaac-Asimov/dp/0440189993

Sorry, folks, you'll have to get it in paper form, it's not available digitally. It's a shame, this book contains some of his best non-fiction works. The other books containing this essay are also out-of-print and paper-only.

(in an ideal world Baen would have the rights and it would be in the Free Library, I consider this essay that important)

26 February 2013

The Possibly Proper Death Litany

Insofar as I may be heard by anything, which may or may not care what I say, I ask, if it matters, that you be forgiven for anything you may have done or failed to do which requires forgiveness. Conversely, if not forgiveness but something else may be required to ensure any possible benefit for which you may be eligible after the destruction of your body, I ask that this, whatever it may be, be granted or withheld, as the case may be, in such a manner as to insure your receiving said benefit. I ask this in my capacity as your elected intermediary between yourself and that which may not be yourself, but which may have an interest in the matter of your receiving as much as it is possible for you to receive of this thing, and which may in some way be influenced by this ceremony. Amen.

23 January 2013