ChadSmiley Blog Things about family, life, coding, and more

28Jun/060

Proverbs 28:1-2

1-The wicked flee when no one pursues,
But the righteous are bold as a lion.
2-Because of the transgression of a land, many are its princes;
But by a man of understanding and knowledge
Right will be prolonged.
Tagged as: No Comments
16Jun/061

HotKeys by qliner

Kevin wrote about his Favorite Windows Shortcut Keys my favorite is the Win-L.  I have added a few more using hotkeys by qliner .  One of the really nice features is you can see the keyboard and the icon associated with it, you might get sick of holding down the Windows key though!


The other very nice feature is the run as, it is a little different than Windows Run As because it as a default user.  The other benefit is easy of running explorer.exe using the Run As, which is not possible with Windows.


The volume control is kind of nice also.

Filed under: General 1 Comment
14Jun/063

Session.DocumentContext something isn't right

If you ran the following code in the Web Query Save agent that was assigned to a form with a subject field. The original value of subject was "Truck" and the new value entered on the web was "Car". The Web Query Save agent code was:

Dim Session As New NotesSession
Dim docBefore As NotesDocument
Dim documentContext As NotesDocument
Dim docAfter As NotesDocument

Set docBefore = Session.CurrentDatabase.getDocumentByUNID( "f02506889e2d5cfc8625712f001b02f9" )
Msgbox "Before: " +
docBefore.subject(0) Set documentContext = Session.DocumentContext
Msgbox "Context: " + documentContext.subject(0)
Set docAfter = Session.CurrentDatabase.getDocumentByUNID( "f02506889e2d5cfc8625712f001b02f9" )
Msgbox "After:" +
docAfter.subject(0)

I was expecting to see:
Before: Truck
Context: Car
After: Truck

What I saw was:
Before: Truck
Context: Car
After: Truck

Domino seems to read the document from the database until the DocumentContext is used at which the document is read from memory where the changes are allready made. This will make my job capturing what has change for Open Audit a litte hard, thus take a little more time.

Filed under: Domino 3 Comments
13Jun/060

Proverbs 13:2-3

2-A man shall eat well by the fruit of his mouth,
But the soul of the unfaithful feeds on violence.
3-He who guards his mouth preserves his life,
But he who opens wide his lips shall have destruction.
Tagged as: No Comments
8Jun/060

Template Build Class 1.1.0

Updated the Template Build Class to include a build number that will be different the build version. The build version is text which could have 1.1.0, 1.0.0 beta 1, etc. The build number is an actual number and would be 40, 100, etc.

Here are the methods available:

Public Sub new( )<br>
Public Function GetVersionField() As NotesDocument<br>
Public Function getTemplateBuildName( ) As String<br>
Public Function setTemplateBuildName( BuildName As String )<br>
Public Function getTemplateBuild( ) As String<br>
Public Function setTemplateBuild( Build As String )<br>
Public Function getTemplateBuildNumber( ) As Double<br>
Public Function setTemplateBuildNumber( BuildNumber As Double )<br>
Public Function getTemplateBuildDate( ) As NotesDateTime<br>
Public Function setTemplateBuildDate( BuildDate As NotesDateTime )<br>
Public Function hasTemplateBuild( ) As Boolean<br>
Public Sub Save( )<br>
Public Sub delete( )<br>




Template Build Class

