Sunday, December 26, 2021

Enhancing Brian Knittel's Cardread.exe to improve productivity archiving old decks of cards

 MAIN CONCEPT OF THE MODIFICATION

When a verify error occurs, a new pushbutton on the screen will offer the ability to accept all the cards that in the stacker except the last card which is the one that caused a verify mismatch error. Those accepted cards can be removed, leaving a hopefully much smaller deck.

That permits me to only deal with the card causing the error and all subsequent cards. These can be read and verified in their own two passes. Since I can accept as much as has been properly verified, I am able to make faster progress through the pile of cards to be archived. 

I read cards in the binary mode, the only lossless way to capture the data. As such, I only implemented this improvement to work with binary mode capture.

HOW IT WORKS

When a verify error occurs, the card reader has been reading each card of the deck as a second pass. The first time the deck was read it was placed into a file on the PC. If there is a mismatch between the hole patterns of the first and second pass, the verify process ends with a failure message. 

At this point, the program has closed the disk file that contains the first pass of the deck, but the full file path is still available in a global variable. If we open the file, determine its end position, drop back one card and truncate the file, we can accept the saved file up to the point of the last successfully read and verified card. An alternative to opening the file 'rb', doing an ftell on the end and subtracting 80 words is to keep a count of words or cards as we are doing the verify so that we can subtract from that to generate the new end of the file. In either case, we open the file 'ab' and do an ftrunc to shorten the file to out desired length. 

IMPLEMENTATION CHALLENGES

The biggest challenge was fighting with Visual Studio  to generate an executable. I can't get the initial window (a DialogBox) to open, the program falls right through that call and exits. I am not and never have been a windows programmer. This may be something simple but until I have the first clue about why it seems to fall through (debug Step Into function of Visual Studio just drops through) I can't research for a solution. 

Will keep you posted. No sense writing code until the baseline app can run. 

No comments:

Post a Comment