Tip

Simple Graphical Counter Agent

Simple graphical counter for static Domino HTML pages. In your page include:
<img src="http://yourdomain/counter.nsf/counter?OpenAgent">


Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Set db=session.CurrentDatabase
Set doc=session.DocumentContext
Dim Account As NotesDocument
Dim Accounts As NotesView
Dim digits(9) As String

digits(0) = "3c 66 66 66 66 66 66 66 66 3c"
digits(1) = "30 38 30 30 30 30 30 30 30 30"
digits(2) = "3c 66 60 60 30 18 0c 06 06 7e"
digits(3) = "3c 66 60 60 38 60 60 60 66 3c"
digits(4) = "30 30 38 38 34 34 32 7e 30 78"
digits(5) = "7e 06 06 06 3e 60 60 60 66 3c"
digits(6) = "38 0c 06 06 3e 66 66 66 66 3c"
digits(7) = "7e 66 60 60 30 30 18 18 0c 0c"
digits(8) = "3c 66 66 66 3c 66 66 66 66 3c"
digits(9) = "3c 66 66 66 66 7c 60 60 30 1c"

' You must create view Accounts with first column with value HTTP_Referer and Ascending sorting

Set Accounts=db.GetView("Accounts")
Set Account = Accounts.GetDocumentByKey( doc.HTTP_Referer(0) )

If Account Is Nothing Then
Set Account = New NotesDocument( db )
Account.HTTP_Referer = doc.HTTP_Referer(0)
Else
count = Account.count(0)
End If
Account.count = count + 1
Call Account.save(True, True)
count = Format(Account.count(0),"00000")
xlen = Len(count)
bytes = ""

For i = 0 To  xlen*3-1
bytes = bytes +  "0x00,"
Next

For y=0 To 9
For x=0 To xlen-1
digit = Mid(count,x+1,1)
byte = Mid(digits(digit),1+y*3,2)
bytes = bytes + "0x" + byte + ","
Next
Next
For i = 0 To  xlen*3-1
bytes = bytes +  "0x00,"
Next

Print "Content-type: image/x-xbitmapnn"

Print "#define count_width "+xlen*8
Print "#define count_height 16"
Print "static char count_bits[] = {"
Print bytes
Print "};"
End Sub

This was first published in November 2000

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.