logo

Next Site Change: Indented Inline Commenting System

Last night I implemented an "experimental" feature on this site. This morning I woke up and the web server had died. I'm hoping it's just a coincidence, but have a funny feeling it isn't.

New Feature?

Take a look at the screen shot below:

image

It will no doubt appear very familiar to you all. If not from reading articles on this site over the years then from the Notes.net Forums. It's the "Domino way" of rendering a discussion-style hierarchy of documents.

I've never really liked it though. It has to be one of the worst ways of holding a conversation. For years now I've wanted to do something about it, so yesterday I did.

Look now at the grab below, which is of the same page but with the new commenting system implemented.

OpenDocument

Notice how the body of all the comments are shown inline and slight indented to show the relation to the one above.

Better, no?

You can see it for yourself by opening the article I took the grab from and scrolling down the feedback section.

How It Works

In order to implement the above solution I had to do some fairly major house-keeping in the backend. This database is more than 10 years old and it shows. If I started over now the database structure wouldn't look much it does. Until yesterday there were two "reply" forms. One to hold replies to blogs and one to hold replies to articles. They were similar, but different. Different for no real reason, so I've now created one form (and view) to hold all replies. All old replies (~20,000 documents) have had their Form field updated and various other fields added/removed. It took about an hour just to replicate all the changes! What I have now is much easier to maintain and build on.

Another part of the update was converting the Rich Text held in the some replies (to articles) in to plain text. No idea why I ever used a Rich Text field, but there you go. I did my best at preserving the formatting but some replies will be a bit screwy.

Yeah, but how does it work? Well, where there was once an embedded view there is now an empty Rich Text field, called "Feedback". The Web Query Open Agent fills this field with the nested "view".

The form looks like this:

image

Note that the document doesn't store a field called Feedback. It's only there as a place-holder for what happens next.

The code to populate the field looks something like this, in principal at least:

'Treats it as plain text without this line
'Hence 64kb limit without this line!
Call web.document.Removeitem("Feedback") 

Dim item as NotesRichTextItem           
Set item = web.document.CreateRichTextItem("Feedback")
                
Dim richStyle As NotesRichTextStyle
Set richStyle = web.session.CreateRichTextStyle
richStyle.PassThruHTML = True

Call item.AppendStyle(richStyle)
                
While not entry is nothing
        Call item.Appendtext(entry.ColumnValues(1))

        Set entry = nav.GetNextDocument(entry)
Wend

In reality the code is more complex, as it has to open and close all the nested LI elements as needed, but you get the idea.

Experimental?

As I said earlier, the HTTP task was dead this morning after adding this new feature last night. Whether it was because of this change I don't know and that's what I need to wait and find out.

There are articles with a lot of feedback and some with little. Not sure what the worst case is, but there's one with >100KB of feedback to render. Could this be bringing the HTTP task down? I don't see how or why.

Moving Forward

I know what you're thinking - aren't the Articles on this site just an archive? Well, kind of, although I do hope to start using them again at some point. What I wanted to do was improve the "archive" as well as test the approach.

I really hope I don't have to scrap this approach as my plan is to implement the same approach for the blog commenting. The code is in the template, I just need to refresh the design. Something's telling me to hold off though.

For now please treat this as just an idea. It will get improved with time if it turns out to be a viable solution. If not I'll look at alternatives though as I don't want to have to revert to the old approach and think it will be a great benefit to the blog commenting, which I've never like either.

Help Testing

To test this out I've created an article for you to add comments to please add comments to this blog entry. Let's see what happens.

