Usability - Productivity - Business - The web - Singapore & Twins

By Date: April 2012

HSBC is starting to seriously annoy me #fail

End of last month HSBC Singapore approached me and offered to upgrade my Credit Card to their shiny new VISA Infinite. Unsuspecting for what I was in for, I agreed and the trouble started. To give you an idea, this is the content I sent to them on January 14 2012:

From: Stephan Wissel <stephan@wissel.net>
Date: Sat, Jan 14, 2012 at 7:25 PM
Subject: Credit Card in eBanking
To: direct@hsbc.com.sg
Hi there,

I'm using HSBC Credit Cards and I'm currently switching from a Visa Platinum to a Visa Infinite card.
The process you have in place for this needs improvements. These are the problems I encountered so far:
  1. The old card was canceled without notifying me when this will happen (a odd situation when you want to buy something)
  2. The new card hasn't arrived when the old was canceled - you lost quite some money on provisions that way
  3. I got a notification eMail that the new card was approved and that in a few days it will arrlive - I replied that you need to expedite that since I would travel - I never got a reply. If messages like these are sent from an unattended mailbox the mail needs to state that clearly
  4. I logged into my eBanking and the old card has disappeared including the ability to retrieve statements and transfer the open balance. So I can't know what I owe and I can't pay that - rest assure, that I will not pay any late fees
  5. The new card doesn't show in the Internet banking either (anyway I don't have the card with me - I left before it might have arrived at home)
  6. the Internet banking lacks the ability to contact you, so I have to resort to the inherently unsave eMail (unless you can point me to encryption keys we can use)
All in all: I'm very disappointed! I will be back in Singapore next Monday. If you need to call: I'm currently in the GMT-6 timezone, call during daytime here.
I never got a reply. So I escalated to the sales lady who sold me in the first place. The matters couldn't be resolved. I never got the new card, so I paid the balance of the old (they sent a paper invoice in the end) and I terminated my customer relationship with HSBC. This didn't stop them sending me a credit card bill for a card I never had demanding the annual fee. So far I sent every invoice back with the statement: "bill for services not rendered, refuse to accept". Today - after they sent another one I replied with a formal letter:

The Hongkong and ShanghaiBanking Corporation Limited
Robinson Road PO Box 896
Singapore 901746

Credit card xxxx-xxxx-xxxx-xxxx

To whom it may concern,

today I received – again – a credit card bill for above HSBC Visa Infinite card.
This bill is NOT justified. The credit card was, based on your mishandling of customer service, never delivered and never activated.

Due to the poor handling of this matter (e.g. canceling the existing card before verifying the new card arrived and not reacting on my communication) I terminated all business relationship with your bank.

Still you are sending bills for services not rendered. I notified you on that before. It looks to me, that your process is not working and it is costing me my time.

You will understand, that I have to bill you for my time lost, based on my commercial rate in the market place. Please do the following:
  1. accnowledge that you have received this letter
  2. stop sending unjustified bills
  3. pay the enclosed invoice to compensate me for time spent

Best regards

Stephan H. Wissel
Curious what happens next. I wonder if I have to complaint to CASE next.

Posted by on 30 April 2012 | Comments (0) | categories: Business

Extracting data from Domino into PDF using XSLT and XSL:FO (Part 4)

This entry is part of the series Domino, XSL:FO and XSLT that dives into the use of XSLT and XSL:FO in IBM Lotus Domino.

