XPages – using # and $ at the same time

Paul Withers posted a great about the XPage Binding and how the order of computing for $(..) and #(..) means that the following code does not compute as we would want it to. The article is well explained and opened my eyes to the intricacies of the timing in JSF. It got me thinking about it and I think I have a solution.

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:text escape="true" id="computedField1"
value="This field's value is#id{id:computedField1}">
<xp:text escape="true" id="computedField2"
value="You are logged in as ${javascript:@UserName()}. This field's value is #{id:computedField1}">

This field’s value is#id{id:computedField1}
You are logged in as CN=Mark Roden/O=MAXDEV. This field’s value is

The solution appears to be forcing the #{id:computedField2} to compute using SSJS @Text – but I am not sure why this works and doesn’t fail like the original example.

is replaced with

I used <xp:value> in this example for clarity because of the extra ” in the @Text formula

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:text escape="true" id="computedField1" value="This field's value is #{id:computedField1}">
 <xp:text escape="true" id="computedField2">
 <xp:this.value>You are logged in as ${javascript:@UserName()}.
 This field's value is ${javascript:@Text("#{id:computedField2}")}

This field’s value is view:_id1:computedField1
You are logged in as CN=Mark Roden/O=MAXDEV. This field’s value is view:_id1:computedField2

UPDATE (02/13/2012)

Sven’s Right – unfortunately this code is not JSF compliant and is more likely to be a bug in Notes which will be corrected in a later version.

Paul came up with a much more elegant solution using dataContexts

Glad to be part of the discussion 🙂

Kindle fire dead – or is it

So my 12yr old who got his Kindle Fire for his birthday (2 weeks ago) comes downstairs with the worst look of horror/guilt on his face last night telling me that his Kindle is dead and he is “SO SO SO SO sorry” and “I didn’t do it” – “I just put it down when I came down for dinner and now it doesn’t work” etc etc

And he was right – the power button was unresponsive – there was no crack on the screen or anything like that, no signs that he’d been stupid with it – so I was resigned to finding my Best buy receipt and we’d be taking it back….

Just in case, I figured I would check out the Amazon Help files – which turn out to be (unsurprisingly) very good –  Trouble Shooting Your Kindle Fire

Went to the Power Issues section and the recommendation was to do a hard reset – Hold down the power button for 20 seconds and try again…..

And it CAME ON (*bells and fanfares*)

So I have a very thankful child who seriously believes I am an IT god and I am happy for him to continue to believe that. This hard reset actually seems to be the recommendation for a number of issues and makes me wonder if they know something about it hard crashing…..meh I digress

The moral of this story is read the help – it really can !

Adding Teamstudio Configurator – Alternate method

Update March 2014

See the comment at the bottom of the page for updated links and/or contact your Teamstudio rep to find out the most up to date links


I LOVE TeamStudio configurator – always have, probably always will

For some reason though (probably permissions or firewall related) I am unable to do the installation via Drag and drop from the website. I drag and drop it – and nothing happens…

Add Configurator 29 Problem

So I figured out a work around and here’s how I did it – might not work for everyone but it might. This also provides an interesting insight into the process and how everything is interwoven in this process.

Right clicking on the Configurator icon and copying the link address gives me this


Looking at the file I find the ftp root for the 29 update


Going there I found the site.xml and that is the one I was looking for


In the Notes Client

Tools—>Widgets—>Getting Started with Widgets

Adding a Widget
Adding a Widget


Select Features and Plugins and hit Next

Add Configurator 29 Step1
Add Configurator 29 Step1


Enter the site.xml URL and hit Load

Add Configurator 29 Step2
Add Configurator 29 Step 2

Select Configurator and hit Next – You will see it start to download

Add Configurator 29 Step3
Add Configurator 29 Step 3

Once it is complete

Add Configurator 29 Step4
Add Configurator 29 Step 4


Add Configurator 29 Step5
Add Configurator 29 Step 5


