T61p

Yesterday I picked up my new laptop – a Lenovo Thinkpad T61p. It’s a worthy replacement for my 3 year old IBM Thinkpad T41p. I know it’s very nerdy but boy it’s nice! πŸ™‚

It’s shipping with Windows Vista Ultimate so now I have to determine whether to go with Vista or install Windows XP which was my intent initially.

Discovering Notes 8: Showing dialogboxes from SWT in Notes 8


One of the big changes in Notes 8 is the move to a Java threading model which means that showing a messagebox is not something you can *just* do. This has implications for you if you’re developing (or thinking of developing) UI components in Java for Notes 8. These UI components (e.g. sidebar contributions) are developed in SWT and hence follow the SWT way of doing it.

Please note: Although the following may seem (overly) complex nothing of it is new when discussion UI development. The only difference between Notes 7.x and earlier and Notes 8 is that some of these aspects now rears their ugly head.

Now lets get to it…

Since only one thread can access the display and hence draw on the screen at any one time, requests to the display needs to be serialized. In Notes 8 and SWT this is done using the Eclipse Job API. This is done by encapsulating a piece of functionality and asking the platform (the “scheduler”) to execute it. The scheduler adds the job to a queue and and execute it once it is its turn. This may not happen right away though it mostly will.

To display stuff in the UI you use an UIJob instance as shown below. This example simply shows a messagebox with some static content.

new UIJob("Rectangle") {
   public IStatus runInUIThread(IProgressMonitor arg0) {
      MessageDialog.openInformation(
         this.getDisplay().getActiveShell(),
         "HelloWorld", "Hello SWT Job API World");
      return Status.OK_STATUS;
   }
}.schedule();

The second example will show you how to display some Notes data. Since access to the Notes API must be run in a specially initialized thread (remember NotesThread.sinitThread?) you have two options:

  • Manually initialize a thread using NotesThread / extend NotesThread.
  • Take the easy route and use NotesJob.

Using NotesJob is by far the easiest and will handle all the dirty details for you. When you do this you can also use the NotesPlatform class which is an (undocumented) way of getting a lotus.domino.Session instance inside Notes 8.

Using NotesJob will take care of getting at the data – to display it in the UI you still need an UIJob which is why I use two job instances in the example below. Since you can only access final variables from within inner classes I mark the name variable as final.

new NotesJob("Show messagebox") {
   protected IStatus runInNotesThread(IProgressMonitor arg0) throws NotesException {
      Session session = NotesPlatform.getInstance().getSession();
      Name n = session.createName(session.getUserName());
      final String name = n.getAbbreviated();
      new UIJob("My UI job") {
         public IStatus runInUIThread(IProgressMonitor arg0) {
            MessageDialog.openInformation(
               this.getDisplay().getActiveShell(),
               "Username", "Username: " + name);
            return Status.OK_STATUS;
         }
      }.schedule();
      return Status.OK_STATUS;
   }
}.schedule();

I hope this helps you.

Caveat with code from developerWorks tutorial on composite applications

If you’re planning to follow the “Building composite applications for IBM Lotus Notes V8” tutorial on Composite Applications from developerWorks (and you really should) and you have Domino Designer set to automatically insert Option Declare for you (and you really should) you need to declare a variable in Lesson 3. You need to declare the cName as a String for the code to compile. Or remove Option Declare of cause… πŸ™‚

Re: Ugly regression in Notes 7.0.2

I just realized that the performance regression mentioned earlier isn’t on the fix list of Notes/Domino 7.0.3 (release technote). This is really unfortunate since 7.0.3 is the last maintenance release for the 7.0.x codestream for a long time (for all I know anyway) since Notes/Domino 8.0 is Gold. This has been the story with previous releases anyway once a new major release has gone Gold.

This is worth keeping in mind when you decide on code releases. It’s a good reason for going to 8.0 anyway… πŸ™‚

Domino on 64 bit Windows and ODBC

Hmmm… This is one of those where you simply have to know how it works. On Windows 2003 Server, 64 bit version, there are two OBDC control panels. One for 32 bit data sources and one for 64 bit data sources. Lotus Domino, being a 32 bit application, should use the 32 bit data sources but for some reason that doesn’t work. It also doesn’t work to add the data source to the 64 bit data sources. The problem shows itself by popping a UI error message on the server. If this isn’t enough the agent is also halted without any apparent indication on the server console.

The solution is to add the same data source in both the 32 bit and 64 bit data source control panels. Then it works. Wierd!

More on Sametime blackboxes

I was at a customer site today and among other things I was asked to take a look on a Sametime business card issue they were having with a custom blackbox. The issue was that the picture was not showing up in Sametime. They did already have a PMR open with Lotus Support but they had been unable to solve the issue.

The customer is using the “custom” blackbox implementation (com.ibm.sametime.userinfo.userinfobb.UserInfoNotesCustomBB) provided by IBM Lotus as part of Sametime 7.5.1 where you can specify a database path, a view and some field names in the UserInfoConfig.xml and the rest is taken care of for you. While this is well and good it still didn’t work. The problem was trivial to solve but it was difficult to explain why it simply didn’t work.

The issue was that the attributes used to specify the database path and view name are case sensitive!! The customer had simply followed the XML convention of using lowercase attribute names which turned out to be wrong. When you use this implementation the database attribute *has* to be called “DbName” and the view attribute *has* to be called “View”. If you get the casing wrong it wont work!

New PMR coming up – change the implementation of the class to make the attribute names case insensitive. Or read the article in THE VIEW 2008 Technical Supplement to see how to easily write your own blackbox… πŸ™‚