Thursday, March 30, 2006

SnTT: Compact Local Databases on Demand

A couple of weeks ago, Chris Miller posted a tip about scheduling databases to be compacted on a user workstation. If, for whatever reason, you don't want to schedule that task, here is some code you can put in a user-accessible button (like in a "Procedures Manual" document) that compacts databases and sends a mail message to the user with the results.

Dim session As New NotesSession
Dim db As NotesDatabase
Dim dbdir As New NotesDBDirectory("")
Dim Stat As Long
Dim nlog As New NotesLog("Compact Utility")

Call nlog.OpenMailLog(session.username,"DB Compact Utility")

Set db = dbdir.GetFirstDatabase(Database)
Call db.Open("",db.Filepath)
On Error Resume Next
While Not (db Is Nothing)
Print "Compacting: " & db.FilePath
If db.PercentUsed < 90 Then
stat = db.Compact
If Err = 4005 Then
Call nlog.LogAction(db.FilePath & " is in use or not on workspace.")
Err = 0
Else
Call nlog.LogAction("Compacted " & db.FilePath & " bytes freed: " & Str(stat))
End If
Else
Call nlog.LogAction("Database " & db.FilePath & " already " & db.PercentUsed & " percent in use")
End If
Call db.Close()
Set db = dbdir.GetNextDatabase()
Call db.Open("",db.filepath)
Wend
C
all nlog.Close
Messagebox("Finished Compacting")

This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.



Technorati tags:
Categories: Show-n-Tell Thursday_

Tuesday, March 28, 2006

Ray Ozzie on Gillmor Gang

If, like me, you like to hear the latest thing that Ray Ozzie is up to, listen to a couple of recent podcasts of the Gillmor Gang. There are 2 episodes titled Ozzie Gang I and Ozzie Gang II where Ray talks about Live Clipboard and other things he sees for the future of computing. Pretty cool stuff.

Technorati tags:

Monday, March 27, 2006

SnTT: Homegrown Application Change Documentation

Originally posted on March 17, 2006

Change control in your application development has become increasingly important over the last couple of years. How good is your system for documenting changes? There are products out there to help manage the process and keep track of which design elements have changed but you can develop a basic system on your own.

In the Lotus Sandbox at developerWorks: Lotus (LDD/Notes.net) you can find the DatabaseDesign class. We used this class as the basis for developing code that compares design elements in two databases to identify differences. The databases can be two replicas of the same database (for example one local and one on the server) or two copies of a database (for example one development and one production). Within the same application, we also used the class to create lists of design items to populate drop down lists in a dialog box; that lets users create their own list of changed design items by choosing from lists.

Unfortunately, at this time I am not able to show you the code we developed, but I thought it was worthwhile to point out that the class is out there (thanks Damien Katz and Andre Guirard) and that it can be helpful in developing a change recording system. Contact me if you run into problems developing your change recorder.


Technorati tags:

SnTT: Sametime Success Story

Originally posted on March 9, 2006

This is a story from a while ago but it seemed worthwhile to share as a success. About four years ago, we decided to evaluate Sametime in our environment. We installed the server and rolled out the Connect client to a few people. We also made the web conferencing components available to a larger group of people to test that feature.

When we did our post-trial analysis, we found that we had pretty much paid for the software during the trial. One group of people used it for an online meeting instead of paying for another vendor's "rented" option. Our team used it to install a piece of software on 15 user machines, saving trips to desktops (including some in remote offices) or time on the phone walking people through the procedures. I know: who visits desktops to install software? But this was four years ago before automated software distribution was implemented in our environment.

To this day, it receives fairly heavy use for scheduled and instant meetings. My team uses it nearly every day to demo applications that are in development, to resolve problems on user machines or provide training at application rollout. We have also been slowly incorporating presence awareness into our applications.

The reach of the product is relatively small within our organization, but the investment continues to pay for itself.

Show-n-Tell Thursday

Originally posted on March 2, 2006

Last week, I showed a way to show responses in a view but open the parent of the response when a document was double-clicked. This week, I have another view tip. Form formulas allow you to open documents from a view using a form other than the one defined on the document. What I will show you is a way to provide users a choice of two forms to display documents and the means to set which form they want to use when they open the view.

Why would you use this? We have an application in which we want to display the fields from a document in a "report" format that can be printed for easier reading or in "data entry" format for user entry. This method allows us to use one view to perform both functions. In our case, the documents that appear in the view that uses this code are main documents and the "report" format form also contains LotusScript code to get field values from specific response documents to include in the report.

For simplicity, this assumes that all the documents in the view use the same form but it wouldn't be too hard to extend the code to handle more than one form. To give the users a way to determine the form they prefer, create an action button in the view with this code:

curr:=@GetProfileField("UserProfile";"DisplayFormat";@UserName);
@If(curr="Summ";
@If(@Prompt([YesNo];"Change Format";"You are currently opening these documents in the Summary Report format. Open documents with the document's form?")=1;
@SetProfileField("UserProfile";"DisplayFormat";"";@UserName);@Return(""));
@If(@Prompt([YesNo];"Change Format";"You are currently opening these documents with the document's form. Open documents in Summary Report format?")=1;
@SetProfileField("UserProfile";"DisplayFormat";"Summ";@UserName);@Return("")))

The Form Formula for the view is then:

