Archives for August, 2012

29 Aug 2012
6

Notes Database Performance Tip: Optimize Document Table Map

Hi Everyone. In the past few days I’ve been asked to audit a few Notes Applications. Apart from the usual disabling of unread marks and removing views no longer used to increase performance, there is a very important setting on a Notes Database and can drastically reduce the indexing time of Notes Views.

It’s called “Optimize Document Table Map“.

Firstly, a quick scenario:

Let’s say you have a Notes Application that contains about 5 different Forms. For each form you have about 3 – 5 Notes Views. Also for each Form you have about 5000-10000 documents.

When it comes to indexing Views, if the property “Optimize Document Table Map” is not selected in the Notes Database Properties, the following happens:

When indexing a certain View,  Notes will search through all documents created from all 5 Forms in the Database to produce the result in the View. If you only have a few hundred documents in the database, then this is not an issue. However, 50 000 documents later this could lead to poor performance of your Views.

 

So, let’s say that you have “Optimize Document Table Map” selected in the Notes Database Properties, the following will happen:

When indexing a certain View, Notes will only search through all records in the Database that were created using the Form that’s specified in the View Selection Formula. This means that if you have 5 Forms in the Database, and 5 000 records for each Form, Notes will only search through 5 000 records for a specific Form to index the Notes View. Can you imagine the Response Time :)

 

So, where to enable this setting? If you right-click on your Notes Database and go to the “Database Properties”, click on the last tab. You will see towards the Top that you can check the option “Optimize Document Table Map

 

2 Important Notes when enabling this Setting:

1. I’ve had varied results with enabling this property and just expecting it to work. I highly recommend compacting the database after enabling this Setting just to be sure.

2. In order for this setting to Work, it’s very important that your View Selection Formula for your Notes View specifies the Form Name.

i.e. If your View Selection Formula only says Select FirstName = “John”, then you won’t see a performance boost on the view. However, if you say Select Form = “Person” & FirstName = “John”, this will work because you are referencing the Form Name inside the View, which if you think about it, makes sense.

 

I hope this helps everyone. Happy Coding :)

John

28 Aug 2012
3

Important Tip when comparing values in Java

Hi everyone. Here’s a quick post that might save you a lot of time. With some programming languages like JavaScript, @Formula or LotusScript, to compare a String value is pretty simple

@Formula: tmp1 := “Test”;

tmp2 := “Test”;

(tmp1 = tmp2) = True


JavaScript:var tmp1 = “Test”;

var tmp2 = “Test”;

(tmp1 == tmp2) = True

 

LotusScript:dim tmp1 as String

dim tmp2 as Stringtmp1 = “Test”

tmp2 = “Test”

if(tmp1 = tmp2) = True

 

But when it comes to Java, the rules are slightly different:

String tmp1 = “Test”;

String tmp2 = “Other Test”;

(tmp1 == tmp2) = True

 

In Java, the == operator compares Objects and not the physical values contained within. The line above this is checking if the object tmp1 is the same object as tmp2.

So, in Java, the proper way to compare values is by using the equals() method:

String tmp1 = “Test”;

String tmp2 = “Test”;

(tmp1.equals(tmp2) = True

 

If it’s anything that I can teach you today, it’s that with Java almost everything is an Object and not just a data type. If it’s an Object, it has Properties and Methods that should be considered at all times, especially when parsing or comparing values.

Cheers for now :)

John

11 Aug 2012
21

XPages Tip: Speed up Design load times by using Design Definitions

Hi everyone. With the merge of the DynamicContent and Switch Custom Controls in the XPages Extension Library, I am more and more practicing the art of adding multiple Custom Controls into a single XPage.

Now, before you shoot me, make sure you understand how the DynamicContent and Switch Control Works. In Short, they Add/Remove designs to your XPage in real time, meaning that you can load a certain Custom Control and its content when you need it, and not on the loading of the XPage. That is awesome stuff, and plays a big role in the performance of one’s XPages Application.

 

But this Post is not about these 2 controls. This Post is about having multiple Custom Controls reside in 1 XPage. Let’s say for whatever reason you have 10 forms that make up your Application, and you have a Custom Control for each Form. What you do now is use 1 XPage, and insert all 10 of these Custom Controls. This is all good and well, except when trying to open up your XPage Design Element in Domino Designer. It become horribly slow, and sometimes my Designer just hangs, forcing me to “Kill Notes”.

The reason for this is because your XPage loads all the design elements and controls that exist inside each of the 10 Custom Controls you added to the XPage, to provide you with a view of more or less how the XPage Looks with all those controls added.

 

So, how do we prevent the Load Time of opening the XPage Design Element? Simple. We use Design Definitions. What is a Design Definition? It’s the ability to make your Custom Control look different when adding it to an XPage, than what it would actually look like when viewing the Custom Control alone.

Let’s say you have a Custom Control that has 30 Combo Boxes running vertically { Please everyone, this is just an example :) }.

You now add this to your XPage, and it looks the same.

A Design Definition allows you to change the look of your Custom Control when it’s added to an XPage or other Custom Control.

Do the following:

1. Open one of your Custom Controls in Designer, and in the Properties Tab, navigate to the “Design Definition” Tab.

2. Add the following Code to the empty Box in this Tab. (All this does is create a div, style it, and add some text inside the Div)

<?xml version=”1.0″ encoding=”UTF-8″?>
<xp:view xmlns:xp=”http://www.ibm.com/xsp/core”
  xmlns:xc=”http://www.ibm.com/xsp/custom”>
<xp:div style=”background-color:blue; color:white; padding:3px;”>This is my Combo Box Custom Control</xp:div>
</xp:view>

3. Save and Close your Custom Control.

4. Open your XPage where the Custom Control exists. If you haven’t added a Custom Control yet, create an XPage and do so.

You’ll see that instead of your Design Elements appearing in the XPage as it would look in the Custom Control, you now have a Blue Box with white Text inside it. If you double click in the Blue Box, you’ll be taken to your Custom Control, where you can view the original Design.

Not only does this keep your XPage tidy when it contains multiple Custom Controls, but it also stops the XPage from having to load all the Design Controls in your Custom Control for viewing in your XPage, which dramatically increases the speed of opening your XPage in Domino Designer.

I hope I didn’t ramble too much in this post. I trust you will find it useful.

Have a good day everyone. Comments, as usual, are always welcome :)

John

11 Aug 2012
1

TIP: When receiving warnings of Modules not loading In Titanium Appcelerator

Hi Everyone. Just a quick tip for the following scenario:

If you’re busy building an App using Titanium Appcelerator, you might run into an issue where the Build is successful, but when testing on an iPhone Simulator, you start getting error messages about Modules not loading or cannot perform operation because of an invalid method passed to UIModule, etc. Below is an example:

[WARN] attempted to load: TiUIScrollableViewProxy – invalid method (createScrollableView) passed to UIModule (Note: Other modules may apply)

A very possible fix to this, one which has worked for me all the time so far, is to Clean the Project before building it.

Note: Don’t go and clean the Project every time before building, just when suspicious errors occur.

 

Hope this Helps. Cheers for now.

John