Journal Articles

CVu Journal Vol 12, #1 - Jan 2000
Browse in : All > Journals > CVu > 121 (30)

Note: when you create a new publication type, the articles module will automatically use the templates user-display-[publicationtype].xt and user-summary-[publicationtype].xt. If those templates do not exist when you try to preview or display a new article, you'll get this warning :-) Please place your own templates in themes/yourtheme/modules/articles . The templates will get the extension .xt there.

Title: A Seasonal Tale

Author: Administrator

Date: 03 January 2000 13:15:34 +00:00 or Mon, 03 January 2000 13:15:34 +00:00

Summary: 

Body: 

It was a stormy night at the turn of the last millennium (well not everyone agreed on that designation, but it was certainly the roll over from 999 to 000 that was expected to cause problems). I had been called in to have a look at the stock control computer in the nuclear weapons store because the stock clerk was having problems with it.

It had been a long afternoon opening up the hardware and testing it before I finally located the problem. It was nothing to do with the then answer to everything (no, not 42 but Y2K). The store clerk was teaching himself C (an archaic ancestor to C+=++java) and had managed to write a program that was being run as part of the start-up process. For completeness this is what he had written:

#include <stdio.h>
void main (){
  char * reply = "xxxx";
  puts("Enter password:");
  gets(reply);
  if (reply = "password") exit(0);
  reboot();
}

No, I am not going to show you that monstrous reboot() function, there are enough problems with the above code without providing further evidence of the danger of unsupervised and unauthorised self tuition.

By the time I had got the machine up and running normally (well it passed all the standard tests, and generated beautiful blue screens with predictable randomness) it was gone 6 o'clock. I packed up my tools and made for the door anticipating a pleasant (and lucrative) evening on standby technician to troubleshoot the Y2K bugs. At that point my first real problem surfaced; the exit was locked. The only way out was with a swipe card and numerical code. I had neither of these.

Fortunately there was an emergency phone near the exit. I picked it up only to hear:

For the twenty-four hours commencing 6 p.m. December 31st all telecommunications is suspended. This is a purely precautionary measure to protect you from potential Y2K problems. Please contact the front desk for further details of alternative modes for communication of urgent matters.

As there are tender ears listening I will leave my response to your imagination. Had they wanted to redecorate the walls I am sure that what I had to say in any of the ten languages in which I can fluently express unhappiness would have shrivelled the paint from the walls.

So there I was locked in and surrounded by tactical nuclear weapons, just as well that even in my state of ire I the idea of blowing the whole lot up only crossed my mind before making a rapid exit stage left. Then I remembered that there had been some games on the stock control computer.

I went over, sat down, rebooted the machine and did a quick directory scan. I came across a game that I had never seen before titled 'No More Y2K'. I quickly scanned the readme file. I gathered that the game involved defeating an anti third millennium group who were determined to stop people celebrating entry to the third millennium a year early. The description talked about a monstrous plan to start WW3 by exploding a nuclear bomb store at mid-night GMT December 1999 with the result that WW3 will get started leading to nuclear winter, which leaves the human residue somewhat disinterested in debating the relative merits of calendars with and without a year zero.

I fired up the game and was promptly asked if I was sure that I wanted to start the timer. I do wish programmers would stop all this double checking, if I didn't want to play the game I would not have said I did. Anyway I pressed for yes noting that, eccentrically, default was 'no'.

The screen lit up with a big message declaring that the timer had been started and that at exactly midnight the nuclear weapon store would explode. Down the bottom of the screen was a message:

'To abort countdown input security code.'

Just then the main lights went out. A few seconds later emergency lighting came on. I was surprised that the computer was still functioning, then I remembered noting that it had an exceptionally heavy duty UPS powering it. Suddenly I became aware that the steady tick of the timer was coming from behind me and not from the computer's speakers.

I thought that perhaps I should investigate. It was then that I discovered the red digital displays remorselessly winding down towards zero. Every one of them was keeping perfect time with the counter on the computer's monitor. Perhaps I should not have been so quick to start that timer.

I felt panic welling up inside me. I wasted precious time checking all the phones, but each was ominously silent. I glanced at the screen to see a new message:

'Weapon Store Isolated, input password to restore exterior communication.'

Thoughtlessly I tried the first password that came into my head only to get the response:

"'password' is not the password. Input correct password. Second error triggers immediate detonation"

Hopefully this was some sick joke perpetrated by that store clerk. Perhaps I should have suspected that even the worst novice could not accidentally such defective code. I should have realised that writing the reboot() function was the work of a malicious expert. A horrible suspicion flared up centre stage in my mind. Yes, I had skipped the file header. There it was, large as life; the name of the coder was… (to protect against libel I have decided to edit out the full name of a well known character in the C/C++ world and leave just the initials. Francis) H.S. I should have realised the significance of so much undefined behaviour in such a short piece of code. Only such a monstrous coder could perpetrate such. What a terrible way to take revenge on all his detractors. The ultimate proof that he was what he claimed, a master of C and C++, and that all that rotten code published in his books was part of a master plan to ensure that no one else would write better code.

Now how was I to find that password? Back to the game. I tried pressing F1. Yep, I got some help. 'Hints cost 30 minutes. Continue Y/N.' I stopped to think, too late I realised that 'yes' was now the default. The screen now read:

"To get a clue to the security code press F2."

and the timer jumped down 30 minutes. Unless I did something WW3 was going to start 30 minutes early. I pressed F2. This time I got the following message:

"Congratulations, you have just advanced the timer to WW3 - 5 minutes. Your reminder as to the password is: 'I am essentially represented by five digits. Reverse me and I become a quarter of myself. Use me before your time runs out.' "

As a fan of cryptic number clues I realised that the stop code for the timer was a 5 digit number that when reversed and multiplied by four would become the original number.

Thankfully the storeroom computer was still running and had a functioning C development environment (well actually Visual C++ 6.0 sp3).

I hastily grabbed the chair and fired up the development environment (wow! Don't you just love that MS Windows can do two things at once?) and prepared to write a program. No time for elegant thought, just get something that would work:

#include <stdio.h>
#inlude <string>
int main(){
  int i, j;
  char old[6], new[6] = " ";
  for(i=10000; i<100000; i++){
    strcpy(old, itoa(i)); 
    for (j=0, j<5; j++) {
      new[j] = old[4-j];
      if (i == 4*atoi(new)) {
        puts(old);
        return 0;
      }
    }
  }
  return 1;
}

Not bad for just over three minutes work. I hit the build key, confident that I would have my answer in a few seconds more. You spotted it didn't you? The linker did as well and threw up missing itoa().

Time was running out, panic was definitely setting in. How quickly could I rework the code to use sprintf()?

Then I heard my old teacher declaiming that the problem with all this new technology was that it causes brain death. I scribbled a couple of lines on the back of an envelope with my sturdy old word processor, thankful that it did not need sharpening. Task switched back to the game and typed in five digits hitting enter just as the countdown trembled on 1.

Well, that is the story I will be telling my grandchildren about the day that my brains saved England from nuclear catastrophe at the start of the millennium.

The real bug with computers is the way they stop us thinking for ourselves. Good programmers choose the right tool for the job and that includes using wetwareJ If you want to know what that number was you can work it out for yourself. And yes it did only take me 90 seconds to solve when Francis emailed it to me. Now I wonder about other multipliers and other numerical bases.

Notes: 

More fields may be available via dynamicdata ..