Just a short follow up to my problem from this afternoon about recompile going into an endless loop or not saving at all, when changing the order of the Use statements (Error "Duplicate PUBLIC Name" : it seems that the compiler can't cope with long names of script libs. My scriptlib was named "de.katzien.ls.MVC.Model.MonitoringCapability". Changing it to "de.katzien.ls.MVC.Model.Monitoring" fixed the problem.
|
Compile Problem fixed: Scripname was too long
|
... or to hell... Currently I'm trying to build an LS framework, which is runtime configurable. Instead of using static functions or simple class extention, I try to build an object graph, where each object adds some functionality. So something which needs to run after a Document is saved will add a observer to the document model and do the work in the right callback method. This results in small objects and class libs, but lots of use of "Use". Unfortunatelly designer seems to be unable to cope with this. Right now I'm in a situation, where designer compiles my code, if I press strg+s, but is sent into an endless loop if I use "Recompile all Lotusscript".
Other fun includes "Use" ordering: this compiles with strg+s (but sends "Recompile all" into an endless loop):
Use "class::logger" Use "de.katzien.App.Infomail" Use "de.katzien.App.InfomailDB" Use "de.katzien.ls.Email"
this not:
Use "class::logger" Use "de.katzien.App.InfomailDB" Use "de.katzien.App.Infomail" Use "de.katzien.ls.Email"
The only change is the ordering... Error: Duplicate PUBLIC Name "CHANGE_LISTENER_EVENT_BEFORE_CHANGING" in USE de.katzien.App.Infomail This name is the public Const in script lib "MonitoringCapability", which is use'd directly by .App.Infomail and indirectly by .App.InfomailDB (uses InfomailEntry which uses MonitoringCapability). setting this to private just ends up with the next error and I can't set a complete class to private if I want to use that class in some other lib...
And don't even ask about "Illegal Circular Use".
@IBM: Please improve the Compiler for LotusScript!
|
Sending Designer into endless loops with "Recompil...
|
Todays fun: my logger (basicly an AgentLog, but with an underlying NotesDocument) opened a second doc where it shouldn't and worse didn't save the first document with the proper logging output. Turned out, that the last logAction call in the logger.delete sub (called by the garbage collector) found that the underlying logdoc was nothing (and so not saved until I turned on flushAlways) and so created a new one with only the "new log opend" and "log closed" message in it. Fun if you expect half a page of debugging output for an webagent (which you need because the agent is not working ) and only get "Log opened and closed"...
The fix was to cache the parent Database of the Logdocument in the Logger object.
This Database was actually cached (Dim logDB...) in the OpenLogFunction Declaration section (the Logger is an extention), but it seems that this script lib was garbage collected before calling delete on my object and as the DB got collected, so gets every object which came from that DB. By-by logdoc...
It seems that something changed between last years domino (7.0.x or 8.0.1, not sure which I tested on) and 8.0.2 in the garbage collection routine, as the same logger setup worked some month ago without this problems. Or I garabage collection is influenced how many classes/ScriptLibs you use in the your agent...
So, todays lesson learned: Do not cache objects in other scriptlibs Declaration section if you use that object in delete... Fortunately this is my only class with a deconstructor 
|
Fun with ... garbage collection
|
I like to write code like this:
public function getSomething() as Something if oSomething is nothing then set oSomething = new Something() end if set getsomething = oSomething end function
How do this with dynamic arrays? I was very surprised when this threw an error:
dim arrSomethings() as Something if isArray(arrSomethings) then print ubound(arrSomething) ' unitialized array error when calling the ubound function
You have to call a redim arrSomething(0 to 0) bevor you can do anything with that array. I tested it with every isXYZ function I could find in the designer help, but i couldn't find a way to detect that...Somehow I agree with Tommy Valand: LS Arrays are strange. Give me a Java collections like API and I'm happy  BTW: datatype (arrSomething) gives "8738", even after the redim, but the designer help says that "8704" is a Dynamic array. Bug?
|
How to test if an array is initialized?
|
Hello LazyWeb,
we had a user who accidentally changed his system date to sometime in the future (year 3434...) and did some work in his local mailfile and replicated... <insert fun with local replication which resulted in delting all his local replics here>. Since then we get this nice message on the servers: 03.10.2008 03:25:07 Error reading RevisionTime for folder operations in database <mailfile.nsf>. Run fixup on the database.: Invalid Time or Date Encountered
Needles to say, that fixup does not make this message go away Anyway: all docs with "funny" dates are gone from the mailfile, there seems to be no folder with such funny dates and I purged the deletion stubs, but the message still comes _twice_ on every fixup.
The last time we just "sat it out", as it was just one month in the future, but waiting to year 3434 is probably not an option.
Anyone with an Idea?
|
Help: Messages from the future: "Invalid Time or D...
|
This is mainly here so that I don't have to google another half an hour... The Policy setting to get the install menu back is in "Desktop policy settings -> Basics -> Provisioning -> Allow User initiated updates"
Additional buzzwords following: com.ibm.notes.branding/enable.update.ui=true, plugin_customization.ini, 8.0.2, install, update, updatesite
Thanks to Henning Kunz, where I finaly found this.
|
File - Application - Install
|
Binding to an onHelp event via " On Event Onhelp From fUIDoc Call delegate_onHelp" is only working, if you have any code/Comment in the onHelp event on the Form: just leaving it with no comment in it in the client lotuscript part will not trigger delegate_onHelp. Putting a comment into the event on the form works:
 I found that only because I wanted to test if this code element is triggered at all and then commented out my code. And behold: it worked from there...
Can someone explain this?
I think I saw a different case, where putting a comment into some otherwise empty code block made a difference, but I can't remember anymore. IMO this is just weird...
Now I only need the LS version of OpenHelpDocument 
|
Notes becomes stranger every day: binding to onHel...
|
I implemented a context sensitive help in one of my applications, but now I want to migrate this code to an event based handler which uses the 'onHelp' NotesUIDocument event. Unfortunatelly I can't find a replacement for this code in LotusScript: @Command([OpenHelpDocument]; ""; "LHelp";"FORM-"+ Form))
Is there no other possibility than using evaluate?
|
NotesUIWorkspace.openHelpDocument(...)?
|
I use OpenLog for my error handling and mostly it just works. But there are a few cases, when I wanted to have something more: - show the error messages to the user and get some information what the user did
- Sending the logentry via mail to the central OpenLog DB in case the user is offline
While I was at it, I also added "Handlers": you can pass in a handler and openlog will ask each handler if the error can be handled (ignored, resolved, etc) by the handler and if so, will return. I got the Idea for error handlers from the "Lotusphere 2008 - AD311 - Object Oriented Programming with Lotusscript – Take It To the Next Level" presentation/ example DB.
Now you can write something like this:
handleerror: If handleError() Then Resume Next There is also a new "handleOrRethrowError() method, which corresponds to "addToStackTrace()" but can handle an error.
This handler mechanism are a great way to let someone else extend your code without changing your code. Everything what is needed are some entry points, where you can add you own "HandlerObjects" and of course your code must delegate the handling to it.
This is the new handleError() method I came up with:
Public Function handleError() As Boolean '** logs whatever error happens to be on the stack (if any) On Error Goto processError Dim session As New NotesSession handleError = False ' First try to handle the error ' Loop over some handler List ' If any can and has handled this error, just return true Forall handler In errorHandlers If handler.isResponsibleFor(Err) Then handleError = handler.handleError() End If If handleError = True Then Exit Function End If End Forall 'if not: ' Create a log item and a document ' Ask the user for input with a dialog Call setupLogItem("","",Nothing,Getthreadinfo(10)) 'refactored to get rid of code duplication Dim db As NotesDatabase If session.IsOnServer Then ' I can garantee that there is a OpenLog DB on each server Set db = GetLogDatabase globalLogSuccess = globalLogItem.WriteToLog(db) Else ' local means in most cases not online -> mail it and ask for input Set db = New NotesDatabase("", "") Call db.OpenMail Dim dummyDoc As NotesDocument Set dummyDoc = globalLogItem.CreateLogDoc(db) ' Just shows a dialog, which displays some fields from the LogItem If askForAdditionalInformation(dummydoc) Then globalLogItem.message = globalLogItem.message + Chr(13)+Chr(10)+ dummydoc.GetItemValue("ErrorMessage")(0) End If Call dummydoc.Remove(True) ' creates a doc and uses doc.send(...) to mail it to the OpenLog Mail-In DB globalLogSuccess = globalLogItem.sendViaMail(db) End If Call ClearStackTrace() If Not globalLogSuccess Then Error 1001, "Log was not saved or sent" End If
Exit Function processError: DebugPrint(StandardErrorMessage(Err, Erl, Error$, Getthreadinfo(1
|