Search DominoPower's 11,422 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
Build your own Domino hit counter (continued)

However, as usual, Domino is flexible enough to allow workarounds for these limitations. The minimum 16-bit output size can be fixed by writing a procedure to buffer output, as demonstrated below. Secondly, there is a neat way around the Print statement limitation, and one that enables a whole bunch of serious optimizations.

Here's a chunk of code that will enable byte-serving:

' Byte-Serving Procedure Code
Sub OutputBinary(ImgHandle%,Byte&)
' ImgHandle% - file handle
' Byte& - byte value to be written to file with handle ImgHandle%

Static LeftByte&
Static Flag%
If Flag%=0 Then
LeftByte&=Byte&
Flag%=1
Else
If Byte&<0 Then Byte&=0
' check for special case of -1 (used to flush out byte buffer)
If BigEndianFlag%=0 Then
' Intel word order
If Byte&>127 Then
OutByte%=Byte&*256+LeftByte&-65536
Else
OutByte%=Byte&*256+LeftByte&
End If
Flag%=0
Else
'SPARC word order
If LeftByte&>127 Then
OutByte%=LeftByte&*256+Byte&-65536
Else
OutByte%=LeftByte&*256+Byte&
End If
End If
Flag%=0
Put #ImgHandle%,,OutByte%
End If
End Sub

Here's how you would use that procedure:

  • Set the global variable BigEndianFlag% to 1 if running on SPARC, RS6000, SGI processor;
  • Call OutputBinary for every byte;
  • After the last byte has been output, call OutputBinary with a byte value of -1 to flush the buffer

Rather than send the binary data (in this case the pixel bytes of a GIF image) directly to a browser as you would HTML, use the old-fashioned Open/Close/Put statements that LotusScript has inherited from Ye Olde Basic. Write the binary data to a file using the buffer procedure. Then send the browser the address of the file, enclosed in square brackets. This acts as a redirect, forcing the browser to immediately start loading the file, as if it had been directly byte-served from Domino.

For example:

PRINT "[/counter/9996.gif]"

Optimizations
I suggested that this approach to byte-serving opened up a new realm of optimizations. Given that the most complex part of such an agent will be the intensive graphics processing to build a GIF image in LotusScript, why go through that process if there's a GIF file lying on the server that's previously been constructed for the same number?

Thus, a cache of recently used images (and since there are only ten digits, that's a relatively small cache) can be built up. To keep things under control, some sort of regular purge is required--another Domino agent easily takes care of this on a weekly schedule.


« Previous  ·  1  ·  2  ·  3  ·  4  ·  Next »
Other articles you might like
Home > Internet Technologies > Logging and analysis (8 articles)
   Boost your server performance with HTTrack
   Keeping user credentials in a frameset
   Using probes to monitor your Domino servers
Home > Lotus Technologies > Domino (77 articles)
   More about Domino log files
   Why your log.nsf might not be purging properly
   Sloppy analysis at the core of another Domino vs. SharePoint report
Home > Lotus Technologies > LotusScript (64 articles)
   When the debugger won't debug hidden code that isn't hidden
   What to do if the LotusScript debugger won't single-step over code
   Little known traps about Lotus Notes fields
Home > Lotus Technologies > Application Development (48 articles)
   An application for scanning physical mail and distributing it virtually
   How hide-whens in Rich Text can ruin your whole day (and what to do about it)
   Little known traps about Lotus Notes fields
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
Application development, William Shatner, and the origin of the universe
Learn Domino Designer 8.5 for free
The (near) future of Sametime, Quickr, Connections, and Symphony
Inside the IBM Innovations lab
Lotusphere 2010: Hot fixes and cool news for Notes, Domino, and LotusLive
Lotusphere 2010: mobility and collaboration
2010: A Lotusphere of change
Latest Lotus Headlines
New Notes/Domino Technotes published about Chile's extended daylight saving time
SnnT: How to prevent Google from listing your Sametime Server
How to send someone an email that shows your calendar availability
"The collection has become invalid"
More XPages onclick event weirdness...
Domino 8.5.1 Fix Pack 1 Interim Fix 1 (8.5.1 FP1 IF1) - DAOS Fixes
Domino Designer 8.5 Tip: Where Working Sets Are Stored
>> Read all the news
More from the ZATZ journals
Computing Unplugged: The iPad defenders have spoken
David Gewirtz Online: CNN commentary and analysis
OutlookPower: More about disappearing text
-- Advertisement --

Learn Notes and Domino 8 at your place and pace!
Learn Notes and Domino in your office and/or home! TLCC's highly acclaimed distance learning courses for users, developers, and admins will enhance your career and your resume.

The many included activities and demos will make you a pro! Expert instructor help is a click away.

Click here to try a FREE demo course!!

-- Advertisement --

Struggling with exporting Notes data to spreadsheets? No More!
Try IntelliPRINT, The world's leading Reporting, Dashboards, and Analysis solution for Notes & Domino

  • Don't spend unproductive time maintaining different versions of the same spreadsheet
  • Preserve data integrity and security in multi-user environments
  • Create reports in minutes INSIDE Notes
  • Get freedom from iterative report requests, deliver self-serve capabilities

Experience Reporting, Dashboards, and Analysis INSIDE Notes.

Try IntelliPRINT NOW!

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login