So far we had a look at the all over process, some Java to convert FO into PDF and FO Basics. Time to get some Notes data exported. To make the task easier I created a little helper that allows convenient export into XML. Currently it works on a NotesDocument(Collection) basis, but it would be a small step to add a method that uses a view navigator for speed.
The most complete rendering of a NotesDocument is done using the .renderXML method. For a collection you use a NotesDxlExporter. Unfortunatelty both methods are comparable slow. So I added an alternate approach (works only if you don't have RichText for the moment) and export lean XML.
A Form2XMLDefinition class (optional) allows to pick which fields need to be picked in the XML file. It also allows to group those fields (more on that another time - or look at the source). So the methods are:
package com.notessensei.fop ;

import java.io.ByteArrayOutputStream ;
import lotus.domino.DocumentCollection ;
import lotus.domino.Session ;

public interface Notes2XML {
    public abstract void addForm (Form2XMLDefinition newForm ) ;
    public abstract ByteArrayOutputStream renderDocument2DXL (lotus. domino. Document doc ) ;
    public abstract ByteArrayOutputStream renderDocument2XML (lotus. domino. Document doc ) ;
    public abstract ByteArrayOutputStream renderDocumentCollection2DXL (Session s, DocumentCollection dc ) ;
    public abstract ByteArrayOutputStream renderDocumentCollection2XML (DocumentCollection dc, String rootName ) ;
I expanded the PDFReport class with a convenience method: getNotesXMLExporter() to be able to reuse my managed bean (beginnings of a Facade pattern).

Read more

Posted by on 28 April 2012 | Comments (1) | categories: Show-N-Tell Thursday XPages

Extracting data from Domino into PDF using XSLT and XSL:FO (Part 3)

This entry is part of the series Domino, XSL:FO and XSLT that dives into the use of XSLT and XSL:FO in IBM Lotus Domino.

In Part 2 I introduced the Java code required to output PDF from XSL:FO and how that code can be called from an XAgent. Now lets have a look at XSL:FO itself. It is a W3C defined standard to layout documents. You could consider it as competitor to PostScript or PDF. XSL:FO contains both layout instructions and content. Since it is expressed entirely in XML, it is easy to manipulate (follow me for a moment and accept XML is easy) and - more importantly easy to split content and layout for reuse. Typically a complete XSL:FO document would be only an intermediate step in PDF production. The report design (without data) would be contained in an XSLT stylesheet that gets merged with XML data. You could consider XSLT the "templating language" of XSL:FO.
A XSL:FO document has a single <fo:root> element. This contains one or more page-sequence elements, that contain the actual content and a layout-master-set, that defines the pages.
XSL:FO layout-master-set
Besides the page size (and content orientation) a simple-page-master defines header, footer, left and right column (called regions). You need to get your math right there. The margin and the regions are both substracted from the page size to compute the real margins. When you have a margin="1cm" and a region-start with 3cm width, then the left margin is 4cm. Read up the XSL:FO tutorial on w3schools.com for more details.
The main element region-body allows to specify a column-count attribute that will create multi-column page layouts without the need for a table and a manual calculation of column content. You also could define alternating page masters, like left and right pages or different pages for a chapter beginning - read details in the repeatable-page-master-alternative specification.
Your main content is contained in one or more page-sequences.
The page sequence contains the content. Don't get confused: a page-sequence represents content of n number of pages (n >=1), not just one page. You need more than one page sequence only when you want the page layout to use a different master/style (of course using the alternatives mechanism described above you can achieve alternate styles inside a single page sequence). The page sequence contains one or more flows. A flow is targeted at a region (there are 5 of them) and contains block elements (think HTML div,p,table etc.) that contain the content. There are a huge number of specialised attributes and elements (stuff like watermarks or graphics) available you can learn about in the specifications.
In practise you write a sample XSL:FO document and transform it into PDF. Once you are satisfied with the results, you then convert the XSL:FO document into an XSLT stylesheet. This is easier than it sounds, you simply wrap xsl:template tags around your fo and replace your sample content with xsl:apply-templates statements. w3schools has a simple example. Of course XSLT is a interesting topic on its own, go and read the XSLT 2.0 and XPath 2.0 Programmer's Reference (also available on Kindle ).
Next stop: How to pull Notes data into XML for processing.

Posted by on 28 April 2012 | Comments (2) | categories: Show-N-Tell Thursday XPages

Extracting data from Domino into PDF using XSLT and XSL:FO (Part 2)

This entry is part of the series Domino, XSL:FO and XSLT that dives into the use of XSLT and XSL:FO in IBM Lotus Domino.

In Part 1 I discussed the process of getting data from Domino to PDF using only open standards. In this part I want to start backwards: If I have valid XSL:FO, how do I get the PDF output? In a later installment I will discuss what XSL:FO is capable of and how to create it using XSLT. Finally I will discuss how to extract XML from your data source (Domino or others).
I choose the backwards approach since it is easier to understand walking from the desired output towards a stylesheet than creating a stylesheet if the result isn't clear. Bear with me for this approach.
I will use Apache FOP as my rendering engine. The Quickstart compresses the needed steps neatly into 1-2-3 (pun intended):
  1. Download
    This is the easy part. Pick one of the mirror servers and get fop-1.0-bin.zip (24M) - check if you read this later if there is a newer version. Extract it to a directory of your choice, we will import/copy what we need from there
  2. Configure
    You have choices:
    • copy the Fop files into jvm/lib/ext (bad idea)
    • import it into an NSF (twice: once for agents, once for XPages)
    • create a plug-in (good for sidebar and XPages, not good for agents)
    Having coined the term XAgent I will stick to the XPages version with import into the NSF. Time permitting I'll add a plug-in approach to this little series.
  3. Run
    The FOP website provides a good overview on general Java use as well as servlet specifics. Using that information as template it is not too hard to implement a managed bean that takes a XMLDocument and an optional Stylesheet and returns the rendered PDF as result
Since our output will be rendered by a managed bean, we need to configure it in the faces-config.xml:
    <managed-bean-name>PDF </managed-bean-name>
    <managed-bean-class>com.notessensei.fop.PDFReport </managed-bean-class>
    <managed-bean-scope>session </managed-bean-scope>
The XAgent follows the usual pattern:
var exCon = facesContext. getExternalContext ( ) ;
var response = exCon. getResponse ( ) ;
var out = response. getOutputStream ( ) ;
response. setContentType ( "application/pdf" ) ;
response. setHeader ( "Content-disposition" , "inline; filename=result.pdf" ) ;
response. setHeader ( "Cache-Control" , "no-cache" ) ;
// In this example the text in sessionScope.longText will be rendered
var written = sessionScope. longText != "" ? "<text>" +sessionScope. longText + "</text>" : null ;
// Writes the default rendering out
PDF. fopReportFromString (out ,written , null ) ;
// Stop the page from further processing;
facesContext. responseComplete ( ) ;
out. close ( ) ;
To get the Java class working I needed to import:
  1. avalon-framework-4.2.0.jar
  2. batik-all-1.7.jar
  3. commons-io-1.3.1.jar
  4. fop.jar
  5. serializer-2.7.0.jar
  6. xmlgraphics-commons-1.4.jar
The class for the PDFReport contains just some wrapper code to render "FO" or "XML with XSLT" into a PDF. It is demo code, you want to add more robust error handling. Next stop: more about FO
As usual YMMV.

Posted by on 26 April 2012 | Comments (2) | categories: Show-N-Tell Thursday XPages

LotusScript LSI_INFO potentially harmful on (64Bit) Domino

There is a handy, but undocumented LotusScript function LSI_INFO that can lead to crashes of the Domino server, especially on 64Bit systems. Since the function never had been documented, a fix for that can't be expected any time soon (or at all). Unfortunately that function is used in OpenLog an incredibly useful logging application written by Julian Robichaux. Here is how to fix this:
  1. Make sure you use the latest release (you also can use the code contained in TaskJam, it is extended to be able to log XPages)
  2. Edit the OpenLogFunctions script library and add into the initialize statement: NoLSIStackTrace = True
  3. Make sure all applications that use OpenLog get the updates library (if you copied it with intact inheritance a "load design" will do)
As usual YMMV

Posted by on 24 April 2012 | Comments (7) | categories: Show-N-Tell Thursday

Teaching an ol' dog a new trick: SET CONFIG param=value update

One of the cardinal sins of Domino administration (besides FTP/copy of a server NSF) is the manual editing of notes.ini variables. To update an notes.ini variable instantly you can use the server console and type set config param=value, while for permanent changes you would add the value to a server configuration document. Using the server configuration document has the advantage, that your ini changes not only will survive a reboot or even loss of your notes.ini, but they serve as documentation too.
My colleague Thomas Hampel today pointed me to a technote that I wasn't aware of. It explains how to combine these two steps into one:
set config param=value update will instantly activate a parameter and wite it back into the server configuration document. For lazy or forgetful administrators you can issue this command once: set config ENABLE_SRVCFG_NAB_UPDATE=1 update and it will automatically update any parameter into the configuration document when you change it through a set command. Just keep in mind: don't edit that notes.ini on the OS level:
I will never edit a notes.ini on the OS level
(Courtesy of the Bart Simpson Generator)

Posted by on 24 April 2012 | Comments (1) | categories: Show-N-Tell Thursday

Extracting data from Domino into PDF using XSLT and XSL:FO (Part 1)

This entry is part of the series Domino, XSL:FO and XSLT that dives into the use of XSLT and XSL:FO in IBM Lotus Domino.

We all know " Notes doesn't print". Nevertheless the topic of document output and reports is not going away, even if I'd like to ban the reports. There are plenty of ready made tools, but today I'd like to start with home cooked reporting.
Why the effort? Using only tools that use open standards you gain more control over the whole process and you can use whatever deems fit. The downside: it is more things you need to know and might not be suitable for business users (but its great to torture interns). In the long run you have a portfolio of source transformations that you can combine potentially faster than any reporting tool. The general principle is "Extract Transform Render":
Extract Transform Render
  1. Extract:
    Whatever will pull out the XML for the second step will do the trick. For list type of rendering ?ReadViewEntries will do the trick or simple DXL exports. Quite often you might opt for some bespoke code to extract code with an eye of a fast and/or easy transformation phase. You also might consider to extract your data in conformance with an established international standard
  2. Transform:
    This step usually takes the XML from the extract phase and runs it through one or more XSLT transformations. XSLT is kind of IT Black Magic (other say it's just set theory) and can use quite some computing power. For high performance the pros use a dedicated applicance. Once you get the heck of XPath you can do some amazing reporting (e.g. "give me all sales guys where withing the last 5 sales of the 3 guys next to his ranking there was a carpenter")
  3. Render:
    Rendering is easy. The outcome of the transformation step will be XSL:FO which is a page description language. Use a free renderer or a commercial offering and a few lines of code. The output typically is a PDF file, but you can target graphic formats too.

Read more

Posted by on 23 April 2012 | Comments (3) | categories: Show-N-Tell Thursday XML XPages

Importing EML files into Notes (lots of them)

My friend and Lotus Champion Weerapong Panpai from Zenith in Thailand asked me " How difficult is it to do a bulk import of eml files into Lotus Notes"? MIME as a format is plain ASCII, so on first look it seems simple.
However on a closer look you might guess where the author of an outstanding movie got his inspiration from. RFC 2045 nicely states:" NOTE: The previous four definitions are clearly circular. This is unavoidable, since the overall structure of a MIME message is indeed recursive." So trying to parse that messages on my own was clearly out of the question. Luckily there is ready code available. On one side there is JavaEE and the the MimeMessage and on the other Apache James. An implementation of the javax.mail.internet classes is hidden somewhere in the Notes client, so that would favour MimeMessage. However I found it easier to work with the mime4j classes. Here is what I came up with:
package com.notessensei.mimeimport ;

import java.io.IOException ;
import java.io.InputStream ;

import lotus.domino.Document ;
import lotus.domino.NotesException ;
import lotus.domino.Session ;

import org.apache.james.mime4j.MimeException ;
import org.apache.james.mime4j.parser.ContentHandler ;
import org.apache.james.mime4j.parser.MimeStreamParser ;

public class Mime2Doc {
    public void importMail (Session s, InputStream in, Document doc ) throws NotesException, MimeException, IOException {
        doc. replaceItemValue ( "Form", "Memo" ) ;
        MimeStreamParser parser = new MimeStreamParser ( ) ;
        ContentHandler h = new DocContentHandler (s, doc ) ;
        parser. setContentHandler (h ) ;
        parser. parse (in ) ;
The bulk of the work happens inside the ContentHandler. Using a Stack (that works LIFO) I can track Mime entries inside mime entries inside mime entries. Still the code is just below 100 lines.
The final piece in the puzzle is the class that helps to track the MIME Parts that are put onto the Stack and returns MIME-Type and encoding derived from the header fields. You are ready to test.

Read more

Posted by on 23 April 2012 | Comments (18) | categories: Show-N-Tell Thursday

Roots of Wisdom

The 21st knowledge society needs to teach different skills than recalling knowledge. I introduced the 9 essential skills a few days ago. Based on an article titled "Older and wiser?" in The Economist there are 5 critical aspects of wise reasoning to add:
5 roots of wisdom
  1. willingness to seek opportunities to resolve conflict
  2. willingness to search for compromise
  3. recognition of the limits of personal knowledge
  4. awareness that more than one perspective on a problem can exist
  5. appreciation of the fact that things may get worse before they get better
Can they be taught? I fear that the fifth aspect has been completely lost in our hypercompetitive business environments, short of the management pep talks of "no pain - no gain". Number one and two might be a difficult call for Testosterone loaded youngsters until they recognize that coming to an agreement isn't the same as giving in (or the hormone wears off). Number three clashes with manger's ego and number four gets brushed aside with " seeing other perspectives doesn't create the next iPhone". So when wisdom manifests, I believe it does, its roots run deep having weathered these storms.

Posted by on 08 April 2012 | Comments (0) | categories: After hours

Setting focus to the first invalid field

When it comes to validation, the only secure way is server side validation (Client side validation is more: "nice suggestions for users"). One little grievance developers have - and try to fix with elaborate measures - is the requirement to set the focus on the first failed field. XPages makes this quite simple. As Tommy pointed out fields that are invalidated server side get the attribute aria-invalid="true".
Besides, as Tommy suggested, using it to style the input (check his comment - cool idea), you can use it to set the focus on the first invalid field. The key component is the dojo.query function. It allows all sorts of interesting queries, including for attributes. So add a simple Script block with this static value to your page:
XSP. addOnLoad ( function ( ) {
      var invalid = dojo. query ( "[aria-invalid=true]" ) ;
      if (invalid. length > 0 ) {
         invalid [ 0 ]. focus ( ) ;
      } ;
} ) ;
As usual YMMV

Posted by on 07 April 2012 | Comments (1) | categories: XPages

Inside the IBM Support Process

No software runs flawless (even if the product is named after a fruit), so from time to time you need to interact with support. The entry point for IBM support is the IBM Support Portal or the support call center. Behind that front is quite a bit a process that is designed to be predictable, repeatable, measurable and ensure that customers get the right level of attention from the right level of expertise. Scribbled on a napkin it looks like this:
IBM Support Sequence Diagram
(click on the image to get a bigger picture)
So you are just 2 degrees away from core development. Level 1's responsibility is to ensure that as much evidence as possible gets provided. This is often the most time consuming task and would tie down product experts quite a bit. It is often a point of contempt since you are not talking to a product expert yet (ironics would say: nothing can be called a process if it isn't broken"). The trick here: call in prepared to keep that phase as short as possible. Also be clear what support does: " Technical question support allows you to obtain assistance from IBM for product specific, task-oriented questions regarding the installation and operation of currently supported IBM software. Short duration problems involving but not limited to: "
  • Installation
  • Usage (how-to)
  • Specific usage/installation questions for documented functions
  • Product compatibility and interoperability questions
  • Technical references to publications, such as Redbooks or manuals
  • Assistance with interpretation of publications
  • Providing available configuration samples
  • Planning information for software fixes
  • IBM database searches
and what it doesn't:
  • Performance analysis
  • Writing, troubleshooting or customizing client s code
  • Extensive configuration questions
  • Recovering a database, or data recovery
  • Consulting
The IBM sales representative will happily discuss a service engagement for the above needs. The full IBM support handbook is available online.

Read more

Posted by on 05 April 2012 | Comments (3) | categories: IBM

Wipe them out - all of them (when a design refresh doesn't work)

You created that shiney new version of your application, ran (in no particular order) fixup, compact and updall and replaced the design. Still some of the design elements haven't updated. Typically that happens when no attention was paid to the "prohibit design refresh" flag of the database design (all your predecessor's fault of course).
While you can go in and hunt the settings down one-by-one (tip: use an DXL export and just look for the property), it is sometimes faster and more profound to strip the offending database(s) from their design entirely before applying the "Replace Design" action.
To do that I use a script in my little universal toolbox. A word of caution:
  • Use it at your own risk
  • Backup the database beforehand
  • Check in Domino Designer's "Navigator view" (the Eclipse panel, not a Notes view) that they are all gone
  • You have been warned
As usual YMMV

Read more

Posted by on 05 April 2012 | Comments (b) | categories: Show-N-Tell Thursday

Reuse web agents that use PRINT - Bean edition

Using Java in XPages does have performance advantages especially when you can use EL instead of SSJS. So I created the Java version of the reuse web agents post. You need to copy the Java either into your NSF or include it in your own extension library. Calling an agent is limited to the same database as the XPage resides in, I leave it to an exercise for my readers to improve on that.
You define the Java class as a managed bean:
    <managed-bean-name>agentHelper </managed-bean-name>
    <managed-bean-class>com.notessensei.xsp.utilities.LsAgentHelper </managed-bean-class>
    <managed-bean-scope>request </managed-bean-scope>
and then simply include (e.g. in the value of a computed field) ${agentHelper.agentResult("SampleAgent")} as EL entry. You have to be careful to ensure your agent doesn't run twice. The agent side adjustments (the LotusScript stuff) is the same as for the SSJS version. The Java version is slightly more flexible since it allows String or Stream results and acting on a new or existing document.

Read more

Posted by on 03 April 2012 | Comments (0) | categories: XPages