Wednesday, October 17, 2012

xPage: Optimize Uploaded Image

I had a task to upload images in xPage. The next one is to optimize image lossless. User upload the image in to the Domino media library and the image optimizing on the fly.

Unfortunately there is no good Java solution for lossless optimization of images. There are set of solution to use third party command line programs and run it from java. The problem is that you need to install this program on the server, many of them supports only one OS, so if you have Domino server on the windows and then would move to the Linux (or vice verse) you got a problem.

I decide to use online optimizer. It looks like there is no good paid online services with a good API. So I start from the free one. It is well known Yahoo! has no API, but there is a guy who create stand alone java API for service. He did it in the way of command line tool, but it could be used as API in your application.

I like it! The only one problem is that program out process information (log) directly in to the System.out. I need some information to be printed in to my log.nsf and some information to be returned to the user. So I add ability to put StringBuilder object in to the API.  

Code example:

//log and statistic contains information 
//about process and compression result 
//file - file to optimize, 
//generally opt rewrite file, but not in all cases. 
//Look "Important" section 
//opt - optimized file

StringBuilder log = new StringBuilder();
StringBuilder statistic = new StringBuilder();

SmushIt smushIt = new SmushIt();
List<smushitresultvo> smushItResultVos = smushIt.smush();

ImageDownloader imageDownloader = 
 new ImageDownloader(file.getParent());

File opt =;      

StringBuilder log variable after running code:

Smushing files:


Adding file:C:\Windows\Temp\notesE3A053\xspupload\0001.jpg

Downloaded smushed image -
Saved image - C:\Windows\TEMP\notesE3A053\xspupload\0001.jpg

StringBuilder statistic variable after running code:

Source Image:0001.jpg
Source image size:40895
Smushed image size:38749
Percentage saving:5.25

Projects on github:

Thursday, October 11, 2012

Custom File Upload in the xPage. Java. Backend.

There are a lot of articles about custom file upload with xPages. Most of them are about JavaScript. They use Java classes, so convert that code in to the Java is not problematic.

It's very easy to do in backend java code within xPages. The only one miss is that we could not write to the file attachment directly from the request. We still need to use a file. Thanks to xPage - it handle server temp files himself.

The code:

