Skip to main content
0 online
deanh77 Mar 28, 2001

OK thats not a back pack. You carry it like a briefcase or use the shoulder strap. *You* try strapping an ATX case with power supply and hard drives to your back. hahaha. (OK, that was really la...

iwz Mar 28, 2001

Oh, dean, give me your best guess as to how I wrote the comment threading algorithm on here to work.

deanh77 Mar 28, 2001

(Note: I did not look at your database structure diagram so I assumed some things) OK. Each comment is stored in a database by 'News Item Number' and 'Comment Number' (these two fields compose...

iwz Mar 28, 2001

Hey, that was too hard for me to understand, could you please express your logic in a C++ program? Just kidding. Anyway, wow, Dean! Great job, man. You came very very close to figuring ou...

deanh77 deanh77Founder

I could do it another way if I do incremental "Selects" to the database, instead of my one "Select * from comment" at the very beginning.

Do you query the database multiple times during the algorithm, or just once at the beginning like I did?

If I had multiple queries, I could forget about hashtables and Node Objects I think. This is how I'd do it that way:

have a function called printComments(int p_id), and call printComments(-1) in your page creation code.

STEP 1) Recordset recs = EXECUTE("Select * from comment where parent_id="+p_id);

STEP 2) For each record in recs:

STEP 2a)Print rec info (comment, date, etc.)

STEP 2b)call printComments(thisrec.comment_id) //pass this record's comment number as the parent_id

STEP 3)If no records, then this comment has no children (actually no comments in the database have this comment as its parent) so just return.

Basically, the difference between my two ideas is database retrieval time verses computation time. One is database-intensive, and the other is computationally-intensive.

iwz iwz

You got it, dean. I went the database-intensive route. I'm not exactly sure which is the best way, but for now, it was the easiest way for me to accomplish the task in ColdFusion, which is not object oriented. The recursive call also keeps track of how many times it has been called for a comment, and this is how I output the indent level.

thefunkyfresh thefunkyfreshFounder

Guys...i know ian is definitely a certified genius, and dean...well, he's proving himself to me as well. But all this java junk doesn't get you nowhere. to be really smart, you have to know calculus and be able to apply it to computer programming, by intergrating the recursive variable functions into to the nodes within the class, then differentiate the entire function into terms of f'(x), thereby being able to graph your results...if you continue to differentiate, you will eventually find that f''(x) gives you your points of inflection, where you can apply the rest of the nodes of the class...whoopdeedooo i don't even know what i'm talking about!

deanh77 deanh77Founder

actually the really funny thing is, I have done this. I took a class called Numerical Methods of Computation in College, cause I was a minoring in Applied Mathematics. And we had to write all these programs in C that would produce tables of figures for differential equations (which is like calculus on acid) using different aproximation algorithms. Anyway.

iwz iwz

Actually, I wonder if the funny thing is that you had to do it for a class... and I did it for fun. Heh...

thefunkyfresh thefunkyfreshFounder

ian, you can take all my classes for fun if you want, and I'll take care of ezabel for a while...nobody will be the wiser.

katiedid katiedidFounder

Matt, you'd give up the opportunity to further your C++ knowledge?.......I'm ashamed to know you. :)

thefunkyfresh thefunkyfreshFounder

ohhh i most definitely would!

Welcome Back to eZabel

It's been a while. Here's what's new.

eZabel Lore

A complete history of our community — stats, Hall of Fame, legendary threads, and more.

View the Lore →

Everything Preserved

All 225,969 pieces of content from 2000–2014 are here — forums, messages, journals, photos, polls, and events.

💎

Gems

Spot something you love — a legendary comment, a classic thread, a great photo? Log in and click the diamond icon to mark it as a Gem. Add a note about why it's special. The best stuff surfaces on the Gems page.