DXL To The Rescue

Standard

The other day I came across an issue in a lotus notes application that was kind of weird.  The user was getting the ***** error when trying to edit a group in the ACL.

The first thing that came to mind was to check the users access, but they had Manager access to the application.  They just wanted to remove a that was put in the name of a group by mistake, so I tried to make the change myself, but I also got the same error.  I also tried to remove the entry from the ACL, but also got the same error.  The next thing that came to mind was to code an agent to remove the entry by using the back-end lotusscript objects.

So this is what I came up with:

Dim targetDB As NotesDatabase
Dim targetACL As NotesACL
Dim targetEntry As NotesACLEntry

Set targetDB = New NotesDatabase(“”, “”)

If(targetDB.Open(“Server”, “db.nsf”))Then
Set targetACL = targetDB.Acl
Set targetEntry = targetACL.Getentry(“Group With / in its name”)
If(Not(targetEntry Is Nothing))Then
‘targetEntry.Name = “TestEntry”
Call targetEntry.Remove()
Call targetACL.Save()
Else
Print “Entry not found in ACL”
End If
Else
Print “Not able to open db”
End If

But when I tried running the agent I got the same error when trying to execute the line Call targetACL.Save().  I then did some searching on the web and found a few people with the same error, but most of them suggested the ACL was corrupt and that the way they solved the issue was to create a new application and copy the data over, but this would only be an option for me as a last resort.  Since it seemed like the cause was the ACL had become corrupt I thought I’d export the ACL to DXL and verify if there was anything strange in the XML.

I created the following agent to export the ACL:

Dim s As New NotesSession
Dim targetDB As NotesDatabase
Dim fileName As String

Set targetDB = New NotesDatabase(“”, “”)

If(targetDB.Open(“Server”, “db.nsf”))Then
REM Open xml file named after target database
Dim stream As NotesStream
Set stream = s.CreateStream()
fileName = “c:temp” & Left(targetDB.FileName, Len(targetDB.FileName) – 3) & “xml”
If Not stream.Open(fileName) Then
Print “Cannot open ” & fileName
Exit Sub
End If
Call stream.Truncate

Dim exporter As NotesDXLExporter
Set exporter = s.CreateDXLExporter

REM Create note collection of actions
Dim nc As NotesNoteCollection
Set nc = targetDB.CreateNoteCollection(False)
nc.Selectacl = true
Call nc.BuildCollection

Set exporter = s.CreateDXLExporter(nc)

Call exporter.SetInput(nc)
Call exporter.SetOutput(stream)

‘ Stops the from being added to output.
exporter.OutputDOCTYPE = False

Call exporter.Process
Else
Print “Could not open db”
End If

After running this agent the following content was generated in the Test.xml:

 

replicaid=’852574830021CC9F’ path=’CN=Test/OU=Test/OU=Server/O=Test!!db.nsf’
title=’Test DB’ usejavascriptinpages=’false’>

percentused=’97.7727051598594′ numberofdocuments=’39’>
dst=’true’>20101006T162213,08-04
>20101007T094423,47-04

writepublicdocs=’false’/>

deletedocs=’true’/>

level=’editor’ deletedocs=’true’ createpersonalagents=’false’ createpersonalviews=’false’
createsharedviews=’false’ createlsjavaagents=’false’/>
10/06/2010 04:20:38 PM Test User/Test/Test updated Test Admins
10/06/2010 04:20:31 PM Test User/Test/Test added Test Admins

Since I did not see anything strange in the ACL DXL I decided to create an agent that would import the ACL DXL after removing the group with the / in it’s name from the DXL.  This is what the agent looked like:

    Dim s As New NotesSession
Dim targetDB As NotesDatabase
Dim fileName As String

Set targetDB = New NotesDatabase(“”, “”)

If(targetDB.Open(“Server”, “db.nsf”))Then
REM Open xml file named after target database
Dim stream As NotesStream
Set stream = s.CreateStream()
fileName = “c:temp” & Left(targetDB.FileName, Len(targetDB.FileName) – 3) & “xml”
If Not stream.Open(fileName) Then
Print “Cannot open ” & fileName
Exit Sub
End If

If stream.Bytes = 0 Then
Print “File did not exist or was empty”
Exit Sub
End If

‘Import DXL into new database
Dim importer As NotesDXLImporter
Set importer = s.CreateDXLImporter(stream, targetDB)
importer.ReplicaRequiredForReplaceOrUpdate = False
importer.ACLImportOption = DXLIMPORTOPTION_REPLACE_ELSE_IGNORE

Call importer.Process
Else
Print “Could not open db”
End If

After running this agent I verified the ACL of the application and the group was no longer there.  I also tested that new entries could be added and modified without issues.

Has anybody run into similar issues before, where you had to resort to DXL for a fix?

Donate For A Good Cause

Standard

Photo By michaelwm25

