19/11/2008

DB2 and Domino - Mini Survival Guide

Category
Bookmark : del.icio.us  Technorati  Digg This  Add To Furl  Add To YahooMyWeb  Add To Reddit  Add To NewsVine 

Since first experimenting with DB2 as a datastore for Domino, I've learnt alot! I now have a production system which uses a DAV to join data from two separate databases - works very nicely. However, it's taken me quite some time to nurse the whole system into a production ready state. Like with most new and ambitious technologies, as this surely is, the road can be treacherous, especially for Domino people who generally just expect things to work out of the box.

I plan to continually update this page as more tidbits appear from my experience.

Number 1: Don't experiment with unsupported version combinations of Domino and DB2. That's right, I did and regretted it. Stick to IBM Lotus requirements or you'll cry.

Number 2: Do Not, I repeat, Do Not name your Domino Access Views (DAVs) using names or aliases used for any other design elements. This seems to be a bug with Domino 8.02 and DB2 v9.1.300.257 (this combination at least).

Number 3: If you're getting the dredded, incomrehensible CLI errors, which appear to be largely related to view indexes maintained in DB2, you must rebuild view indexes regularly using UPDALL -R which is similar to purging views manually using the Domino Administrator. I have had one instance that even this doesn't work, and a critical view became inoperable with a "General NSF DB2" error when trying to open it. In this case, Copy and Paste the effected view, delete the original and rename the copy to the original name.

Bookmark this page, there's more to come!


29/10/2008

Limit Field Length with HTML and JavaScript

Category
Bookmark : del.icio.us  Technorati  Digg This  Add To Furl  Add To YahooMyWeb  Add To Reddit  Add To NewsVine 

Quite often it's important to limit the length of characters a user can input into a field. The reasons are various and sometimes obvious, so just a quick outline here:
  • Prevent an overflow in the backend table (that would be nice!)
  • Prevent Casual testers (ie hacker novices) from entering long junk data to see if you did your homework.
  • Provide the user with a guide as to how long a field is allowed to be and how many characters they have left <- the cool bit

My solution:

  1. Javascript function to inform the user of the current length and maximum length of the field, and also to truncate the field if they reach the maximum.
  2. HTML tag to enforce a maximum length, in case javascript is not available
  3. Backend validation to ensure man-in-the-middle attacks cannot occur (this is a puritan measure, overrkill for small-scale or corporate applications. Yes I happly welcome and invite your scorn).

In the example below, a text-area field is limited by the browser to 500 characters. With every character entered, the updateCounter(element, max) function is called which checks the length of it's parent field (specified by 'the this' identifier). If the length is OK, the function looks for an element to drop information into. In this case I've added an empty SPAN who's id is the name of the field being checked with '-counter' appended. The span gets populated with information for the user. If the length is OK, the current length and the maximum length are shown in green, otherwise in red.

The Code
<html>
<head>
<script type="text/javascript">
function updateCounter (el, max) {
var span = document.getElementById (el.name + "-counter");
var str = el.value;
if (str.length >= max) {
el.value = str.substring (0,max)
span.innerHTML = "<font color=red>length: " + el.value.length + " max: " + max +"</font>"
} else {
span.innerHTML = "<font color=green>length: " + el.value.length + " max: " + max +"</font>"
}
}
</script>
</head>
<body>
<div>Enter a Description:</div>
<textarea MAXLENGTH=500 name="Description" onkeydown="updateCounter (this, 500)"></textarea>
<span id="Description-counter"></span>

08/02/2008

Notes kill script

Category
Bookmark : del.icio.us  Technorati  Digg This  Add To Furl  Add To YahooMyWeb  Add To Reddit  Add To NewsVine 

Notes 'power users' and programmers like myself often make Notes dance in curious ways to do curious things and this often leads to "Notes MIA". And sometimes, well it just hangs! One thing peculiar to Notes is that it consists of a bunch of coordinated processes rather than a single process like most applications. When one of these fellas becomes the walking dead, it's not surprising that the whole show retreats into "not responding" territory. Solidarity!

I frequently have to kill notes and reload. One way of doing this previous to Notes 8 was to kill nnotes.exe and child processes, (right click on nnotes.exe in Task Manager and select Kill Process Tree). Alas, in Notes 8 it appears we're dealing with not only the Lotus Notes family of executables, but we have a whole clan of other processes related to the Eclipse framework. What a nightmare! Well not really because our Lotus friends have it all monitored by the secretive and somewhat ominous NSD.EXE.

I call him Doctor Death. Tell NSD to -KILL and the whole shannanigan is brought to heel. I have a batch file on my windows desktop called KILLNOTES.BAT:

cd c:
cd \Program Files\IBM\Lotus\Notes
nsd -kill

UPDATE: In Notes Client 8.02 it seems not even NSD will properely terminate dead processes requiring a computer restart. But there is a work around. After running NSD -kill (as above), instead of launching Notes via the Notes Client, Load the Notes Administrator. Then launch the Notes Client via the sidebar of the Notes Administrator.


14/01/2008

QAF Release 8-Jan-2008 in stores now!

Category
Bookmark : del.icio.us  Technorati  Digg This  Add To Furl  Add To YahooMyWeb  Add To Reddit  Add To NewsVine 

