Thursday, July 31, 2008

How to Do Simple Javascript Field Validation on the Web using Domino

Why Javascript?
If you're like me and not really a domino developer, but a bit of everything, then you probably don't have a lot of time to spend on learning all the tips and tricks of domino. Often, creating a database is simply a matter of "knocking together" forms and views that will do the job and putting only minimal validation in place.

The problem is that normal built-in notes validation is awful on the web. You need to submit a form and get a validation "knockback" then click the back button in your browser and re-fill in the form. (Unless you have a modern version of firefox which seems to remember form data prior to submission).

In any case, what you really want is something that neatly informs you that you've missed something. The way to do this on the web is to use Javascript.

Disclaimer The technique I'm going to use here is an old one. If you're a seasoned Javascript developer, you'll certainly have much better methods. I'm not trying for an elegant solution, I'm just trying to do something simple.

A word of caution: Javascript is case sensitive, so be sure to check your case very very carefully. It can save hours of debugging afterwards.

About our Example Form
In order to explain this example, we need to have a form that we can display on the web. For the purpose of display, I'm going to assume that we have this simple form.

It has three fields on it.

  • FirstName
  • LastName
  • $Return

It also has one button.

The validation rule that we're going to apply is simply that no field can be blank. Both fields are to be mandatory.

oh, and the Designer client I'm using is 7.0.2

So, here goes...

The JS Header
Open your form in Designer and look for the JS Header part of the form (on the Objects Tab).
Put the following code there under WEB and JAVASCRIPT

The code is as follows;
(my apologies for using images - I was just worried about it being interpreted by blogger).

You should notice that each field has three bits that should be modified;

  1. The alert message telling you what is wrong
  2. The if (f.FirstName.value=="") bit which specifies the field to be checked
  3. f.FirstName.focus(); bit which refocuses the cursor on the offending field.

The OnClick Event
Now, In the OnClick event of your button, under Web and Javascript, put the following;

Apparently, and I don't know the reasons for this, you also have to have the following on the same button under Client and Formula

The $$Return Field
These changes should be enough to get your form working but I've discovered that a lot of people don't know about the $$Return field, so it's probably worth mentioning it too.

The $$Return Field should be a hidden (from Notes and Web) computed field
The formula for this field should be something like the following - though you'd probably replace the reference with the address of a "thank you for submitting" page in your database.

So now, you should have a form you can use.
If your database is called mydatabase.nsf and if it's in the \test folder of your server and if your form is called myform, then you should be able to get to the database by doing the following;

Depending on security, you might not need &Login
also; if you don't have a domain (for the bit), you could simply use the IP Address of your server if you're inside the firewall.

Right, so now that you can test for blanks, you can start modifying the code to test for more exciting things.

Fun with Blackberries - Moving Servers, Backing up, Wiping and Restoring Handhelds

If you've been following this blog lately, you'll know that we recently replaced our domino server. As part of this move, we moved the Blackberry Enterprise Server to another box.

Now, I'm not sure what happens when you move a blackberry server from one box to another while keeping the same server name, IP address and domino server name but I can tell you what happens when you move the blackberry service to an entirely different box - and when you "downgrade" it to Blackberry Professional at the same time.

It all gets wiped.

A Short Rant about Blackberry Professional
Before I continue, I just want to take a few moments to have a quick rant about Blackberry Professional. We bought a 10 user license for Blackberry Enterprise Server but have been told by our carrier (Telstra) that due to licensing changes at RIM, we are no longer able to buy any more Blackberry licenses for enterprise without paying a hefty up-front fee to convert our Blackberry Enterprise Server to a "full fledged" enterprise server. Instead, we have to "upgrade" to Blackberry Professional.

Now, they're very quick to point out the benefits of Blackberry Professional. In particular that the number of supported users has grown from about 15 to 30 and that (apparently) it can be run on the same server as your production environment.

My rant isn't about the benefits, but about what this apparent "upgrade" takes away from us. In particular, it removes Lotus Sametime support and Blackberry MDS (user-created applications) support. Luckily for us, we weren't using either... but we'd been considering both. The worst removal though is the removal of a lot of the RIM product support. Yes... I know that the support hasn't been actively withdrawn but the issue is that RIM are now seeing two flavours of customers;

The "rich" people on Blackberry Enterprise Servers and the Minions on Blackberry Professional. The difference in care is best illustrated by the following example. Blackberry Enterprise is certified for Domino 8 and 8.0.1 but RIM are yet to make a statement about Blackberry Professional.

The point about being able to run on your production server is a moot one too. We were cornered into using BES for a time on our production server. (We ran out of servers - and would have had to buy an additional domino license). It ran fine... ...mostly fine. The only change we noticed was that our rock-solid server which could easily go six months without a reboot developed a memory leak which locked the console if it wasn't rebooted at least once per month. I wouldn't recommend that anyone run non-notes products on their production domino servers.

