About Me...

NotesRunningLogoRSmall.png

I'm Kathy Brown and I've been an application developer in Lotus Notes/Domino since 2005.

Prior to working in IT, I've had numerous careers including an Investment Analyst and even an Actress (long ago and far away).

And I (try to) love running!

me.jpg

kathy (at) runningnotes (dot) net

On Twitter, kjbrown13

Upcoming Races

Looking 4 Something?

Disclaimer

This is my personal blog. None of the opinions shown here represent those of my employer. In fact, forget I even have an employer. Any examples given here are strictly fictional and hypothetical and it is pure coincidence if they in any way seem like anything in real life.

05/14/2009

DXLMagic for Dummies

Category DXL Lotus
I recently needed to look through an application to determine if a view was used anywhere in the application. A common requirement, right? A quick Tweet, and several people said DXL was the answer to my question. Dump out the design into a file and search through it for the view. Done. But how to accomplish it?

A few posts ago I dabbled in DXL. Just one folder, which I manually exported to a file, but used DXL to create a new one from the file. So, how to export the design of an entire application? Enter Stephan Wissel's completely awesome DXLMagic. I missed this session at Lotusphere, but lucky for me and others that missed it, he's got a ton of great information on his blog.

So I titled this entry DXLMagic for Dummies, because, well, I am a dummy. He has very detailed instructions on his blog about how to get started and I still managed to screw it up. I'm blogging about it in the event someone else is a dummy and runs into the same problem.

Okay, so if you're interested. Go look at Stephan's instructions. Pretty detailed, right? Go to Openntf.org to download the latest and greatest (and it IT great) jar file of DXLMagic. Now, Stephan's instructions say that if you are using a Windows machine (I know, my first mistake) to add three lines to your autoexec.bat file. I can follow instructions pretty well, so I did that. File, open, type type type. Save. Reboot for good measure. Now he lists several commands at our disposal. I was first and foremost interested in DesignExporter.

Note to Dummies: we are going to enter the commands at a command prompt. (You know, Start, Run, cmd).

Another note to Dummies: Stephan's instructions say to start the command with java [command] [parameters]. In my excitement, I missed this for my first several attempts. Surprisingly, it doesn't work if you forget the word java at the beginning.

I got an error. Shocking, right? I checked my Java version. Stephan's instructions do say that this will work with 6, maybe 5, but definitely 6. Okay, I had the latest and greatest from the Java site. Now what? Check my typing in the autoexec.bat. Yep, it all looks good. Per Stephan's instructions, I have my file paths in quotes since Notes is buried under "Program Files", which has a space in it. Still nothing, still getting "NoClassDefFoundError" "java.lang.ClassNotFoundException".

Around this point, I sent out an SOS on Twitter, which Stephan was kind enough to respond to himself. He tried to help me out a bit, but since this wasn't a problem with his code, I felt a bit bad about pestering him. I kept trying on my own. Still nothing. Still the same error.

Messing around a bit more and typing SET in the command prompt showed that the other settings from the autoexec.bat were in effect, except CLASSPATH. For reasons uknown to me, they didn't take. So, I manually typed SET CLASSPATH=[stuff from Stephan's instructions]. This was a test box, so I didn't really care if I broke other things. You may feel differently. I navigated to the directory where the DXLMagic.jar file was located. I have no idea if that mattered, I'm just tellin ya what worked for me. And that did indeed work!

Can I say how fabulous this tool is? IT IS FABULOUS. And so easy to use (you know, once you get it working). And so useful! I had a blast (yes, I am a geek) searching through the design of my application just looking for stuff, because, you know, I could. So newbies/dummies, don't be afraid of DXL, jump in! Have fun! Check out Stephan's blog! [ETA: actual error message above]

05/06/2009

It's Never Easy, Or Is It?

Category DXL Lotusscript
Today I tried my hand at a DXL Import. Guess what? It didn’t flipping work. Surprising, eh?