Comments

    • avatar
    • Jake Howlett
    • Thu 15 Oct 2009

    This is the first reply

      • avatar
      • Jake Howlett
      • Thu 15 Oct 2009

      This is a reply to the first reply

      Show the rest of this thread

    • avatar
    • Jake Howlett
    • Thu 15 Oct 2009

    This is the second reply

  1. OK, I can see how the "Domino way" works. It's the way people have been doing things on Domino for years.

    There are very few other websites which use this model. Such as SlashDot. But /. has one big thing going for it... the amount of readers.

    In normal blogs you only get a few comments. So the traditional methods of issuing replies at the end of the comments works really well. The big gripe I have over the traditional Domino Way is that if somebody comments to an earlier message then it may be missed by those who are used to the old way of working and skip right to the end to see the latest messages.

      • avatar
      • Jake Howlett
      • Thu 15 Oct 2009

      "the traditional methods of issuing replies at the end of the comments works really well"

      Does it? Not in my eyes. I hate all "@Dragon" stuff you have to do to say who you're replying to. If a blog entry has more than say 6 comments it all gets a bit out of hand and impossible to follow.

      I don't think you need to have as many readers or commentators as /. in order to get some benefit from having a logical flow to a conversation.

      • avatar
      • Jake Howlett
      • Thu 15 Oct 2009

      "it may be missed by those who are used to the old way of working and skip right to the end to see the latest messages"

      I see your point there and that's something I thought of/worried about too.

      That's just a learning curve though, surely? Just because we're all used to the "broken" way doesn't mean it shouldn't be fixed or improved.

      Another option that this new approach allows me to go on to add is a checkbox to say something like "Alert me to new replies to my reply". No need to check back as you can get an email with the reply.

      I'd imagine most conversations on blogs (this one at least) are mainly between the visitor and the blogger and go about two levels deep. Goes something like this: I write a blog entry, which a visitor asks a question on, which i then answer. If they asked me to I can send an email to tell them the answer. No need for them to check back.

      Of course you can just carry on using the unindented approach if you like...

      Jake

      Show the rest of this thread

  2. I think it looks great!

    1. Wish there was a timestamp along with the date the post was made -- I like the way it seems to be loading the most recent at the top, though.

      Show the rest of this thread

    • avatar
    • Rob
    • Thu 15 Oct 2009

    I mostly read CodeStore blog and comments in my RSS reader. I only come to the site to make comments. How will the indenting work in RSS? RSS is by its very nature chronological so I think the RSS will not reflect this new structure.

    Here's my suggestions.

    We are using computers here that give us tremendous flexibility.

    1) Why not have it both ways. That is let each reader decide if they want to read the comments threaded or chronologically and save this decision in the cookie with the rest of their info.

    If you're reading the comments from top to bottom then threaded is most useful. If you're catching up then you might switch to chronological to see all the new comments at the bottom.

    2) When the commenter clicks on "Reply to this comment", add a line to the new comment which says something like "Comment in reference to #4.2.3 by Dragon Cotterill". You'd have to add comment numbers with the decimals indicating the indent level. You could also have a link back to the referenced comment. If you carry this link into the RSS feed then I could click on it and come to the page at exactly that comment.

    This is what I like about computers. With real file folders you can only file a paper in one folder. With computers you can have a reference to one document in many folders.

    Got'a love it!

      • avatar
      • Jake Howlett
      • Thu 15 Oct 2009 02:27 PM

      RSS will still be chronological Rob. You shouldn't notice any difference really. Let me know if you do!

      I like the idea of a choice between chrono vs threaded. Easy enough to implement. It's in my head-based todo list.

    • avatar
    • Rob
    • Thu 15 Oct 2009

    What happened? I posted a comment and got an error message back. After five minutes the site came back up I looked for it and it wasn't there. Cleverly I had saved a copy of the comment in my clipboard so I re-posted it using the form at the bottom of the page ... not a reply. But it showed up near the top as the second "prime" comment.

    I'm doing the same with this comment. Wonder where it'll show up.

    Peace.

      • avatar
      • Rob
      • Thu 15 Oct 2009

      I think somehow the software has lost track of the comment order. This one is a reply to my second comment.

      Good luck.

      • avatar
      • Jake Howlett
      • Thu 15 Oct 2009 02:28 PM

      Wish I was always that clever!

      Was it a Domino error or a browser/connection one?

  3. I've got some nearly-identical code that's spitting out a whole lot more HTML/docs than you are and it's been working fine forever.

    1. What server version are you on now?

    2. You shouldn't need to remove the Feedback field at all. You might need to make it computed (to itself) though, if you haven't already.

    3. Just for kicks you may want to try an item.Compact() call just before your WQO agent finishes. In our version of the code running it crashes the Notes client repeatedly without that call. Interestingly, however, the server version runs fine without it.

      • avatar
      • Jake Howlett
      • Thu 15 Oct 2009 10:08 AM

      Yeah, I'm starting to think it was a cruel coincidence. I noticed a few hack attempts in the log too. Maybe they're to blame.

      Server is 8.5 "FP2".

      I found that if I didn't remove the field then it was treated as a normal text item (item.type="1290" rather than "1") and was limited to 64kb of output. Removing the field and creating it afresh forced Domino to accept it as a Rich Text field, even though that's what it is on the form. I guess that as it's not stored on the document it's not treated as rich text until it is...?

      Show the rest of this thread

    • avatar
    • Erik Brooks
    • Thu 15 Oct 2009 12:37 PM

    8.5 FP2? AFAIK there is no FP2 for 8.5, just 8.5 FP1. And 8.5.1, which has about 1,000 more fixes.

    If you crash again I'd give that .Compact() call a try and see if that helps.

      • avatar
      • Jake Howlett
      • Thu 15 Oct 2009 02:31 PM

      Sorry, it's "Release 8.5HF224". Or at least that what it says when I connect via Domino Administrator.

    • avatar
    • Jake Howlett
    • Thu 15 Oct 2009 12:54 PM

    Hmm. Seems like my ThreadSort fields is acting up. Will investigate in a mo...

    • avatar
    • Erik Brooks
    • Thu 15 Oct 2009 03:51 PM

    @Jake - Ah ok. I bet you just hit an 8.5 crash (there are several). I'd guess that 8.5.1 will fix you right up.

      • avatar
      • Jake Howlett
      • Thu 15 Oct 2009 04:01 PM

      You replied to the wrong post Erik ;o)

      Better get on the blower to Prominic then...

    • avatar
    • Ferdy
    • Thu 15 Oct 2009 04:54 PM

    Jake, awesome improvement. Some feedback:

    - Have you checked your web log for any weird messages? Perhaps too obvious but it helped me find the cause of a problem often

    - It's a matter of opinion but I'd like a restricted nesting level, perhaps at 3 or 5 levels deep. Anything beyond that becomes really hard to follow when you show inline bodies, and I doubt you need more levels than that on blog comments.

    - If you'd like to push things even further, comment voting may be a suggestion, although I'm not sure it's a good idea without a login system. Another suggestion could be an option to "report abuse" per comment or commenter. That too is not a killer feature but you see it often in more advanced comment systems.

    - If you absolutely, positively want to be the king of comments, allow for replies to PARTS of comments. Check this very comment, I'm making multiple points, it would be great if you someone could reply to parts of my comment. Yes, it is pushing the boundaries and it is a long shot, but the whole discussion then becomes a true conversation. I believe Google Wave allows for the same thing btw.

    -- Ferdy

      • avatar
      • Jake Howlett
      • Fri 16 Oct 2009 01:09 AM

      The logs did have lots of stuff in them that looked like a sustained attack on a LAMP box. Looking for .ini files or whatever it does. Leads to lots of "not found" errors, which has been known to crash the HTTP task.

      I'll see how the nesting goes for now. The level is a constant in the WQO agent I can change at any time.

      Expanding nested items is on the list. Good idea!

    • avatar
    • Ferdy
    • Thu 15 Oct 2009 04:58 PM

    Jake,

    Forgot a suggestion: collapsing/expanding replies. Personally I like the comment system at Digg.com. There you can easily follow the general conversation, and go into detail by expanding replies to a comment (a counter will tell how many replies there are). Another feature is that comments that are voted down, score lower than 0, are collapsed entirely, both the body and its' replies.

    Just throwing ideas at you, without thinking about the consequences ;)

    • avatar
    • Salva
    • Fri 16 Oct 2009 02:01 AM

    Do you cache the rich text field? If I were doing it, I would save the date & time I las updated the rich text field, and when loading the page, if that date is >= lastcomment + 20 seconds (to avoid problems if someone posts a comment at the same time the rich text is being created), i would just return the pre-rendered item.

    P.S. With your new design, have you tried expanding the comments so that they occupy the full width of the page? (The article should always be long enough so that comments start below the right column, but I don't think that will be a problem).

      • avatar
      • Jake Howlett
      • Fri 16 Oct 2009 02:43 AM

      That's an idea I'm reserving for if either a) performance becomes an issue or b) the server crashes I've seen since I updated the site are related to not storing the Rich Text.

  4. Hi Jake,

    Is it possible to make the comments collapsible? So that where some threads are separated by lots of responses, you don't have to scroll down to find the next relevant thread.

    Nice, clever work once again. (Do we get a download? ;@)

    regards,

    Alan

      • avatar
      • Jake Howlett
      • Fri 16 Oct 2009 04:29 AM

      It's on the list Alan. Will probably be a bit like Digg.com in that anything below 2 levels deep is hidden by default.

      For now I'm just testing the theory and ironing out bugs (server has crashed four times since!). Then I can build on top of it.

      If I don't offer a download, which I might, then I'll definitely right a "how to" on it. It's actually very simple.

      Show the rest of this thread

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Thu 15 Oct 2009

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

Elsewhere

Here are the external links posted on the same day.

More links are available in the archive »

More Content