Automatically redirect iPhone users to the mobile UI of Lotus Connections

If you’re running Lotus Connections 2.5 and you installed the mobile interface you really should redirect your mobile users to this interface and not have them remember the URL to the mobile interface. By default users need to specify http://<hostname>/mobile to access the mobile interface (see bleedyellow.com/mobile if you want to see what it looks like) which is not what you want. You want it to happen automatically. To accomplish this simply use mod_rewrite to automatically redirect the user based on the User-Agent of the accessing browser (much like setting the default feature).

To add a mod_rewrite rule to automatically redirect iPhone users add the following to your httpd.conf and restart IHS. Doing the same for Nokia S60 users should be equally easy if you know the User-Agent for those phones.

RewriteCond %{HTTP_USER_AGENT} "^Mozilla/[0-9].[0-9] (iPhone.*"
RewriteRule  ^/?$ /mobile [R,L]

Easy isn’t it?

I’m a certified Lotus Connections 2.5 Administrator


It’s official – I’m certified! How cool is that?! The certification exam was quite hard and the questions range from Websphere Application Server administration questions to administering the individual features to configuring security to deployment scenarios. There’s a huge deal of things you need to know and the infocenter was my friend throughout preparing for the exam. Don’t bother taking the exam if you haven’t worked with the product for a while and put in the hours preparing.

I must admit that this is my first ever Lotus certification as I’ve never had the need before. While studying for this exam my view on certification has changed a bit. Before taking this exam I heard all the stories about certification and how it was about know exact UI wording etc. This exam was nothing like that. The question was very valid and made you think quite a lot and base your answer in your knowledge of the product. An exam as it should be. Another benefit is that I’ve read about areas of the product I otherwise wouldn’t have and I’ve discovered quite some stuff that I need to implement or configure at customers. All very nice.

Using Abdera XPath on the Lotus Connections service document

As always namespaces and XPath/XSLT is “funny” to play around with. Tonight I have been messing a little with the ATOM feeds available in Lotus Connections and needed to use XPath to extract a URL from the service document instead of the object model in Abdera. I didn’t find it all together easy to figure out so I’ll post it here in case it helps anyone. The key is to specify a java.util.Map with the two namespaces in use (atom, app) when doing the XPath (the “ns” variable) and remembering to use the correct namespaces in the actual XPath string.

Document<Service> doc = ...;
XPath x = Abdera.getNewXPath();
Map ns = new HashMap();
ns.put("atom", "http://www.w3.org/2005/Atom");
ns.put("app", "http://www.w3.org/2007/app");

String link = x.valueOf("/app:service/app:workspace" +
   "/atom:link[@rel='http://www.ibm.com/xmlns/prod/sn" +
   "/mv/theboard']/@href", service, ns));
System.out.println("Link: " + link);

Using a non self-signed certificate with Lotus Connections

When you deploy Lotus Connections you find out that the login has to be done using SSL and hence you need a SSL certificate. When Lotus Connections is installed a self-signed certificate is generated but you’ll probably want to use a “real” certificate whether this be one signed by a public CA or one signed by a corporate CA. Doing this is quite simple if you only swap out the IBM HTTP Server certificate as this only requires change to httpd.conf and using the ikeyman application.

Although the ikeyman application looks like something from another century it works and does its job. To launch it go to c:websphereappserverprofilesappserver1bin and invoke ikeyman.bat (substitute the path as appropriate). Once this is done follow the documentation to create a new keystore database (KDB format) and create a stash file. Then generate a new key pair and submit the keys for certification at your CA (again follow the documentation). The stash file is used by the web server to open the otherwise encrypted keystore without a password.

When you receive the reply please bear in mind that the certifying certificate must be in the keystore before accepting the reply. For most CA’s this will require you to import a certificate before proceeding. This goes for Equifax as well as Verisign. The easiest way to find these is to surf to your CA and search for “intermediate”.

Once this is done you can import the certificate reply, update httpd.conf, restart IHS and you’re laughing…

By popular demand – scaling images in Java for Lotus Connections

