The neglected program, the chronic bug and the invaluable friend

For years now I knew of a bug in this little utility I had written ages ago. "Akatanomasto" ("one that cannot be named" in Greek) was this little sticky-notes utility I wrote back in 1999. I think it was the summer of 1999 when I had this idea of floating notes on the desktop with the unusual twist of being able to send the little notes across the network, "stick them up" electronically on somebody else's desktop. Soon after, the little application developed a minor bug. You couldn't type a hyphen ("-"). You could paste a hyphen and you could type a hyphen using the minus key on the numeric keypad, but you couldn't type one using the Underscore/Hyphen key on a normal keyboard. An initial investigation did not shine any light to the bug and I didn't bother that much to be honest. Who would discover?

The spring of 2000 found me being very busy with a job change, a move to a different country etc. The little utility was abandoned even though it was put up on my website (www.cylog.org) available for download. By 2003 a couple of people had discovered the bug and I probably had another look. No fix found. It was about that time (2003) when I was legally obliged to rename the utility, which actually made me decide to remove it from my site all together since it has become a bit derelict (read about rotting software on "The Pragmatic Programmer"). The program had some critical bugs (like the one that made it read several megabytes from the disk whenever you launched or even activated it - I kept that one a secret), I had a long list of improvements I wanted to make and on top of that I couldn't compile the code anymore since it was written in Delphi 5 and my current version of Delphi was 7. I decided that I was going to withdraw it, forever concealing the hideous bugs that came with it!

Two days ago, I decided to rewrite "Akatanomasto". It was always in the back of my mind. How I should find a name for it, how I was going to implement all these new ideas. How, this time, will write it more carefully and will not hastilly add features like adding ornaments on a christmas tree. And so I started...

[I sincerely apologise to those of you who are not very interested in the way we programmers develop, you may stop reading this post now. For those of you who are however, here it goes...]

First of all, we start from scratch. One window with the old code, one window with the new code. We write on the new code window, occasionally copying and pasting from the old code - not full units or forms, just lines of codes here and there. Frequently we check the old code to see how we implemented a certain feature, then we chose to follow or not to follow the old example. With all this in mind, I was gradually coming to a point were the program could create new notes on the desktop.

In all my preparation and re-design process I was preoccupied with things like naming conventions for the .ini files, XML usage for configuration, how to upgrade from the previous version, graphics improvements, how to use the new multi-monitor support libraries I developed over the years etc. The program was gradually taking shape and it came to the point were the notes could be read from the disk, created as new, etc. And then I remembered of that nasty little bug. I checked the new version. It was still there!!!

How on earth? How could this have happened? I took such care not to copy any code. I only copied a few components from old forms to the new forms... And a few lines here and there. I was gutted. I sighed, then I decided not to bother. "Oh well", I said to myself, "that at least can make the app more popular amongst my friends... They'll have a laugh". And I carried on building... "The chronic bug. Who cares!"

When I started redeveloping "Akatanomasto", I was between calling it "K-Not" or "KNot". I opted for the latter. I now realise that most of you who read this, will take the piss about dropping the hyphen for the obvious reason that one couldn’t type it! But I will ignore you... :-)

I digress. Last night I was on the phone to my friend Zaf and I was proudly telling him how I finally came about rewriting "Akatanomasto" and I added this cool feature, the chameleon effect (notes can take the color of the desktop wallpaper area they cover [picture here]). I mentioned the chronic bug to him and he offered help. He was confident that he’ll find it and fix it and will have an embarrassing story about me to tell to future generations. I was sure that he wouldn't find it. Or if he would, that it wouldn’t be my fault. It’d be something like Delphi's fault, or Windows'...

I zipped the source code and sent it over to him. We tested that he had all he needed in terms of libraries etc. - he was able to compile it. And he could emulate the bug. Good stuff. Now he could focus on finding why the bloody hyphen was not even sending a key-notification event to my little notes!...

Half an hour later he had the answer. I cannot disclose the adjectives he used to describe me for obvious reasons – this is a respectful blog. Along with the very few things I copied from the old app I copied the main menu off the app's main form. Which apparently had a "hyphen" assigned shortcut key assigned to a separator line. That, was intercepting key strokes from the hyphen-key (that explains why the numeric keypad key was working). The best of all, is the fact that because of the way the menu separators are rendered in Windows a shortcut key, if assigned, is not shown. I couldn't believe it!

I promised Zaf I'll post a story to my blog. Thanks matey! You are trully amazing. And invaluable. And you have my source code!

You can find a public preview of KNot here.

Comments

Unknown said…
I could disclose the adjectives I used to describe you, if everyone else reading this blog agrees... :-)
andreadi said…
Ok, u found the bug. Now can u tell me why I could write the hyphen in the old version, using my british Natural MS keyboard?

If u find that Zaf, u get a "Mantolato". How u call it in Londra... "Nougat", "Almond Cake"...
The problem was not the hyphen as a character, the problem was the key code associated with a hyphen shortcut. That is why you could type a hyphen using the numeric keypad, i.e. a different key code. I assume that the way the key strokes are intercepted and translated as messages is basically using the VK_XXX constants. Maybe your hyphen key on the Microsoft keyboard is represented by a different code.

Actually if you download the current version, that has the hyphen bug so you can try.

BTW, I am thinking of releasing two versions one with the bug and one without. I'll name them "KNot" and "K-Not" respectively...
Unknown said…
"KNot" and "K-Not"!!! LOL
i want the KNot... :)
emfyalomenos said…
g..ato programmataki opos kai to toolbox ksymeon. Tin eixa patisei asxima me to freeware version tou akatanomastoy kai eixa xasei ola ta notes moy. No more!

To kerasaki einai oti p.x oson afora to toolbox, exo 6 ksexorista tooboxes, kai trexo to katalilo, analoga me ti programmata thelo, px paixnidia flash, efarmoges grafeioy klp.

To idio blepo na kano kai me to knot, px simeioseis prosopikes, gia to grafeio klp klp
Anonymous said…
I 'm so glad KNot is back -hyphen or no hyphen :P - and I am grateful you shared the story behind it.
Useful and handy like Wild Rename and Folder Icons.
All three have proven deus ex machine many times!
vpapanik said…
U-N-B-E-L-I-E-V-A-B-L-E !!!!!! Well done Zaf. My teacher and mental father ksymeon always teached us to declare the VCL properties inside our code and don't use the object inspector all the time....

'daskale pou didaskes'. For not-greek readers, RTFS (S stands for Systran).

Popular posts from this blog

GetDIBits vs. Scanline vs. Pixels[] in Delphi Bitmaps

Chrome Packaged Apps

Installation of Mint 17.1 Cinnamon on VMWare