Tuesday, January 31, 2012

Disable encryption while creating new databases

My friend was facing a problem that while creating new databases in the New Application dialog the encryption settings were being set to "Locally encrypt this database using Medium Encryption".

Friday, January 20, 2012

Tuesday, January 17, 2012

View XPage source code in browser

Karthikeyan A had written in his blog about viewing your XPage source code in browser. You just needed to add a plus (+) sign in front of your XPage URL and it would show you the source in the browser. Tommy Valand confirmed that this bug was fixed in Domino 8.5.1 FP1.

But recently, while playing around with XPages I found out that there is yet another way where you can get the source code in browser. Open the XPages view in Domino Designer and go to "Properties > Document Ids". There you will find Note UNID. Copy it.

Now create URL as http://<SERVER NAME>/<DATABASE PATH>/<Note UNID>. For e.g. http://myserver/mydatabase.nsf/14C2FD8F53CD42204925791600131817 and run it. You will find your XPage source code in the browser if you are using IE else you will be prompted to download a file which would contain it. I tried it on Domino 8.5.1 FP2.

Of course you need to know the Note UNID of XPage for this, which might not be possible for an end user... PHEW!

Sunday, January 15, 2012

Add custom icon to dojo button in XPages

Adding icon to a dojo button is pretty simple. Jut set the dojo type to dijit.form.Button and add a dojo attribute named iconClass with value dijitEditorIcon dijitEditorIconCut.

And you get something like this:

But what if you want your own custom icon to appear on the button? The Dojo Themes and Theming Documentation explains about using custom icons. First of all import the icon image in your database. Now create a style sheet with following CSS class.

Saturday, January 14, 2012

Dash search in Ubuntu / Unity

When I first upgraded to Ubuntu 11.04 I took an instant disliking to its new desktop environment - Unity. But sadly I was really out of choice as GNOME 3 was even more disappointing (they even decided to do way with minimize and maximize buttons). Unity in Ubuntu 11.10 was a bit improved but still I hated the interface. But now, I have kind of got used to it and discovered this new thing in Dash search.

In Unity you can search for applications in Dash, but what I didn't know that you could also search inside applications. Basically I wanted to change the theme so I went to Dash and searched for "theme" and look what it gave me in results.

Saturday, January 7, 2012

Declaring global variable in XPage using dataContexts

While working on a XPages application I required a database object to be initialized and then used in various controls in XPage. I wanted to initialize the object only once then use it again and again. With some experimenting I found out that if I put the initialization code in beforePageLoad, afterPageLoad or beforeRenderResponse I was able to access the object from anywhere in XPage. But I wasn't sure that whether this was the correct way or the objects would get automatically garbage collected. So I posted this question on XPages forum.

Paul S. Withers suggested me to use dataContexts. You can find them in All Properties tab of XPages properties inside data section.

Getting methods, fields, constructors for XPage Java classes

In my previous blog I was able to find out which Java classes were represented by global objects & functions of SSJS. For e.g. facesContext.getExternalContext() returns object of com.ibm.xsp.domino.context.DominoExternalContext. But what methods, fields, etc. are available in that class? To get those you use the Reflection API (java.lang.reflect package) in Java via which we can find out the methods, fields, etc in a class. Using this I built a small XPage which can explore these classes. Here’s how it looks:

Wednesday, January 4, 2012

Double exclamation / bang (!!) in Lotus Notes

Double bang or double exclamation (!!) is an interesting thing in Lotus Notes. It basically is an internal network separator to Notes1 used to separate the server name and database path. No wonder in older release of Lotus Notes, launching attachments which have double exclamation marks in file name would crash Notes client. Also if you try to attach a file (either from Notes client, web or XPages) with double exclamation marks in its name, then the part preceding the double exclamation marks is removed from the attached file name. So if your name of file is file!!name.txt then after attaching, your file name would be name.txt. Even using the EmbedObject method in NotesRichTextItem class attaches the file in same way.

I used it myself when I wanted to open a specific frameset in a different database. Basically where ever you find the @ button in properties, there you can specify the server & database concatenated with double exclamation marks.

Also you use it in Show Database command at the Domino server console to display database and view information on a different server. David Leedy found out that while binding XPages to external databases you need to use double exclamation. Even in the C API function of W32_NSFDbOpen(dbpath$, hdb&) you specify the dbpath$ as <Server>!!<Database path>.

Update 8 Jan 2012: Starting with Notes and Domino 8.5.3 you can set up Domino to preload XPage applications using the notes.ini entry of XPagesPreloadDB, where you specify the server and database name concatenated with double exclamation. And yes, it is present in the final release of the 8.5.3.

1. Lotus Notes and Domino 5.0.5 Release Notes (Pg 116)