Manage Learn to apply best practices and optimize your operations.

A fun site, with serious code

Read this code that lets readers rate their boss's bad behavior. The code may be useful for more serious Web applications.

Many sites out there ask you to submit pictures of yourself so other readers can vote on how good-looking you are. Last year I created a Domino Web site using the same general concept, only applied to how bad-behaving your boss is. You can use my site, called, to relate something obnoxious your boss did, and ask other readers to vote on how obnoxious it was. The goal, of course, is to submit the "worst boss" story.

To create a story on the site, press the red link on the upper-left part of the screen. You can judge someone else's story by using the three Vote buttons to rate each story on outrageousness, humor and perceived truthfulness.

Besides getting a kick out of the site, you may also find the underlying code useful for a more serious Web application. The two main design challenges I faced were how to conduct the voting and how to handle the browser windows. (This tip will explain the voting code. A future tip will look at the window issue.)

The voting code had to meet four requirements:

  • Votes had to be submitted and stored anonymously, since the application is open to anyone on the Internet.
  • Each vote had to identify the story it concerned.
  • The tabulation code had to deal with the possibility of a large number of votes coming in very quickly.
  • I needed to keep a record of all votes, even after they were tabulated, so I could verify that the correct tallies were displayed for each story.
To meet these requirements, the voting design includes:
  • A "story ID" that is uniquely generated for each story, as it is composed. You can see these IDs at the bottom of each story.
  • A set of three vote forms, one each for outrageousnes, humor and truthfulness. The forms create separate documents in the database to record each vote. The vote forms inherit the story ID of the currently displayed story, so that a vote document captures which story was being read when the vote was cast.
  • Two views that hold the vote documents. One of the views shows all votes; the other shows votes that have not yet been tallied.
  • A periodic agent, called Tally Votes, which examines pending votes and enters them into the story totals. After recording a vote, the agent marks the vote document as "tallied" so that the vote is not counted again.

The periodic agent is well-documented and readable, but there is one wrinkle. Each story must contain not only the current average of the three kinds of votes, but also the number of votes recorded of each type. The reason is that each vote carries less weight as more votes come in. For each new vote, the new average is not based just on the old average plus the new vote. The new average is based on the old average, the new vote, and how many total votes have been cast.

I have posted the source code for this application on my Downloads page. As you look at the code, be sure to look at the views Admin/Controls and Admin/Development Info views. The first allows you to adjust various setup parameters; the second contains other information for programmers. Feel free to use/modify the code, as long as you credit me for the original design. The default ACL for the downloadable version is set to Manager, so it is easy to examine. Before using the database in production, you should change the default ACL so it matches the Anonymous ACL. The database uses R5 design.

Please let me know about any bugs or suggestions for improvement.

Chuck Connell is president of CHC-3 Consulting, which helps organizations with all aspects of Domino and Notes.

Do you have comments on this tip? Let us know.

Please let others know how useful it is via the rating scale at the end of the tip. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

Dig Deeper on Lotus Notes Domino Administration

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...