After blogging about how Lotus Connetions teaches you to scale images in Java the other day I was contacted by Lotus Support who really would like to see the code as customers were asking for such code. Mitch also forwarded me a response from Lotus Support where they referred to my blog post which I got a real kick out of… 🙂

So here’s the code. Thanks to the customer for allowing me to blog the code. Use to your hearts content but don’t blame me if it doesn’t work for you. The disclaimer is there for a reason.

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOError;
import java.io.IOException;

import javax.imageio.ImageIO;

public class ScalePicture {

  public static void main(String[] args) {
    try {
      File f = new File("d:\images");
      File pictSrc = new File(f, "source_photo.jpg");
      File pictDest = new File(f, "destination_photo.jpg");
      if (pictDest.exists()) {
        System.out.println("deleting...");
        pictDest.delete();
      }

      // scale image
      BufferedImage img = scaleImage(pictSrc);

      // write to target image
      ImageIO.write(img, "jpg", pictDest);

    } catch (Throwable t) {
      t.printStackTrace();
    }
  }

  private static BufferedImage scaleImage(File source)
    throws IOException {
    // declarations
    final int width = 115;
    final int height = 115;

    // read source image
    BufferedImage imgSrc = ImageIO.read(source);

    // calculate scale factor
    double scaleFactor = (double)imgSrc.getWidth() /
      (double)width;

    // scale image
    BufferedImage imgScaled = new BufferedImage((int)
      (scaleFactor * 100), height,
      BufferedImage.TYPE_INT_RGB);
    AffineTransform transform = AffineTransform.
      getScaleInstance(scaleFactor, scaleFactor);
    Graphics2D g = imgScaled.createGraphics();
    g.drawRenderedImage(imgSrc, transform);
    g.dispose();

    // create new target image in correct size
    // with white background
    BufferedImage imgResized = new BufferedImage(width,
      height,
      BufferedImage.TYPE_INT_RGB);
    g = imgResized.createGraphics();
    g.setBackground(Color.WHITE);
    g.fillRect(0, 0, width, height);

    // calculate offset for scaled image on new image
    int xoffset = (int)((double)(width - imgScaled.getWidth()) /
      (double)2);

    // draw scaled image on new image
    g.drawImage(imgScaled, xoffset, 0, null);
    g.dispose();

    // return new image
    return imgResized;
  }

}

Configuring SSO between Lotus Domino and Lotus Connections

This morning I configured single-sign-on (SSO) between Lotus Connections and Lotus Domino and was again surprised by how easy it is. The steps are simple:

  1. Open the WAS server administration interface and go to Security > Secure administration, applications, and infrastructure > Authentication mechanisms and expiration.
  2. Select “Authentication mechanisms and expiration” in the “Authentication” section on the right hand side.
  3. Now in the “Cross-cell single sign-on” section specify a set of passwords and export the keys to a file on the file system.
  4. Move the file to your local file system.
  5. Now follow the guidelines in the Domino Administrator help for importing the keys into Domino LTPA configuration.

Lotus Connections teaches you how to scale images in Java

Lotus Connections is a little bit screwy when it comes to profile pictures IMHO as they are being forced to be square in Profiles (115×115 pixels). In profiles search results however they are scaled to 55 pixel in width and height is automatic…

In my mind portrait pictures are rectangular and not square.

Yesterday this gave me some grief as I was at a customer where I had to write Java code to import pictures in the PHOTO table of the Lotus Connections PEOPLEDB database. The actual importing the pictures into the database is easy using JDBC but the pictures showed up wrongly in Lotus Connections as they were rectangular (200 x 133 pixels). They clearly had to be scaled but how – clearly not manually!

As with many other things you are gifted with Java as it already contains all the pieces you need to scale pictures. I quickly found some sample code on Google to use java.awt for the resizing. The solution was to

  1. Scale the source image from 200 x 133 pixels to 115 x 76 pixels to keep the aspect ratio
  2. Create a new blank white image sized 115 x 115 pixels
  3. Place the resized source image on top of the white image centered
  4. Upload the resulting image to the database as a byte array

Love Java!