Domino: 8.5.1 XPages Bug in Document Data Source

A bug in 8.5.1 Domino Designer causes the field list for a Document data source to not appear in the Domino Designer data tab in right hand sidebar.


Continue Reading February 18, 2010 at 6:33 am

[Domino] Integer division operator

I often use code such as the following to simply divide two integers and get the result as an integer, throwing away any remainder:

dim x as integer, y as integer, res as integer

x = 11

y =4

res = Fix (x / y)

The above code would return 2 in the integer variable res.

Of course, if I had used res = x/y, res would have the value of 3, since LotusScript will implicitly round any float when converting to an integer.

Simple, right? But there actually is an operand for performing exactly this type of “integer division”.  You can use the backslash character ( \ ), as in:

res = x \ y

The backslash operand has been there forever (well, at least back to R5), but how rarely I see it used.

February 8, 2010 at 7:25 pm

[SQL Server] Rename a SQL Server Database

Well, this may be obvious for SQL DBA’s, but after completing a data migration effort tonight, I needed to rename a database in SQL Server. Well, you cannot just right-click the database name in SQL Server and choose rename. Instead, you need to get all users out of the database and then open the database in single user mode. At that point, you can run a system stored proc to rename the database. Pretty simple – the second time :)

Here are the steps:

  • Kick any connected users out of the database.
  • Open database in single-user mode by opening Enterprise Manager and right-clicking the database name, and opening the Properties dialog. In the dialog, go to the Options tab, and select the checkbox labeled Restrict Access and then select the radio button labeled Read-Only.
  • (Important) Close Enterprise Manager, to be sure SQL Server does not count that session as a connected user.
  • Open Query Analyzer and run the system stored procedure named “sp_renamedb”. The proc takes parameters of the old name and new name. For example: “sp_renamedb MyOldDatabaseName MyNewDatabaseName”
  • Close Query Analyzer
  • Open Enterprise Manager and undo the Restrict Access setting made earlier. (Your database should now be listed under the new name).

That’s it!

February 8, 2010 at 6:24 pm

Domino: ArrayUnique may cause server crash in Domino 8.0.1

Yes, if you have 8.0.1 (or earlier), or apparently any version of Domino 7.x, on your server and use the ArrayUnique LotusScript function in a server-side agent, the code may crash the server. Specifically, if the array argument has over 4,085 elements, the server will consistently crash upon executing the ArrayUnique call. there is a recent technote documenting this known bug (which can be found here. (Of course, I learned of the bug the “harder” way).

Note that this is addressed in 8.0.2 and later.

December 16, 2009 at 9:54 pm

Favorite Books: The Best Software Writing 1

I have finally finished reading through this great collection of essays on software development – The Best Software Writing 1, edited by Joel Spolsky. The books is an interesting collection of writing of interest to any software developer, covering a wide spectrum of topics. I guarantee, the writing in this book will make you think differently about software development and software developers.

A few of my favorite articles include Bruce Eckel’s Strong Typing vs. Strong Testing; Paul Graham’s Great Hackers; Eric Lippert’s How Many Microsoft Employees Does it Take to Change a Lightbulb?; and where the lucky stiff’s A Quick (and Hopefully Painless) Ride Through Ruby.

December 1, 2009 at 10:16 pm

CSS: IE6 compatibility for <a> tags with no href attribute

Since I still need to worry about compatibility with older browsers (especially IE) on most of my web applications, I try to make sure all of the CSS I use works under IE 6 and up, as well as FireFox and Chrome. I ran into this interesting issue last week (this does seem to be documented elsewhere, so maybe I am just the last to have encountered it). Should you have an anchor tag with no href attribute, IE will not apply any matching a:hover styles. (Althought, IE7+ and Mozilla browsers do). The reason for this is somewhat legit – IE considers an <a> tag without an “href” attribute to be a “destination” anchor tag – that is, an anchor which would be used for intra-page jumping (as in, <a name=’myBookmark’>). And IE only applies :hover styling on “source” anchors – that is, anchors which actually link to something. In my unfortunate situation, I had an anchor tag which was used exclusively to launch some JavaScript. The simple solution – to add an href=”#” attribute.

November 22, 2009 at 4:32 pm

Domino, documents and content-types

After many years of developing in Notes and Domino, there are some standard design patterns I tend to use over and over. One of these is placing as much (or all) of my client-side code – including Javascript libraries and CSS style sheets – in data documents, rather than design elements. Treating this portion of your application as data has some downsides (think about template deployments) , but also has the advantage of allowing for easier code modification.


One drawback, however, is that you may want or need to control the content-type http header sent back from the server. One example is with CSS style sheets – W3C- compliant browsers will not respect styles in a CSS page which is returned as content-type text, or text/html – the page must return as “Content-type: text/css”. Now, IE6 will respect such CSS pages,but IE7 and Firefox will not.


As a side note, during development, I really prefer to use Firefox for testing my applications, given the rich debugging environment available. Even when deploying an application in an internal corporate environment, in which we can control the end users to always use a particular IE variant, I still use Firefox for development testing.


So, if you have a simple “CODE” form in Domino and each of your code libraries sits in a document using this form, by default Domino will serve these back as content-type: text/html. Not what you want. You cannot control the content-type header through fields on a form, or through the HTMLHead form attribute, or anything along those lines. (Don’t try to use @SetHTTPHeader for content-type in a WebQueryOpen agent – it will be ignored). But you really want something like
“text/javascript” or “text/css” to be set as the content-type header, depending on the type of code in this library document.  So, here is the basic approach I have been using:


  • Create a subform with the basic fields used for your resource files – such as title, code, etc. And also a radio button field for the Content Type (with values of Javascript, CSS, JSON, XML, etc). And a computed DocType field which computes to “RESOURCE”.
  • Create a distinct form for each resource type – for example, one form for CSS resources; one for JavaScript resources; etc. For each form, set the form’s content type as appropriate – for example, “text/javascript” or “application/json”.  Include nothing on each form other than the one subform.
  • Create a view with a selection formula which includes documents created with DocType of “RESOURCE”, and with a form formula which computes to the appropriate form based on the “Content Type” radio button.
That’s all – you can then reference any of the resource documents in a form or page’s HTMLHead formula, using a simple formula such as:


“/” + @webDbName + “/vwResource/myJavascript.js”


The resource will be served by Domino with the appropriate content-type header.

November 10, 2009 at 9:11 pm

Older Posts

Ed Schembor’s Blog

Adventure's of an application developer, living in the world of corporate IT.