Just a quick warning from the start here: this note is about the recoding I had to do here to accommodate these new notes I’ve been posting. If reading about code sounds about as fun as eating razor blades, you might want to just go stare at photos of my calzones. Again. Trust me, it will be better for all of us. If you really want to continue reading and don’t know what these “notes” are, a recent entry offers some background information.
When I first dreamt up the notes, I foolishly assumed that I would be able to start posting notes without fiddling with the code that runs Liminality. Of course, I was wrong. In order to get the first note online I had to implement a stopgap measure that would break everything the next time I tried to post an entry. The problem was in the way I had written the original Liminality code. Had I known better, I would have coded in such a way as to make future changes easier. But I didn’t know any better—I taught myself PHP by building this site, so the code that holds it together is inefficient and overly complex.
If you look at the bottom of each Journal post, you will see a list of items with the heading “Recent Journal content....” That information is drawn from a text file that lists the title of each Journal post on a separate line. I also use this text file to create the archives and to determine what should appear on the front page (i.e., the Journal) of the site. Everything worked fine because every item was in the same format and journal entries were numbered sequentially—entry numbers corresponded with the line numbers of the text list file.
Then notes came along and threw a huge wrench into the works. Now I had a new type of content starting from 1 again, so I could no longer rely on my automatic numbering system. This caused more problems than I had anticipated. For one, the code that determined which entry should appear on the front page, the code that made sure archive links pointed to the right pages, and the code that handled the “Recent Journal entries...” all relied on this scheme and thus all stopped working. The code that prints the months in the Archives also stopped working, but for a slightly different reason—with Journal entries, the month was always whatever appeared before the first period, but with notes it was whatever appeared between the second to last and the last period.
The fixes for these problems ended up being messy, and I avoided them for a few days because I knew they were going to be messy. To make a long story short, I had to abandon the automatic numbering scheme and parse each line in the list to extract both the number (adding an “n” to the front of the number for notes—look in the address bar to see what I mean) and the month. It wasn’t particularly difficult to do, but it was painful for a couple of reasons. For one, I hadn’t messed around with PHP or my site code in ages, and I wasn’t looking forward to diving back into that can of worms (I love mixed metaphors). But it was also painful because it laid bare how incredibly inefficient my code was.
Had I known what I was doing when I first started this thing, I would have organized my data logically. Namely, I would have had all of the information arranged neatly, ready to be read into arrays, and then constructed my archive entries, etc., from that, instead of the other way around. But I didn’t, so I was forced to jury-rig a solution with bubblegum and string. It works, and it will hold everything together, but it sure ain’t pretty.
And yet, amidst all the pain and embarrassment, I remembered why I used to love coding—it comes down to the challenge of a coding problem and the feeling of accomplishment you get when you solve that problem and get everything working correctly. It’s like a drug, and I do not say that lightly. I used to stay up until absurd hours of the morning working on coding problems because I couldn’t sleep until I had solved them.
One might think that this would be a reason to avoid coding, but having tasted the drug again I find myself tempted. I am under no illusions—my schedule these days will simply not allow any serious coding marathons for quite some time. But the time has long since passed for a reworking of the Liminality code. When I say “reworking,” of course, I mean “complete rebuilding from scratch.” This time I’m going to do it right. For starters, Liminality will run off a database, which will make certain things much easier to code and bring other things that are now impractical into the realm of possibility.
I’m not going to go into too much detail about what exactly I’m going to do, mainly because this is going to take a very long time. I’ve come to the realization that my schedule is probably never going to allow for serious coding marathons, at least not for the foreseeable future, and if I want to get anything done it’s going to have to come in tiny steps. A piece of code here, another piece of code there, and sooner or later I will have a new site. I don’t know if this is the most efficient way to code, but this is reality. And it’s going to take a long time. But every journey has to start with that single step, right?
And just in case you were thinking it was going to be all notes from here on out, I have an entry idea that I hope to write soon. So that’s something to look forward to.