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.
[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.
[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!
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.
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.
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.
Domino, documents and content-types
- 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.
“/” + @webDbName + “/vwResource/myJavascript.js”