What is the world is Error 500 refering to??

I’ve often find that troubleshooting and log files provided very limited information for troubleshooting. The infamous and dreaded …

Screen Shot 2013-09-19 at 3.21.24 PM

I really am not sure what to do with that. I’ve crosswords puzzle that provide more clue than that. I’ve even had ones where I’ve only given a blank page and nothing else. Looking at the log.nsf can be just as infuriating.

Screen Shot 2013-09-19 at 3.35.56 PM

“CLFAD0211E” or “CLFA0246E” really tells me anything. At this point, I really have no clue what to do next …. until I came across this post at stackoverflow by Per Henrik Lausten. It pointed me to the “IBM_TECHNICAL_SUPPORT” folder. If you sort the files within it by date, you’ll get at “xpages_exc_…” text file which turns out to be very useful.

Despite all the texts and clutters, this one does provide a useful clue as to what is wrong.


I’ve been going to this folder every time I’m given a mysterious/ambiguous  error message from domino and it’s proven to be very useful so far.

Living on the Mac as a XPages developer

I’m a self profess idiot who drank the koolaid and bought a mac while living full time on a window vm. After years of this,  I think it’s ultimately a good decision. The eclipse rich client, to me, is very power and very adaptive. However the learning curve is fairly high and often times mistakes are nearly impossible to recover from. This is where a vm shines. Often times, I would have a base vm with a specific version of window paired with a specific version of the dreaded IE. Most of the projects I’ve been on seems to favor IE and I still face IE6 more frequently than I like, but I digress. With all these different base versions, I would pick one, clone it by copy and paste and start it up and experiment with it. It could be different fix packs, upgrade packs, versions of designers, etc. In the event something catastrophic happens, I’ll delete the new vm and clone another one. It’s saved me tons of time trying to fix the existing designer. It also allows me to have designers of varying versions depending on the project I’m on.

The following are some of the stuff I do while living on a vm fulltime to make my life slightly easier.

  • I use VmWare Fusion. I would imagine parallel or virtual box is similar, but I’m used to Fusion.
  • I love using my vm full screen, in OSX this pushes the vm to a new virtual desktop. I like swiping between them 2 virtual desktops as if I have dual monitors and to me it helps me segregate the work in window and OSX.
  • Key Maps
    • F9, the refresh key. It’s pretty useful in a client and I mapped it to “⌘-9″.
    • Another userful key is the “Ctrl-Break” key. In the client, it’s very useful to stop a process that’s running. Unfortunately, it’s only able to stop a notes process. If you have a build, search that’s running in the XPage Designer client, you can really stop it as quick. Seeing that there isn’t any “Break” key, I mapped it to “⌘-\”
  • I’ve only assigned 1 processor with 2048MB of ram to the vm, and it’s running pretty brisk. Never had any lock up, and the only time it did was when I was running two vm concurrently.
  • I used a shared folder to store all my relevant files.  This was I can share them among several vm at the same time. Thus if I were to switched to another MacBook, all I have to do is to copy the shared drive. The only downside is that, for a local preview, you need to have the nsf in the data folder.
  • I usually prefer a large screen vs multiple monitors. One of the reason is that if you are in a vm, you can’t extend your desktop across multiple monitors.

I wold love to switch to Linux if I do have a chance, I know I can run virtual box or wine. At the moment, the only thing stopping me is that I can’t seem to find any hardware that matches the MacBook Pro or MacBook Air.


Reusing your jqPlot. Write once, plot anywhere, any type

After going through 2 chart and the example database provided, you will notice a pattern. You will notice that JSON is used everywhere, from the array object we are building and passing into the charting lib and the setting for the charting lib. JSON is very prevalent and that is a good thing. By using JSON as the settings parameters for the charts, it allows us to separate actual function that is used to call the chart and the parameters needed for the chart. This way we can use a single script lib and function call to build the chart and all the settings that are unique to each chart is abstracted away from the function call itself or as Mark Roden said in a non related post, “decoupling” your function from your data. The process is actually fairly simple.

We’ll first create a custom control that contains the basic setting that we’ll need. Setting such as chart type, animation, ticks, legends labels, etc as the property definitions.2013-09-01_12-01-28

Within the custom control, you’ll transplant all the lines of code from the script library and pass the value from the XPages via compositeData as shown below. You won’t even need a script library since you can call jqplot right in the custom control.


Depending on the chart that you are trying to build, some of the options does not apply. However jqPlot is smart enough to ignore some of the settings. For example, if you are going to use a bar chart, “Fill” will not apply. Fill is only used for area chart used to fill the bottom of the area chart. Thus with a bar chart, “Fill” will not apply and jqPlot will be smart enough to ignore it.

From the source, that’s how the custom control will look like via the XPages

There is a sample nsf, ccCharts.nsf, provide at the “examples” link at the menu at the top.

Digging a little deeper, Pyramid Charts

As you have seen with the previous example, at the layer we are working with, the complexity with charts isn’t the actual rendering. It’s getting the data out from a notes db and into a format that jqPlot need for each of the specific type of charts. A Pyramid chart is a new one for me, I’ve seen it but never use it. Here is an example from jqPlot’s website.


