Wednesday, March 30, 2011

Test, Test, Test

I am working on some of the relational code in our server and decided to test performance of a small function to see which alternative was faster.  The function tests if a string contains all whitespace and I thought one alternative may be much faster than the other. 

The first alternative uses regular expressions.  It does look more elegant, but I didn't look at the Java source code to see what it is actually doing.  Further, I don't use regular expressions much and thought I would take the opportunity to see if it would help me in my quest for performance.  Regular expressions can do some complex processing, so it makes sense they may not be real fast, but for some reason I thought this option may be better. 

The second alternative merely trims the string and evaluates whether the length of the trimmed string is zero (in which case, of course, the original string was all spaces).  This alternative creates a new String object each time it is called and thus I thought it may have some performance problems.

Here is the code:

public static void main(String[] args) {
  performanceTest("   ", 1000000, 1);
  performanceTest("   ", 1000000, 2);
  performanceTest(" bogus ", 1000000, 1);
  performanceTest(" bogus ", 1000000, 2);

static boolean isWhiteSpaces( String s ) {
  return s != null && s.matches("\\s*");

static boolean isWhiteSpaces2( String s ) {
  return s.trim().length() == 0;

public static void performanceTest(String s, int loops, int version) {
  long start = System.currentTimeMillis();

  for (int i = 0; i < loops; i++) {
    if (version == 1) {
    } else {

  System.out.println("Total time for " + loops + 
                     " loops using algorithm #" + 
                     version + ": " + 
                 (System.currentTimeMillis() - start));

I was surprised at the difference in the performance:
Total time for 1000000 loops using algorithm #1: 1042
Total time for 1000000 loops using algorithm #2: 41
Total time for 1000000 loops using algorithm #1: 991
Total time for 1000000 loops using algorithm #2: 41
The second option, which trims the string, then compares the length, wins hands down.  Now I know which option I will use in my code.

Tuesday, March 15, 2011

New Dodeca Training Video Online: Creating an Essbase Excel View, Part 1

We have a new training video online that shows how to convert a simple Essbase-aware Excel template to a Dodeca report in minutes.

Adding the Essbase Retrieve Range
This 23 minute video, which is part 1 of 2, is posted on the Applied OLAP YouTube channel at  The first video covers basic Excel template preparartion concepts, such as retrieve ranges and tokens, importing the Excel template into Dodeca, creating the View object for configuration settings and deployment. 

The second video in the series, which will be posted soon, will continue building the view and will show how to make the template cascadable.


Saturday, March 5, 2011

Hacking EIS for Fun (and Profit)

I have been doing some cool work on our Dodeca Essbase server and am at the point where I am working on Linked Reporting Objects. Of course, one type of LRO is the EIS Drillthrough Report. It has been years since I had EIS running on my machine, so I decided to get it running to help my development efforts.

Needless to say, this is the first time I have installed EIS since I converted my laptop over to Essbase 11.1.2 running on Windows 7 64-bit. Everything seemed to be going along very smoothly building the EIS Sample until I ran the Create Sample menu entry in the EIS console. Error! And it was a very strange one at that:
Contact your AIS administrator because the Java runtime environment may not be set appropriately on the server machine.., IMPORTMODEL failed NULL.

After some quick research, I found I am not alone with this issue as there are a couple of posts on OTN on the subject. With a bit of searching, I found this item on

Contact your AIS administrator because the Java runtime environment may not be set appropriately on the server machine..." EIS XML Import /Export Fails on Unix [ID 1086979.1]

The symptoms listed include:
  • Cannot use the Import/Export feature of Models from the AIS console.
  • The XML import/export feature in 64bit EIS 11.1.2 on 64bit Windows 2008 doesn't work.
  • When trying to import or export any OLAP model or metaoutline to a XML file, the following error occurs: "Error -1: Contact your EIS administrator because the Java runtime environment may not be set appropriately.."
I finally got it to work by going to a 32-bit Essbase 11.1.2 VM, configuring the TBC and TBC_MD DSN’s to point to the relational database on my 64-bit server, then running the Create Sample menu item on the 32-bit machine. The import worked and inserted the data into the tables on my 64-bit system.
Once this was complete, I opened the TBC metaoutline and tried the Verify menu item. OUCH! I remember hating this issue:

According to my friends in tech support, I needed to create the tables under the TBC username. In other words, wipe the databases and start over. It was painful enough getting to this point, so I decided to figure out why the TBC username was required.

I looked at the data in all of the tables of the TBC database and found some columns where the TBC prefix existed in the data.

As this is just a test system, I decided I would try to modify the data in my effort to get the EIS sample application to work. In the end, I had to update the ‘TBC’ string to ‘dbo’ in the following tables/columns:
Hopefully, I didn’t miss any of the changes I made as I put this list together after getting the Verify function to work. Once this was complete, the TBC sample loaded successfully. After this brief distraction, back to work on my Java code!