A Notes/Domino application that hasn’t been tested with a large random data set may develop poor performance as it accumulates more data — long after the development team has moved on to other things.
This is partly for organization which, like HCL, use Domino Global Workbench to do translations of their Notes/Domino applications. But also, even if you do translations manually, or even if you don’t do them at all, it makes sense to learn good habits for creating applications in a way that makes translations simple, because it’s not that hard and you never know. Rationale Your applications are more valuable if they’re capable of being translated. It’s also easier to maintain the user-facing text of an application, even if it’s not translated, when such texts are stored in a predictable way. Errors in translation can be hard to catch, because the testers generally either don’t speak all the targeted languages, or else they speak the language but don’t know how the application works in its original language.… Read More »Coding for translatability in Domino
For a couple of applications, I’ve needed a way to store values specific to the combination of a user and workstation. These are personal settings, in other words, but the same person may need different settings if they use the application on a different workstation. This would mostly be local filepaths, things like the last folder the user selected for a particular file-open prompt, or the path of an external tool the user has to launch in a given situation. A list of recently accessed files. These would be different on different workstations. Implementation strategy and alternatives You could use environment variables for some of this, and that might be the answer in some situations. But there’s a limit to the amount of data you can conveniently store that way, and you have to worry… Read More »Workstation-specific user application settings
The general term for it is “associative array” — a collection of values indexed by a string rather than a numeric index. You might be thinking you already know about the List datatype in LotusScript, but there are a few tricks you might not have thought of. Basics Declare a variable of type List As datatype — for instance, Dim docsByColor List As NotesDocument Read and set values as you would an array, but using a string as your index value. Set docsByColor(doc.color(0)) = doc In this example we’re building an in-memory collection of documents that we can search by the value of their color field, so: Function getDocOfColor(ByVal color$) As NotesDocument If IsElement(docsByColor(color)) Then Set getDocOfColor = docsByColor(color) End If End Function Attempting to access an element with a key that’s not found in… Read More »Wonderful List datatype in LotusScript
Lars Berntrop-Bos posted a comment concerning the LotusScript NotesStream class and his practice of reading as large a block as he possibly could to optimize performance. I decided to run a test to see how much difference that made. The results are as follows: Block size (bytes) Runtime to read a large file (seconds) 512 10.30 1024 5.09 2048 2.75 4096 1.49 8192 0.86 16384 0.52 32768 0.35 65536 0.26 Each of these cases is doing the same amount of work — reading every byte in the same large binary file. The effect of increasing the block size is dramatic — the largest possible block size was 40 times faster than a 512-byte block. 216 bytes is the upper limit of the NotesStream.Read method, because that’s the maximum number of elements in the array datatype… Read More »NotesStream performance
This is about how function and subroutine parameters are passed in LotusScript, and how to use that intentionally in consideration of code maintainability and performance. For basic types There are two ways a caller can pass a parameter to a subroutine or function. A call “by value” gives the subroutine a copy of the value. A call “by reference” gives the subroutine access to the caller’s variable, so it can change the value of that variable. Here’s an example: Sub fie(a%, b%, ByVal c%) a = 11 b = 12 c = 13 End Sub Sub Initialize Dim x%, y%, z% x = 1 y = 2 z = 3 fie x, (y), z Print “x=” & x & “, y=” & y & “, z=” & z End Sub The output of this code… Read More »By Value, By Reference
Ok, it’s my blog so I get to vent. Here is a fact: 80% of text fields on Notes forms would be improved with an input translation formula. This is the best formula for most cases: @Trim(@ReplaceSubstring(@ThisValue; @Char(9):@Newline; ” “)) Rarely do we really want to allow tabs, leading or trailing spaces in a text field. Sometimes newlines, but the formula is easily adjusted to allow that. Of the remaining 20% many are identifiers that shouldn’t contain any whitespace. @ReplaceSubstring(@ThisValue; @Char(9):@Newline:” “; “”) I’m working on a tool called The Developer’s Friend that contains, among other things, some database design reports and fixup tools. I think I’ll add one to list the input translations for all fields so you can easily scan down the list and find ones that need something more than the nothing… Read More »Can you please translate?
How to set up your comment templates in LotusScript Editor preferences to provide the best typeahead assist for people calling your functions, and what information to put in which comments.