public void process() throws Exception {
 HttpServletRequest request = getRequest();
 Document document =
 document.replaceItemValue("Form", "picture");

 Map parameters = request.getParameterMap();
 UploadedFile uploadedFile=
  (UploadedFile) parameters.get("upload");
 File tmpFile = uploadedFile.getServerFile();
 File fileToUpload = new File(
 boolean success = tmpFile.renameTo(fileToUpload); 
 addAttachment(document, success?fileToUpload:tmpFile);
 fileToUpload.renameTo(tmpFile);, true);

private void addAttachment(Document document, File file)
 throws Exception{
 RichTextItem item = document.createRichTextItem("Body");
  file.getCanonicalPath(), null);   

Look to find how to get request

Saturday, October 6, 2012

It looks like Planet Lotus users are more familar with programming languages than with natural.

True code header have better rate:

CKFinder for Domino. Downloading

CKFinder have two options to download files (images) - by request to the server "connector" command processor and by direct downloading.

Request to the "connector" ("ckfinder-connector-url\connector.xsp?command=Download...") is not accessible for Domino.

For direct download CKFinder use file(image) link with the "?download" command. Let's modify this way for allowing CKFinder to "download" files from the Domino server.

Browser would download file in the case if "content-disposition" header available (and filled). We need to have ability to open file (no "content-disposition" header) and to download file ("content-disposition" header present). Let assume we have some database with web view "web-files" for open files on the web. Then we will need another one, completely the same, view "web-download" for downloading files and HTTP response headers rule for  adding "content-disposition" header.

HTTP response headers rule:
Incoming URL pattern: */web-download/*
Custom headers:
            Name: content-disposition 
            Value: attachment

Now, when you will open file "web-files/companylogo.jpg", then browser will show it, and when you open file "web-files/companylogo.jpg", then browser will ask to save it.

Domino configured. Now we need to modify ckfinder.js to allow it to load files from another url. I am using "url" attribute of "ResourceType" tag in the response of "Init" command to put files url. So I  add "download" attribute to the "ResourceType" tag to put files download url.

ckfinder.js with modification that supports "download" attribute: 

p.resourceTypes.push(new a.aL.ResourceType(p, {
 name: t.getNamedItem('name').value,
 url: t.getNamedItem('url').value,
 download: t.getNamedItem('download').value,
 hasChildren: t.getNamedItem('hasChildren').value,
 acl: t.getNamedItem('acl').value,
 hash: t.getNamedItem('hash').value,
 maxSize: t.getNamedItem('maxSize').value


a.aL.ResourceType = function (q, r) {
 var s = this; = q; =;
 s.url = r.url;
 //Modification =;
 s.hasChildren = r.hasChildren === 'true';
 s.defaultView = 'Thumbnails';
 s.allowedExtensions = r.allowedExtensions;
 s.deniedExtensions = r.deniedExtensions;
 s.oT = p(r.allowedExtensions); = p(r.deniedExtensions);
 s.nS = r.acl;
 s.hash = r.hash;
 s.maxSize = r.maxSize;

Now we need to change generation of download url in he CKFinder:

if (R.config.directDownload){
 var filename = encodeURIComponent(;
 var basenanme = 
 filename.substring(0, filename.lastIndexOf('.'));
 T = S.folder.getResourceType().download + 

 //original CKFinder String
 //T = S.folder.getUrl() + + '?download';

That's all.

Friday, October 5, 2012

CKFinder for Domino. Images (and Files)

CKFinder open an image in the same way as a thumbnail. So we have exactly the same problem like for thumbnails in Domino.

CKFinder construct link to the file like "base-file-url\filename". In Domino, we have access to the attachment with the help of "\$file\" path. So we must to have URL like:
"base-file-url\filename\$file\filename." or "base-file-url\filename\filename" in the case of substitution.

You need to find in the ckfinder.js string like
J.push('<a href="', D.folder.getUrl(), 
'" title="', C[K].name, '" rel="', E, '">a</a>'); 
and change it with
if (!F || F(C[K])) {   
 var filename = encodeURIComponent(C[K].name);
 var basenanme = filename.substring(0, 
 var url = D.folder.getResourceType().url 
  + basenanme+'/$file/'+filename;
 J.push('<a href="', url, '" title="', C[K].name, 
  '" rel="', E, '">a</a>');                    
 if (C[K].isSameFile(D)) H = I;
That will change image url. You also need to change File url. Find
if (! + 
 encodeURIComponent(, '_blank', V)) 
 R.msgDialog('', R.lang.ErrorMsg.oo);

and change it with

var filename = encodeURIComponent(;
var basenanme = filename.substring(0, filename.lastIndexOf('.'));
var url = S.folder.getResourceType().download + basenanme+
if (!, '_blank', V)) 
 R.msgDialog('', R.lang.ErrorMsg.oo);

CKFinder for Domino. Thumbnails.

CKFinder have two options to show thumbnails - by request to the server "connector" command processor and by direct downloading.

Request to the "connector" ("ckfinder-connector-url\connector.xsp?command=Thumbnails...") is not accessible for Domino. Reading thumbnail attachment on the server and return data as result of the command is expensive operation for the server.

CKFinder construct direct download like "thumb-base-url\filename?hash=.....". In Domino, we have access to the attachment with the help of "\$file\" path. So we must to have URL like:

Or better:

In the case if will use substitution rules for fine url:

You need to find in the ckfinder.js  "getThumbnailUrl" function and modify code in the
"L && N.config.thumbsDirectAccess"

if (L && N.config.thumbsDirectAccess) {
     var filename = encodeURIComponent(M);
     var dotIndex = filename.lastIndexOf('.');
     var ext = filename.substring(dotIndex+1);
     var basenanme = filename.substring(0, dotIndex);
     return N.config.thumbsUrl + basenanme 
         + '-thumb/$file/'
         + basenanme + '-thumb.' + ext
         + (!K ? '' : '?Open&hash='
         + N.getResourceType(R.folder.type).hash
         + '&fileHash=' + P);

Wednesday, October 3, 2012

xPage java.lang.NoClassDefFoundError

Suddenly got "java.lang.NoClassDefFoundError" error on my xPage for the class from "Java" design area. The day before it works without problems.

Project clean, rebuild does not help.  Server restart does not help. I read that Recompile code when opening in designer (xPages) solution helps for someone, unfortunately not for me.

The only one solution helps is to rename class that was not found. I am lucky to have only one such class and I am afraid to get this error again for all of them.

... maybe I will try to move code to the WEB-INF/src ...

My Client version is "20120703.0900-T00099SHF-FP2 (Release 8.5.3FP2 SHF99) "

Friday, September 28, 2012

CKFinder for Domino. First step.

I am trying to get CKFinder to work with Domino.

I saw the post "ckeditor 3.2, ckfinder 1.4.3 and Domino" but it is unavailable 2nd day, so I am looking himself in to this point.

First problem

CKFinder add some command to the end of it's URL, that domino server do not like:

Just remove it:
open ckfinder.js, look for something like "f={jY:'C7OA1WG',_:{}," and replace it on "f={_:{}," (delete jY:'C7OA1WG')

CKFinder also use command syntax like "?command=..". It's also a little trouble for domino.

Replace "?command=.." to "?Open&command=.." in the ckfinder.js

Second problem

I am trying to create server side command handlers for CKFinder.
"INIT" command example"

<?xml version="1.0" encoding="utf-8"?>
<Error number="0" />
<ConnectorInfo enabled="true" s="" c="" thumbsEnabled="true"  
thumbsUrl="/userfiles/_thumbs/" thumbsDirectAccess="false" />
<ResourceType name="Files" url="/userfiles/files/" 
deniedExtensions="" defaultView="Thumbnails" hash="654e8f3600949355"  
hasChildren="true" acl="17" />
<ResourceType name="Images" url="/userfiles/images/"  
deniedExtensions="" defaultView="Thumbnails" hash="4d8ddfd385d0952b" 
hasChildren="true" acl="17" />
<ResourceType name="Flash" url="/userfiles/flash/"  
deniedExtensions="" defaultView="Thumbnails" hash="a2d473ff04429cc5" 
hasChildren="true" acl="17" />

This example born errors in real life:

TypeError: t.selectSingleNode(v + "@imgWidth") is null

"Connector/ConnectorInfo" node must have "imgWidth" attribute (as well as "imgHeight") in the command "init" resonse

TypeError: t.getNamedItem("maxSize") is null

"Connector/ResourceTypes/ResourceType" node must have "maxSize" attribute in the command "init" resonse

So the correct "INIT" response must be like

<?xml version="1.0" encoding="utf-8"?>
<Error number="0" />
<ConnectorInfo imgHeight="100" imgWidth="100" enabled="true" s="" c=""  
thumbsEnabled="true" thumbsUrl="/userfiles/_thumbs/" 
thumbsDirectAccess="false" />
<ResourceType name="Files" url="/userfiles/files/"  
deniedExtensions="" defaultView="Thumbnails" hash="654e8f3600949355"  
hasChildren="true" acl="17"  maxSize="100"/>
<ResourceType name="Images" url="/userfiles/images/"  
deniedExtensions="" defaultView="Thumbnails" hash="4d8ddfd385d0952b" 
hasChildren="true" acl="17" maxSize="100"/>
<ResourceType name="Flash" url="/userfiles/flash/" 
deniedExtensions="" defaultView="Thumbnails" hash="a2d473ff04429cc5"  
hasChildren="true" acl="17" maxSize="100"/>

Thursday, September 27, 2012

CKFinder in Domino

I need to add some image library to use it with CKEditor in domino.

The best I found is CKFinder (it is not free). I did not find a good media library for build it up on the Domino.

CKFinder also have some troubles in the case of  work with Domino.

Do someone know a good media library?  I would prefer some client side library that communicate with server through  JSON or XML (like CKFinder).

Maybe some one have a nice experience with CKFinder on Domino ?

Tuesday, September 25, 2012

xPage in DXL

Domino export xPage's (java area, libs, xPages actually) in to DXL as base64 with some pre header.  This does not allow to change DXL and import it back. More of then, extracting real base64 become hard task because there is no any information about that "pre-header" in DXL.

I found similar question on the stackoverflow:

Sunday, September 23, 2012

Export Design DXL

Export design DXL feature has been added to the DominoJavaSyncer:

Orphaned agent data in Notes 8.5

I have export of DXL from my database and found many orphaned agent data. It's "agentdata" tag that does not follow "agent" tag.

First of all I check help: Note also that the agentdata element immediately follows the agent element, but is not contained by it.

Second - look for a possible problem and solution. Take attention, "In order for the utility to clean up orphaned Agent Data Notes, you must have at least one LotusScript agent in the database.". I spend half of our until detect this. 

Friday, September 21, 2012

How to print any data in XPage output

I was looking for a solution for output clean data in xPage without any tags.

Nice solution is present in the first comment to this post. In the case you need few xPage with output special data, better to create special base class and then just extend it.

More under cut.

Accessing XPages global objects in Java (extended)

There is nice post "Accessing XPages global objects in Java". There is a little more information about returned objects.

It's a good idea to create some base class to extend it for all classes that need access to global xPage objects.

So I take variables from that articles and add Request and Response objects also.

Look more for the source.

Monday, September 17, 2012

Synchronize database resources with folders

The task I have was to update CKEditor that we have in our app.

And yes - there is not possible to use server file system for me, only nsf.

A long time ago (1 year) I was upload CKEditor using WebDAV. There is only way that store folder structure in the file names of resources in .nsf. This days configuration of WebDAV was not allowed for me (yes, I have very strict access to the server) . So I need to install local (development) domino server, configure WebDAV, upload files, do copy of database with uploaded files on the main server .....

To much work, and what if I would need it again in few month ?

So I decide to wide my Domino Java Syncer utility to do image\css\file synchronization.

You could use it if you have similar task.

In a short:


Friday, September 7, 2012

How to use Velocity in xPages

We are using velocity in our project for build some HTML fro some templates.

There was a problem with using it in the Java libraries. Look at this post to find problem description and solution.

Now we want to use velocity in the xPage context. There is also a little trouble:

at java.lang.SecurityManager.checkPermission(
at java.lang.Thread.getContextClassLoader(
at org.apache.velocity.util.ClassUtils.getClass(

This problem could be resolved  by adding next string in to the java.policy:

permission java.lang.RuntimePermission "getClassLoader";

We could not edit java.policy unfortunately. So we resolve it in the next way.

1. Download velocity source

2. Find place of error (at org.apache.velocity.util.ClassUtils.getClass(
ClassLoader loader = Thread.currentThread().getContextClassLoader();

3. Replace this string with the xPage classloader initialization:
ClassLoader cl =;

4. Add appropriate library for compile velocity source with this new class.  You will need
or similar

5. Compile new velocity jar from modified source.

Well done! You could upload velocity jar in to the WebContent\WEB-INF\lib and use it in the xPage context.

Domino Java Syncer Documentation

I moved documentation from the document format in to the wiki. So you could find actual documentation on the git hub wiki

Thursday, September 6, 2012

xPage CKEdior: how to remove language direction attribute?

in-build CKEditor in xPage (Domino 8.5.3) always add dir attribute to the text container's tags, like P or H2.  

For example:
<p dir="ltr">test</p>

I could change direction "ltr" or "rtl" from the Rich Text Element settings or CKEditor custom config, but I could not remove this attribute at all.

If I use trivial CKEditor, the this attribute absent until I special set up contentsLangDirection property.

So It looks like xPage force this attribute to be set in any case.

Does some one know how to remove it from the in-build CKEditor in xPage ?

Domino Java Syncer on the Github

I was commite source of Domino Java Syncer to the Github:

There is also new functionality - import\export JavaScrip libraries as projects in to the Eclipse.

So version is up to 3 now. New documentation would be published later

Friday, July 6, 2012

Corrupted DateTime

Some time, the code like this

could cause error like this

This issue for example:;context=SSCQGF&amp;dc=DB550&amp;uid=swg1IO13958&amp;loc=en_US&amp;cs=utf-8&amp;lang=en

Wednesday, March 21, 2012

Handle Leak with Domino Server

Run next code as third party program on Domino binaries.

PATH must point to Domino location and Notes.jar must be from Domino.

It will crash Domino server within few minutes. The reason is that Domino has Handle Leak on every create\recycle session. It will free only if Java program will stop.

The same code works correct with Notes Client

There is dummy work around. I am not sure it will stable and appropriate for any

If test will stop without closing notes thread (incorrect closing) then Domino will generate message in the console:

"process ... javaw.exe ... has terminated abnormally" 

In the case of this message begin to showing in the domino console, then handle counts will not rising and this code will work without crash.

Monday, March 5, 2012

Fast fix to Domino Java Syncer

After importing java libraries by Domino Java Syncer 2.1 some agents was not compiled by native DXL importer in some databases. So there is fast fix to compile and sign all java agent in database after export java library with Domino Java Syncer.

Domino Java Syncer 2.1 updated without version change.

Saturday, March 3, 2012

Update of Domino Java Syncer

There is a few improvements to Domino Java Syncer 2.0.

Domino Java Syncer 2.1  and list of changes:

Notes.jar parameter was removed form “eclipse” command

Exported eclipse project will use Lotus Notes JVM. This JVM includes Notes.jar, so there is no need to include this package within special entry.

You will need to add it manually in to the project In the case you will use not Lotus Notes JVM.

“.jar” dependencies have relative path in exported eclipse projects

Full path in dependencies was bad in the case if you will want to move you project to another location or sync it with Version Control system.

So precious path like "C:\eclipse\workspace\MyEmail\lib\mailapi.jar" was changed to "\MyEmail\lib\mailapi.jar"

Do not forget compiler settings

Notes DXL use 1.3 compiler by default (at least 8.5.3 Lotus Notes client). Default compiler will be used In the case of importing DXL. So, if you use some newer Java features as annotation, then Java libraries will not be compiled after importing. You will receive many “NoClassDefFound” issues.

To avoid this, go in to the notes.ini file of LotusNotes client and add “JavaCompilerTarget=1.5” property.

DXL import log

DXL log will be shown in the console for DXL importing operations. 

Friday, February 24, 2012

Export and Import Domino Java libraries

I describe how to export Domino Java Libraries in to Eclipse Projects. Current post will show how to do backward operation  - import Eclipse project in to Domino library.  Within both way you will be able to import\export Domino java libraries in to Eclipse project.

The main reason to do it is to use Control Version on class level but java library level. This application will be very useful if you do many code in the Domino Java libraries and works in team.


Feel free to use it

Wednesday, February 22, 2012

"Facebook shares" retrieve in a back end

Sometimes you need to get Facebook shares number of you pages in back end. I was need it for performance reason, it faster to preload this data from Facebook in to Domino document and then show it.

There are two way to do it:


You could find examples and explanation following

Within FQL you could get shared statistic divided by "share", "like", "comment" and also sum of them.

Graph API

Look for"id" query.

Graph API as well as actual "like button" widget shows "total_count" number.  Some people think this is not completely correct, but Facebook developers suppose it's correct.

Example of  read shares from java under the cut

Tuesday, February 14, 2012

Concurrency Lotus Document Processing in Java

Domino have all objects synchronized within session so it does not look a good idea to do something with documents in multiple threads in Domino. Some time you need to do some on document that takes a lot of time out of Domino objects, like read some data from URL and put it to the document. Reading URL source data will take a lot of time there, so it is a good idea to do such task in multiple threads.

Take in to mind this multiple thread test on 50 documents

Only document access operations like computeWithForm:

1 thread: 110 ms
10 thread: 124 ms (looks like the same)

Document access (computeWithForm) and read source from URL:

1 thread: 14330 ms
10 thread: 2369 ms (83 % faster then one thread)

I want to present an special class for easy process documents in multiple threads. It based on ExtendedCollection and NotesExecutorService. Realization is under the cut.

Monday, February 13, 2012

How to run Domino Java agents in Multi threads

You could use ExecutorService for Domino Java for running Domino Java agents in the few threads.

There is only one attention:

You know that code will wait until or agent.runOnServer() finish. It looks like this methods using thread.wait() for waiting the end of the task. So interrupt() in NotesExecutorService.NotesTask.stopThread() will interrupt not only the NotesTask thread itself but also.

If you are using ExecutorService for Domino Java for running agents then you need to run task in the synchronized method to avoid calling .stopThread() [read interrupt()] until it waits agent finishing [read done] 

Changes under the cut

Friday, February 10, 2012

ExecutorService for Domino Java

ExecutorService is a good to use class, but it have a little problem in domino

It's nice when company politic allow you to fix it like this

If you are not allowed to do it, than you got a little trouble. Fortunately Java is creator friendly language, so you could do ExecutorService himself.

I did NotesExecutorService on the base of next articles:

Modification NotesExecutorService for run multiple thread agents you could find following link How to run Domino Java agents in Multi threads

NotesExecutorService itself under the cut

Thursday, February 9, 2012

How To: jQuery on demand

jQuery are needs to be loaded on demand some times. There is lot of examples but I will add one more from me.

You could wrrite some functions that needs jQuery, some "function myFunctionWithjQuery(){...}", and call it as "initializeJ('myFunctionWithjQuery')".

"initializeJ" will load jQuery, after that, "myFunctionWithjQuery" will be called.

"initializeJ" under cut

Tuesday, February 7, 2012

How To: export Domino Java Libraries in to Eclipse Projects

Based on my previous blog post I create utility for exporting Domino Java Libraries in to Eclipse projects. It is a simple java program with command line interface

Take attention on "ExecutorService" in Domino Java

If you will use "ExecutorService" in your Domino Java code, you will need additional configure Java Security.

"shutdown" method in "ExecutorService" will throw "AccessControlException" in trival java agent. Access denied (java.lang.RuntimePermission modifyThread)
    at java.lang.SecurityManager.checkPermission(
    at java.util.concurrent.ThreadPoolExecutor.shutdown(

Yes, this is not a bug but this turn my mind in to stat like this is bug.

Here the way to resolve

Or you could create your own executor like NotesExecutorService

Saturday, February 4, 2012

How To: unmap MappedByteBuffer

There is an issue in the JVM  "Add unmap method to MappedByteBuffer"

We got this bug in the How To: extract some text nodes from DXL in to files. File could not be deleted in the current program flow - that is the effect of this bug.

There is some solution, I will show example under cut

Ho To: easy Java agent development

Widely spread practice to write java code in the agent. Some coll guys will say, you need to write in library and append library to the agent.

I want to show you a more clear scheme:
So you will be able to easy manage code of all agent in one place.

Mode explanation under cut

Friday, February 3, 2012

How To: extract attachment from DXL (XML) in to the file in Java

I will show how to extract some raw data from DXL in to the file.

We need two things:

1. Code for extracting DXL
2. Some Utility to decode Base64

".jar" files from the Java Libraries will be extracted in our example

How To: create project for Lotus Notes\Domino development in Eclipse

I will show how you could create an Eclipse project configured for work with Lotus Notes\Domino.

This will be a simple java class as always.

First of all you need to do one thing out of java programming - add Domino JRE to Eclipse. You could use any JRE you want, but I prefer to use Domino or Notes JRE because it's "native" for our future code. So let's add it and call it "Domino":

You also will need one more information for our program - path to the Notes.jar like "C:\Program Files (x86)\IBM\Lotus\Notes\jvm\lib\ext"

Having JRE in Eclipse and Path to Notes.jar you could run your program (with my class).

And ... you could just import ready Domino Java Project in to Eclipse:

Now you could easily work with project - it is configured for work with  Lotus Notes\Domino

look message if interested in implementing

How To: write string in to file in one line of code

There is many examples how to do it, I propose you to add one tiny method to your code and forget.

How To: wrapp StringBuffer.append to print each "append" in new line

All of you know fine StringBuilder (StringBuffer) classes. Time to time you need to out multilines text and must code something like

Thursday, February 2, 2012

How To: simple Log in Java

If you need log in your application, you could find a lot of implementation in the internet. The best one is Apache log4j

But in the case of simple application I prefer to use a tiny Log class:

New subscription for Domino developers on StackOverflow

Feel free to engage in to xPages thread on the StackOverflow

How To: extract some text nodes from DXL in to files

One more post about processing DXL.

I will show how to extract text nodes from the Database DXL. We will use previous code How To: export DXL in Java and How To: parse DXL in Java

Let's extract Java Libraries from our datbase DXL, like it does Source Control Enablement for Designer

How To: clean directory in Java

There are tons of file utils on the web. The best one is File Utilities in Apache commons IO.

Any way, if you need just deleting directory with sub-directories or just clean directory form all files and sub-directories, then look at my tiny example

How To: run Domino agent outside from Lotus Notes client

This is simple with the help of Java API

How To: parse DXL in Java

How to export database in to DXL I described in How To: export DXL in Java

To do something with resulting DXL we need to find a way to easy get anything we want from the DXL. I will show how to do it with DOM parser. This is easy as always.

XPages does not run in NTF

I got a problem: XPages could not be opened from .NTF in the client

"XPages cannot process the application launch page: notes:///discussion8.ntf/allDocuments.xsp?OpenXPage"

I suppose this could be because of .NTF could not be opened on the web also, so Lotus does not run HTTP to process XPage for the client.

So .NTF becomes useless for development because of you could not test what you are doing immediately.

Wednesday, February 1, 2012

How To: read image from URL in Java

It's fairly easy.
Next example shows how to read an image and show it in a little java window, as well as read as image and store it in to the file

How To: parse HTML in Java

If you want to parse HTML in java, you could find a lot of different libraries from google search. I am preffer jsoup. The main reason is that this is pretty simple and easy to work with jsoup.
And yes, it is free to use.
If you like that code, try it:

How To: read HTML source from URL in Java

HTML source could be read easily like
HtmlRemoteSource class

How To: detect operation system in Java

There is well known way to detect operation system
Work with strict type is much better in my opinion. Something like this:
It will allow to do strict switch:
The class itself

Tuesday, January 31, 2012

How To: export DXL in Java

We will do few simple steps to allow DXL exporting like this
Let's create simple class for description of database location. We will use it as light database representation
Exporter class itself
Class for run a simple example
Do not forget
You need add to the java class path also few libraries to allow DCL exporter to work:
Good old

How To: file separator in Java

I am always use
There is one more elegant way to get the same result
I did performance test of both on my PC and it's have the same speed. So you could use what you like

Monday, January 30, 2012

How To: remove an item on the document

How To: Iterable View

We could easily create iterable view by using ExtendedCollection

HTML 5 going forward

Good example of using HTML 5 with Domino
It's about XPages application, for offline mobile e-mail management. It's call "D+ Everywhere".

How To: Iterable DocumentCollection and View

Trivial iteration of DocumentCollection or View in Domino:
It's looks a little ugly.
Fortunatly we could improve it:
ExtendedCollection realization

How To: compare two documents

Java Code for compearing two documents item by item.
It prints only item's that is different by Name, Type, IsSummary, Values.

How To: Correct handle 404 and other errors in Domino Web server

The best is to use DSAPI filter.
Look at for a solution

How To: print all items of document

Java Code for printing all items and it's values from some document: