Bugs-n-Donuts by Mike Kolesnik
Heaven's donuts are jelly donuts. The blend of texture, from the cool, sweet
ooze of the jelly, mined with tiny raspberry seeds, to the firm, spongy cake,
so lightly encrusted in a thin glaze of sugar, that cracks and flakes as you
gingerly tear off small pieces of delight, is certainly the greatest
experience a humble man can afford.
I was eating a jelly donut when He first appeared in my office, smelling
slightly of gunpowder. He was tall and gaunt, with deep-set eyes and crooked
teeth, long, delicate fingers, and sloped shoulders. He wore a black Ozzy
Osborne concert t-shirt, frayed black jeans, and dusty black high-tops,
unlaced. He smiled at me in an ugly way. I put down my donut and glanced at
my watch. 7:00 PM. "You're Mike Kolesnik."
I nodded.
"You're a programmer for CyberHackers."
I nodded again. Not only was I a programmer for CyberHackers-I was the best
damn programmer this group had ever or would ever see. I suppose I should
introduce myself. I am Michael Kolesnik, master programmer. I'm not just
blowing smoke here either. I'm the best damn programmer to come out of MIT
since code was constructed one bit at a time. I can do it all: C, LISP,
assembly-even the languages no self-respecting programmer would deign to look
at. I can do it all in no time flat, with the most elegant of style. Code
sprinkled with glistening semicolons and flowing rivers of indentation. Lesser
programmers avert their eyes when I enter the room.
"They say you're the best, and I'm here to challenge you." I sized this guy up
again. He had the right shape. The pot-belly, the greasy hair, parted with
precision. The fingers. And the funny smell. I told him I didn't have time.
"I'll make it worth your while," he said. "I have something you might be
interested in. Follow me."
I grabbed my box of donuts, and followed him down the hall and into the
elevator. He pressed a button and the elevator descended into the basement.
I'd never been in the basement before. For that matter, I didn't even recall
that the building had a basement. Nonetheless, the elevator chimed, the doors
opened, and we stepped out into a wide room that was entirely featureless.
That is, except for the fog on the floor and two workstations that were set
up, side by side. One of the workstations was mine. The other was a
workstation like none other that I had seen before. It was magnificent.
It was matte black. More than an object, it looked like a hole in space. The
monitor it sported was the biggest I had ever seen, and the keyboard was a
flow of liquid lines, containing a field of keys of different sizes and
shapes, packed in like cobblestones. The mouse floated above the table, and
had no wire. Next to the computer was a box with a small chute coming out of
one side, and a large red button on the top. The monitor was flanked by two
gigantic speakers, and I could see a sub-woofer poking up out of the fog. It
hummed. It steamed. It was the most beautiful computer I had ever seen.
"You approve," said the stranger.
I swallowed and said, "It is beyond description."
"It's a custom job. And it's yours. If," he said, "If you can beat me in a
coding contest."
I looked at him incredulously. "What's in it for you?"
"I will have defeated the greatest coder in the world, and thus, I can claim
that title. AND, I get to keep your immortal soul." He smiled the ugly smile
again.
Here was a dilemma. I was dealing with the Devil. There was no doubt about
that. And he was no doubt very good. I am somewhat attached to my soul, but
oh, the prizes. The glory. I can easily claim to be the best coder in the
company, in the Bay Area, probably on the whole planet, but if I pulled this
off, I will have shown myself to be the best coder in this entire theology!
Vanity got the better part of me.
"What's the contest?" I asked.
I won't bore you with the details, but it was seriously ugly. Ugly in a way
that makes the most arrogant of coders cringe and causes managers to pad
development schedules into the next century. It had to run in any language,
including the nasty chicken-scratch ones. It had to be backward compatible,
all the way to the ENIAC. And it had to run on Windows... I cringed. But
vanity won. I signed the forms, agreed on a deadline of midnight, and we sat
down at our machines and started to code.
My watch said 8:00 PM, and I started warming up. Class definitions flew off my
fingertips like throwing stars. Structures and declarations grew like perfect
crystals, and I didn't even break a sweat. True to the task, I soon lost
myself in an endless cycle of postulate, create, instantiate and verify. Bits
grew to bytes, to K, to Megs, and finally to Gigs. By 11:00 PM it had come to
that crucial point. With an hour to go, I had to put all the pieces together.
It wasn't going to be easy. It was going to take all the concentration I had.
Then I hit the first bug.
At first, I wasn't sure where it was coming from, but then I spotted it. It
wasn't mine. It was a bug in Windows. Even worse, it was a bug in Windows that
stemmed from a timing problem with the system clock itself. I couldn't see a
workaround. I was stymied. I genuflected and called Microsoft support. "Hello,
and welcome to the Microsoft help line. Please enter your 64 digit user
identification number, followed by your 32 digit password." While I
frantically typed number after number, trying to navigate through layer upon
layer of phone menu, I heard Him pick up his phone and call a number.
"Hello, is Bill in? ... I don't care, wake him up ... Tell him it's Mr. Black
... Hey Bill, what's shakin'? Listen, I needed to know a workaround to one of
your bugs ... Yes, I know what time it is... Yes, I know ... Bill ... Bill!
You remember our little deal?... That's right. Now be a dear and give me
that workaround ... Mm-hm ... Right ... Thank you, Bill. I'll be seeing you."
I was shocked. It was obviously pointless continuing my desperate journey
through Microsoft's Help line. I needed immediate genius! I scarfed down a
grape jelly. Sugar shock engulfed me, and my vision tunneled. I shuddered
once, something clicked, and I determined the answer I needed-I could use the
clock on the sound chip to get my timings.
I dove back into the code, and was quickly integrating modules when I hit bug
number two. It was even uglier than the first. In fact, it was the ugliest bug
I had ever seen. It was a problem with C. With the language itself. There's no
way to fix a broken hammer using the same hammer.
I wracked my brains. I clenched and grunted and sweated and thought and
Thought and THOUGHT, but to no avail. Over my shoulder, I could hear Him chime
in, "Bugger, isn't it? I remember putting that one in back when I was working
on the Unix kernal. Did you really think there was a Kernighan and Ritchie?
Rearrange the letters in their names and you'll discover an interesting
anagram."
I ignored him and continued thinking. My mind went deeper and deeper into the
problem at hand-my senses dulled, my breathing grew shallow. My eyes rolled
back and sweat beaded on my forehead. Clumsily, blindly, my hand pawed it's
way to the box on my desk, containing my last jelly donut. It raised slowly to
my lips, and I bit.
Pounding waves of sugar induced euphoria washed through my mind. I felt my
brain hum and crackle. My hands trembled, my body shuddered, and I began to
type. I was a man possessed. Complex topographical math equations formed on my
screen. Klien bottles and hypercubes locked neatly into place like pieces of a
puzzle. Beyond my control, a complex mathematical world formed in my computer,
with additional dimensions unimaginable.
I felt a small pop, and I came to. I looked at my screen. I had worked around
the bug. My watch read 11:45. Frantically I continued putting all the modules
into place. Glancing for a moment at my rival, I could see I had him worried.
He was typing furiously. Smoke poured from his ears, and flames licked around
his collar.
Then I hit the third bug.
It was not so much a bug, it was a limit. I only had 4 Gigabytes of memory,
and I had used it all. There wasn't a bit left. I had compressed data to a
point so fine that it was in danger of collapsing into a black hole. I was
storing memory in every conceivable way, including keeping a chain of sound
waves running between the speaker and the microphone. There was no memory left
to be had.
Frantic, I reached into my box of donuts, and my heart sank into my stomach
when I realized that I had eaten the last one. I glanced at my watch, but it
was too late. I was sunk. I had done the best that I could, and I had nothing
more to give.
The Devil laughed, and grinning cruelly, he reached over to the box with the
chute and the button. Remember the box? Slowly, firmly, his hand pressed the
red button, and a jelly donut slid down the chute and onto the table.
My jaw dropped. "What...is...that?" I asked.
He languorously chewed as he replied, "The Box of Eternal Donuts."
"The Box of Eternal Donuts!?"
"Yes," he said.
"It never runs out?"
"Never," he said.
"It's mine if I win?!?!"
"If you can win, it is entirely yours," he replied, grinning cockily.
My mind reeled. The Box of Eternal Donuts. The Box of Eternal Donuts! My eyes
darted everywhere, my jaw hung slack, and my throat emitted strange
animal-like noises. Anything. I would do anything to win! I just needed the
smallest amount of memory. But where could I get it from? I glanced at my
watch again, and a plan came into my mind. A beautiful, devious plan.
I went quickly upstairs and retrieved the emergency toolkit that we keep in
the medicine cabinet. I ripped the case off my computer, and quickly scanned
for the right connections. I pulled two wires, and unscrewed the back of my
watch. The Devil's eyes widened and he desperately started coding again, but
it was too late. I got the last of the memory I needed out of my watch, and
pressed the ENTER key seconds before he did.
The watch burst into flames. Sparks flew from the disk drives and the monitor
glowed and throbbed, finally melting into a puddle of glass. The computer
exploded in a shower of sparks, and then there was absolute silence.
There was a pause, and both of us turned as the printer started, slowly
emitting a single sheet that wafted gently into the out bin. I nonchalantly
strolled over, and held up to the Devil's scowling face, a sheet imprinted
with two words. "Hello World".
Nothing more needs to be told, other than, as I write this, I am sitting in
front of my new computer, munching on what is undoubtedly the best jelly donut
I have ever eaten...
WHAT IF PEOPLE BOUGHT CARS LIKE THEY BUY COMPUTERS?
General Motors doesn't have a help line for people who don't know
how to drive because people don't buy cars like they buy computers, but
imagine if they did....
---------------------------------------------------------------
HelpLine: "General Motors HelpLine, how can I help you?"
Customer: "I got in my car and closed the door and nothing happened!"
HelpLine: "Did you put the key in the ignition slot and turn it?"
Customer: "What's an ignition?"
HelpLine: "It's a starter motor that draws current from your battery
and turns over the engine."
Customer: "Ignition? Motor? Battery? Engine? How come I have to
know all these technical terms just to use my car?"
---------------------------------------------------------------
HelpLine: "General Motors HelpLine, how can I help you?"
Customer: "My car ran fine for a week and now it won't go anywhere!"
HelpLine: "Is the gas tank empty?"
Customer: "Huh? How do I know?"
HelpLine: "There's a little gauge on the front panel with a needle
and markings from 'E' to 'F'. Where is the needle
pointing?"
Customer: "It's pointing to 'E'. What does that mean?"
HelpLine: "It means you have to visit a gasoline vendor and purchase
some more gasoline. You can install it yourself or pay
the vendor to install it for you."
Customer: "What? I paid $12,000 for this car! Now you tell me that
I have to keep buying more components? I want a car that
comes with everything built in!"
---------------------------------------------------------------
HelpLine: "General Motors HelpLine, how can I help you?"
Customer: "Your cars suck!"
HelpLine: "What's wrong?"
Customer: "It crashed, that's what wrong!"
HelpLine: "What were you doing?"
Customer: "I wanted to run faster, so I pushed the accelerator pedal
all the way to the floor. It worked for a while and then
it crashed and it won't start now!
HelpLine: "It's your responsibility if you misuse the product. What
do you expect us to do about it?"
Customer: "I want you to send me one of the latest version that
doesn't crash any more!"
---------------------------------------------------------------
HelpLine: "General Motors HelpLine, how can I help you?"
Customer: "Hi, I just bought my first car, and I chose your car
because it has automatic transmission, cruise control,
power steering, power brakes, and power door locks."
HelpLine: "Thanks for buying our car. How can I help you?"
Customer: "How do I work it?"
HelpLine: "Do you know how to drive?"
Customer: "Do I know how to what?"
HelpLine: "Do you know how to drive?"
Customer: "I'm not a technical person. I just want to go places
in my car!"
Hello, World
------------------------------------------------------------------------
Here are some examples of "Hello World" programs written by people at
different stages of their "careers".
High School/Jr.High
===================
10 PRINT "HELLO WORLD"
20 END
First year in College
=====================
program Hello(input, output)
begin
writeln('Hello World')
end.
Senior year in College
======================
(defun hello
(print
(cons 'Hello (list 'World))))
New professional
================
#include <stdio.h>
void main(void)
{
char *message[] = {"Hello ", "World"};
int i;
for(i = 0; i <2; ++i) printf("%s", message[i]); printf("\n"); }
Seasoned professional
=====================
#include <iostream.h>
#include <string.h>
class string
{
private:
int size;
char *ptr;
public:
string() : size(0), ptr(new char('\0')) {}
string(const string &s) : size(s.size)
{
ptr = new char[size + 1];
strcpy(ptr, s.ptr);
}
~string()
{
delete [] ptr;
}
friend ostream &operator <<(ostream &, const string &); string &operator="(const" char *); };
ostream &operator<<(ostream &stream, const string &s) { return(stream << s.ptr); }
string &string::operator=(const char *chrs)
{
if (this != &chrs)
{
delete [] ptr;
size = strlen(chrs);
ptr = new char[size + 1];
strcpy(ptr, chrs);
}
return(*this);
}
int main()
{
string str;
str = "Hello World";
cout << str << endl;
return(0);
}
Master Programmer
=================
[
uuid(2573F8F4-CFEE-101A-9A9F-00AA00342820)
]
library LHello
{
// bring in the master library
importlib("actimp.tlb");
importlib("actexp.tlb");
// bring in my interfaces
#include "pshlo.idl"
[
uuid(2573F8F5-CFEE-101A-9A9F-00AA00342820)
]
cotype THello
{
interface IHello;
interface IPersistFile;
};
};
[
exe,
uuid(2573F890-CFEE-101A-9A9F-00AA00342820)
]
module CHelloLib
{
// some code related header files
importheader(<windows.h>);
importheader(<ole2.h>);
importheader(<except.hxx>);
importheader("pshlo.h");
importheader("shlo.hxx");
importheader("mycls.hxx");
// needed typelibs
importlib("actimp.tlb");
importlib("actexp.tlb");
importlib("thlo.tlb");
[
uuid(2573F891-CFEE-101A-9A9F-00AA00342820),
aggregatable
]
coclass CHello
{
cotype THello;
};
};
#include "ipfix.hxx"
extern HANDLE hEvent;
class CHello : public CHelloBase
{
public:
IPFIX(CLSID_CHello);
CHello(IUnknown *pUnk);
~CHello();
HRESULT __stdcall PrintSz(LPWSTR pwszString);
private:
static int cObjRef;
};
#include <windows.h>
#include <ole2.h>
#include <stdio.h>
#include <stdlib.h>
#include "thlo.h"
#include "pshlo.h"
#include "shlo.hxx"
#include "mycls.hxx"
int CHello::cObjRef = 0;
CHello::CHello(IUnknown *pUnk) : CHelloBase(pUnk)
{
cObjRef++;
return;
}
HRESULT __stdcall CHello::PrintSz(LPWSTR pwszString)
{
printf("%ws\n", pwszString);
return(ResultFromScode(S_OK));
}
CHello::~CHello(void)
{
// when the object count goes to zero, stop the server
cObjRef--;
if( cObjRef == 0 )
PulseEvent(hEvent);
return;
}
#include <windows.h>
#include <ole2.h>
#include "pshlo.h"
#include "shlo.hxx"
#include "mycls.hxx"
HANDLE hEvent;
int _cdecl main(
int argc,
char * argv[]
) {
ULONG ulRef;
DWORD dwRegistration;
CHelloCF *pCF = new CHelloCF();
hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
// Initialize the OLE libraries
CoInitializeEx(NULL, COINIT_MULTITHREADED);
CoRegisterClassObject(CLSID_CHello, pCF, CLSCTX_LOCAL_SERVER,
REGCLS_MULTIPLEUSE, &dwRegistration);
// wait on an event to stop
WaitForSingleObject(hEvent, INFINITE);
// revoke and release the class object
CoRevokeClassObject(dwRegistration);
ulRef = pCF->Release();
// Tell OLE we are going away.
CoUninitialize();
return(0); }
extern CLSID CLSID_CHello;
extern UUID LIBID_CHelloLib;
CLSID CLSID_CHello = { /* 2573F891-CFEE-101A-9A9F-00AA00342820 */
0x2573F891,
0xCFEE,
0x101A,
{ 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 }
};
UUID LIBID_CHelloLib = { /* 2573F890-CFEE-101A-9A9F-00AA00342820 */
0x2573F890,
0xCFEE,
0x101A,
{ 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 }
};
#include <windows.h>
#include <ole2.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "pshlo.h"
#include "shlo.hxx"
#include "clsid.h"
int _cdecl main(
int argc,
char * argv[]
) {
HRESULT hRslt;
IHello *pHello;
ULONG ulCnt;
IMoniker * pmk;
WCHAR wcsT[_MAX_PATH];
WCHAR wcsPath[2 * _MAX_PATH];
// get object path
wcsPath[0] = '\0';
wcsT[0] = '\0';
if( argc 1) {
mbstowcs(wcsPath, argv[1], strlen(argv[1]) + 1);
wcsupr(wcsPath);
}
else {
fprintf(stderr, "Object path must be specified\n");
return(1);
}
// get print string
if(argc 2)
mbstowcs(wcsT, argv[2], strlen(argv[2]) + 1);
else
wcscpy(wcsT, L"Hello World");
printf("Linking to object %ws\n", wcsPath);
printf("Text String %ws\n", wcsT);
// Initialize the OLE libraries
hRslt = CoInitializeEx(NULL, COINIT_MULTITHREADED);
if(SUCCEEDED(hRslt)) {
hRslt = CreateFileMoniker(wcsPath, &pmk);
if(SUCCEEDED(hRslt))
hRslt = BindMoniker(pmk, 0, IID_IHello, (void **)&pHello);
if(SUCCEEDED(hRslt)) {
// print a string out
pHello->PrintSz(wcsT);
Sleep(2000);
ulCnt = pHello->Release();
}
else
printf("Failure to connect, status: %lx", hRslt);
// Tell OLE we are going away.
CoUninitialize();
}
return(0);
}
Apprentice Hacker
===================
#!/usr/local/bin/perl
$msg="Hello, world.\n";
if ($#ARGV >= 0) {
while(defined($arg=shift(@ARGV))) {
$outfilename = $arg;
open(FILE, ">" . $outfilename) || die "Can't write $arg: $!\n";
print (FILE $msg);
close(FILE) || die "Can't close $arg: $!\n";
}
} else {
print ($msg);
}
Experienced Hacker
==================
#include <stdio.h>
#define S "Hello, World\n"
main(){exit(printf(S) == strlen(S) ? 0 : 1);}
Seasoned Hacker
===============
% cc -o a.out ~/src/misc/hw/hw.c
% a.out
Guru Hacker
===========
% cat
Hello, world.
^D
New Manager
===========
10 PRINT "HELLO WORLD"
20 END
Middle Manager
==============
mail -s "Hello, world." bob@b12
Bob, could you please write me a program that prints "Hello,
world."?
I need it by tomorrow.
^D
Senior Manager
==============
% zmail jim
I need a "Hello, world." program by this afternoon.
Chief Executive
===============
% letter
letter: Command not found.
% mail
To: ^X ^F ^C
% help mail
help: Command not found.
% damn!
!: Event unrecognized
% logout