Using LanguageWare with Lotus Notes

I had meant to finish this a long time ago, but I remembered how annoying it is to do video recording, so I might ramble on a bit (It’s no notes in 9!).

So this demo will give a very brief overview of how you can create a personalised live text/analysis system in XPages using UIMA. It demonstrates using Languageware, which takes a lot of the pain out of working with UIMA. We quickly create a names dictionary of over 5,000 first names, then teach it how to understand a full name.

[edit] I redid the video so it is more watchable now.

Why you should use source control (doh!)

I have been tinkering with an application on and off for a few months. The plan was to submit to openNTF at some stage.

I am spending maybe 30 minutes max every couple of weeks. Each time I finished changing it for the day I would create a new copy of the database. That way if I make a mess I can revert back to previous version (safety vs Eclipse Local History).

I wasn’t using source control, because it was only one user and what could possibly go wrong? :) right??!!

So recent sit down with the code, I had CSS misbehaving and it was pushing my repeat control all over the place. After some annoyance I finally got that working. Checking it in the client while it worked I found one of the action buttons now was broken. I was pretty sure I didn’t touch the button.

I go back to the previous release and see there is a whole load of code differences. I paste them back in. I noticed however the code in the backup appears to be out of sync in what I did the last time.

Checking back further I realized that I was working from the backup of an earlier day and had done so a few times. -_-”

So now my code is working perfectly, just in multiple different databases.

On the plus side it looks like ExtLib will do nearly everything I had coded anyway, making life easier to create my Frankensteins monster of a new database. Only this time I will be using a source control.

Databinding to an image component.

embedding image example.

The XPages image component is read only. So it is great for reading an image from your document/URL, but if you do any kind of image editing then it becomes a pain to save it back. Or if you need to pull an image from another location (ie. avoid link jacking) it doesn’t have an easy way to do this.

The easy way around it is to convert the image to a text resource instead.You can pull an image, convert to text and store with ease, using Java. The image component can then read the value directly.

Example XPage code: 

 <?xml version="1.0" encoding="UTF-8"?>
 <xp:view xmlns:xp="http://www.ibm.com/xsp/core">
 <xp:image id="image1">
 <xp:this.url>
 <![CDATA[#{javascript:
var urlString = "http://sodohertydotcom.files.wordpress.com/2012/01/simondemoing.png";
var url = new java.net.URL(urlString);
var bi = javax.imageio.ImageIO.read(url);
var baos = new java.io.ByteArrayOutputStream();
javax.imageio.ImageIO.write(bi, "png", baos);
var byteArray = baos.toByteArray();
var base64Bytes = com.sun.org.apache.xml.internal.security.utils.Base64.encode(byteArray);
// Save this variable to your text field.
var answer = "data:image/png;base64," + base64Bytes;
return answer;}]]>
 </xp:this.url>
 </xp:image>
 </xp:view>

Limitation: 

Due to a bug in Java it is not possible to save the favicon.ico image from a web site this way.

Connecting to Domino on the iPhone (Restoring old files)

Checking my previous blog, I noticed that the tutorials on connecting an iPhone to Domino was missing. The PDF’s are for an older version of XCode, but someone may still find useful.

Tutorial 1 – Connecting to a Domino View in an iPhone Application

Tutorial 2 – Connecting to a Domino Document in an iPhone Application

Tutorial 3 – Displaying an image from a Notes document.

 

New years wiki updates.

Happy new year! 

To start the new year I have updated the Domino Appdev wiki with the following.

Mapping Agent code to an NSD crash stack.
Updated it with more relevant information to help you track that code which is causing a crash.

Creating your first Web Service provider and consumer in LotusScript and Java.
A tutorial for newbies to web services.

Testing your Domino web service provider and consumer using SoapUI.
After following the previous walkthrough this goes through how to capture the SOAP request and response of your Domino web services. The sample covers the LotusScript provider and Java consumer.