Option Public
Option Declare
 
 
'/**
' * Notes/Domino uses a shared field called $TemplateBuild to store the current 
' * build number, build name and build date this class will allow access to the shared field
' * both to read and update.  
' *
' * History
' *14 Apr 2005	Christopher J Doig	Initial version
' *30 May 2006	Chad Schelfhout ( http://www.chadsmiley.com )
' *		Converted function to class
' *		Setters and getters for Build information
' * 		Allow the creation of the shared field if it does not exist
' *8 June 2006	Chad Schelfhout ( http://www.chadsmiley.com )
' *		Added TemplateBuildNumber which is a number not text.  This will allow the comparison to see if a new version is available.
' */
Class TemplateBuild
	SharedFieldTitleName As String
	SharedFieldName As String
	TemplateBuildNameField As String
	TemplateBuildNumberField As String
	TemplateBuildField As String
	TemplateBuildDateField As String
 
	docTemplateBuild As NotesDocument
	session As NotesSession
	saveDocTemplateBuild As Boolean
	Public Sub New ()
		SharedFieldTitleName = "$Title"
		SharedFieldName = "$TemplateBuild" 
		TemplateBuildNameField = "$TemplateBuildName"
		TemplateBuildNumberField = "$TemplateBuildNumber"
		TemplateBuildField = "$TemplateBuild"
		TemplateBuildDateField = "$TemplateBuildDate"
 
		Set session = New NotesSession
		saveDocTemplateBuild = False
		Call GetVersionField()
	End Sub
'/*
' * 	Attempt to load the Build information if it is not there then import the DXL to create
' * the shared field then try and load the Build information again.
' */
	Public Function GetVersionField () As NotesDocument
		Call attemptLoad()
		If docTemplateBuild Is Nothing Then
			Call createBuildTemplateField()
			Call attemptLoad()
		End If
		Set GetVersionField = docTemplateBuild
	End Function
 
'/*
' * Search for the shared field called $TemplateBuild
' */
	Private Sub attemptLoad() 
 
		Dim doc As NotesDocument
		Dim nc As NotesNoteCollection
		Dim item As NotesItem
		Dim strID As String
 
		Set nc = session.CurrentDatabase.CreateNoteCollection ( False )
		nc.SelectSharedFields = True
		Call nc.BuildCollection
		strID = nc.GetFirstNoteId
 
		Set docTemplateBuild = Nothing
		Do Until strID = ""
			Set doc = session.CurrentDatabase.GetDocumentByID ( strID )		
			Set item = doc.GetFirstItem ( SharedFieldTitleName )
			If item.Text = SharedFieldName Then
				Set docTemplateBuild = doc
				Exit Do
			End If
			strID = nc.GetNextNoteId ( strID )
		Loop
	End Sub
'/*
' * Import a shared field called $TemplateBuild
' */
	Private Sub createBuildTemplateField()
 
		Dim importer As NotesDXLImporter
		Set importer = session.CreateDXLImporter
 
		importer.DesignImportOption = DXLIMPORTOPTION_CREATE
		Call importer.Import( |<?xml version='1.0' encoding='utf-8'?><!DOCTYPE sharedfield>
		<sharedfield name='$TemplateBuild' xmlns='http://www.lotus.com/dxl' language='en'>
			<field type='text' kind='editable' name='$TemplateBuild'/>
			<item name='$TemplateBuildName' sign='true'>
				<textlist>
					<text>Application Name</text>
				</textlist>
			</item>
			<item name='$TemplateBuild' sign='true'>
				<textlist>
					<text>0.0.0</text>
				</textlist>
			</item>
			<item name='$TemplateBuildNumber' sign='true'>
				<numberlist>
					<number>0</number>
				</numberlist>
			</item>
			<item name='$TemplateBuildDate' sign='true'>
				<datetimelist>
					<datetime dst='true'>20050815T000000,00-07</datetime>
				</datetimelist>
			</item>
		</sharedfield>| , Session.CurrentDatabase )
		saveDocTemplateBuild = True
	End Sub
'/*
' * Get, Set Template Build Name
' */	
	Public Function getTemplateBuildName As String
		getTemplateBuildName = ""
		If hasTemplateBuild Then
			If docTemplateBuild.HasItem( TemplateBuildNameField ) Then
				getTemplateBuildName = docTemplateBuild.getFirstItem( TemplateBuildNameField ).text
			End If
		End If
	End Function
	Public Sub setTemplateBuildName ( BuildName As String )
		If hasTemplateBuild Then
			Call docTemplateBuild.ReplaceItemValue( TemplateBuildNameField ,  BuildName )
			saveDocTemplateBuild = True
		End If
	End Sub
 
