Atmospheric Rivers and A Coding Conundrum


As has been widely reported on the news, even nationally, California has experienced a nearly unprecedented series of storms moving in from the Pacific in what are called “atmospheric rivers,” some ten storms since late December, with only partial day breaks in between. That is, there have been only two or three sunny days so far this entire month. Fortunately we’ve not been directly affected. No leaks in the roof; no landslides from the hillside behind us. And we’ve avoided road closures, several along Highway 13 below us, mostly by staying home.

(I’m not sure if the photos above are visible without subscriber access to the SF Chronicle site. If not, apologies.)

\\

This week I am back to regular development of my sfadb.com database, working at least an hour a day to implement the final pieces of my vision, ever since forever, of the site. Today I discovered a peculiarity of the Visual Basic code that Microsoft Access uses for macros. I was getting weird results, outputting lists of ranked items limited by a cap on the rank, depending on category. I toyed and toyed with inserting tracing code to see what was happening, why the limit on one category kept getting set to the limit on a different category.

I’ve said before how, with rare exceptions, you can *always* figure out a problem with code, because it’s deterministic. But today’s problem challenged that. I had always thought that this would work:

If A and B then
     C
elseif D and E then
     F
else
     G
endif

Was a perfectly valid logical construct. But it wasn’t working. I had cases where D and E were true, but the result came out G. But as I played around and rebuilt this as,

If A then
     If B then
         C
     endif
elseif D then
     if E then
         F
     endif
else
     G
endif

Then it worked! Why didn’t the earlier version work? I don’t know. Something peculiar about Visual Basic in Microsoft apps? And yet — I did figure it out, the problem with my code to generate those pages, if only by trial and error, and now it works.

\\

I began a review/summary of Michael Shermer’s THE MORAL ARC this afternoon, but of course I underestimated the amount of time it would take to do a complete summary. Will plan to finish tomorrow.

This entry was posted in Personal history. Bookmark the permalink.

Leave a Reply

Your email address will not be published.