|
One of our products uses a SmartCard and our supplier recently increased their price by ... a lot. We found another supplier, but our product couldn't read the new cards. This has been on my plate for months. I'd look at it occasionally and not get anywhere. The code was originally written by someone else (now retired) and was full of magic, undocumented numbers.
My boss and I discussed it late last week, and I told him I thought I'd have to do a rewrite to clean up the mess. Probably a couple weeks worth of work, plus another week for my testing, plus another couple of weeks of regression testing. Not a small task.
I finally wrote a small test program to read and dump out the cards just so I could learn what was actually going on. Yesterday afternoon I discovered the problem.
A single byte in one command, two ing characters in the source code, were wrong for the new card. Interestingly, the changed code works correctly with the old cards as well as the new ones.
The word sheepish comes to mind .
Software Zen: delete this;
|
|
|
|
|
It's not obvious until it is. Happens to everyone, be glad you found it.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
Sounds like a success to me. You have saved yourself a couple weeks of work, and another few weeks of testing and regression testing!
|
|
|
|
|
Coulda had three weeks on the beach though.
|
|
|
|
|
Yeah, I'm just annoyed at my initial "Chicken Little"[^] reaction.
Software Zen: delete this;
|
|
|
|
|
Any time you delve into a codebase full of magic numbers and other completely odd idiosyncrasies, a chicken little response is appropriate.
|
|
|
|
|
That reminds me of the time I had to implement a simple system for writing magnetic cards for a security system. I was handed a reader/writer, the manual, and a few cards.
I implemented it in DCL . I pity tha fool who had to maintain it.
|
|
|
|
|
DCL = Digital Command Language, from VAX/VMS?
I used that a lot back in the day...
Software Zen: delete this;
|
|
|
|
|
Yes. My education and early career (1983 - 2002) were all on DEC systems.
I have four OpenVMS systems here.
|
|
|
|
|
I was a developer on and the system manager for a number of VAXen in the mid-to-late 1980's, most at our local Air Force Base.
I think my worst abuse of DCL was when I wrote a preprocessor for VAX FORTRAN in DCL that reduced it to FORTRAN-77 syntax with some generated code. Good times.
Software Zen: delete this;
|
|
|
|
|
Yeah, I developered, managered, and operatored a variety of VAX and Alpha systems, in education, manufacturing, transportation, and communication fields. So many employers trusted me with full privileges, the fools.
Mostly writing in C, often accessing databases.
|
|
|
|
|
Been there two days ago. Forgot an underscore in the SQL for query, forgot to run the integration tests which immediately identified the problem when I did run them, but unfortunately the customer discovered the problem which took a LOT longer to smooth feathers and fix the 6 resulting issues than it did to type the underscore.
|
|
|
|
|
Man, you forget one TPS report cover sheet...
|
|
|
|
|
It happens to me when I think I can save time by skipping the front-end (analysis) stuff that has worked in the past. The time you do not spend thinking you wind up spending rewriting; so, even "no progress" can be progress. (And I don't feel so bad procrastinating)
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
So true. I've also fallen into that trap. Just start writing code that later has to be totally reworked.
|
|
|
|
|
Better sheepish then many weeks work!
The less you need, the more you have.
Even a blind squirrel gets a nut...occasionally.
JaxCoder.com
|
|
|
|
|
It reminds me the time I spent two weeks delving in the depths of the Windows Dinamic Loader, to the point of reaching documentation dated in 1993, because I had a static variable in a DLL randomly blanked.
It was a marshaling mismatch, tha DLL memcpyed 4 bytes more than the application was expecting, overwriting said variable which was just contiguous and of course inside the process space, so no access violation. This exchange structure was sent on external events so it wasn't obvious what triggered it.
A single line of code fixed the issue.
GCS d--(d-) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
Was there a symbol for the two chars before?
How many characters in the new symbol to describe the updated magic number?
I wonder is it was a v1 vs v2 type API. If you have been using the original vendor for that long it seems that they may have provided some backward compatibility.
New vendor may have joined the market at v2.
|
|
|
|
|
Initial assumptions are frequently wrong. Be glad yours were and take the win.
|
|
|
|
|
Today in ISO date format is 2021-12-02; which, without punctuation, is 20211202. When reversed, it is still 20211202.
Next (I guess) will be 2101-10-12
|
|
|
|
|
|
I did say that I had guessed! Obviously wrongly. Thanks for the correction.
|
|
|
|
|
Not ISO format!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Just spotted that! Was going to edit my answer. Brain fog day.
|
|
|
|
|
We all have 'em!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|