Thursday, 12 April 2012

Announcement: Workflow for XPages

XPages - Announcement

Announcement: Workflow for XPages

Phil Riand, Qian Liang and team have contributed a new project to OpenNTF - Workflow for XPages.

Read the following deck for a description of the project.


Wednesday, 11 April 2012

Create Report of Latest Notes Client Installed on Users in the Domain

 

One of our customer asked to generate a report of current Lotus Notes client version installed on user’s machines across the country. Fortunately, Lotus Notes Client store the information about the Client Installation in Person document. There is a field called ClntBld which contains all the builds that a particular person has installed on his machine. However, this multi value field doesn’t store these values in expected sequence. The latest information can be at any position of multi valued field.

Therefore, the below mentioned approach first determines the latest date of Build being added to person document from ClntDate field, then retrieves the relative information from ClntBld field.

Use this formula for a view column to get the latest build from Addressbook:

lst := @Sort(ClntDate;[Descending]);
ClntBld[ @Member(@Text(lst[1]); @Text(ClntDate))];

image

Installation Help for Lotus Domino

Lotus Domino

IBM Redbooks: Optimizing Lotus Domino Administration
http://www-10.lotus.com/ldd/dominowiki.nsf/dx/Table_of_Contents_Optimizing_Lotus_Domino_Administration

IBM Redbooks: Lotus Notes and Domino version 8.5 Deployment Guide
http://www-10.lotus.com/ldd/dominowiki.nsf/dx/Table_of_Contents_for_Lotus_Notes_and_Domino_version_8.5_Deployment_Guide

Lotus Notes

 

Lotus Traveler

Installation Help: http://www-10.lotus.com/ldd/dominowiki.nsf/dx/Installing_the_Lotus_Notes_Traveler_server_LNT853

System Requirement: http://www.ibm.com/support/docview.wss?uid=swg27022506

Sametime

Friday, 6 April 2012

Lotus Notes : Restrict Attachment size before Saving Email Document


Below is the code that needs to be added to the QuerySave event of Memo and Reply Forms.
Also, change the Max. Attachment size as required.

Below is the code that needs to be added to the QuerySave event of Memo and Reply Forms.
Also, change the Max. Attachment size as required.

Sub Querysave(Source As Notesuidocument, Continue As Variant)
    If source.InPreviewPane Then Exit Sub
    
    '****************************************************
    '**  Configure Attachment Size here ***********
    Const ATTACH_SIZE = 5 'MB
    '****************************************************
    Dim ws As New NotesUIWorkspace
    Dim uidoc As NotesUIDocument
    Dim doc As NotesDocument
    Dim totalSize As Long
    
    Set uidoc = ws.CurrentDocument
    Set doc = uidoc.document
    
    Call uidoc.GotoField("Body")
    Call uidoc.refresh(True)
    Dim rtitem As Variant
    Dim embedObjs As Variant
    
    Set rtitem = doc.getFirstItem("Body")
    embedObjs = rtitem.embeddedObjects
    totalSize = 0
    Dim oneMB As Long
    oneMB = 1048576
    
    
    If Not Isempty(embedObjs) Then
     For i = 0 To Ubound(embedObjs)
      totalSize = totalSize + embedObjs(i).filesize
     Next
     
     If totalSize > ATTACH_SIZE * oneMB Then
      Msgbox("Your total attachment size is " +Cstr(Round (totalSize /    oneMB,1)) +" mb.  The limit is " + Cstr(ATTACH_SIZE) + " MB.")
      continue = False
      Exit Sub
     End If
    End If
    
    Call source.FieldSetText("useApplet", "True")
    Call cMemoObject.QuerySave(Continue)
End Sub
 

References:
http://www-10.lotus.com/ldd/46dom.nsf/55c38d716d632d9b8525689b005ba1c0/a8ac654c57789e2085256e660074cc05?OpenDocument
http://searchdomino.techtarget.com/tip/Check-attachment-size-before-doc-is-saved

Thursday, 29 March 2012

Developing High Performing XPages Applications

Recently, I come across a strange scenario, where an XPages application was not able to meet the performance testing benchmark of 5sec average load time for more than 300 concurrent users. The application performed like a charm till 100 concurrent users but beyond that the response time was increasing to around 25sec. The expert team performed Code Review to optimize the performance, CPU, IO, Memory Utilization analysis to figure out the issue with Application's response time. I am sharing my experience for the benefit of others as well.. The result that we figured out was related to Memory Leak in "Native API Calls". This indeed is a very important point for almost all the XPages applications.

Following Technotes highlight the importance of using Recycle() method in each Notes Object accessed via Java or SSJS code.

Title:    'LSXBE: Out of backend memory' errors coincide with Notes/Domino performance and crash issues
Doc #:    1438386
URL:    http://www.ibm.com/support/docview.wss?uid=swg21438386

Title:    Why it is important to use the Recycle() method on every Java object
Doc #:    1097861
URL:    http://www.ibm.com/support/docview.wss?uid=swg21097861

Important point to notice is the approach how Java code handles the Notes Objects. Setting a java Object is not sufficient for Domino Java Objects. They must be recycled!

Creating an object in LotusScript:

When you create an object in LotusScript, you create two objects: one in LotusScript and one in the Notes backend (C++ code). The LotusScript object "points" to the C++ object which really implements the class behavior. When the LotusScript agent or event ends, both objects are destroyed automatically. If the objects were not eliminated, they would stay resident in memory, thereby creating a memory leak.
Creating an object in Java:
If you create an object in Java, the same applies. This object is a pointer that points to an object that is created in C++. It is common in pure Java coding to set something to Null in order for it to be flagged for garbage collection (gc) immediately. This is called "aggressive" garbage collection.
However, when using Notes objects for Java, setting something to Null marks the Java object for garbage collection but does not mark the C++ object for garbage collection. Dereferencing the Java object flags it for garbage collection but nothing will be affected on the C++ object.
Why recycle?
Recycle() destroys the C++ object and sets the Java object for garbage collection. If you mark objects Null, you can still experience memory issues. When using objects in an agent, all objects (both Java and C++) are destroyed when the agent ends. When using servlets, .jsp's, or standalone applications, recycle must be used since Domino will never clean up these backend objects.

Following URL contains a nice collection of XPages Performance Tips:

http://xpageswiki.com/web/youatnotes/wiki-xpages.nsf/dx/Memory_Usage_and_Performance

Multi-threaded Programming in XPages

Thanks to the great work done by Niklas Heidloff, Philippe Riand.

We have a great capability to write Multi threaded applications in XPages. A project “Threads and Jobs” has been posted on OpenNTF.org

http://www.openntf.org/internal/home.nsf/project.xsp?action=openDocument&name=Threads%20and%20Jobs

The project is using the The Eclipse jobs framework (http://www.eclipse.org/articles/Article-Concurrency/jobs-api.html) to perform time consuming processes asynchronously while the XPages UI is available for user without freezing.

Here’s a short video posted by Phil:

Saturday, 25 February 2012

Learning XPages

Hi Friends,

This is my first post in this blog..

I am an XPages Evangelist and would like this blog as medium to interact with developers looking for a NextGen Technology for Application Development..

I'll add all learning resources that I have access to this post..