Serendipitous Programming

Today I’ve been working on a new feature for PocketBible for iOS and one thing led to another, and, well, I ended up implementing a feature I didn’t know I was working on, and didn’t realize how much of it was already sitting there, waiting to be exposed to the user.

So the new feature I thought I was working on is the ability to “rename” your highlight colors. That is, you’ll be able to assign a topic to each color. Then when you highlight a verse, instead of seeing a list containing “Khaki”, “Cornflower Blue” and “Hot Pink”, you’ll see “Salvation”, “God’s Love” and “Prophecy”. We’ve been wanting to implement this for a long time. While we were upgrading our cloud synchronization protocol over the last few months, I added the ability to sync highlight color names with the server and we took advantage of that in PocketBible for Windows Phone and Windows Store. The plan has always been to roll that into other platforms as we have the opportunity.

While looking through the code that shows you your list of highlight colors (which I’ll have to modify to show you your user-defined names for those colors) I stumbled into a bit of code that Jeff wrote years ago but then “commented out”. (If we have code that we’d like to retain for reference purposes but don’t want to actually have the computer execute, we turn the code into a “comment” so it will be ignored by the compiler but still be there if we want to see it.)

Those of you who have been with us for a while know that Jeff was my programming partner for 27 years before his death from cancer in May 2012. It’s been a bittersweet year as I’ve had to deal with his passing while surrounded and immersed every day in code that he wrote. I keep running into little things that remind me of him, make me want to give him a call to talk about a problem, or give me a chuckle. So it’s always interesting when I run into a piece of code like this.

What this particular piece of code did was add three additional highlighting styles to the list of colors you can highlight with. These are “underline”, “strikeout”, and “underline+strikeout”. Those look like this, this, and this, respectively.

Now, why would you ever want to strike out a verse? That’s a good question and takes me back fifteen years to the days of the Palm operating system when cameras were cameras, phones were phones, and “portable digital assistants” were all the rage. In those days, color displays were luxuries that cost money, size, weight, and battery life. So most of those devices had monochromatic screens.

On color screens, we could highlight a verse with a background color. But what could we do on these black and white screens? Since our text was coded in HTML, and since HTML offered simple styles like bold, italics, underline, and strikeout, we decided to use those. We ended up not using bold and italics because they could cause the text to re-wrap when they were applied, and in those days of wimpy processors, it just took too long and was disturbing to see. That left us with underline and strikeout, so that’s what we used.

As time has gone on, we’ve gotten to where we don’t even include these underline and strikeout highlighting styles in our programs. They’re not in PocketBible for iOS, and we weren’t planning on implementing them in PocketBible for Android. Unfortunately, some of you who were around back then and have sync’ed your highlights from your Palm PDA to PocketBible for Windows to our server and to PocketBible for iPhone expect to see those underlines. So we have to at least be able to display them if they exist, but we don’t let you create them (because we don’t want to proliferate a bad idea).

What I discovered today was Jeff’s original code for being able to create underline, strikeout, and underline+strikeout highlights in PocketBible for iOS. His comment said he had taken them out because the display engine (my code) didn’t support them. Sometime between then and now I implemented those highlight styles but we just never went back into Jeff’s code and turned those choices on.

On a whim, I enabled those lines of code and what do you know — they worked! That put me in the awkward position of trying to decide whether or not to leave them in. I never liked the idea of striking verses from the Bible, and even once you get over that, it makes the text hard to read.

About then it was time for dinner and I set the laptop aside to meet my wife and get something to eat. On the way there it occurred to me that we now have some better styling options that we had back in 1998. New versions of HTML with CSS support dotted and dashed underlines.

When I got home I spent about 30 minutes and implemented the styles you see here. These new styles replace the old styles rather than adding to them. So where you had strikeouts, you’ll have dotted underlines. And where you had strikeout+underline, you’ll have dashed underlines. I think this is a nice way of making your legacy data from your Palm days more usable and it gives you three more highlighting styles to use in PocketBible for iOS. (If you’re having trouble making out the dots and dashes, click on the screen shot to see the original size image.)

One of the cool things about this is that the underlying data storage and cloud synchronization already supports it. We’re not changing the data we save, but rather the interpretation of the data. So nothing changes in any of the other platforms nor on the server.

What I think is special about this — even though it’s not a life-changing feature — is that Jeff left it behind and it only took a little extra work to make it useful. And I like that all the infrastructure both for storing the new highlight styles and displaying them was already there.

Tomorrow I’ll get back to work on naming your highlight colors. But this was a nice little one or two hour detour to give us an unexpected new feature in PocketBible.

When Jon and I discussed this in the past, I made him promise that he would provide a way to view these styles, but wouldn’t provide a way for the user to create them, because if he did it for Android, I’d have to do it for iOS. He has been on vacation this past week, so he’s in for a bit of a surprise on Monday.

We have lots of options for how to indicate selected text. We’ll figure it all out.

I do not think it would make a lot difference even if the text appeared the same. When a verse is “selected” there is a menu present. If you see the underlining and have no menu (for highlight or future features) present, you would know it is an “imported” underlining from the early days. My first app was on the Palm Tungsten. I basically used if for reading and following along with sermons. I know I never attempted any server upload of any thing I did on it though.

See what you did now Craig Rairdin! Now I had to dig out my old Palm Tungsten e2 just to see what all I could make it do with MyBible and syncing. First I had to get it charged, re-learn how to operate it, then upgrade to MyBible 5, add the synchronization provider, search for and add the hotsync program to the windows 7 machine, find out that the usb sync does not work for unknown reasons, learn how to Bluetooth sync (never did that before)and finally I can begin testing across all 5 platforms I personally have. Notes go back and forth real well. Highlights, not so much with the older platforms. I also discovered the underlining (discussed in the blog) in Palm, WM 6.1 and the PC. Was a rainy day here and my body needed a rest any way. Thanks for such great Bible study software. Looking forward to my reward from supporting the MAC project even though I don’t have a MAC. Really wanted some the titles in the Bronze bundle, seemed like a great way to get them! If you are interested, I added a pic to my website of all my devices with Laridian software displayed. http://crowders.info/POCKETBIBLE_DEVICES.html

I got back to the office this morning and Craig just got me up to speed. I don’t think it will be too much trouble to have the same functionality as the iOS versions on the Android app.

I am in the middle of bookmarks and a new UI to manage them. Once that is done this will probably be a quick feature to add. So, if all goes well, the new way of underlining will probably be in the next released Android version, or the one after at the latest.

I’ve seen lots of half-finished, commented code that needed to go (and left a bit myself). That makes this a great story. Maybe too much to call it providence? Still, an excellent finish to a day. (Thank you Jeff.)