08/26/99

A couple of rants today.

First of all…. Malda comment your bloody CODE! In playing around with the slash source for getting Iambe’s comments threaded, I came along such uncommented gems as this:

my $sibs=$$comments[$$C{pid}]->{kids};
for(my $x=0; $x< @$sibs; $x++) {
  ($n,$p)=($$sibs[$x+1],$$sibs[$x-1]) if $$sibs[$x] == $cid;
}

The threading is a whole other story. I hope I can do it without being completely insanely sql and processer intensive. Far as I can figure right now, I do something like the following.

The table is set up with the data fields and a cid (comment id) and rid (reply id) field. rid is set to -1 by default. If you click on reply to a comment, it’s rid is set to the cid of the comment you are replying to.

Simple huh? Well, my problem is in the rendering. Unless I can suck everything into memory and manipulate them in perl I’ll end up doing something like this.

for each comment...
   Select any comments with a rid of it's cid
      For each of those comments
         Select any comments with a rid of it's cid
            ...
         When there are none left print out the comments
      all
   the way
back down...

Pretty ugly huh? Anyone got a better idea? I could probably make some sort of struct in perl and suck the data into that and then do the same thing, but with only one database access (select * from comments where pid=$pid;). Wish I had a faster box so I wouldn’t have to worry about all this. Hmm… I really should email the guys from dell/compaq/alpha to see if they want to donate some hardware.

Rant #2:

While I love Alan Jackson as a singer, he has some really good songs, but he, and JRFM (my radio station) are driving me crazy by playing his fscking “Little Man” song all the time! Argh! Sorry, but I’m really beginning to hate it.