IBM Champion 2016

I just wanted to say how honored I am to be nominated and accepted as an IBM Champion for the third year.

Thank you to everyone who nominated me – I really appreciate it and it is good to know that in a small way I make a difference.

It has been an interesting year, what with Bluemix and XPages coming together for me, job position changes within PSC and much more.

I cannot overstate this enough….Thank you

 

Here’s to an interesting 2016 🙂

 

Advertisements

XPages in Bluemix: Creating a searchable REST service

In this article I will demonstrate how we can set up a new searchable REST service in an Bluemix XPages environment.

Introduction

This article was driven by a question on Twitter from Paul Ramos (@parf82) who asked how to search a database in Bluemix. The answer is of course, in the same way that you search it not in Bluemix, using an FTSearch. The more pertinent questions is really how to make the XPages runtime find the application to search in the first place.

Creating the base application

If you follow this video by Brian Gleeson you will be able to create your first application in Bluemix. Once you have that you can manipulate the environment to your hearts content. There are multiple, documented, methods for updating your XPages environment in Bluemix, I prefer to create a Git repository. As Toby and I demonstrated in the socialbizug webcast you can download the application design, manipulate it and send it back to Bluemix as one.

Manipulating the boilerplate

I have the initial boilerplate code cloned to my local hard drive.

bl1

First step it to edit the Manifest and get rid of the Boilerplate application. Why, you ask? Well this way you have the manifest and everything else configured for you nicely. You can do this from scratch but I generally find this mentally easier to work through.

bl2

I renames the application from todo_design to xpages_design.

