As I’ve highlighted previously on this blog I’ve done quite a lot of work on LiveText to Java integration in my How to extend Notes 8-series. This week IBM contributed a sample on OpenNTF showing of the same thing – the project is New OpenNTF Sample: Eclipse Live Text Action. I recommend you take a look at the project as well as my series of blog entries for information on how to extend the Notes client yourself.
An update on the RedWiki
The writing on the wiki is almost done and all chapters are of to review. I think IBM is shooting for a release by mid October. As to the code examples it has been decided that all code goes on OpenNTF for easy download and hosting using the recently announced SVN capabilities. This will also make it easier to control additions to the code base as the wiki hopefully continues to evolve.
New pet project: LiveTextr
Part of my job, interest and efforts goes towards illustrating just how extensible the Notes 8 platform is. Part of this is playing around with the platform and trying to do stuff to illustrate how the platform may be extended. One of the very cool ways to extend Notes 8 is using widgets and LiveText but debugging it can be a hazzle due to the way widgets are created and installed into the platform. The goal of my latest pet project was to alleviate some of these pains and make it easier to work with LiveText.
So I’m happy to show of LiveTextr!
LiveTextr is a sidebar plugin for Notes 8 that allows you to test LiveText regular expressions against the Notes documents you have open in Notes without creating a widget first. This means that I can open a document that contains some text I would like to test against and start writing regular expressions and have them debugged in the Notes client before doing the actual widget. Installing and testing the pattern is done by clicking a button and the pattern is dynamically added to the LiveText engine.
The first screenshot shows me debugging a pattern right there in my Notes 8.5.1 client.
Click image for larger version
LiveTextr also provides you with instant feedback on the syntax of your regular expression as you write it. This is also a problem with the built-in model as there’s no way to test your regular expression as you write the widget. The second screen shot shows the current feedback (shown in red text) when the regular expression contains errors.
Click image for larger version
Further improvements I’m planning is to allow users to build regular expressions visually (or at least without having to know the syntax of regular expressions) and to handle capture groups. I also plan to open source the project on OpenNTF.org.
Using OpenAudit to save my hair… :-)
At the moment I’m doing old school Notes development and needed to implement audit logging the in application. What better and easier to do than to head over to OpenNTF, grab the latest version of OpenAudit and implement it. Given I had some issues with some form aliases which I need to talk to Chad Schelfhout about it took me all of 90 minutes to implement. The component is now seamlessly embedded in the application – nice, quick and easy…
For me the the number one benefit of using open source is to be able to tweak the code to fit the exact problem domain. When creating applications I like to keep all databases for the application in a separate directory and hence group associated databases. When doing this it makes sense that the databases can automatically find the other databases of the application thus eliminating the need for additional configuration. This goes for Julians OpenLog application as well as OpenAudit. I previously implemented this for OpenLog and hence needed to do the same for Open Audit.
It proved very easy. A simple hack of the setAuditDb-method in the “Open Audit”-script library made it possible. Now when specifying “*/” at the start of the path name in the audit configuration (e.g. */OpenAudit.nsf) the method will assume that the database can be found in the same directory as the calling database.
My changes are in bold:
Public Sub setAuditDb(sServer As String, Byval sDatabase As String, sReplicaID As String) On Error Goto ErrorHandler If ( dbAudit Is Nothing ) Then If sServer = "*" Then sServer = System.ThisDatabase.Server End If If Left(sDatabase, 2) = "*/" Then 'get database relative to current directory Dim session As New NotesSession Dim current_directory As String Dim sep As String If Left(session.Platform, 3) = "Win" Then sep = || Else sep = |/| End If current_directory = Strleftback(System.ThisDatabase.FilePath, sep) sDatabase = current_directory + sep + Right(sDatabase, Len(sDatabase)-2) End If Set dbAudit = New NotesDatabase( sServer, sDatabase ) If dbAudit.isopen Then Else Call dbAudit.OpenByReplicaID( sServer , sReplicaID ) If dbAudit.isopen Then Else Set dbAudit = System.ThisDatabase End If End If End If Exit Sub 'Catches any invalid Replica IDs, and will uses the current database then errorHandler: Set dbAudit = System.ThisDatabase Exit Sub End Sub
AutoPurge for OpenLog
We are using the OpenLog logging framework written by Julian extensively in our applications but in logging intensive applications or when running with our custom DEBUG-level enabled you can generate a lot of logging documents. Cleaning these up should preferably be done automatically on a scheduled basis so I wrote a small agent to purge log documents older than 6 months and thought I would share:
Sub Initialize Dim session As New NotesSession Dim db As NotesDatabase Dim dc As NotesDocumentCollection Dim dt As NotesDateTime Set dt = New NotesDateTime(session.International.Today) Call dt.AdjustMonth(-6) Set db = session.CurrentDatabase Set dc = db.Search(|Form="LogEvent" & LogEventTime<@TextToTime("| + dt.DateOnly + |")|, Nothing, 0) Call dc.RemoveAll(True) End Sub
Really simple and nothing much to it…