@If(@IsNewDoc;Form;
@GetProfileField("UserProfile";"DisplayFormat";@UserName)="Summ";"ReportFormat";
Form)

Nothing to it!

Show-n-Tell Thursday

Originally posted on February 23, 2006

Here's my first contribution to this new web-wide feature. It took me a while to come up with something small that I thought may be useful. This is a kinda sorta pseudo-relational behavior you can incorporate into a view.

Say you have a set of response documents that contain the fields you want to display in a view. But, instead of opening those documents when they are clicked, you would rather open their parent document. And you display the response documents in other views, but in those views you want to open the response document (so you don't want to put code in the QueryOpen of the response form). What do you do?

Put this code in the QueryOpenDocument event of the view and the parent document will open instead of the document that you double-clicked to open.

UPDATE: I added some error handling for orphans, unreadable parents and replication conflicts. Don't know why I didn't think of it, other than that we hadn't run into those problems in the view where I used the code.



Sub Queryopendocument(Source As Notesuiview, Continue As Variant)
Dim doc As NotesDocument
Dim docParent As NotesDocument
Dim ws As New NotesUIWorkspace
Dim openIt As Integer

openIt = False
Set doc = Source.Documents.GetFirstDocument
If doc.IsResponse Then
Continue = False
If doc.HasItem("$Conflict") Then
Messagebox "Opening replication conflicts is not allowed in this view",48,"Open Document"
Exit Sub
End If
Set docParent = doc.ParentDatabase.GetDocumentByUNID(doc.ParentDocumentUNID)
If docParent Is Nothing Then
openIt = False
Elseif docParent.IsDeleted Or Not docParent.IsValid Then
openIt = False
Else
openIt = True
End If
If openIt Then
Call ws.EditDocument(False,docParent)
Else
Messagebox "Cannot open requested document. This may be because " &_
"the selected document is an orphan or because " &_
"you do not have access to the requested document.",48,"Open Document"
Exit Sub
End If
End If
End Sub


This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.

Air Travel Can Be Bad for Your Mental Health

Originally posted on February 15, 2006

OK, so anyone who has flown more than a few times has probably had a frustrating experience. My most recent ones were more memorable to me because they happened in such a short period of time. And to think we get to *pay* for all this “fun”.

I made it to Orlando when I was supposed to, had no tight connections or changes, but my luggage decided to stay in Detroit for a while longer. I had someone meet me at the airport and they ended up hanging out until 11:30 before driving 90 minutes back home. The voicemail finally came at 4:30 that the luggage was at the hotel. We should have just gone back to the airport!

I flew from Orlando to St. Louis for the weekend and that went OK. Until the trip home. A mechanical problem delayed us out of St. Louis, which meant I missed my flight out of Detroit. I got on standby for the next flight out and was sweating to see if I’d make it (otherwise it would be a long walk and two more hours in the Detroit airport). Fortunately, I made it and so did my luggage.

Then Friday we flew down to Tampa. We got on the plane in Detroit and sat for 20 minutes before they said they needed to service the lavs. Then 20 minutes later we heard that they needed to service the water in the plane. Then 10 more minutes and they said there would be a 60 minute ground stop because of weather in Tampa (which was, admittedly, bad - 8 inches of rain in 12 hours). I suppose it was better to be on the ground than to be circling northern Florida waiting for the weather to clear, but it wasn't like the plane came in 30 minutes before we left - why couldn't they have taken care of the other stuff before?

We took off 90 minutes late, flew around thunderstorms and came through another one just before landing. Of the four of us, only the one sitting next to me (our 3yo) threw up. No more details than that are needed.

But, it's vacation and the worst February day in Florida is better than the best February day in Michigan. How bad can it be?

BTW, our trip back from Tampa was completely uneventful. Just a l-o-n-g layover in Detroit.

Is This Thing On?

Originally posted February 15, 2006

Well, since Jess offered, I’m going to give blogging a try. Time will tell if I have anything interesting or worthwhile to say. This was really supposed to be posted a week ago, but vacation (of all things!) interrupted.

Went to my first Lotusphere this year. What an incredible time! Since reviews of the sessions have been blogged all over the place already, I won’t rehash them. I did attend a lot of the sessions on using DB2 with Notes/Domino and I can’t wait to get 7.01 installed (although, that might not be the best idea in some cases). We have a few applications in place already that might benefit from NSFDB2. The Office integration stuff that John Head showed will come in handy as well. And the stuff that Rocky showed was - as he says - just plain kewl.

So here are some personal experiences from the week:

  • Best experience: standing around the fountain in the Dolphin meeting a lot of people who I have read online
  • Worst experience: peeling (literally) my lips from the frozen fruit treat we had on Wednesday
  • Surreal experience #1: sitting at lunch when a group of IBMers filled the rest of the table and talking with Chris Reckling and someone who was involved with the initial involvement of NSFDB2 development (sorry I can’t remember his name).
  • Surreal experience #2: Being part of the group that walked into Boardwalk Brewery, rearranged half the tables and chairs, stood there a minute, then put them all back and walked out.

Thanks to jonvon for encouraging me to blog and to Jess for encouraging and offering a way to do it.

Welcome!

So here is my own blog. I will be reposting the entries I made at Jess' site, but I had to start somewhere, so here it is.