Monday, April 20, 2009

Careful what you ask me!

Some poor guy wrote to me to ask me what I meant by the following line from the little 'bio' paragraph I used to put at the end of programming articles:


[Greg is] a devout believer in the religious idea that, when a computer program works, it's a complete coincidence.


I sometimes get questions about articles I wrote (many years ago), but no one had asked me about this line, so I was pleased to respond. But the poor guy didn't know what he was getting into, because I just went on and on and on:



> I haven't thought of it before. and I know it may sound silly, but I'm
> curious to know why you think so..

Not silly at all! I've gotten many emails about my articles over the
years, but no one asked about this most-important of topics.

In programming, we use so many methods to try to control the
complexity, but in the end, I, at least, feel like I don't have a
handle on the whole system, and when something works, it *feels* like
I just got lucky.

When I first wrote that bio, I was just a year out from writing
DOS/Windows games. It drove me nuts -- one bug and you have to reboot
your computer. It really frustrated and traumatized me, so that I
would be crossing my fingers every time I ran the program. I guess I
needed more reliability than that, which is why I was quite pleased to
switch to Java.

If I think about the enormous complexity of the whole system, it
boggles my mind. I write this code running inside emacs, an ancient,
huge program that, itself, contains a lisp interpreter; my code is
compiled by a huge program that itself was compiled by a huge program
that, itself, was in turn compiled by a huge program, going all the
way back over the years to someone who wrote a tiny assembler and
punched it into the front panel of some primitive computer.
Meanwhile, the compiler is reading from disk spinning at who knows how
many RPM, with a magnetic head floating just above the fragile
surface. The disk sectors are being read, possibly out of order, into
memory buffers, probably inside an interrupt where some special pin on
the chip halted the processor in the middle of decoding some zany
machine language that looks like

0a 62 6f 67 67 6c 65 73 20 6d 79 20 6d 69 6e 64
2e 20 20 49 20 77 72 69 74 65 20 74 68 69 73 20
63 6f 64 65 20 72 75 6e 6e 69 6e 67 20 69 6e 73
69 64 65 20 65 6d 61 63 73 2c 20 61 6e 20 61 6e
63 69 65 6e 74 2c 0a 68 75 67 65 20 70 72 6f 67
72 61 6d 20 74 68 61 74 2c 20 69 74 73 65 6c 66
2c 20 63 6f 6e 74 61 69 6e 73 20 61 20 6c 69 73
70 20 69 6e 74 65 72 70 72 65 74 65 72 3b 20 6d
79 20 63 6f 64 65 20 69 73 0a 63 6f 6d 70 69 6c
65 64 20 62 79 20 61 20 68 75 67 65 20 70 72 6f
67 72 61 6d 20 74 68 61 74 20 69 74 73 65 6c 66

but also, since it's DOS (or Windows 3.1, same thing), the memory is
being paged around by some crazy 'dos extender' which has all its
interrupts going; all of this data is being parsed by a crazy state
machine with hundreds of states, and turned into a code tree and
analyzed and rendered into more '79 20 63 6f 64' and written to an
executable file with interlocking code sections; and then that file is
read into memory which does the run-time linking, relocating pointers
or whatever the hell it does, and don't forget that we might be
triggering page faults and reading from and writing from disk, and all
of this is written in a language that is almost certainly not Java,
all of this is running inside a little chip of silicon, tiny currents
running through tiny wires, right next to humming power supplies and
spinning fans, and any single component might go bad and a 0 changes
to 1 and you'll never never ever ever know...

I'm telling you, I get freaked out thinking about it, and when my
program *doesn't* print "Segmentation Fault: core dumped", it seems
like I just got *really lucky*.

So that's why.

In the morning, my code feels to me like it's a nicely-designed
bicycle, with a few well-understood moving parts, and I have to adjust
this or that and get riding; by the end of the day, it seems more like
an off-shore oil rig slowly toppling into the sea...

Put another way, in the morning it feels like science, and in the
evening it feels like religion.

Wednesday, April 15, 2009

