Tips Tricks Samples

lotus.domino.types Jar file

I’m writing some web services for Domino at the moment and the thought of trying to write Java code in the Domino Designer is just too much, so I’m coding in Eclipse and then importing the code back into Designer when I’m done.

Normally you just need to add notes.jar to the build path to import all of the lotus.domino.* classes but with web services you also need lotus.domino.types.*. For my own future reference, the extra jar you need to include is C:\lotus\notes\jvm\lib\ext\websvc.jar.

dojo.io.bind, File Attachments and other fun

Things are still quiet, I am still on a roll with my application development. As mentioned previously I am putting together a Domino and Dojo framework, it’s going well but slowly. Dojo is great but the documentation leaves a lot to be desired, I guess this is the downside of the bleeding edge. So I have spent quite some time getting file attachments / dojo.io.bind and Domino validation working together. I won’t try and explain how dojo.io.bind works but what it does is degrade gracefully. When you submit a form it will first of all try and submit using pure AJAX, but if your form has a file upload control on it the submit over AJAX will not work so Dojo degrades to use the old iframe model of submission. This will work but the struggle then is to use input validation formulae in Domino. Ultimately what I have discovered is that when you use @Failure the return string must be wrapped in a textarea tag. Dojo uses the first textarea returned as the response text when dealing with file attachments. So now my input validation formula will look like this:

@If(@ThisValue=””; @Failure(“<textarea>Please enter the value.</textarea>; @Success)

The text within the textarea tag will then be returned to the response handling javascript function.

I don’t suppose this makes much sense unless you have played with Dojo, if you haven’t then I’d definitely recommend it (or you could give it six months for the documentation to catch up to the capabilities). It’s always dangerous making predictions about the future of the internet but I can definitely see one of the AJAX frameworks becoming the default standard for future web application development. With the backing behind Dojo and the well thought out architecture the team has already put together I think I’ll be placing my allegiance with them.

On a totally different note, I have put my house on the market with a view to moving down to London. I tried this last year but didn’t get very far so I’m not holding my breath but if I can knock the commute on the head it will give me a lot more time to spend on this interesting geeky stuff!

Custom Login Form with Subforms

OK, time for me to admit my total dumb-ass-ness. I just spent a couple of hours trying to work out why my custom login form was breaking every time I entered an invalid username or password. The style sheet was still being loaded but the majority of the navigation was disappearing.

Of course you know where I went wrong already, but just for my own records… don’t forget to make your subforms "Available to Public Access Users" as well as the main form itself otherwise they will not load.

That’s a couple of hours of my life I won’t get back!

What an arse!

I have just wasted almost two hours trying to track down a bug in a servlet I am writing. On the server console I was getting an error going through with every page: "Amount of data written in response is more than specified by Content-Length header". So somewhere I was obviously making a mistake with the StringBuffer which gets returned to the browser. I was just being an unobservant arse with the problem just staring me in the face:

httpservletresponse.setContentLength(sbOut.length());
httpservletresponse.setContentType("text/html");
PrintWriter printwriter = httpservletresponse.getWriter();
printwriter.println(sbOut.toString());
printwriter.close();

should obviously have been

httpservletresponse.setContentLength(sbOut.length());
httpservletresponse.setContentType("text/html");
PrintWriter printwriter = httpservletresponse.getWriter();
printwriter.print(sbOut.toString());
printwriter.close();

The extra line break returned with the printwriter.println() was making the content length different to that of the contents of the string buffer.

God that’s annoying!

Increasing Font Size for Notes on the Mac

Now that Ed has bought a Mac and finally managed to get Notes installed I thought it might be a useful moment to mention a really useful little tool called Ninix which allows you to edit the Notes.ini file (which is binary on the Mac for some reason). The most useful feature of the editor is that it lets you increase the font size to something readable on a larger screen. So, you simply download the tool and then on the Fontsize menu there is an option to “Increase 1”. Do this twice and you have a much better and more usable Notes client. (Especially in conjunction with Silk font smoothing which he has already discovered).

Sametime installation funnies

We needed to install Sametime 6.5.1 onto our development server today which I had never done before but assumed would be pretty easy. However because of our setup there were a few issues which I thought I would record for my own benefit in future even if noone else finds it useful.

  1. All Sign in Form Mapping documents in your Domino Web Server Configuration database (domcfg.nsf) will be deleted and replaced by a new server wide Sametime document.
  2. A pile of new servlet definitions will be added to the servlets.properties file which may or may not cause problems (we have disabled them for the moment).
  3. The Session Authentication field in the server document is changed to "Multiple Servers (SS0)" instead of Single Server which breaks browser authentication.

Luckily one of the guys on the team has been here before and so fixed the problems in no time but it would have taken me hours to get things back to a working state. Be warned!

AJAX Screencast

Lance has created a screencast which demos some of the Domino AJAX samples which the blogging community is talking about at the moment. It’s a very good introduction to some ideas that you may not have come across yet and includes my own name picker amongst them.

Good job Lance.

How to use the name picker

I probably did this whole thing the wrong way round, but having posted my new name picker yesterday, I should probably tell you first of all how to use it and secondly how it works.

Name Picker

One of the things which has bugged me for a long time is getting a good name picker. We have been using a servlet on our Domino server for a long time which looks at views in the NAB and allows the user to select individual names to be added to a document in a web browser. Alas the servlet is showing its age and with the advent of AJAX it is about time that we came up with something better.

So the requirements:

  • A generic popup window which allows a user to select one or many values from a very large view (100,000 documents plus)
  • It has to perform well
  • It has to be cross browser compatable (at least IE and Firefox)
  • It has to be easily re-usable

    I have put up a demo page which looks at a view in my sister site – 50WordReview.com, over the next few days I’ll put up an explanation of how it works and some of the tricks which I have used.

    Update: I have added a couple of articles which will hopefull be useful. How to use the name picker and how the picker works.