IBM Blog Template – Syntax Highlighter for Lotus Script

How often would we like to insert coloured code in our documents? I know it’s not that important but, first, it looks much nicer and, second, it’s much easy to understand a piece of source code when it is coloured. At least for me.

I played around with the new IBM Blog template. It gives you all you need to start to blog. As you can see in my blog, I sometimes post some code along with my articles. The code is automatically formatted.

Well, how could this be done in the IBM Blog template? First of all, there is no feature that will do the job out of the box. So I googled and found Alex Gorbatchevs “dp.SyntaxHighlighter“.
dp.SyntaxHighlighter is a free JavaScript tool for source code syntax highlighting. The script is meant to help a developer to post code snippets online with ease and without having to worry about applying format.

Here are the steps to inplement syntax highlighting into the IBM Blog template. At the end of this article you’ll find the necessary files in a zip archive. The archive contains shBrushLS.js. This file contains the keywords and classes for Lotus Script along with REGEXP for formatting Single-Line and Multi-Line comments.

Open the IBM Bolg template in Designer and add the .js files to the files section of the template. Add the .css file to the StyleSheet section of the template.

Now open the “HTML Templates” section in the navigation pane of your blog and click “Block Templates”

Add the following lines to the HTMLBottom template document

Syntax Highlighter

and these lines to the HTMLTop template document.

Syntax Highlighter

Do not forget to save the documents ­čśë

You can now start to post your code. You have to use a TEXTAREA tag as shown in the picture below. For mor informations on how to use the script, please take a look at the doumentation.

Syntax Highlighter

When you now open the article in the web, it should look like this …

Syntax Highlighter

I encountered a few problems when using the textarea tag. It seems that all CRLF are replaced by nothing and the code appears in one single line. So I had to modify the existing Lotus Script code in the DXLiveContentEngine lib of the template.

