Monday, January 31, 2011

LS: Currency data type seems to return proper results in arithmetics

I had a problem the other day with JS' inaccurate arithmetics. One can also stumble onto the same problem with LS:
Dim first As Double, sec As Double, third As Double
first = 0.1
sec = 0.2
third = 0.3

Print ( first + sec ) = third
'// -> False

I got a little bit curious, and lurked around in the documentation for other number data types in LS. Lo and behold, there's Currency. It seems to have some inbuilt functionality that corrects the inaccuracy in data types like Double.
Dim first As Currency, sec As Currency, third As Currency
first = 0.1
sec = 0.2
third = 0.3

Print ( first + sec ) = third
'// -> True
Nice to know if you need accurate results when doing arithmetics in LS.

Friday, January 28, 2011

CKEditor: Using external plugins from an NSF

This is a follow-up to my previous blogpost regarding importing files to an NSF.

If you want to use CKEditor plugins from an NSF, you have to create an override-function for CKEditor.getUrl. The reason for this is that CKEditor automatically adds a timestamp-parameter to the url, which Domino doesn't like.

CKEDITOR_GETURL = function( resource ){
// From NSF - don't alter the url
if( resource.indexOf( '.nsf' ) > -1 ){
return resource;
} else { // Let CKEditor handle the url
return null;
}
}


This function has to be loaded before ckeditor.js.

Using the Package Explorer to import file resources to an NSF

Using the package explorer, you can add import files/folder from your file system.

To import folders from the file system: In (windows) explorer, select the file(s)/folder(s) you want into the NSF, and copy them (CTRL+C or right click/copy). Then in Package Explorer, select the WebContent folder, and paste (CTRL+V or right click/paste).

It's as simple as that :)

If you're wondering what I needed this for, it's to create/maintain CKEditor plugins locally in an NSF. You can import "external" plugins using CKEDITOR.plugins.addExternal.

The imported files are noticed by the Design task, so this also works with templates.

Tuesday, January 18, 2011

XPages: Small update to the search interface demoapp

I've added automatic update of the FTIndex on search, when content has changed. There are rumours(?) on the web that FTSearch is evil, and that changes takes a long time to get into the index, even when running NotesDatabase.updateFTIndex.

I have never had those problems. It might be that it was something that was fixed in a previous version of the Domino server. I don't know.

To test how it works, change a document using the Notes client, then search for the changed value in the XPage.

Original post about the search interface demo

>> Download demoapp

Tuesday, January 11, 2011

XPages: Three ways to build a search interface revisited

I decided to update the search interface demo a little bit.

Changes:
* Cleaned up/improved some of the code
* Made the ViewEntry search sortable in both directions
* Improved the ViewEntry search code, so that it should be a little quicker
* Added a load time indicator (measures the time it takes to search/sort)
* When you click to sort a column, the pager automatically goes to the first page
* Changed resorting to execute partially (partial refresh)
* Added error handling (shows up as a "validation error" box)

The app has >40k documents, so you should be able to get an impression of the performance on bigger datasets. Remember to create FT Index in the app, or it won't work. It might take some time due to the number of documents.

>> Download demoapp