So much for a "short" rant.

Moving Blackberry
The procedure for moving blackberry was fairly simple. We just installed domino on a new server and then reinstalled Blackberry. We turned all of the services off on our old production server and then added our new users manually (there were only 10, so it was simple). We figured that it was just a matter of re-authenticating with the new server (ie: reset of the activation password). We figured wrong.

As it turns out, moving Blackberry to a different server with a different notes name and different ip name and addresss trips off a blackberry security feature. The device will not reconnect without a wipe.

Backing up BEFORE you wipe your Device
Blackberry Admins... Hands up how many of you have taught your user base how to back up their handhelds? Keep your hand up if you've set up a regular backup job for these devices. Yep... probably not too many hands in the air.

So.. How do you backup a Blackberry handheld?

First of all, if you haven't already done so, install the Blackberry Desktop Manager software on your user's PC. Now, attach the USB cable that came with the blackberry handhelds to your PC and to the Blackberry.

Quick Tip: These first steps are pretty much an essential must-have for all blackberry owners. Ignoring all of the other benefits, they allow you to plug your blackberry into your PC's USB port for a recharge. This allows you to take the power pack home - effectively giving you a means of charging your device at home or at work.
Ok, so now you've got the blackberry plugged in - you can start the software.

A word of warning: There's a synch function in the blackberry software which keeps the blackberry address book in synch with your Lotus Notes address book. It's probably best that you don't use it. If you do use it, here's the trap to watch for; You want to contact someone at work, so you do a lookup of your domino server's address book using your blackberry. This effectively adds that person to your blackberry address book. Later, when you synch your device, the blackberry software puts that person into your personal address book. Now your person is in two places. Local and on the server. If the server record changes, for example - if they change their email address and you try to send them mails from your desktop, the notes client will be looking in your local address book first and you'll find yourself sending to the wrong address.
anyway, on with the show... backup.. (before I get side-tracked again).

In the desktop software, you'll find an icon marked Backup and Restore. Click it. This opens a new dialog containing a bunch of different options.

For a one-off backup, click the button marked Backup and choose a folder location and click Save. That's it, very simple. If you're a blackberry administrator though, I'd be inclined to suggest that you set up a regular job on your users' devices. To do this, click the button marked Options and then fill in the dialog box. I'd be inclined to suggest once every 30 days and that you choose to backup everything.

Now, whenever your users plug the blackberry into their computer and start up desktop manager, they'll be prompted to backup their device if it has been 30 days since the last backup.

How to Wipe a Blackberry Handheld Device
Wiping a blackberry is pretty easy - and I've done it a lot over the past week (sigh). First of all, make sure that the device isn't connected to anything via usb then...

  1. Go to the Spanner Icon
  2. Select Security Options
  3. Select General Settings
  4. Press the Blackberry Button.
  5. Chose Wipe Handheld
  6. You will be prompted to type the word blackberry and press enter in order to continue.
  7. The wiping takes about one minute.
I've noticed that the newer blackberries, the curve, prompt to erase applications too. Unless you're feeling particularly mean, you probably don't need to wipe them. Personally, I was quite happy when my erase killed my high scores but left all of my games in working order.

Restoring after the Wipe
Ok, so now we've done the wipe and we are able to reconnect to the new server. (a simple matter of an activation password). We're ready to restore the blackberry data.

The trick here is to restore enough data to be useful without restoring so much that it moves the phone back to the other server. A total restore is no good in this situation.

So, connect the blackberry to the PC and fire up the Desktop Manager Software. Next, click the Backup and Restore Icon, then click the button marked Restore. It's possible to let the restore continue and then back out of it a little later but I found that it worked best if I select the file, click the button marked Open then immediately click the button marked Cancel. You'll get a quick error message but then you can click Ok on it.

Now, you can click the button marked Advanced. This will bring up a list of the files on your device and the files in the restore file. You can hold down Ctrl and click on each item you want to restore to select it.

If you're sensible, you should be able to restore most of your data without tripping off any authentication problems. If you restore too much, simply wipe the device, reset the activation password, reconnect and try restoring again.

The activation problem we found was most obvious when you replied to an email on the blackberry and had typed a response. There was no send option on the menu. If you get this, then you've restored too much.

Tuesday, July 29, 2008

Moving a Domino Server onto New Hardware - Part 2

Following on from Part 1, we should now have a working Server running fully patched versions of Windows and Backup. If we've been really sensible, we've even tested a backup and a restore.

The next step is to obtain copies of databases on your live server.

Getting Databases off your Live Server
In a perfect world, this would be easy. Simply shut down your Domino server and go in with a USB hard drive.