'/*
' * Get, Set Template Build
' */	
	Public Function getTemplateBuild As String
		getTemplateBuild = ""
		If hasTemplateBuild Then
			If docTemplateBuild.HasItem( TemplateBuildField ) Then
				getTemplateBuild = docTemplateBuild.getFirstItem( TemplateBuildField ).text
			End If
		End If
	End Function
	Public Sub setTemplateBuild ( Build As String )
		If hasTemplateBuild Then
			Call docTemplateBuild.ReplaceItemValue( TemplateBuildField ,  Build )
			saveDocTemplateBuild = True
		End If
	End Sub
 
'/*
' * Get, Set Template Build Number
' */	
	Public Function getTemplateBuildNumber As Double
		getTemplateBuildNumber = 0
		If hasTemplateBuild Then
			If docTemplateBuild.HasItem( TemplateBuildNumberField ) Then
				If ( Isnumeric( docTemplateBuild.getFirstItem( TemplateBuildNumberField ).text  ) ) Then
					getTemplateBuildNumber = Cdbl( docTemplateBuild.getFirstItem( TemplateBuildNumberField ).text )
				End If					
			End If
		End If
	End Function
	Public Sub setTemplateBuildNumber ( BuildNumber As Double )
		If hasTemplateBuild Then
			Call docTemplateBuild.ReplaceItemValue( TemplateBuildNumberField ,  BuildNumber )
			saveDocTemplateBuild = True
		End If
	End Sub
 
'/*
' * Get, Set Template Build Date
' */	
	Public Function getTemplateBuildDate As NotesDateTime
		Set getTemplateBuildDate = New NotesDateTime( "0/0/0" )
		If hasTemplateBuild Then
			If ( docTemplateBuild.HasItem( TemplateBuildDateField ) ) Then
				Set getTemplateBuildDate = docTemplateBuild.getFirstItem( TemplateBuildDateField ).dateTimeValue
			End If
		End If
	End Function
	Public Sub setTemplateBuildDate ( BuildDate As NotesDateTime )
		If hasTemplateBuild Then
			Call docTemplateBuild.ReplaceItemValue( TemplateBuildDateField ,  BuildDate )
			saveDocTemplateBuild = True
		End If
	End Sub
 
	Public Function hasTemplateBuild As Boolean
		hasTemplateBuild = Not ( docTemplateBuild Is Nothing)
	End Function
 
	Public Sub Save()
		If saveDocTemplateBuild Then
			Call docTemplateBuild.Save( True , False )
			saveDocTemplateBuild = False
		End If
	End Sub
	Public Sub delete 
		Call save
	End Sub
End Class


Filed under: Domino No Comments
6Jun/062

Template Build discussion

Currently Set Template Version uses three pieces of information TemplateBuildName, TemplateBuild, and TemplateBuildDate.  Each of these is a string which is not a problem, but Vince created a web service for checking for updates that uses Project, BuildNumber, and BuildName as strings but BuildNumber is a double.  The double is needed to see if there is a new version available, and a string can not be used because 1.1.1 is different than 1.01.01 or 1.1.10.  Thus the discussion!

I would like to see some consistency between these so the Build Template class can work.  The two are very close TemplateBuildName = Project and TemplateBuild = BuildName.  The only difference is the BuildNumber with no corresponding field on the $TemplateBuild shared field.  What I am proposing is enhancing Set Template Version to include on more additional field called Template Build which would be a number allowing a decimal.  Leaving Template Version (TemplateBuild) as a string will allow for 1.0.0 beta 1 and multiple decimals.A picture named M2
Please let me know your thoughts.

Filed under: Domino 2 Comments
5Jun/061

Rich Text to MIME

In November I was working on rendering Rich Text as MIME for Blogsphere which been doing well, based on no new is good news.  There is a new technote that explains how to get around the images disappearing if the document is refreshed more than once.  Which Blogsphere handles because it uses a second rich text field so it never converted to MIME twice.  The technote uses 'ConvertedMime' with a value of 1 so it is not converted to a MIME database twice.  Does anyone else know if there are any other fields related to Rich Text to MIME conversion?

Filed under: Domino 1 Comment