The Boston Diaries

The ongoing saga of a programmer who doesn't live in Boston, nor does he even like Boston, but yet named his weblog/journal “The Boston Diaries.”

Go figure.

Monday, August 27, 2007

And my blog's back from the dead as well

I was curious if my efforts at fixing some issues with my blogging software were having any affect. So I checked the current server logs and yes, my efforts did have an affect:

Slow death of a blogging engine
Site Bytes Hits Status
Okay (200) Redirects (300) Client errors (400) Server errors (500)
boston.conman.org 3,050,415,479 130,912 99,696 24,403 935 5,876

And some significantly bad affects if that last column is anything to go by (which were the number of requests that the server could not handle due to an internal problem, like my blogging software crashing).

Upon initial investigations, it appeared the problem was lost data—my program was generating output, but it wasn't getting to Apache. That's a buffering problem, and an easily fixed one (I just have to make sure that before my program ends, any data it has buffered is written out). But that didn't fix all the problems.

If anything, the problems were getting worse.

And they seemed to be smack dab in the middle of the actual blogging engine itself—a bit of code that I haven't really touched in six years. Mainly because I didn't want to touch this code. It was ugly. Convoluted. Comments like:

/*------------------------------------------------------------
; adjustments for partial days.  The code is ugly because
; of the reverse hacks I've done without really understanding
; how I actually *implemented* the reverse display of entries.
; Funny how I'm the one writting the code and even *I* don't
; fully understand what I'm doing here. 8-)
;-------------------------------------------------------------*/
and
/*----------------------------------------------------
; I have no idea how long ago I wrote this code, but in
; all that time, I never knew that blog->stentry or
; blog->endentry could become negative.  It didn't seem
; to affect the rest of the code, but with the new adtag
; feature, it became a problem.  This bit o' code ensures
; that they at least remain positive.  
;
; I still don't fully understand what I'm doing here.
;--------------------------------------------------------*/

litter the code. And to top it all off, the reverse printing of entries never fully worked right. The more I hacked on the code to get it right, the more I came to realize—

I'm going to have to scrap this mess and rewrite it from the ground up (well, not the entire program—just the portion that deals with collecting up the entries and displaying them, which works out to be about half the code).

The code is tricky because of two interlocking features—the first being you can display the entries between two arbitrary dates (or a date and a given number of entries, or on the main page, seven days worth of entries, which isn't necessarily seven consecutive days). The second feature is you can reverse the order of printing.

The original implementation left a lot to be desired. Frankly, it was a bad design, which made it difficult to get these two interlocking features right (not to mention the automatic generation of next and previous links) and something about the last feature I added (adding the entry title to the page title when there's only one entry being displayed) just broke the engine completely (although how, I have no idea).

So late Sunday I started rewriting.

My sleeping schedule was shot anyway due to being sick for the past couple of days.

I finished the work (for the most part—I still have to write code to add entries; for the time being I'm adding them manually) sometime this afternoon, much to my surprise.

So much for the boring stuff—now onto fun stuff

Obligatory Picture

[It's the most wonderful time of the year!]

Obligatory Contact Info

Obligatory Feeds

Obligatory Links

Obligatory Miscellaneous

You have my permission to link freely to any entry here. Go ahead, I won't bite. I promise.

The dates are the permanent links to that day's entries (or entry, if there is only one entry). The titles are the permanent links to that entry only. The format for the links are simple: Start with the base link for this site: http://boston.conman.org/, then add the date you are interested in, say 2000/08/01, so that would make the final URL:

http://boston.conman.org/2000/08/01

You can also specify the entire month by leaving off the day portion. You can even select an arbitrary portion of time.

You may also note subtle shading of the links and that's intentional: the “closer” the link is (relative to the page) the “brighter” it appears. It's an experiment in using color shading to denote the distance a link is from here. If you don't notice it, don't worry; it's not all that important.

It is assumed that every brand name, slogan, corporate name, symbol, design element, et cetera mentioned in these pages is a protected and/or trademarked entity, the sole property of its owner(s), and acknowledgement of this status is implied.

Copyright © 1999-2021 by Sean Conner. All Rights Reserved.