I added the following code to the “renderBlogItem” function ( starting at line 750 )

	If rtitem.Type=1 Then
		'is rich text
		Set rtitem2=doc.getfirstitem("rt")
		html=rtitem2.GetFormattedText(False,32767)
		' --- added 05.11.2006, Ulrich Krause
		Dim strHTML As String
		strHTML = R5ReplaceSubstring ( Mid$( HTML ,Instr ( HTML,"", Chr$(13))
		html = R5ReplaceSubstring ( HTML, Mid$( HTML ,Instr(HTML,"

Maybe Steve Castledine can have a look at this.

DOWNLOAD sh.zip

Technorati:


Insert RichText into RichText with LotusScript – Chapter 2

In an earlier post I wrote about how to insert richtext from another document into a specific position in an exiting richtext item using DXL. This solution works fine but has a few limitations. One of this limitations is the handling of attachments and embedded objects.

So I was looking for another solution. I tried to use LotusScript but due to some missing methods there is no way to achive the goal.

Then I searched the C++ API and found

LNSTATUS Insert( const LNRichText &richtext, LNRTCursor *cursor )

This was exactly what I was looking for. I wrote a small console application to test this method. The function did exactly what it is supposed to do.

Using the

LNSTATUS GotoFirst( const LNString &searchstring )

method, it is possible, to insert the richtext at a specific position that can be defined by a placeholder. The placeholder can be of any name.

Insert Richtext - the placeholder

To delete the placeholder before inserting the replacing content, I use

rtTarget.Delete( &cursor, sizeof( InsertionPoint ));

I guess this is what IBM does when you use the FindAndReplace method of the NotesRichTextRange class. But with this metod you can replace text only. Replacing a string with richtext is not supported. I wonder, why IBM does not enhance this method. In my oppinion this is not very hard to do; as I stated before, the Notes API already has this functionality.

After a few more tests with attachments and embedded objects, I put all this stuff into an DLL. Now the function can be used from inside LotusScript. I decided to provide this new functionality as an DLL because all of my attempts to create an LSX ( using the LSX toolkit ) constantly crashes my client. Even with some help from Bill Buchan and Benjamin Langhinrich I was not able to build a stable function. Maybe i will succeed some day …

To use the InsertRichTextItem function from LotusScript, you have to copy “rt.dll” to your notes executable directory. Since the function uses the C++ API, you have to copy “lcppn70.dll”, too. I have created and tested the function with Notes 7.0.1, but it should work in former versions of Notes as well.

In the Declaration section of your Lotus Script put the following lines

Declare Function InsertRichTextItem Lib "rt" (_
Byval dbServer As String,_
Byval dbPath As String,_
Byval lngSourceNoteID As Long,_
Byval strSourceRTField As String,_
Byval lngTargetNoteID As Long,_
Byval strTargetRTField As String,_
Byval InsertionPoint As String) As String

The function is called as follows

strRet = InsertRichTextItem ( DB_SERVER, DB_FILE,  SourceNOTEID, "Body", TargetNOTEID, "Body","")

The function returns “OK” when completed successfully, otherwise it throws an error.

Sub Click(Source As Button)

	Dim s As New NotesSession
	Dim db As NotesDatabase
	Dim col As NotesDocumentCollection
	Dim doc As NotesDocument

	Dim SourceDoc As NotesDocument ' contains the richtext to be inserted
	Dim TargetDoc As NotesDocument ' insert RT here

	Dim rtItem As NotesRichTextItem
	Dim retval As Integer

	Set db = s.GetDatabase( DB_SERVER, DB_FILE)
	Set col = db.AllDocuments
	Set SourceDoc = col.GetNthDocument(2) ' SecondDocument
	Set TargetDoc = col.GetNthDocument(1) ' FirstDocument

	Dim SourceNOTEID As Long
	Dim TargetNOTEID As Long

	' Convert NOTEID from HEX to Long
	TargetNOTEID = Val("&H" + TargetDoc.NoteID)
	SourceNOTEID = Val("&H" + SourceDoc.NoteID)

	Msgbox InsertRichTextItem ( DB_SERVER, DB_FILE,  SourceNOTEID, "Body", TargetNOTEID, "Body","")

End Sub

Attached you’ll find a sample database. The necessary files are included in the “first document” – doc.

If you find this function useful, pls. let me know.

Technorati:


AUTOLAUNCH_NOTES=nlnotes

When you run autorun.exe to launch the Lotus Notes® client installed on a USB drive, the Notes client installed on the operating system (OS) comes to focus instead. This behavior occurs only if the local version of Notes is already running on the OS. If the local version of Notes is not running, the Notes client from the USB will launch.

To run Notes from the USB drive even if a local version of Notes is running, do the following:

1. Open the autorun.ini file on the USB drive in edit mode.
2. Change the following line:

AUTOLAUNCH_NOTES=yes

to

AUTOLAUNCH_NOTES=nlnotes.exe

3. Save the file, and then run autorun.exe again.

[Lotus Notes KnowledgeBase]


Notes 7.0.2 – NOMAD

Installed Lotus Notes on my 1GB Cruzer SanDisk USB Drive today. As you can see, the estimated time for installation was 32 minutes; At least it took 45 minutes to install the client. This is far to long. Copying 300MB of data from my local drive C: to the usb device is normally done within 2 Minutes or so.

Lotus Notes 7.0.2 - NOMAD Installation

UPDATE:

I found this hint on LDD regarding a TEMP_DIR issue:

“Currently the TEMP_DIR variable in your AUTORUN.INI file for IBM Lotus Notes client on a USB drive installation only works when your client is automatically launched. When launching the client from the “Lotus Notes on USB” desktop icon, the temporary files will be stored in the local system’s temporary directory,

When adding the TEMP_DIR variable to your AUTORUN.INI, also set AUTOLAUNCH_NOTES=Yes (default). After inserting the USB drive into your computer, if your Notes client is either (1) automatically launched, or (2) you run the command AUTORUN.EXE from the root of the USB drive which launches the client, then the temporary file will be stored in the path for the temporary directory you specified.”


Differences between the IBM Lotus Domino 7.0.2 Blog Template and previous external versions

The Domino Blog template, which was developed and maintained for over 3 years by an external source (Steve Castledine), was acquired by IBM® and incorporated into Lotus® Notes/Domino® 7.0.2.

Therefore, some IBM customers are already familiar with the template.

When the template was brought into IBM, some changes had to be made in order to:

  • remove Open source code
  • ease support of the template
  • simplify use of the template
  • change the user interface to fit in with IBM standards
  • make Language translation easier

These changes have, therefore, resulted in some feature removals, feature alterations and a different user interface (UI), which are discussed in this technote.


USB Drive Letter Manager

USBDLM is a Windows service that gives control over Window’s drive letter assingment for USB drives. Running as service makes it independent of the logged on user’s previleges, so there is no need to give the users the previlege to change drive letters.
It automatically solves conficts between USB drives and network or subst drives of the currently logged on user.
Furthermore you can define new default letters for USB drives and much more.

[USBDLM website]


XFL – Extended Formula Language

The Extended Formula Language improves the native formula language of Lotus Notes in several important points, e.g.:

  • Real formula debugging
  • Define your own @Functions
  • XFL makes @For, @While, @Goto etc. available even for Notes R4/R5
  • Use LotusScript code within your formula code
  • Object oriented programming in formulas

There is no installation routine.

Just copy two script libraries of the example database into the database you want to use XFL programming in. If you still have Notes R4 clients copy the subform too. That’s all.

Extended Formula Language is written and provided by Bert Haessler.


OpenNTF Mail Experience – German Edition

Jens-B. Augustiny und Christian Tillmanns haben heute ein neues Projekt auf OpenNTF gestartet.

Ziel ist es, das bereits seit l├Ąngerem verf├╝gbare OpenNTF Mail Template Projekt ins Deutsche zu ├╝bersetzen. Bisher waren die n├╝tzlichen Erg├Ąnzungen der Standard Mail Schablone nur in englischer Sprache verf├╝gbar.

Danke an Jens und Christian f├╝r dieses Projekt. Ich denke, es wird ebenso erfolgreich werden, wie das “Ur”-Projekt.

[Projektseite]


atnotes.de – the no.1 forum for Lotus Notes in Germany

atnotes, founded in december 2001 by Arne Riemann, over the past 5 years became the no.1 forum for Lotus Notes users, administrators and developers.
7500 member from mostly Germany, Austria and Swiss and about 205.000 postings in 31.253 threads made this forum a valuable resource for the Notes Community.

atnotes.de

You’ re looking for a place to get a quick answer to your urgent Lotus Notes / Domino question? Well, atnotes is the place to be. Become a member, post your question. I’ m sure you’ll get an answer or a hint within minutes.


S.I.S.C – Single Instance Space Calculator

S.I.S.C = Single Instance Space Calculator. Jo mei, wos ‘n des ??

S.I.S.C ist ein Instrument basierend auf Lotus Notes, MS SQL-Server und MS-Access zur Berechnung des Speicherverbrauchs redundanter Attachments.

Wozu braucht man das ?

Wir besch├Ąftigen uns zur Zeit mit der Frage, wie viel Speicherplatz auf unseren NotesServern frei wird, wenn jedes Attachment nur noch ein einziges Mal vorhanden ist.
Im Moment sind ja die Attachments durch Mails an eine Gruppe oder mehrfache Weiterleitung oder Antwort n -fach in der Maildatei eines oder mehrerer User vorhanden.

Intelligente Systeme zur Auslagerung von Attachments oder Archivierung von Mails legen diese redundanten Attachments nur einmal ab und referenzieren jeweils auf diese “single instance” eines Attachments.

Die Fragen, die einem dabei im Kopf herumschwirren sind:

– Ist das mit der mehrfachen Speicherung wirklich sooooooooo dramatisch ? und
– wie zum Teufel soll ich das denn nun wieder so bauen, da├â? es auch der oberste Oberindianer versteht ?

Herausgekommen ist S.I.S.C. Oberindianer interessieren sich wahrscheinlich nur f├╝r die rot eingerahmte Zahl.

SELECT Round ( Sum( Multiplikation.Ersparnis ) /1024000000,2 ) & " GB" AS Ersparnis_Gesamt
FROM Multiplikation;
Single Instance Space Calculator

Um die anfallenden Datenmengen zu handhaben, werkelt im Hintergrund ein SQL-Server. Bei kleineren Unternehmen kommt man wohl auch mit MS-Access als Datenspeicher aus. Ich benutze MS-Access der Einfachheit halber f├╝r die Auswertung der erfassten Daten.

Die Ermittlung der Daten erfolgt ├╝ber Lotus Script in Verbindung mit einer f├╝r die Hashwertbestimmung entwickelten DLL.

Declare Function GetHash Lib "filehash" (_
Byval strFileName As String,_
Byval intAlgorithm As Integer,_
Byval intFormat As Integer,_
Byval intOperation As Integer,_
Byval intSHA2Strength As Integer)_
As String

'//  Algorithm
Const  CRC32 = 1
Const GOSTHASH = 2
Const MD2 = 3
Const MD4 = 4
Const MD5 = 5
Const SHA1 = 6
Const SHA2 = 7

'// Formatting options
Const LOWERCASE_NOSPACES = 1
Const LOWERCASE_SPACES = 2
Const UPPERCASE_NOSPACES = 3
Const UPPERCASE_SPACES = 4

'// SHA2_STRENGTH
Const SHA2_STRENGTH_128 = 128
Const SHA2_STRENGTH_256 = 256
Const SHA2_STRENGTH_512 = 512

'// Definitions of some kind
Const STRING_HASH = 1
Const  FILE_HASH = 2

...
hash = GetHash (fNAME, SHA2, UPPERCASE_NOSPACES, FILE_HASH, SHA2_STRENGTH_128)

Die Daten werden bis auf ein paar statistische Daten zu den einzelnen Datenbanken anonym erfasst. Es sind keinerlei R├╝ckschl├╝sse m├Âglich, wer denn nun welches Attachment doppelt und dreifach in seiner Maildatenbank voh├Ąlt. Datensch├╝tzer d├╝rfen also aufatmen.

Ich werde an dieser Stelle weiter ├╝ber die Entwicklung dieses Projekt berichten. Da das Know How m├Âglicherweise f├╝r Consultants im Bereich DMS n├╝tzlich sein k├Ânnte, nehme ich Abstand davon, die relevanten Teile hier in allen Einzelheiten zu beschreiben und das Gesamtprojekt zum kostenlosen Download anzubieten.

Sollte Interesse bestehen, kann man jederzeit mit mir Kontakt per mail oder auch telefonisch aufnehmen.


Happy 50th Birthday, HardDisk

Hardisk

IBM introduced the 305 RAMAC computer in 1956, which was the first computer to include a disk drive named the IBM 350 Disk File. Prior to this magnetic computer storage had consisted of core memory, tape, and drums. The magnetic disk was seen as a replacement for the magnetic drum for the same reason 78 RPM Records eventually replaced Edison cylinders- more storage with less space.

The 350 Disk File consisted of a stack of fifty 24″ discs that can be seen to the left of the operator in the above picture. The capacity of the entire disk file was 5 million 7-bit characters, which works out to about 4.4 MB in modern parlance. This is about the same capacity as the first personal computer hard drives that appeared in the early 1980’s, but was an enormous capacity for 1956. IBM leased the 350 Disk File for a $35,000 annual fee.

Today the magnetic disc is the platform of choice for the temporary storage of digital video, but it wasn’t until the late 1960’s that the magnetic disc was used for any sort of video storage. At that time the Instant Replay Deck was introduced, which permitted the storage and playback of brief segments of analog video.


Site: Domino & Web 2.0

Found an interesting site today. The site is run by Philippe GAUVIN from France and covers all about “Int├ęgration de solutions Web 2.0 dans les applications Lotus Notes/Domino” or in english “How to integrate Web 2.0 solutions in Lotus Notes/Domino“.

Int├ęgration de solutions Web 2.0 dans les applications Lotus Notes/Domino

The site is in french language and I have to commit that I do not understand much french. But Phillipe wrote me in an eMail that he is about to translate the content to english. But when you look at the published code, you can see that there is some valuable information on this site.


QuickTools for Lotus Domino

QuickTools for Lotus Domino offers Domino administrators the ability to create custom Java plug-ins to manipulate Domino databases. The custom plug-ins extend Domino├ó??s concept of agents such that the plug-ins can be run on any database or document selected from the application├ó??s graphical interface. … { more }