It’s that time of the year again and this Saturday, May 1st, 2010 I will be competing at the Tampa Bay Dragonboat Races as part of the Tampa Blade Runners Red Team.  Participating in this event gives us the opportunity to help with fund raising for two great organizations: FACTors Breast Cancer Patient Support Program at Moffitt Cancer Center and the Florida Aquarium.So please help with any amount you can Make a Donation


If you live in the Tampa Bay area come watch the races behind the St Pete Times Forum –> Map

My First iPhone App – pSimon

Standard

Well I’ve been busy since my last blog post working on my final project(more on this coming in separate posts) and other personal projects.  Anyways it’s been a while since I started learning iPhone development and last December I released my first app pSimon for sale on the iTunes Store.  pSimon is a modern implementation of the classic “Simon Says” game that was popular in the 80s.  On March 4, 2010 I released a Lite version of pSimon Lite which only included the easiest level of the game and some ads.  I released the Lite version to see if I could make extra income with the ads.  While I’ve made more income from the paid app up to this point, I have to say that I saw an explosion of downloads for the Lite version the first week that I would have not imagined.  I will keep this in mind for the release of the other two apps I’m working on right now.  It seems like a good marketing strategy is to release a Lite and Full version at the same time and the Lite version will drive sales for the Full version.

If you enjoyed playing the “Simon Says” game back in the day, try pSimon Lite and leave feedback as I’m constantly trying to find ways to make the game more challenging.

Creating Image Maps in Joomla

Standard

Photo By cocoate.com

Lately I’ve been working on some joomla sites for some friends and in one of the sites my friend wanted to add an imagemap. So I started researching what was the best way to go about doing this in a joomla site. I even posted a question in Stackoverflow. Well my search lead me here, it is a plugin for the default editor(TinyMCE) included in joomla that adds the ability to create and modify image maps in articles. After following the instructions on that page I still couldn’t see the image map button on the TinyMCE toolbar. I found some installation instructions within the downloaded package and they didn’t match the ones on the page, so I decided to give those a try, but there were some problems.

These are the instructions from the page referenced above:

    1. copy files from plugin_tinymce{x}.zip to {yourjoomlainstance}/plugins/editors/tinymce/jscripts/tiny_mce/plugins/imgmap/
    2. edit {yourjoomlainstance}/plugins/editors/tinymce.xml, after ‘directionality’ add lines:


<param name="imgmap" type="radio" default="1" label="Imagemap" description="Imagemap">

<option value=”0″>Hide</option>

<option value=”1″>Show</option>

</param>

    1. edit {yourjoomlainstance}/plugins/editors/tinymce.php, after ‘XHTMLxtras’ add lines:


if ( $imgmap ) {

$plugins[]      = ‘imgmap’;

$buttons3[]     = ‘imgmap’;

$elements[]     = ‘img[usemap|class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],map[id|name],area[shape|alt|coords|href|target]’;

}

  1. go to Joomla admin/Plugin manager/Editor – TinyMCE 2.0/Advanced Parameters, and make sure Imagemap is set to Show.
  2. go to article editor, click on any image, and notice the button highlighted on the toolbar, you are done:)

These are the instructions found within the downloaded package:

    1. copy files to plugins/imgmap/
    1. set up your instance in the tinyMCE.init method to use the plugin, like:
      plugins : “table,save,advhr,advimage,imgmap,…”,
    1. set up your instance to use the imgmap button, for example:
      theme_advanced_buttons3_add : “emotions,iespell,…,imgmap”,
    1. you might need to add:
      extended_valid_elements : “img[usemap|class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],map[id|name],area[shape|alt|coords|href|target]”,

Ok so I had done the first step since I had already done the five ste.s. I never found the tinyMCE.init mentioned in the second step so I decided to skip the step. I didn’t understand where I was supposed to make the change mentioned in the third step so I decided to skip it as well. The parameter mentioned in the fourth step took a while to figure out, but I finally found it by going to Plugin Manager–>Editor – TinyMCE and it is in the Plugin Parameters(below is a screenshot).

After doing this last step I finally got the image map button to show on my TinyMCE toolbar.

In conclusion, to get this to work I had to use a combination of both instructions. The actual instructions should be:

    1. Copy files to plugins/imgmap/
    1. Edit {yourjoomlainstance}/plugins/editors/tinymce.xml, after ‘directionality’ add lines:


<param name="imgmap" type="radio" default="1" label="Imagemap" description="Imagemap">

<option value=”0″>Hide</option>

<option value=”1″>Show</option>

</param>

    1. Edit {yourjoomlainstance}/plugins/editors/tinymce.php, after ‘XHTMLxtras’ add lines:


if ( $imgmap ) {

$plugins[]      = ‘imgmap’;

$buttons3[]     = ‘imgmap’;

$elements[]     = ‘img[usemap|class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],map[id|name],area[shape|alt|coords|href|target]’;

}

  1. Add the following to the “Extended Valid Elements” parameter:
    img[usemap|class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],map[id|name],area[shape|alt|coords|href|target]

