Genii Weblog

Civility in critiquing the ideas of others is no vice. Rudeness in defending your own ideas is no virtue.

Thu 10 Mar 2011, 05:38 PM
I have been developing software extensions for Lotus Notes for a long time. No, I mean a really long time. Sometimes it makes me vaguely ill to think about, but sometimes I have to feel good about the positive side of all that effort:

Almost every time I set out to write something new, I already have code to do much of what I want. Even if I never anticipated that specific task, I have intellectual property everywhere, and there's almost always a solution I've written somewhere that will help with the new task.

Thus, I set out earlier today, around noon, to implement both the GetAsText and SetAsText methods I mentioned in my earlier post. I put in the basic framework using code I developed to make adding Midas methods easier. I then looked around and found internal methods to get text from rich text fields with various parameters, and to get text from file resources with different parameters. I found internal methods to put them back. I cobbled it all together, and now have a working prototype that implements that script I wrote earlier (copied below). It works pretty well. Once I clean up some of my CopyWithDependencies method, which also uses a heck of a lot of existing code, I'll send the whole thing off to Ulrich so he can see how it works.

With more than fifteen years of code saved up, it is pretty easy to do almost anything. Perhaps tomorrow I'll tackle turning Notes docs into PDF or making Midas into an OSGi plugin.

Copyright 2011 Genii Software Ltd.


Thu 10 Mar 2011, 01:50 PM
I made an offer the day before yesterday: Gripe about XPages and win valuable software.  Today, I'm announcing the first winner, although the offer is still open, of course.  

Inline JPEG imageUlrich Krause

Ulrich suggested a few things, but the idea that definitely made sense to me was this (rephrased since I better understand his point after a follow up email):

The concept to support multiple languages in an XPages based app is great and simple but lacks an easy way to maintain the file resources which hold the language settings. You need to either use Domino Designer or a fairly complex agent to transfer the language information from a normal notes document to the file resource. If there were an easier way to have the language information in the front-end but still leverage the eclipse features for handling the file resources, XPages would be more powerful. 

I thought how best to do this. As with any new feature, I worried about how to make the methods as powerful and general as possible so they could be used for various purposes, while still being easy to use and understand. After a few discarded attempts, I have come up with two methods that are being added to the Midas Rich Text LSX and Midas C++ API for the next version. 

The methods will be part of the GeniiRTItem class, and are GetAsText and SetAsText. The script example below retrieves the string properties from a file resource, copies them into a rich text field where they can be modified, then retrieves them from the rich text field and puts them back into the file resource.  This would work with HTML files, CSS files, themes, etc.  The developer could just as easily copy them into a text field, but rich text works better for large files.

' *** Put the contents of a properties file resource
' *** into a rich text field where it may be modified
' *** and then replace it in the file resource
Dim rtItem As New GeniiRTItem
Dim rtProps As New GeniiRTItem

Call rtItem.CreateBackend(doc.Handle, "Body", True)
Call rtProps.ConnectFileResource(db.Server, db.FilePath, "")
str = rtProps.GetAsText()
Call rtItem.Everything.AppendText(str)

' *** Do whatever processing of rich text that you like

str = rtItem.GetAsText()
Call rtProps.SetAsText(str)
Call rtProps.Save()

Congratulations, Ulrich. For that idea, you win a free 50-user client license for the Midas Rich Text LSX with support and maintenance for a year, a $1500 US value.

Do you have any complaints about XPages? You could be a winner too.

Copyright 2011 Genii Software Ltd.