In Soviet Russia, Fir Tree Uproots You!

Some guy in Russia went to the doctor and they found a little fir tree growing in his lung. Would this be the first creature born to a male animal?

Susan came and told me this, and we were both filled with a feeling of reverence. I would honored if a tree would grow in me. However, it sounds like it was rather painful; I would probably pick some other place to grow it.

For added fun: this news story actually has a list of 5 related articles. Um, this news story is not related to any other news story that has ever been.

Monday, April 13, 2009

View larger.

I love how "view larger" really means "resize my browser and show me the same image".

When will people realize that pop-up windows are for programmers to impress clients with, not to help the user?

Friday, April 10, 2009

Tiny tiny kittens

I just have to post this picture of Becky and Tessa as tots. I look at it several times a day. I imagine there's a "well, are you going to take us home" kind of look in their eyes, so it kind of tugs at my heart. But then I remember that I did bring them home, and now they are jolly, healthy cats, are are by no means the same size anymore.

Bad ad targeting.

Really bad ad to show on the Baby Chick Cam...

Primitive art not so primitive after all?

I found an "office cave painting" the other day: a coffee splotch on a counter that looked like a hippo. Note the sophisticated use of foreshortening that makes this young hippo seem to be walking away from us.

test

test via ping from phone
Test from ping.fm.

Tuesday, February 17, 2009

Do what now?

I keep my to-do 'list' in the form of many small scraps of paper in my back pocket. Every morning I rifle through them to see what I need to do. I throw away (recycle) the ones that I have done or that no longer need to be done. I look sheepishly at the ones at the bottom of the stack that have been in there for 5 months, the paper turning into a silky mess. I take a few out that I plan to do that day, and often wind up just putting them back. Sometimes I can't read what I wrote on them.

The other day, I was writing some task down on a slip of paper, but I was distracted by something else. The next day, I was looking at my slips of paper, and there was one that just said, "Karma".

What's my action item here?

Saturday, February 14, 2009

The truth about 'classical music'

Someone replaced the the music of the Yo-Yo Ma performace at the inaugural address.

http://www.youtube.com/watch?v=ka-sHA74N40

I think this proves that the way people look when they are listening to high-art music is the same as they way they look when they are either (1) listening to something terrible, or (2) listening to nothing.

Tuesday, December 16, 2008

Stop resizing my window!

Hey all you javascript programmers out there, and all you html people who copy and paste:

Stop resizing my browser windows!

Why do you want me to have less room to read your nice information? Why do you take a nice page that fits completely in my browser window, and put it inside a window that's too small to show it all, so that I have to use the scrollbars?

A browser is not a paint program! Web pages don't have edges! Stop it!

Monday, December 15, 2008

I love Klaatu

I saw The Day The Earth Stood Still and was quite pleasantly surprised. I loved it. I love Klaatu. Only Keanu could play Klaatu.

I bought the tickets online, and the site then sent me a link to some reviews. The reviews bothered me, so I posted my own review:

This movie was just wonderful. I found myself desperately wishing Klaatu was really on his way. This story couldn't be more relevant, and no one could possibly have played Klaatu other than Keanu.

I'm saddened to see a lot of reviewers here who didn't like the movie because it had too much Environmentalism and not enough Bone-Headed Action-Adventure Stupidity. This movie is thrilling and terrifying, if you just pay attention to the story, and to what the story is a metaphor for.

Maybe you weren't able to really enjoy the movie because you're running low on American Exceptionalism Vitamin. Unacceptable! Print out this handy cheat-sheet and bring it with you to the theater the next time you see a movie that you suspect might not satisfy:

