Part of an ongoing personal project. Here are all posts on the subject. Also, here’s the code at this stage and the working prototype.
Initial Release!
I finally got this thing to the point where it’s ready for an initial release – it is at MVP stage, if you will. It now supports lazy login, runs on Firefox and Internet Explorer 9+ (in addition to the previously supported Chrome and Safari), and performs slightly better. Also, I spent an hour or so using it in earnest to decode the message and found some more snippets. However, the question of whether the entire message is coherent is still inconclusive.
Lazy Login Pattern
Lazy login is the most significant new feature. It means that if someone wants to poke around with the message prior to logging in, he/she can do that, and later, if he/she decides to log in to save the message on screen, that is now possible to do smoothly without losing the in-progress message the user started.
Technically, this was challenging. Logging in normally requires going off to a Google authentication page, granting the Digit Decoder access to use one’s Google account for the purpose of identification, and coming back to the Digit Decoder once access has been granted. It means that anything that was once on the main page (including one’s in-progress message from prior to log in) is by default lost when the Digit Decider reloads after authentication. My approach to fixing this was as follows:
- Intercept the normal action of redirecting to the Google authentication page in order to save some things first.
- Save the on-screen message to a new row in the database
- Store the ID of that new database row in a session variable
- Continue the previously-interrupted workflow of authentication
- After successful authentication, load the message that was on screen from earlier by referring to the ID stored in the session variable
- Delete that stored message from the database since it will no longer be needed – just to keep things tidy
This took a bit of doing, but it worked. It surprised me how many steps are involved in doing something like this, which seems simple on the surface, but turns out to be a bit more complex when breaking down every step.
Optimizing by Exclusion
There are two basic scenarios here: someone can decode part of the message and then log in, or someone can log in before doing any decoding. In the latter scenario, that whole cascade of steps to store and load the message-in-progress is unnecessary and time-consuming. So later, I restricted it to only run when necessary – that is, if someone has started decoding the message before logging in. Initially, I thought I would need to create a new Boolean variable to capture whether someone has started decoding the message, but then I realize that the simpler (and more reliable) way to tell if there is a message on screen that should be saved before login is to look for” words” on screen. If there is at least one word, it runs the whole shebang to store and load the message. If not, it just authenticates like before and loads the initial encoded message.
Getting More Specific About the Logic
I made some sensible tweaks to the overwriting behavior. Previously, it would clear an existing word if the start of the new word was inside the existing word. I discovered that this is not robust enough, since if the new word starts outside of an existing word, it can still collide with said existing word later. Now, if any character from the new word overlaps with an existing word, it clears the existing word before writing the new word.
Also, the “remove word” button follows a similar logic. In order to “move” the controls (which contains the drop-down for the word choices, the “next” button, and the “remove word” button), I am deleting and re-creating those elements at the appropriate new place. Each time this “move” happens, I am only creating the “remove word” button if the index where the controls will be created is within a word.
Try it out!
In order to subtly launch this project, I posted a message on this old Yahoo Answers question I found in which someone asked about this message in the book and mentioned this Digit Decoder. I’ll consider the project a success if it helps at least one other person to decode a part of the message that I wasn’t able to decode. As I mentioned in the Yahoo Answers bit, I spent some time working on the message and found some new things, but I don’t feel I’ve exhausted my efforts. I think I am subconsciously very curious for someone else to try it out before I either solve the whole thing or decide conclusively that there is no more real message to discover.
To that end, have a look at the working prototype, and please let me know what you discover in the message! Also, let me know any feedback about using the application.