XPages boilerplate: useful code snippets and modules for your next XPages project

When I start a new XPages project, I use lots of code snippets and modules from previous projects. Many of these code snippets and modules are open source or available on blog posts from fellow XPages bloggers. In this blog post I will list some of these useful code snippets and modules and hope that this will inspire you and help you enhance your next XPages project.

Useful code snippets and modules:

You can also take a look at the XPages Scaffolding project by Jesse Gallagher. At least look at the README.md file in which Jesse describes what’s included.

Of course, you should not forget all the useful libraries and tools available in OpenNTF Essentials (both in the Essentials Runtime and in Essentials Toolbox) such as the OpenNTF Domino API, XPages Debug Toolbar and XPages Log File Reader. Also of great value is Auto Logins which provides “remember me” functionality for your app.

IBM Notes 9.0.1 and IBM Domino 9.0.1 are now available for download

IBM Notes 9.0.1 and IBM Domino 9.0.1 are now available for download on Passport Advantage.IBM Notes

This release includes 292 documented fixes (as of this evening). Here’s the “Top 20” fix list according to IBM.

Some of the 9.0.1 part numbers:

  • IBM Notes Client 9.0.1 for Windows English: CIQ7REN
  • IBM Notes Client 9.0.1 for Mac English: CIQ7UEN
  • IBM Notes, Domino Designer and Admin 9.0.1 client: CIQ91EN
  • SwiftFile 4.2.1 for IBM Notes 9.0.1 English: CRP4BEN
  • IBM Domino Server 9.0.1 64 bit for Windows English: CIQ7WEN
  • IBM Domino Server 9.0.1 64 bit for Linux for xSeries English: CIQ7ZEN
  • IBM Notes Traveler 9.0.1 for Windows Multilingual: CIQ7BML
  • IBM Notes Traveler 9.0.1 for Linux for xSeries Multilingual: CIQ7CML
  • IBM Domino Social Edition OpenSocial component 9.0.1 64 bit for Windows English: CIQ85EN
  • IBM Domino Social Edition OpenSocial component 9.0.1 64 bit for Linux for xSeries English: CIQ89EN
  • IBM XWork Server 9.0.1 64 bit for Windows English: CIQ8DEN
  • IBM XWork Server 9.0.1 64 bit for Linux for xSeries English: CIQ8HEN

Thanks, Bruce

Thank you Bruce for all you have done for OpenNTF and the community since 2001.

I have worked with you as a director on the OpenNTF board since October 2011. We have spoken together at IBM Connect 2013 on our open source project Collaboration Today.

You are a great friend and mentor and I always enjoy our chats and talks on Skype.

Good luck with your new adventure at Clark College.

#ThanksBruce

Submit your abstract for the 50th DanNotes conference

DanNotes

The 50th DanNotes conference takes place November 27-28, 2013 and also marks the 20th anniversary for the DanNotes user group.

I am part of the organizers team and we are hard at work planning the conference and have opened for session abstract submissions. If you are interested in speaking at the conference, please register and submit your session abstract.

We are looking for business related sessions, technical sessions, case stories and more. We are looking for speakers from all over the world.

One important point: DanNotes will take care of your travel and accommodation expenses! So what are you waiting for? 🙂

How to recycle Notes objects in XPages and Java

Using Notes objects in XPages and in Java require that you recycle those objects in order to avoid memory leaks and backend out of memory issues. Here I will summarize how to do proper recycling in XPages for server-side javascript, Java and Java using the new OpenNTF project org.openntf.domino.

Server-side JavaScript

With server-side JavaScript you have to use the recycle method available on Notes objects and you have to “nullify” your server-side JavaScript variables. Thank you, Tony McGuckin, for clarifying this.

Here’s a very simple example that assumes that the variable doc has been initialized elsewhere:

doc.recycle();
doc = null;

Java

In Java you have to use the recycle method available on Notes objects. So for looping through a document collection you have to do this:

try {
	Database dbCurrent = ExtLibUtil.getCurrentDatabase();
	DocumentCollection dc = db.getAllDocuments();
	Document doc = dc.getFirstDocument();
	While (doc != null) {
		// process doc
		tmp = dc.getNextDocument(doc);
		doc.recycle();
		doc = tmp;
	}
	dc.recycle();
} catch (NotesException e) {
	e.printStackTrace();
}

org.openntf.domino

With org.openntf.domino you do nothing with regards to recycling! So when looping through a document collection you can concentrate on your business logic:

Database db = Factory.getSession().getCurrentDatabase();
for (Document doc : db.getAllDocuments())
	// process doc
}