Get on the horn! The president is waiting! Scramble the jets! Put your hands in the air! Put down the gun! Get a life! Bring it on! Over my dead body! Won't get fooled again! Cold dead hands! I'll be back! I'll be back, Bennett! That's no moon! This is Sparta! Say hello to my little friend! Resistance is futile! They'll never take our freedom! Yippie Ki Yea Mother Fucker! Steers and Queers! Do ya, punk? Get away from her, you bitch! I'll tell you about my mother! Get off my plane! I am your father! Hasta la vista! I am the law! There are always two deaths! Frankly, my dear, I don't give a damn! Shaken, not stirred! This is my rifle, this is my gun, this is for fighting, this is for fun! You're an errand boy! I make this look good! Fly, you fools! It's sex with someone I love! Life is like a box of chocolates! Elaine! Red Rain! Ma, I love him awful! You wouldn't like me when I'm angry!


Sadly, there was a 750-character limit, which I didn't find out until I tried to post it. (I should have been tipped off by the insistent message "minimum length reached", perhaps.) And they they detected the "profanity", although I think they were referring to the potty-language, so I had to work around that. AND it gets reviewed first, so I'm thinking they might not actually put it up there.

Wednesday, December 10, 2008

Lego Nancy: Scandal!

So I come in to work today, and I get my coffee, and I look over and see if Nancy is still there, and today she isn't.

She's on a table. She's kind of separated into two pieces, and there is a column of about 6 1x1 pieces taken out. What the fuck?

Now, it might have fallen off the shelf. The other portraits seem to be glued to some kind of stiff backing. Now, I remember, from my childhood, that there were some kids who would glue their legos together. You know, the kind of kids who might glue anything to anything, and they glue their lego to a barbie head, or to other lego.

Now, I'm all for kids gluing things to other things, but gluing lego is heresy -- a misuse of a great thing. Not just a misuse, but a misuse with a certain painful irony. Like Using a macbook for writing a screenplay, or using set-car!.

So I had affixed Nancy to a piece of cardboard, and held it all together with some large binder clips. Since the binder clips were on the bottom, it gave the whole thing a tendency to slip. So it might have slipped off. That's easier for me to believe than the other possibility, which is that someone came along and needed some 1x1 pieces and figured the easiest way would be to take them from the middle of one of the portraits.

I didn't restore the missing pieces -- let the crime show! But I pushed the two halves back together. And, MacGruber-style, I deftly scared up some rubber bands and cleverly wrapped them about the binder clips so they wouldn't slip again.

I went to put the thing back on the high shelf, and it just wouldn't quite fit. There was something in the way. There's some random lego junk up on that shelf, so I kind of pushed, and it turns out that there was some stupid 80-page marketing booklet up there, which, when moved, knocked a big chunk of lego off the shelf. A piece of some older project that had been stuffed up there. So that fell off and shattered all over the place.

Just as that happened, a whole bunch of Google Dudes were arriving, and one of them said, "heh, yer fired", and they all laughed and walked on. (Make no mistake, the nerd world has its own frat-boy stratum.) I ignored them. Another guy came in and, while talking on his cell phone, awkwardly picked up some pieces for me. That was nice.

I cleaned up and checked that Nancy wasn't going to slide again, and that was my breakfast!

Monday, November 10, 2008

Nancy

Google NYC has a Lego area, as is publicly known. In particular, there are some lego portraits of luminaries who work at Google. However, there was room for another lego portrait, so I took a bunch of lego home and Susan and I put one together.

First, you have the two founders, shown at the top of this NYTimes photo:



(Recently, another one of Eric Schmidt has been added.)

Up on top of the lego storage shelves, on the left side, you have a couple of dudes whose names I don't know:



On the right, you have Brian Kernighan, who co-wrote my C textbook:



And, finally, ours:



So far, there's been no indication that anyone has even noticed it. But that's okay, I did it for my own delight.

Monday, April 21, 2008

Phone System 2.0

I realize the phone system is an example of a system that Just Works. It's got a pretty good interface. And I know that there is a lot of high tech behind a dial tone that still sounds like it's made from cans and waxed string.

However, here's an idea for a new version of the phone system interface. Useful, perhaps, not just for itself, but to inspire other ideas.

* If two people call each other at the same time, instead of 2 busy signals, how about just connecting them?

The 'how to' part is left as an exercise.

Thursday, January 10, 2008

The Death Star suddenly makes sense to me -- it's what you get when you build a skyscraper in zero gravity:





