Unfortunately, in a world where your server is expected to be up 24x7 or at least conform to one of those 98%** SLA's it's not possible to shut the server down for very long - even when doing a migratory backup.

** One interesting point that most people forget; A 98% uptime figure in a 30 day month allows for up to 14 hours of downtime. Of course, you'd never see management admit or accept that amount of downtime but it is technically allowable under contract.

So, how to get the data off your domino server for a speedy migration....

Attach a large USB drive - not a stick unless you enjoy waiting and don't have too much data to copy. Then go right through your domino folder structure (the Data folder and all folders below) noting the following;

Archived Databases
Databases which are read-only or contain info that doesn't change. If you've only got a few days to go before you switch servers, you could consider asking your people to not update the company web site (if it's hosted in Domino). The same goes for other non-essential systems.

You should copy all archived databases to your usb drive (operating system copy - not notes copy).

If you've got the mail files of terminated employees on your server, you can treat them as archived files and either copy them over without worrying about downtime - or back them up and remove them altogether.

Full Text Index Directories
These take a lot of room but shouldn't be transferred to the new server. It's much better to rebuild them from scratch.

Other Directories
Make a note of all other directories and build them into your usb hard drive version of the notes\data directory. This will save time later.

Large Internal Notes Databases
Notes generates a lot of databases which aren't all that important, except for statistical purposes. These include logs (log.nsf and domlog.nsf) and the statistics reporting database (statrep.nsf). You shouldn't bother copying these across, but should let them get recreated automatically - so cross these off your list.

You can probably do the same for

Log Files
You may find a bunch of folders on the server containing hundreds (maybe thousands) of little log files. These add up, but again, they're not of any immediate value on the new server, so leave them alone.

Non-NSF Files
Your server will also possibly contain a lot of html files, id files, certifiers, ssl files etc. Most (all?) of these can be safely copied while the server is running.

Remaining NSF Files
All the other NSF files are things that change on a regular basis. You need to make a list of these and copy them when the domino service has been shut down - just prior to migration.

Copying the Files
So... The procedure is simple; go onto your domino server and
  1. copy whatever files you can
  2. ignore any files you don't need
  3. list any files that you can't get yet.

Then, once you have your copy;

  1. Install Domino on your new server but don't start it.
  2. Copy all of the files from your portable hard drive to the \data directory of domino (don't forget notes.ini)
  3. Reinstall Domino over the top of your copy - just in case you've gotten any version changes.


Shutdown the Old Domino server service and disconnect the box from the network.

Leave your old server running windows and copy the remaining files (on your list) to your portable hard drive - or directly to the other server if you've established a gigabit peer to peer network.

When the file copy completes, change the IP address on your new server to match the old one and change the ip name to match too (not as important - but nice to have).

Connect your new server to the network and restart.

Domino should be up and running in no time at all.

Try doing that using exchange ....

Saturday, July 26, 2008

Moving a Domino Server onto New Hardware - Part 1

I've probably blogged about this kind of thing before but since we did a domino server replacement a couple of nights ago and it all went smoothly, I figure it's worth reiterating the procedure.

It's funny how as you try to type a blog during the gaps in your busy schedule, it mutates from your original idea. I've ended up talking more about backups than intended but since it's all useful information, I've decided to retain it and split this into two articles.

The Aim
Our main domino server was getting a bit old and we wanted to move to newer hardware. The server runs Domino 7.0.2 on Windows Server 2003. It replicates with an offsite server as well as an internal one.

The server runs mail, lots of internal notes applications, an ExtraNet and two web sites. It used to run blackberry too but that's a different post. The server is part of a ...believe it or not... Windows NT Domain. One day we'll move to active directory - maybe.

Downtime is fairly critical for this server but we decided not to cut over to the offsite backup in this case since the majority of our business tends to be during normal business hours and the cutover is currently a tedious manual process.

So; the aim of the exercise was to replace the server with minimal downtime.

Obtain and Assemble the new Server.
Remember my post on buying server hardware? Well, this was the reason. The first step is to buy the thing and put it together. IMHO, the best configurations are mirrored drives for the operating system and a separate set of RAID 5 (or 6 if you can afford it) data drives.

Install the Operating System
In this case, we installed Windows Server 2003. Whatever the system, you need to make sure that you've installed it, added correct devices, service-packed it and connected to your network. It's also at this time that you should be considering your security setup, including anti-virus and firewalling on the device. Personally, while I'm all in favour of simple firewalling, I'd recommend that you exercise caution when applying anti-virus software to the server to make sure that it doesn't adversely impact performance. As far as anti-spam is concerned, I don't believe that it should reside on the mail server at all. Personally, I think you should either subscribe to a service or place an "appliance" in between the server and the corporate firewall. Regardless of which way you go, this step is probably the best opportunity you'll get to fine-tune your security solution on the serve since you shouldn't muck around with these settings after you go live.

Obviously you can't connect to the network with the same device name and IP address as your existing domino server, so you'll need to choose a different name (and possibly use DHCP) for now. We'll change these later.

Install Backup software (If appropriate)
I'm not a great fan of running other applications on the domino server but it's quite conceivable that you might be running backup software at least on it. Particularly if your business is mostly around domino (backups applications are often best placed where the majority of the data resides to reduce network streaming issues).

Consider the placement of your backup solution very carefully. I'd recommend that you put the backup software entirely on the C: drive of your server. If you do this however, you should take particular care to have the logs erase themselves regularly so that they don't consume the entire operating system partition and pull the server down.

Once you've got the backup setup, you might want to consider imaging software for the system partition. We've just installed ShadowProtect which, as it turns out, isn't compatible with Domino. (according to the ShadowProtect people anyway). This doesn't matter.

The aim of the ShadowProtect image is to backup the Operating System and the Backup Software. We store these images on another server. In the event that we have a catastrophic server failure, our priorities will be as follows;

  1. Obtain new and working hardware of the same spec. Our warranty will cover this.

  2. Configure the raid drives - it shouldn't matter if they're different, so long as they're "the same size or bigger".

  3. Restore the system partition (including backup software) using shadow protect.

  4. We now should have a working server with working backup software. The next step is to do a normal restore from tape to the data partition (raid drives). We use ArcServe for this, not because it's the best software but because thus far, it has worked well for us in the domino environment and we've always been able to restore what is required.
In my next post - unless I get sidetracked again, I'll talk about moving the actual Domino parts of your old server to your new one with minimal downtime.

Thursday, July 10, 2008

How to use your Blackberry on Aircraft without causing Disasters

I'm sure that seasoned air travellers know all about this but I haven't flown much since I got my blackberry and I only got clued into this with a little slip from one of the flight attendants during the usual "how life-jackets can save your life at 30,000 feet" speech.

Note: these instructions are for the Blackberry Pearl. They may be different on other Blackberries.

It's simple;

BEFORE you get on the plane;
  1. Scroll to the aerial icon marked manage connections and click on it.

  2. Choose the option marked Turn all Connections Off

  3. Press the ESC/Back key to go back to the main screen.

  4. Power off your blackberry until the plane has taken off and is in level flight.

In Level Flight
When the Air-Hostesses or the Captain tell you that you can turn electronic devices on, turn the blackberry back on. It should not establish any connections.

Now you can use your Blackberry as a game machine, MP3 Player, Movie watcher and note taker (Memo Pad) during your flight. In fact, you can even read old mail and compose and send new ones.

After landing
  1. Turn your Blackberry back on (you did have it turned off for the actual landing didn't you?)

  2. Go back to the Manage Connections screen

  3. Choose Restore All Connections. Don't worry that checkboxes on this screen are unticked, just choose to restore all connections and they'll sort themselves out.

    Any "sent" messages (which got stored in an outbound queue) will now actually be sent.

Happy flying.

Tuesday, July 08, 2008

Installing Lotus Symphony

After sitting on the fence for a while, trying not to show too much Lotus bias, I finally decided to give Lotus Symphony a trial.

For the record, my work PC is old..
It's an IBM 8194 P4 2.8GHz with 3GB RAM and not a lot of available hard drive space.

Downloading and Installing
I went to the IBM Symphony site ( and selected the Windows version and in the English Language. I've got lots of issues with IBM's downloading services - I really don't think they're designed for lay-people. I decided to play "dumb" and just click on the first thing I saw. It defaulted to the Java applet which never works well on my system. I waited for the inevitable error message, then switched to downloading via html. The 197MB file downloaded relatively quickly.

IBM - The download facility for this is too user-unfriendly for the people you really want to capture as users. It should be as easy as downloading Mozilla Firefox or Open Office.

When the download was finished, I Double-clicked on the EXE and it started extracting to a folder determined by the TEMP/TMP environment variable. I was a bit miffed that I didn't have any choice about where these temporary files went - as they consume about 266 MB of additional disk space. I cancelled the setup and changed my environment variables - the next try was much better.

As far as the rest of the install process was concerned, it was fairly straightforward and gave me the ability to choose locations etc. The overall consumption was to be 494.6 MB.

The only other installation issue I had was the fact that for some bizarre reason, my McAfee Anti-Virus scanner decided to sit at about 90% during the entire installation process. Eventually I closed the McAfee task and all worked beautifully. I'll blog another time about Anti-Virus and whether they are appropriate in today's world or not.

Working with Symphony
Wow... I was expecting a long load time with Symphony but it seems to start faster than MS Office.

Symphony seemed to work well with my word processing documents and power point slides but didn't preserve the charts from my Excel 97 spreadsheets terribly well. I'll have a bit more of a "play" and provide an update later.