    <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
     <channel>
        <title>ACCU  :: A Seasonal Tale</title>
        <link>https://members.accu.org/index.php/articles/948</link>
        <description>Professionalism in Programming</description>
        <dc:language>en-us</dc:language> 
        <dc:creator>Administrator</dc:creator> 
        <admin:generatorAgent rdf:resource="http://www.xaraya.org" /> 
        <admin:errorReportsTo rdf:resource="mailto:webeditor@accu.org" />
       <sy:updatePeriod>hourly</sy:updatePeriod>
       <sy:updateFrequency>1</sy:updateFrequency>
       <docs>http://backend.userland.com/rss</docs>




<div class="xar-mod-head"><span class="xar-mod-title">CVu Journal Vol 12, #1 - Jan 2000</span></div>

<table border="0" cellpadding="1" cellspacing="0">
    <tbody>
    <tr>
        <td valign="top">
            Browse in :
       </td>
       <td valign="top">

                                            <a href="https://members.accu.org/index.php/articles/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c76/">Journals</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c77/">CVu</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c128/">121</a>
<br />
</td>
   </tr>
   </tbody>
</table>




<div class="xar-error">
   <p>
 <strong>Note:</strong> when you create a new publication type,
the articles module will automatically use the templates
<em>user-display-[publicationtype].xt</em>
and <em>user-summary-[publicationtype].xt</em>.
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/<em>yourtheme</em>/modules/articles . The templates will get the extension .xt there. </p>
</div>
<div class="xar-norm xar-standard-box-padding">
   <h1><strong>Title:</strong>&nbsp;A Seasonal Tale</h1>
<p><strong>Author:</strong>&nbsp;</p>
<p>
<strong>Date:</strong> 03 January 2000 13:15:34 +00:00 or Mon, 03 January 2000 13:15:34 +00:00</p>
<p><strong>Summary:</strong>&nbsp;</p>
<p><strong>Body:</strong>&nbsp;<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e16" id="d0e16"></a></h2>
</div>
<p>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.</p>
<p>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:</p>
<pre class="programlisting">
#include &lt;stdio.h&gt;
void main (){
  char * reply = &quot;xxxx&quot;;
  puts(&quot;Enter password:&quot;);
  gets(reply);
  if (reply = &quot;password&quot;) exit(0);
  reboot();
}
</pre>
<p>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.</p>
<p>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.</p>
<p>Fortunately there was an emergency phone near the exit. I picked
it up only to hear:</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>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'.</p>
<p>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:</p>
<p>'To abort countdown input security code.'</p>
<p>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.</p>
<p>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.</p>
<p>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:</p>
<p>'Weapon Store Isolated, input password to restore exterior
communication.'</p>
<p>Thoughtlessly I tried the first password that came into my head
only to get the response:</p>
<p>&quot;'password' is not the password. Input correct password. Second
error triggers immediate detonation&quot;</p>
<p>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&hellip; (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.</p>
<p>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:</p>
<p>&quot;To get a clue to the security code press F2.&quot;</p>
<p>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:</p>
<p>&quot;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.' &quot;</p>
<p>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.</p>
<p>Thankfully the storeroom computer was still running and had a
functioning C development environment (well actually Visual C++ 6.0
sp3).</p>
<p>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:</p>
<pre class="programlisting">
#include &lt;stdio.h&gt;
#inlude &lt;string&gt;
int main(){
  int i, j;
  char old[6], new[6] = &quot; &quot;;
  for(i=10000; i&lt;100000; i++){
    strcpy(old, itoa(i)); 
    for (j=0, j&lt;5; j++) {
      new[j] = old[4-j];
      if (i == 4*atoi(new)) {
        puts(old);
        return 0;
      }
    }
  }
  return 1;
}
</pre>
<p>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().</p>
<p>Time was running out, panic was definitely setting in. How
quickly could I rework the code to use sprintf()?</p>
<p>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.</p>
<p>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.</p>
<p>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.</p>
</div>
</p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
</div>
</channel>
</rss>