2008 is going to be a huge year. There's definitely the smell of change in the air.. or is it just me? :P. To kick it off, here's a new version of QAF just in time (JIT) for LotusSphere. Wish I was going (WIWG) :(
Read More

13/10/2007

Update fields without agents

Category
Bookmark : del.icio.us  Technorati  Digg This  Add To Furl  Add To YahooMyWeb  Add To Reddit  Add To NewsVine 

Not sure what other people do when they want to quickly change or add a field value in a document, particularly in a production environment where it's generally not kosher to allow developers to create agents randomly. I know there are serious tools for doing this but I somehow seem to get away with using a simple toolbar icon which I've written over time. The other day I finally decided to finish it off properely so it supports date & number fields, and lists of values aswell.

Enjoy :-

REM {Smarticon Field Updater by Mark Demicoli};
REM {This formula will prompt you for a field name to add or edit in the currently selected document and is designed to run as a Smarticon in the Notes toolbar but should also work in other contexts.};
REM {Date fields are wrapped in square brackets, numbers prefixed by percent (%) and multiple values are delimited by semicolon.};
REM {When operating on lists, you can add entries by simply prefixing new entries with a semicolon};

t1 := @Prompt([OkCancelEdit]; "Enter Field Name"; ""; "");
@If(t1 = ""; @Return("");"");
t3 := "";
t2 := @GetField(t1);

@If(
@IsTime(t2[1]);
@For (n := 1; n <= @Elements(t2); n := n + 1;
t3 := @Trim(t3 : ("[" + @Text(t2[n]) + "]"))
);

@IsNumber(t2[1]);
@For (n := 1; n <= @Elements(t2); n := n + 1;
t3 := @Trim(t3 : ("%" + @Text(t2[n])))
);
@Do(
t3 := t2
));

editableText := @If(@Elements(t3) > 1; @Implode(t3; ";"); t3);

t2 := @Prompt([OkCancelEdit];"Edit value(s). Format: text, [Dates],%numbers, ; for multi"; "Modify field: " + @UpperCase(t1); editableText);

@If(
@LowerCase(t2) = "@deletefield" | @LowerCase(t2) = "@delete";
@Do(@SetField(t1; @Unavailable);@Return("")); "");

@If(@Left(t2; 1) = "[";
@Do(
t2 := @Trim(@Explode(t2; ";"));
@For (n := 1; n <= @Elements(t2); n := n + 1;
t4 := @If(t4 = ""; @TextToTime(@Right(@Left(t2[n]; "]"); "[")); t4 : @TextToTime(t2[n])))
); "");

@If(@Left(t2; 1) = "%";
@Do(
t2 := @Trim(@Explode(t2; ";"));
@For (n := 1; n <= @Elements(t2); n := n + 1;
t4 := @If(t4 = ""; @TextToNumber(@Right(t2[n]; "%")); t4 :@TextToNumber(@Right(t2[n]; "%"))))
); "");

t4 := @If(t4 = ""; @Explode(t2; ";"); t4);

@SetField(t1;t4)

21/09/2007

QAF release 20-09-2007 is out now!

Category
Bookmark : del.icio.us  Technorati  Digg This  Add To Furl  Add To YahooMyWeb  Add To Reddit  Add To NewsVine 

The new version of QAF is finally here...

..after literally a few months since the last version (that's a pretty long delay for a Notes app :). So what's new? I'm actually pretty excited about this version because we've finally dealt with a long ignored issue in Notes development, that of managing the quality of scheduled code (ie Agents). In this release we give ServerScripts new muscle by allowing them to be scheduled much the same way as developers have done for eons with scheduled agents, except ofcourse, we've reined in the code with automatic error handling out-of-the-box, plus some neat monitoring & reporting blings and lots of other cool new bits and pieces.

So download it! It's free man! Also check out the ServerScript tutorial.

Oh and thanks to Kevin Pettitt for helping out and Grant Muscat who did a hit-n-run stint out at Qenos but came away enlightened by the framework.. cheers mate!


13/07/2007

Scheduled Agents

Category
Bookmark : del.icio.us  Technorati  Digg This  Add To Furl  Add To YahooMyWeb  Add To Reddit  Add To NewsVine 

Ray* has been hassling (demanding genius) for some time about scheduled agents. What he wants is to click something in any application and see what scheduled agents it contains, when they last ran, etc. We'd had a look at a few existing offerings but never really got too excited about any of them. Being QAF zealots, we naturally hatched the idea of doing something in QAF. Choosing a direction is so easy when you have a vested interest! So, it occurred to me that some existing QAF functionality - ServerScripts - could be the basis for a 'natural' progression. That being, endowing ServerScripts and by virtue, some types of Actions with the ability to be scheduled. Get it? Lets say u have an Action that contains embedded script. How about clicking something to make it run on schedule? Then we have QAF as a wrapper around scheduled code and therefore the ability to do some tracking and displaying...

* Ray is my pointy-haired IT manager of Dilbert fame. But this is not a put down. Promise!
Read More

13/07/2007

New Life

Category
Bookmark : del.icio.us  Technorati  Digg This  Add To Furl  Add To YahooMyWeb  Add To Reddit  Add To NewsVine 

From the rotting pile of matter rises another Lotus Notes guru. This blog is mainly about Qenos Application Framework (QAF), an open-source Workflow Engine for Lotus Notes. Not so mainly, this blog is about Lotus Notes in specific, life in general, all sautee'd in my random heretical views, puns, insinuendo and creative drivel.
Read More

Calendar