I took a design copy of my extjs database and saved it in the git repo folder. The database can be seen at (http://demo.xomino.com/xomino/extjs.nsf) which is at it’s heart just a modified fakenames.nsf database (http://www.xpagescheatsheet.com) from David Leedy.

The reason I chose this database is that it contains a lot of REST services already in a normal XPages environment.

bl6

I then had to create a copy of the database itself in the Bluemix NoSQL environment.

bl4

bl5

Quick review

We now have the database split into two separate pieces

  1. The data on slaney/bluemix
    1. https://xpages-domino.ng.bluemix.net//bluemix/PSC_Playground/Hybrid/extjs.nsf/ByName-First
  2. The design xpages_design.nsf – currently in my local git repo

Putting the data directly on slaney – very possible and works in a view as expected

bl7

But if we try and access an XPage – it doesn’t work – which is what we would expect.

Accessing the data from the XPages runtime

Back in our xpages_design database we are going to create a normal REST service – but we have to use the new BluemixContext object to find out the path for the service (https://www.ng.bluemix.net/docs/services/XPagesNoSQLDatabase/index.html#xpservice_portexisting).

 

				<xe:restService id="restService3" pathInfo="byFirstNameBlue">
					<xe:this.service>
						<xe:viewJsonService viewName="ByName-First" start="0" count="100" defaultColumns="true" databaseName="#{javascript:bluemixContext.isRunningOnBluemix()? bluemixContext.getDataService().getHost()+'!!' + bluemixContext.getDataService().getRootDir() + 'extjs.nsf' : 'extjs.nsf'}">
						</xe:viewJsonService>
					</xe:this.service>
				</xe:restService>

The bluemixContext values are derived from the VCAP_Services variables made available to the XPages in Bluemix service through Cloud Foundry. An example is shown here – it is available from the Bluemix dashboard for your XPages by clicking on the ^ arrow on your NoSQL database service.

t1

Viewing the result

Once we have pushed the REST service design changes back up to Bluemix we should be able to see them. Once we correctly create the URL to the rest service. In this case “xpages_design.nsf/xRestService.xsp/byFirstNameBlue”

http://xpages.mybluemix.net/xpages_design.nsf/xRestService.xsp/byFirstNameBlue

 

We are able to demonstrate the new searchable REST service by manually modifying the URL and adding search parameters:

http://xpages.mybluemix.net/xpages_design.nsf/xRestService.xsp/byFirstNameBlue?open&search=smith

 

 

Conclusion

In this article we have seen that we are still able to use the XPages out of the box rest service to communicate between the design database and the “data” database. All the out of the box functionality is available as if it were an on premises application. We also saw the usage of the new bluemixContext to find out where the data database resides within Bluemix.

 

 

How to easily hide an XPages CKEditor toolbar

Today’s random requirement was to be able to provide a Rich Text field without the user realizing that it was. The requirement derived from modernizing an existing application and the need to retain field type for notes client users more than web users.

So I did I quick google and did what every good developer did – stole the idea – in this case directly from Jesse

https://www.frostillic.us/f.nsf/posts/quick-and-dirty-ckeditor-toolbar-setup-for-xpages

I was able to hide the toolbar on the CKEditor by making a new toolbar which was completely empty.

<xp:inputRichText id="editor1">
	<xp:this.attrs>
        <xp:attr name="toolbar">
        	<xp:this.value><![CDATA[ [ ] ]]></xp:this.value>
        </xp:attr>
    	</xp:this.attrs>
</xp:inputRichText>

 

OneUI ? IE7? Seriously…………? Another one of *those* days…..

Working with a client and we are trying to insert some Bootstrap code into a OneUI site running on IE11 – everything was working smoothly until we actually tested in IE11. (Of course we developed using Chrome – well who wouldn’t….)

Compatibility Mode

So finding the root cause of the problem was simple – Compatibility Mode being run on the customer intranet – AAAAAAh yes that old chestnut – well we overcome that issue with a phaseListener as documented by Mark Hughes many years ago.

But that did not fix the layout issue – IE=edge was in the header and everything else looked just fine…..

Then I noticed this in the Page HTML….

ie7

but I look at the page source and I find this……no Class

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”&gt;
<html lang=”en”>
<head>

Oh OneUI you old devil

So after some digging I found this included in the HTML

/domjava/xsp/theme/oneuiv2.1/js/ie7.js

and there, in the code……

/* Copyright IBM Corp. 2010, 2013  All Rights Reserved.              */

document.getElementsByTagName("html")[0].className+=" lotusui_ie lotusui_ie7";

OH MY……….so what is happening is that the Notes Server is detecting that the IE11 Compatiblity Mode browser is actually trying to behave as IE7. And it is adding an IE7 style sheet, as the page is loaded, overriding the theme’d OneUI CSS which is being added earlier up the HTML DOM (yay cascading stylesheets I guess…)

Easy fix.

Naturally we are using jQuery within the page so the classes can be easily removed with the following code at the end of the XPage

$(document).ready(function() {		
	//This is HACK CODE to remove the lotusui_ie7 class which is 
	//programmatically added to the page by OneUI after the page is loaded in IE7 compatibility mode
	$('html').attr('class', ' ');
});

 

Thank you Richard, et al for MWLUG 2015

Last week I attended MWLUG 2015 in sweaty Atlanta, GA and had a great time. I wanted to say a heartfelt thank you to Richard Moy, Lisa and Darren Duke, Ray, Tony, Ulrich and everyone who contributed to a great conference. There is a significant amount of effort which goes into the conference as Richard explains. What people also do not appreciate is that Richard is personally in the hole for the conference costs unless the conference is a success. I don’t think there are many of us who would be able to do that, let alone have the balls to do it.

http://www.dominointerface.com/

My personal highlights:

  • Speaking with Ryan Baxter on Bluemix and XPages. Being able to show a drone being controlled from an XPage (and it works in XPiNC as well) was and probably always will be, the coolest XPages demo ever 🙂
  • Seeing two new speakers who I have encouraged in the past (Shean and Steve Z) actually take up the challenge, do it really well, and thoroughly enjoy themselves. New Addicts are born.
  • Shean McManus proudly announcing that he is moving jobs to start working at PSC
  • Drinking beer at a session for the first time ever – yes seriously the first time ever –  (thanks Eric and ultimately Rob Novak)
  • Meeting Csaba finally. I was very touched that he said to me that the reason he came to the conference was to listen to me speak. That’s really cool and very humbling!!
  • Meehans, how convenient and a fantastic way to encourage dialog
  • Pete Janzen, for so many things which brought a smile to my face 🙂
  • Spending time with Kathy, Brad, Eric, Steve, Richard and everyone else involved at the conference
  • and everything else I forgot……

thank you all 🙂