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!

My feed has been broken for 2 weeks so here are 5 posts you might have missed…

My RSS feed has apparently been broken for the last two weeks so I’ll summarize the posts from this period below:

Show ‘n Tell Thursday: Configuring Ubuntu for Notes 8 plugin development (2 April 2009)


This weeks SnTT post is about configuring Eclipse on Ubuntu 8.0.4 for Notes plug-in development. I use Notes 8.5 but it should work equally well for Notes 8.0.x clients. Wan’t to develop plug-ins? Well read on and do it on Ubuntu. Notes 8.x runs freakishly fast on Ubuntu. Read on…

Actually this is a cheat post as the steps are almost the same as for doing it on Windows. Most of the stuff has to do with platform differences. My post for doing it on Windows is here. I have updated this guide with steps for Linux. Enjoy!!

LotusLive.com going commercial – what will that mean for Lotusphere presentations?

So I just received an e-mail from LotusLive.com about the beta moving on to be a 45 day trial. What will that mean? Well for me only that I will no longer use LotusLive.com which isn’t too much of a loss for me. The main issue is that I’ll no longer have access to the Lotusphere 2009 presentations which is a shame. I thought the beauty of having the presentations there was that they would remain there… Unfortunately not.

On plug-ins, features, update sites and extension.xml files…

I’m receiving quite a few e-mails asking questions about features, plug-ins, update sites and extension.xml files and how they relate so I thought I would try and clarify things.

Term Description
Plug-in The smallest unit of code you use to create functionality for an Eclipse based client. This is where the actual Java code is.
Feature Used to package and bundle plug-ins together. Features are thin wrappers for plug-ins and is basically a single file called feature.xml. You can bundle multiple plug-ins into a single feature. When installing code into Notes you actually install the features which in turn point to the plug-ins to copy to the client. You can only manage features through the Notes “code UI” (File/Application/Application Management) though you can install code into the platform by simply copying the plug-ins into the appropriate directories in the file system. This is not recommended… 🙂
Update site Update sites are used to deploy features to clients. An update site is simply a directory containing a

  • “plugins”-directory containing a jar-file per plug-in
  • “features”-directory containing jar-file per feature
  • site.xml file describing which features and plug-ins (and in what versions) are available on that particular update site

When an Eclipse based client contacts an update site it reads and parses the site.xml file to discover what’s available there.

Update Sites may be remote or local. A local update site is a directory on a local hard drive or LAN drive with the above structure or a zip-file with the above structure. An update site may also be remote and may be read using HTTP (any server will do) or it may be read using NRPC if you’re using a Notes 8+ client. When using NRPC you use the Update Site Notes database template.

extension.xml These files are used when installing code using the MyWidgets sidebar plug-in and is a shorthand for manually installing code. There is no magic at work here. When you drop an extension.xml file onto the sidebar panel the following steps are performed:

  1. The extension.xml file is parsed and verified to be a valid XML file
  2. The features to be installed are located and a dependency graph is assembled so any required features are identified
  3. The update site address specified in the extension.xml file is contacted and each missing feature in the dependency grapg is attempted installed “bottom up”
  4. The client is restarted