There are actually a lot of useful info you can glean from just this one chart. So let’s see what we got. 5 type of injuries over the course of 12 months.


We do record the gender, maybe we’ll follow the cue a little and see what kind of distribution we’ll get out of it. The steps to extract the JSON out of the nsf is the same and we will have to do the same transformation of the original data to something that’s distributed over the course of the 12 months. Once you are there, then you’ll need to revise the next transformation into something that the pyramid chart needs. The image below shows the progression of the data from the notes view into something that the pyramid chart can use and on the left you see the distribution of the data in the pyramid chart.


You can glean a few quick data point from the above pyramid chart. A quick one is that you can see that the number of injuries for male is also always twice that of females. From the chart you can get some easy calculation of the median and mean for each demographic, which injury type is the most common and what the average count for each injury type.

Chart is more than about graphic representation of the same data. What chart will tell you are the relationship between the different data point that you don’t see while looking at just the numbers. Next time, I’ll use the chart I used for MWLUG and we’ll see if we can get the chart to talk to us.

Now we have the data, let’s make a chart

From the previous post, Simple, effective JSON with native notes, we extracted data from a notes nsf using view and @Formula. With those data we were able to build a JSON array object and then upload it to the viewScope to be read by the client side js and used to build a chart. These examples are tested only on Firefox , 8.5.3 with UP1 running on WIndow 7. It’s not been tested on any os and/or combination of OS, client and browsers.

Once the JSON object is in the scope, the easiest way to retrieve it is to use expression language.


Now that you have it in the client side javascript, you’ll have to manipulate it into something that is usable for the chart. jqPlot is need data to be supplied in a very specific format for each chart, otherwise you’ll get a “Uncaught Exception: No Data” error. Basically this means that, either you forgot to supply the chart with data to plot or the data submitted is not in a usable format. This is where Firefox comes in handy. With Firefox, you can install firebug which allows you to look at the data being generated in the global variable space and you can adjust your code accordingly if it is incorrect.

Let’s take a look at the JSON object that’s being retrieved. You can view it via Firebug


Looking at the object via Firebug, you can see we pretty much exported the data from the native Notes view straight up. However, since we are plotting a bar chart for these injuries over the course of 12 months, the original JSON from viewScope isn’t compatible with jqPlot. We needed to loop through the original JSON and transform it into something that represent data spread across 12 months. To do that we need to run the original object through a for loop and rearrange everything into a new object as shown below.


When that completes, take a look at the JSON object again in Firebug. This time, since you just created new object, you are looking for dataObj instead of datum


All that gives us what we need for now, the same data spread over the course of the 12 months. So we are building a bar chart and we will be tracking only 5 different types of injuries. The next transformations is easy. Since we already have the information spread over 12 months, just do a simple for loop and extract the information you need. The way jqPlot needed it to plot a bar chart that tracks 5 different injuries is

chartData = [{Injury Type 1}, {Injury Type 2 }, {Injury Type 3 }, {Injury Type 4 }, {Injury Type 5 }]

As you can see there are 5 types of injuries and within each one there is an array of 12 numbers each representing a month. This final object, chartData, is what we need. There are various methods you can use to do it, the example below should be the simplest.


Looking at it through Firebug, it should look like below.


The last step is the simplest. Just feed the chartData object to jqPlot.


sit back and watch it draw


and if you want it stacked, change “stackSeries:true”



That’s all there is to charting.

Simple, effective JSON with native notes

JSON is very prevalent in XPages, there’s really no escape from it. It’s a very flexible and portable data format. It’s used in numerous locations such as charting libraries, REST, ?readviewentries&outputformat=JSON. So, what is the simplest and most effective method of extracting the data we need? Running a view using LotusScript and building a large string is going to be very intensive and it’s going to tax the server heavily. Using java or ssjs to extract the data might be quite efficient, but both might be a little bit complex while there is a simpler method in lurk.

Sometimes the most over looked method is the simplest. I find that using @Formula and a native view is the simplest and most effective way of getting JSON from a Notes DB. @Formula is native to notes, and it’ll parse through thousands of documents with relative ease and I’m sure we’ve had situations where it index and parse through over 100,000 documents easily. Also a notes view is something that notes is also able to handle with relative ease, I’ve seen database with over a 100 views and still functions with little to no hickups. Imagine the size and the number of index being maintained by the database.

Below is a screen shot of how you can create a JSON object in a notes view.


As you can see from the above, it’s just a simple string concatenation. During the formation of this we string we can even perform any manipulation as needed and set them as a new value pair in JSON. Once done, save it and you can view the results on a notes client.


As you can see each row just become a JSON object and when you need to use it, you just have to create a view navigator to access the view entries and push each entry as a new object in a array. once completed, you will have a JSON array that is ready to be use.



This method might not be most syntactically appropriate method, it is the simplest and most effective way of getting JSON out of any notes database.

MWLUG 2013


Thank you to everyone who attended my session, I really appreciate it. Here is the link to the demo I was using with the session. There are 3 different nsf, each one for a specific chart.

–>Example Database

–> The slides are available at the top, named “Slideshare” on the main menu.

MWLUG concluded with a high note, excellent sessions, great folks, wonderful time.