I am reading so many horror stories about spagetthi code and errors that take down whole commercial websites, I thought it was a good idea to share some of you positive easy coding win stories? When were you assigned a (on the surface) hard task to just google, copy paste and be done with it? I am very curious. :)
The idea was that this army of temps would enter data into a home-grown Java app, then someone would push a button to spit it all out as XML files, and then there was a Perl program that would read the XML files and "drive" QuarkXPress to automatically create pages with optimal product position to minimize whitespace at the bottom of columns. But there was a bug and every special character got printed with extra spaces around it. For example ™ ® © ° ± ² – — ‘ ’ “ ”. There were hundreds per page. (Think row after row of 1¼” ID 1¾” OD Fastenal™ Supertight® hex nut.) So just when they thought the project was over, they asked us all to stay and use red pens to mark up proofs so that another army of graphic designers could fix the problems in Quark by hand.
I looked at the Perl code, and it was using a regex to replace our own special codes (something like [tm] etc IIRC) with the unicode chars, but the regex had extra spaces, something like
s/\[(\w+)\]/ $replacements{$1} /g
Elsewhere the developer was fond of the /x option, so I assume he just omitted it here.I tried editing the code and saw that it fixed the problem, so I told my manager. He asked me to write a letter to the developer (who was in another office across town), so that night I wrote a 3-page explanation and brought it in. To remove two blank spaces.
A day or two later my manager said the developer approved, and he asked me what salary I'd accept to work there full-time as a programmer. :-)
With just a few wget commands and a dns redirect, $100 was sent to my Paypal account, the guy was so happy he refered me to a bunch of others needing the same thing done.