Notes Net Forums xPages Design Update

Standard

I was looking through the notes.net forums last night and it occurred to me that they badly need a design update. So I went to ideajam and searched to make sure that nobody had already created an idea about this, it turns out someone had, so I promoted the idea and I urge everyone that uses the forums to do the same. I’m a bit surprised as to why IBM hasn’t already updated the design of the forums to the new xPages design, I mean it seems like the logical thing to do since it shows off the cool stuff you can do with the new version of domino. I mean what better way is there to show off xPages? The forums are used daily by hundreds of users yellowbleeders, newbies, and most importantly people that don’t like notes/domino but are forced to work with it where they work. Who knows maybe these last people will start to like notes/domino a bit more once they see the new cool stuff that can be done with xPages.

Head over to ideajam and promote the idea if you haven’t already–> Improve notes.net forums

Code That Makes You Say… Huh? #1

Standard

Photo By Andyrob

Most of the work I do at my current job is maintenance to existing applications within my team.  A while ago I found an interesting line of code within a lotusscript library.

TStamp = Evaluate(“@Text(@Now)”)

It seems the developer that did this doesn’t know that there is a Now function in lotusscript.

I have found this same line in most of the applications that I maintain and I’ve also seen it in applications that I don’t maintain.  Worst of all, most of these applications are used globally and this line is used to capture the date and write it to an audit trail.  What’s wrong with this you ask?  Well you don’t have a consistent audit trail, for example the date format in the UK is not the same as in the US.

Two solutions to fix this would be:

  1. Make the audit trail date field a multi value date field and use the Now function to append the date value to the field.  With this approach you can use the field properties to adjust the format for displaying the dates.  This allows you to display the dates in the users local format or choose a specific format.
  2. Use the Format function in combination with the Now function to get the same date format everytime.  With this approach you ensure a consistent date format within the audit trail, but you loose the ability to display the dates in the users local format.

Have you found code that makes you say Huh in applications you maintain?

P.S. I’ve tried telling the developer that maintains the other applications to modify the code, but that’s another story…

You Can Help!!!

Standard

Photo By ViNull

This Saturday I’m going to be competing at the Tampa Bay Dragonboat Races as part of the Big Blue Dragons Team.  As part of the event we are asked to help with fund raising with the proceeds going to two great organizations: FACTors Breast Cancer Patient Support Program at Moffitt Cancer Center and the Florida Aquarium.

So if you can please Make a Donation

If you make a donation remember to fill out our team name as Big Blue Dragons and my name as individual paddler Carlos Rivera.


If you live in the Tampa Bay area come watch the races behind the St Pete Times Forum –> Map

Better Lotus Notes DB Icons

Standard

If you haven’t done so, please head over to the Notes Design blog and ideajam and give your input.  We have been asking for application icons to allow more colors for as long as I can remember.  The application icon is the first thing the user sees and let’s face it, 16 color icons does make the application look like legacy software.  So anyways just head over to ideajam and promote the ideas the more votes it has the more likely it will be done.

Allow Notes Database icon to have 24-bit (=16.7 million) colors
Allow .png and .svg image resources

Better Java Development with Domiclipse

Standard
I have been using Domiclipse for over 2 years now and it is a great tool when doing java development within Notes.  It’s basically a set of plugins that allow you to import a notes application as a java project into eclipse and do development using all the great tools included in eclipse.  Then it lets you sync your changes back into your notes application with a click of a button.  Anyway, I decided to post a step-by-step tutorial of how to install Domiclipse into your existing copy of eclipse.First we open up the eclipse environment and we click on the Help–>Software Updates… menu item.

Next we have to add the update site url for Domiclipse.  On the Software Update and Add-ons window click on the Available Software tab and then click on the Add Site… button on the right.

Next we add http://www.domiclipse.com/domiclipse/update.nsf as the location in the Add Site window and click on OK.

Once we have added the site to the Available Software, expand the site by clicking on the + on the left of the new site and this will fetch the available plugins from the Domiclipse site.  Next we want to expand the eclipse category and check the box next to the Domiclipse Java Feature.  The next thing to do is click the Install… button on the right and this will start the installation.

The next screen will ask you to confirm your choice, just click on the Next >

Next you will be asked to accept the license, here you will have to click on the I accept the terms of the license agreement radio button and then click on the Finish button.

After the installation finishes you will need to shutdown eclipse and open the properties for your eclipse shortcut.  Here you will have to edit the Start in: property to match your Notes program directory in my case it is C:Notes

The final step would be to start up eclipse and verify that you have the Domiclipse icons on your toolbar.

Congratulations you have just installed Domiclipse into your eclipse environment.  Hope this helps some of you new that are new to java and eclipse.  Domino designer 8.5.1 is supposed to have most of the eclipse features, but Domiclipse will still be a great asset to those that don’t upgrade right away, which I’m guessing is most of us.