Add Configurator 29 Step6
Add Configurator 29 Step 6


Add Configurator 29 Step7
Add Configurator 29 Step 7

Restart and we’re done

I am assuming it is the same steps for any of the other products which appear in the site listing but I have not yet tried them.

– Productive

Chaining jQuery – it’s a beautiful thing

A very cool feature of jQuery is the fact that most of the methods returns a jQuery object that you can then use to call another method. {link}

This also increases performance because you do not have to re-select the objects each time.

I am working a form validation model and I want to copy a field and all its attributes into a dialog box to present to the user and have them correct it “in their face” so to speak.

So I want to:

  • Clone the field (generic passed in as JSON string)
  • Append it to the contentFieldset
  • Rename the field id to make sure there is no conflict
  • With the minimum amount of code/effort, while maintaining maximum readability
msg = '{"fieldname": "First_Name", "error": "Enter a First Name"}'
var obj = jQuery.parseJSON(msg);
$("#"+obj.fieldname).clone().appendTo("#contentFieldset").attr("id", "validate_"+obj.fieldname);

And that created the field along with the text which was already entered

<fieldset id=”contentFieldset”>
<input id=”validate_First_Name” size=”25″ value=”Marky Entered this” name=”DEP_FNAME”>

Productive !


Source Code highlighting in your blog – SyntaxHighlighter

I was looking for a way to make my code easier to read in the blog and I found SyntaxHighlighter as it was being used in the XSnippets website.

It is already built into wordpress which is hosting my blog and the format is simple.

Originally I was just italicizing my code

function x$(idTag){
     idTag=idTag.replace(/:/gi, “\\:”);

but if you wrap it with the appropriate code for WordPress

Syntax Highlighter Example
Syntax Highlighter Example

gives us a much easier on the eye:

function x$(idTag){
	idTag=idTag.replace(/:/gi, "\\:");

It also gives you the ability to copy and view – LOVE IT !
Productive !

jQuery selector function for xPages – x$(“#{id:inputText1}”)

In a previous post I discussed the problems with using jQuery selectors in an xPage. I wanted to make a simple function to overcome the issue in xPages and I must have been having a brain fart that day as it is actually very simple and I couldn’t see it.

The crux of the solution is to create a jQuery object representing the dynamically created xPage input field id

A normal jQuery selector for the inputText1 field would look like this


My new selector looks like this


To achieve this we add the following function to your xPage

function x$(idTag, param){ //Updated 18 Feb 2012
 idTag=idTag.replace(/:/gi, "\\:")+(param ? param : "");

Use the new selector in the same way that you would in jQuery

x$(“#{id:inputText1}”).css(‘border’, ‘2px solid green’);
(or with an extra parameter)
x$(“#{id:viewPanel1}”, ” tr:even”).css(‘border’, ‘2px solid green’);  //Note the space before ”  tr:even”

the function works like this:

  • It receives the dynamically created idTag
    • view:_id1:inputText1
  • It replaces the colon’s with \\:
    • view\\:_id1\\:inputText1
  • Using the new string it returns the jQuery selector object we are looking for
    • $(“#”+” view\\:_id1\\:inputText1”)
Example using the x$ jQuery selector in an xPage
Example using the x$ jQuery selector in an xPage


The attached word document contains a demonstration database

jQuerySelector_X sample database

Update – 18 Feb 2012

This is going to evolve apparently….I realized tonight as I was trying to use my own function I had made the case for replacing the colon (:) but I had overlooked the fact that they can still be used. I have updated the function above with the param argument.

The following fails because the tr:even gets converted to tr\:even

x$("#{id:viewPanel1} tr:even").addClass("alt") //creates $("#view\:_id1\:viewPanel1 tr\:even")

so I added a param argument to function (which is optional) which allows the selector to be passed without any colons being replaced

x$("#{id:viewPanel1}", " tr:even").addClass("alt")

creates the desired end jQuery code

  $("view\:_id1\:viewPanel1 tr:even")