On EarthIn Space
Candle
Building
So, now I work at Google. It's pretty great.

When I told my boss I was leaving, the first thing she said was, "you are making a BIG mistake". I was aghast, since we had had a good relationship during the four years I was there.

She went on to give a few vague reasons, but nothing that really explained the reaction. It kind of freaked me out, because I was already nervous about making such a big decision.

The next two weeks were rather bad. She told the other programmers, and it seemed like she convinced them, too, that it was a "big mistake". With one exception, no one congratulated me at first, and when they did, they sounded mournful, like I was leaving to live in an iron lung.

The same day, or maybe the next day, another programmer quit -- he'd been there for a long time, and was well-liked and essential. My boss announced that he was leaving, that they would really miss him, that he had done great work, that he was just so wonderful, that she would give him a 'quitting bonus' if she were allowed to. He was going to love his new job where they did things the way he liked, and so on.

Not a word about me, nothing. It continued to freak me out. My former boss is quite charismatic, and it doesn't really surprise me that she was able to turn their feelings against me.

It's not like I left in the middle of a project. I mean, you're always in the middle of a project, that's true for everyone, and everyone who had quit before had been sent off with the best wishes. It was even company policy that people are encouraged to grow and improve, etc. etc., and if that meant moving on to a new place, that's fine.

But not, apparently, for me.

Anyway, my code was working, it was mostly complete, it was in a usable state, etc. What did I do wrong? I know that they didn't really like my code, since it used lots of functions and had unit tests and all that annoying stuff, but so did the other guy who quit.

I was nervous about coming to Google, but I just wanted a change of pace, and Google certainly seemed like that. I've never worked at a big company (except for some contract work), and I didn't know if I would like it. I didn't really look forward to writing C++. I had once been a C++ pusher, but now I'm a die-hard functional programming pusher. What would become of me?

My wife and other family members were excited, because everyone's heard of Google and it's a big deal and all that. I felt some pressure, so I tried to play it off like it wasn't a big deal, what's all the fuss. But after about a day here, I must say, it's pretty great.

Before I decided to come here, I looked around on the web for blogs or mailing lists for disgruntled former Google employes. Those can tell you a lot about a company. I would have taken it with a grain of salt, because I know how they are biased and bitter, but there's still useful information to be gotten.

I couldn't find one. I think I found something someone said about working on something that never got used, but that's it. I was amazed. Nearly every place I had ever worked at, or even contracted for, had some place you could laugh about your former company. But not Google.

Now, I can tell why. There's just not that much to complain about. It's eerie.

I could go on about this place, but the highlights: it's good for programmers; it's casual; people are smart; there's free, high-quality, healthy vegetarian food every day.

So, let's all feel terrible about my


Sunday, December 23, 2007

Ken Thompson has an automobile which he helped design.

When I first started using unix when I got to college, when you would log out, it would print out a 'fortune'. This is the output of the famous unix program called, well, 'fortune'. They weren't really fortunes, although some of them sounded like snide fortune cookie fortunes.

Then, one day, I got this one, which I did not understand:

Ken Thompson has an automobile which he helped design. Unlike most automobiles, it has neither speedometer, nor gas gauge, nor any of the numerous idiot lights which plague the modern driver. Rather, if the driver makes any mistake, a giant "?" lights up in the center of the dashboard. "The experienced driver", he says, "will usually know what's wrong.
I didn't understand it, but I found it so compelling that I never forgot it. Who was this Ken Thompson? Surely this story wasn't literally true; but what had he done that someone was compelled to tease him in this way? Did Ken Thompson feel bad about being teased like this?

I now know that Ken Thompson was one of the creators of unix. In this fortune, the car is unix, and the giant '?' is the dreaded 'segmentation fault' error that plagues beginning unix/C programmers and which provides no useful information.

I have always felt a little bit bad for him, being teased in this way (and why does Dennis Ritchie get off so easy?). Apparently, though, Mr. Thompson and I work at the same company now, so maybe I will have a chance to comfort him.