So, what I was trying to accomplish: I needed to generate a folder for a user, if the user did not already have a particular folder in this application. The folder needed to be able to be updated by the designer whenever requested changes were made (if a change was requested, each folder needed to have the new design), hence I could not use a shared-to-private view. DXL seems all the rage, so why not? Export the folder to DXL, edit and replace folder name to a new folder name, import the DXL and voila! Happy new folder. Added bonus, anytime the folder design changes, I could do the very same thing for all the folders and have the design updated. Extra added bonus, I could learn something new! [Note: a button automagically updates the documents in these folders, so no need to be concerned that I would be zapping meticulously moved documents when I replaced the folders.]

It all seemed too easy. For this exercise, I manually exported a folder using Tools, DXL Utilities, Exporter. Whew. Okay, halfway there, right? Ha. Well, first I tried to get fancy. I wanted to store the exported DXL in a profile doc in the database, and use the NotesDXLImporter (the help says you can use a rich text item) to import the DXL into a domino folder. A little help file here, a little help file there and I had this:

Dim session As New NotesSession Dim db As NotesDatabase Dim importer As NotesDXLImporter Dim doc As notesdocument Set db = session.CurrentDatabase Dim rtitem As notesrichtextitem Set doc = db.GetProfileDocument("adminprofile") Set rtitem = doc.getfirstitem("prodoc_body") Set importer = session.CreateDXLImporter importer.ReplaceDBProperties = False importer.ReplicaRequiredForReplaceOrUpdate = False importer.ACLImportOption = DXLIMPORTOPTION_IGNORE importer.DesignImportOption = DXLIMPORTOPTION_CREATE Call importer.Import(rtitem, db)
ls2html was brought to you by nsftools.com

And … no go. It didn’t blow up, but I got an error, ever helpful as always.

DXLfail.JPG

Yes, thanks. Wonderful. Well, fine. Maybe for my first try, I should simplify a bit. Let’s get the DXL from a file.

Dim session As New NotesSession Dim db As NotesDatabase Dim importer As NotesDXLImporter Dim doc As notesdocument Set db = session.CurrentDatabase Dim stream As NotesStream Set stream = session.CreateStream If Not stream.Open("C:\Documents and Settings\kathy\Desktop\folder.dxl") Then Messagebox "Cannot open " ,, "Error" Exit Sub End If If stream.Bytes = 0 Then Messagebox "File did not exist or was empty" Exit Sub End If Set importer = session.CreateDXLImporter importer.ReplaceDBProperties = False importer.ReplicaRequiredForReplaceOrUpdate = False importer.ACLImportOption = DXLIMPORTOPTION_IGNORE importer.DesignImportOption = DXLIMPORTOPTION_CREATE Call importer.Import(stream, db)
ls2html was brought to you by nsftools.com

Hey, look at that! I just successfully created a folder from DXL.

Being stubborn, I’ve tried to get the rich text item on the profile doc to work, and it…won’t. Stepping through the debugger, all looks right with the world. The DXL is correctly stored in the profile doc and captured in my code as a rich text item. It just doesn’t work.

So, being really stubborn, I still wanted this to work from a document within the database, rather than a file. Further investigation showed I could get plain text from a profile doc and send that in to a NotesStream. Success! I could now import my folder from a profile document.

Dim session As New NotesSession Dim db As NotesDatabase Dim importer As NotesDXLImporter Dim stream As notesstream Dim doc As notesdocument Set db = session.CurrentDatabase Set doc = db.GetProfileDocument("adminproftext") Set stream = session.CreateStream Call stream.WriteText(doc.GetItemValue("prodoc_body")(0)) Call stream.WriteText(doc.GetItemValue("Body")(0)) stream.Position = 0 Set importer = session.CreateDXLImporter importer.ReplaceDBProperties = False importer.ReplicaRequiredForReplaceOrUpdate = False importer.ACLImportOption = DXLIMPORTOPTION_IGNORE importer.DesignImportOption = DXLIMPORTOPTION_CREATE Call importer.Import(stream, db)

ls2html was brought to you by nsftools.com

So this isn't the most exciting or advanced post in the world. We'll say it's DXL for Dummies. Meaning me.

Oh, and I'm very excited to try ls2html tool from nsftools.com in this post. Pretty cool, huh?