Archives for the ‘Java’ Category

13 May 2016

My 2 webinars on Optimus XPages: An explosion of techniques and best practices

I’m happy to announce that both my webinar presentations titled “Optimus XPages” are available for viewing.


The first part focuses on techniques and best practices on a high level, where most of the video is presentation slides with a few short demos at the end.

The second video is a lot more fast-past. Nearly the entire video is live code. I pretty much design an XPages Single Page App from start with explanations of what’s happening along the way.

You can delve straight into Part 2, but I do recommend watching Part 1 if you have another 1.5 hours to spare, as it really gives some great insight to how apps should be developed.

Optimus XPages – Part 1: An Explosion of Techniques and Best Practices

Optimus XPages – Part 2: The Deep Dive


I trust you will get great value-add out of these videos. I just want to thank TLCC and Teamstudio for giving me the opportunity to present.

See you on the other side :)
7 Dec 2015

John Jardin’s 2nd Session at IBMConnect 2016: Optimus XPages


So, to my utter surprise, my second Abstract for IBM Connect 2016 was approved. It’s titled “Optimus XPages: An Explosion of Techniques and Best Practices“. For a reference to my first Abstract, click here. Just so everyone knows, IBM Connect takes place at “The Hilton” in Orlando, Florida. My session “Optimus XPages” is scheduled for Monday the 1st February 2016 at 3:30pm.

I am extremely excited to be presenting this session. Over the past year I have implemented a number of solutions running on XPages, and I got to experience first hand the improvement in performance and overall user experience when comparing these solutions to ones I developed in the past. I feel I have come up with some serious practices that anyone can easily apply to make their applications work and feel fast and responsive, whether running on a local network or in the cloud.

Below is a rundown of my session:


AD-1074 – Optimus XPages: An Explosion of Techniques and Best Practices


Starting a new XPages project but not sure it’s going to be done right the first time? Do you have an existing application that doesn’t seem to have that “X” Factor? In this session John will demonstrate how XPages developers can apply proven techniques and best practices to take their applications to a game changing level.


  1. Rapidly develop responsive applications
  2. Improve user experience and response times with background and multi threaded operations
  3. Keep your XPages lightweight with code injection
  4. Create scheduled tasks the XPages way
  5. and much more.

I hope to see you all there :)

Cheers for now :)
10 Jul 2013

XPages Video Tutorial: Signing a Notes Database using Java

In this video tutorial I show you how to sign a Notes Database using the Server’s ID via Java Code.

In Lotus Notes version 6, IBM introduced a new method for the NotesDatabase Object called “sign()”. this allowed you to sign either the current database or another database using your current Notes ID. The only issue with this is that the Sign Request would only work if triggered manually inside the Notes Client.

For XPages development, this becomes an issue because you cannot perform a NotesDatabase.sign() on the front-end of your XPages Application.

So without further adieu, here’s the Video :)


5 Jun 2013

XPages Java Tip: Be careful with static variables in your Classes

I learned a very valuable lesson the other day when I relied on the Java Editor to recommend the setting of certain members in my classes. This is a silly mistake that occurred and only cost me about 1.5 hours of troubleshooting, but hopefully others can learn from this and not make the same mistake.


I need to thank the following 4 individuals for assisting me with this issue:

1. Serdar Başeğmez – (Who pretty much knew what the issue was but I didn’t understand him properly. Sorry man)

2. Solly Bronkhorst – (My senior Domino Developer at Ukuvuma, who is quite new to Java, but managed to point out the issue fairly quickly. That’s mad skills Solly)

3. Thimo Jansen – (For really trying hard to help me out. I really appreciate the effort Thimo)

4. Paul Withers – (For providing me an alternative to the below issue in Java. Thanks man)

5. John Dalsgaard and Nathan T Freeman – (For providing valuable feedback on my Blog Post and helping me correct some of my statements which were quite misleading)


In my XPages Applications, my Application Logic is designed around the MVC Architecture. For every Application I usually create a “Global Controller” Java class that initializes certain parts of my application and sets a few members. I access the Global Controller via a managed Bean which I store as a Session Scope Object (Session Scope meaning the Object will remain active for the current Notes Database/Application for the current User only).

Inside this Global Controller, I have a few member properties that get populated on load of the application. (e.g. The current Username, e-mail address, roles, etc). In one of my cases these members needed to be used in my XPages as well as in some of my other Java Classes.


While I understood how to get a handle on my Managed Bean via my XPages and Custom Controls, I made an assumption on how to get a handle on it in my other Java Objects. I would import the “Global Controller” into my Java Class and reference its members directly.

Everything worked fine for me when I was testing the application, but the moment there was more than 1 user working in the Application, my Global Controller’s members would be overwritten (i.e the username is not mine, but the 2nd user’s. The same for the roles, e-mail address, etc).

It was as if my Global Controller was being stored as an Application Scope Object and not a Session Scope Object.


When I imported my Global Controller into my other Java Objects and started referencing its member properties, the Java editor started returning errors, telling me that my Global Controller’s members need to be Static. It was here that I allowed the Java Editor to make the necessary changes in my code.

So what does it mean to have a static member? From my understanding, Static members are initialized only once and at the start of the execution. When I launched my XPages Application, my static members would be initialized and would then be stored as values to be used by everyone until they were re-initialized. So if I launched the application first (me as John Jardin), the member properties would be populated with my details, which is correct. If a second user launched the application on her side (Susan Smith), the member properties would be changed and would contain her details. This directly affects me and any user who launched the Application prior to Susan.


You cannot import a Java Object into another Java Object and assume to get a handle on it the same way you would in XPages via a Managed Bean. At least this is how I understand it. What you need to do in your Java Object is get a direct handle to your Managed Bean, which contains an Instance of your Global Controller.

Let’s say that your facesconfig.xml has the following code that defines your Managed Bean:


To use this Managed Bean in your Java Object, you’ll need the following code:

FacesContext context = FacesContext.getCurrentInstance();
GlobalObject globals = (GlobalObject) context.getApplication().getVariableResolver().resolveVariable(context,"GlobalObject");

Here you created a variable called “globals” and connected it to your GlobalObject Managed Bean. Now you can continue working with your Global Object in your Java Class. Simple as that.

Till next time. Cheers
28 Aug 2012

Important Tip when comparing values in Java

Hi everyone. Here’s a quick post that might save you a lot of time. With some programming languages like JavaScript, @Formula or LotusScript, to compare a String value is pretty simple

@Formula: tmp1 := “Test”;

tmp2 := “Test”;

(tmp1 = tmp2) = True

JavaScript:var tmp1 = “Test”;

var tmp2 = “Test”;

(tmp1 == tmp2) = True


LotusScript:dim tmp1 as String

dim tmp2 as Stringtmp1 = “Test”

tmp2 = “Test”

if(tmp1 = tmp2) = True


But when it comes to Java, the rules are slightly different:

String tmp1 = “Test”;

String tmp2 = “Other Test”;

(tmp1 == tmp2) = True


In Java, the == operator compares Objects and not the physical values contained within. The line above this is checking if the object tmp1 is the same object as tmp2.

So, in Java, the proper way to compare values is by using the equals() method:

String tmp1 = “Test”;

String tmp2 = “Test”;

(tmp1.equals(tmp2) = True


If it’s anything that I can teach you today, it’s that with Java almost everything is an Object and not just a data type. If it’s an Object, it has Properties and Methods that should be considered at all times, especially when parsing or comparing values.

Cheers for now :)