Category: Dev & Admin

Debug fun: Folder names

Learned a lesson the hard way this week. debugging a problem where a code running against the

Database.views

property of a mail file with over 7000 folders couldn’t locate certain folders even though the interface clearly showed the folders as being there.

The ultimate cause was as simple as stupid: The code that ran against the Database.views property used the (undocumented) function

folder =  getParentFolder()

to ask the user to select a folder. This function shows the user a folder select dialog and returns the selected folders as an array.

The users would select folders but for some reason the subsequent code retrieving the selected folders from the database.views wouldn’t always find them.

After some debugging the cause turned out to be that the folder names that the

getParentFolder()

Returned does a

Fulltrim()

on the selected folder names before putting it into the array. Problem was however that on creation of the folder (which was not being done manually but through a script in which the user was prompted for a folder name) the user sometimes added leading, trailing or double spaces in the name.

On normal (manual) folder creation, folder names are automatically trimmed to remove obsolete or trailing spaces. When created through script though this isn’t automatically done. So the actual folder names (as listed in Database.views) contained the names with the spaces while the returned array of folder names from the getParentFolder() didn’t.
As trailing spaces are almost impossible to spot in the interface this went undetected.

folder name problem

So while normally (on ordinary folder creation) this Fulltrim() by the getParentFolder() wouldn’t have been a problem, the fact that the folders were being created through script – and users were entering names with extra spaces – meant it caused a discrepancy between the name returned by the function and the name actually used. Or, to put it differently: the inherent ‘human’ factor wasn’t being filtered out.

Lessons learned from this:

  1. Debugging a mail file with 7000 folders is a pain in the …
  2. Do a Fulltrim() on any folder name created through code
  3. And finally… NEVER underestimate the inherent capabilities of users to cause havoc (roughly 1 in 5 folder names contained trailing and or double spaces)

Lotusscript TimeDifference & Long data type – Grrr….

Spent Friday investigating some freakish code problems. This one just blew my mind….
When assigning numbers to a data type what do you expect to happen when you assign a number to big to fit the assigned data type? Right, an overflow error. 

Well explain this then….

Ok, yes I know, you can solve it by using “difference# = notesDateTime.TimeDifferenceDouble( notesDateTime )” method which will return a double. I just can’t get my head around the fact that it didn’t return an error when it overflowed on 2,147,483,647 and instead continued up from it’s negative boundary (-2,147,483,648).
Or is this normal behavior for a Long data type??  I just hate it when I can’t logically explain something…

Code I used to test the effect:

Sub Click(Source As Button)
    Dim todayD As New NotesDateTime(Today)
    Dim AlteredDate As New NotesDateTime(Today)
   
    Set todayD = New NotesDateTime(Today)
    todayD.Localtime = todayD.Dateonly + ” 00:00:00″
   
    Set AlteredDate = New NotesDateTime(Today)
    AlteredDate.Localtime = AlteredDate.Dateonly + ” 00:00:00″
   
    For x = 24850 To 24860
        Set AlteredDate = New NotesDateTime(Today)       
        Call AlteredDate.AdjustDay(-x)
        If TodayD.Timedifference(AlteredDate)<0 Then
            ‘EXPECTED OVERFLOW ERROR AT 24857 NOT HAPPENING
        End If

        Print “TimeDifference between: ” + TodayD.DateOnly + ” and ” +_

        AlteredDate.DateOnly + ” = ” + Cstr(TodayD.Timedifference(AlteredDate)) +_
        ” —- Days: ” + Cstr(x)       
    Next

End Sub



Update: I got this answer back through Twitter: “@FemkeGoedhart normal behavior for int/long. See http://en.m.wikipedia.org/wiki/Integer_overflow” Thanks @Thimo! It explains it, although the logic of Lotusscript returning an error on overflow of Integers but not on Longs still eludes me….

Firebug Lite makes my day!

Anyone doing web design regularly uses tools to do so. One of the tools I used to used a lot was Firebug. A simple add-in for Firefox that allows you to inspect and debug code, CSS and HTML on websites directly while viewing the site. A lovely tool.

Unfortunately Firebug is not compatible with the Firefox 4.0b6 Beta release I installed a couple of days ago so it didn’t work anymore. 
I installed the Firefox Beta because of some other functionalities I wanted and as I’m not currently in a web project I didn’t really mind that Firebug wasn’t working in the Beta. Until I wanted to change something this morning in my blog design and missed my trusted Firebug icon.

Right. 

So I searched the Firebug site for a compatible Beta. There wasn’t any but I did see something else. a Firebug Lite version that opens as a website instead of a full blown add-on and can be used in other browsers as well.
Ok, this is interesting because I’ve wanted the Firebug functionality to work in Internet Explorer for ages (don’t like the IE tools, to complex for what I need and I’m used to working with Firebug). But as Firebug is a Firefox add-on I just never even considered it as something I could use in IE.
Here was a lite version however that simply calls a javascript making it Browser compatible with most larger browsers. You just add a bookmark (Firefox) / Favorite (IE) to the Firebug Lite Javascript and when you want to inspect a site you simply click the bookmark, presto! Now I have Firebug in both my Firefox as well as IE!

Ok, it might be total geek mode but this makes my day!

IBM Lotus Quickr V8.5 for Domino shipping data announced!

It’s finally there! The announcement was made today that IBM Lotus Quickr V8.5 will be released on September 13th. This release was long anticipated!

Early 2009, on the eve of the Quickr 8.2 release the DomDoc redbook team I was on describing a migration path from the DomDoc platform to Quickr was already told some of the features likely to be in the 8.5 release. One (folder security) even made it into the Redbook itself as an announcement for the next (8.5) release.

At that moment, we didn’t know it would take until September 2010 to actually get that release. So it feels really good that it’s here now and I can’t wait to start working with it!

DAOS checklist

Nice checklist for people planning a DAOS implementation with lots of further links for additional information.

Especially the one about Backup’s. It’s the one thing that sticked in my head from the 10 worst real live examples of ‘how not to‘ given in the  “BP108 Worst Practices….Orlando we’ve got a problem” session by Paul Mooney and Bill Buchan at LS10. The story about a company implementing DAOS, suffering a major OS failure and then discovering that they didn’t have backups of the DAOS directory because they forgot to include it in their backup scheme……..Right, I’d call that a problem!