Monday, December 28, 2009

DXL + XSL -> XFDF -> PDF

We started to use XFDF approach when create PDF file. I have to say that FDF is nothing, XFDF is power :). XFDF approach much easier to use and to debug.

For debugging I used Firefox plug-in XSL Results it works good.

So what steps you have to do if you want to use this approach.

  1. get NotesDocumentCollection of document you want to export to PDF
  2. export it using NotesDXLExporter to dxl file
  3. get NotesXSLTransformer and use it :)
  4. check result

you may have problem if you are not familiar with XSL. There are many good sites where you can read about it.

Here is an example on openntf

Here is my first example of XSL for generation XFDF file. It can help to somebody.





Related articles about creating PDF files

Thursday, December 24, 2009

Use XFDF approach insted of FDF when create PDF file

My fellow just shown me that my approach that I posted on my blog couple weeks ago
how to create PDF using FDF is old one :)
It is shame for me :) that I did not find XFDF approach.

Anywhere from now I would recommend to use XFDF approach when you want to generate PDF file. The idea is similar to FDF but done via real XML. It is much easy to work with it and it is readable :)

Here is simple XFDF file, it demonstrate how it looks.



As you see it is really simple XML file and it will use http://ip/pdf_form.pdf file to show data from XFDF file.

Now I am looking for 'opposite way'. Let's say I'm opened PDF file using XFDF approach and add some values to this PDF file. How I can get export this data back then to XFDF file? Does anybody have such experience?

Related articles about creating PDF files

Tuesday, December 22, 2009

Lotus Notes integration with Skype

Hi guys,

Let me introduce our new product Skytus - live integration Lotus Notes with Skype.

I would like to share it to our community :) and want to get feedback as much as possible as I'm one of developer. I'm interesting about each opinion!

We used C++ and Lotus Notes to make this product. Of course it is only beta and there are some issues there, we will fix it later.

Actually this is only demonstration of our possibilities and knowledge in Lotus Notes Integration area, so if you have any question regarding integration with Lotus Notes, you can contact us directly!

here is a site: http://skytus.com/
here is a download page: http://skytus.com/download

VIEW:


CONTACT:


Thanks!

UPDATE: We have decided to close the website due to very low interest to skytus.

Friday, December 18, 2009

do you want to re-configurate your server?

I hope everybody knows this, but I just tried it first time in my life (before I only read about this), so just confirm that it is work :)

find notes.ini in domino directory

- make local copy (who know -) probably it will help later)
- remove all line except these:

[Notes]
NotesProgram=d:\IBM\Lotus\Domino
Directory=d:\IBM\Lotus\Domino\data
KitType=2
InstallType=1


fix path and run domino then, now you can manage it again from "draft"

Thursday, December 17, 2009

How to do authentication in google analytics in LN

Here is an example how to do authentication in google analytics. This example was written not by me (author is Mikael Thuneberg), I just would like to share it here as well, because this example helped me a lot.

There are many example in web with VBA example to get data from Google Analytics (I work on that topic as well).

Public Function getGAauthenticationToken(email As String, password As String)

'Fetches GA authentication token, which can then be used to fetch data with the getGAdata function
'Created by Mikael Thuneberg

Dim objhttp As Variant
Dim authToken As Variant

Dim URL As String
Dim tempAns As String
Dim authResponse As String
Dim ch As String

Dim CurChr As Integer
Dim authTokenStart As Integer

If email = "" Then
getGAauthenticationToken = ""
Exit Function
End If

If password = "" Then
getGAauthenticationToken = "Input password"
Exit Function
End If

'hex password
CurChr = 1
Do Until ((CurChr - 1) = Len(password))
ch = Mid(password, CurChr, 1)
Select Case Asc(ch)
Case 48 To 57, 65 To 90, 97 To 122
tempAns = tempAns & Mid(password, CurChr, 1)
Case 32
tempAns = tempAns & "%" & Hex(32)
Case Else
tempAns = tempAns & "%" & Format(Hex(Asc(Mid(password, CurChr, 1))), "00")
End Select

CurChr = CurChr + 1
Loop
password = tempAns
'/

On Error GoTo errhandler

' authentication
Set objhttp = CreateObject("MSXML2.ServerXMLHTTP")
URL = "https://www.google.com/accounts/ClientLogin"
objhttp.Open "POST", URL, False
objhttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
objhttp.send ("accountType=GOOGLE&Email=" & email & "&Passwd=" & password & "&service=analytics&Source=tool-1.0")

authResponse = objhttp.responseText

If InStr(1, authResponse, "BadAuthentication") = 0 Then
authTokenStart = InStr(1, authResponse, "Auth=") + 4
authToken = Right(authResponse, Len(authResponse) - authTokenStart)
getGAauthenticationToken = authToken
Else
getGAauthenticationToken = "Authentication failed"
End If

basta:
Exit Function
errhandler:
getGAauthenticationToken = "Authentication failed"
Resume basta
End Function

Here is another example, it gets real data from Google Analytics.

Wednesday, December 16, 2009

Use JSMin when do web developing

I started to use JSLint and JSMin just couple weeks ago but now I have to say that everybody must use it.
Today I used JSMin and I have to say that In my case it saves ~22% of space (original size was 28kb and after minimization it was 22kb).

So, now when you are ready to put your JS libraries to productive server, use JSMin always! It is really cool (at least I think so :) )

JSLint
http://www.jslint.com/

JSMin
http://www.crockford.com/javascript/jsmin.html

Sunday, December 13, 2009

Create PDF / FDF in Lotus Notes using LS

I had task where I should create PDF file from template and fill fields by values from documents
So what did I do?

I spoke with my colleagues :-) they recommended to use FDF Toolkit For Windows, instead of iText approach that I used before, and I have to say that it is very cool approach, it is much better at least for me. Instead of generation new PDF file we just export data to FDF file and link it with PDF template and that's all, so our FDF will show data using PDF form/template. -> No Java required and now no non-supported libraries.

Here is an instruction how to do this:
  • register FDFACX.DLL (in order to do that, I copied FdfTk.dll and FDFACX.DLL to windows\system32, but I believe there is better way)
 regsvr32 C:\WINDOWS\system32\FDFACX.dll  
  • example of code now (it is from Adobe)

Using the FDF tooklit in LotusScript

 Sub Initialize  
 '  
 ' Set up for using the FDF Toolkit for ActiveX  
 '  
 Dim FdfAcX As Variant  
 Dim outputFDF As Variant  
 Dim sPdfFileName As String, sFdfFileName As String, sFilePath As String  
 Set FdfAcX = CreateObject("FdfApp.FdfApp")  
 Set outputFDF = FdfAcX.FDFCreate()  
 '  
 ' % REM  
 '  
 ' Change these paths to reflect your server environment  
 ' Ideally, you could use a Lotus Notes profile document to store this  
 ' information.  
 '  
 ' Below are the three options for storing the PDF that was discussed in  
 ' the documentation for this application.  
 '  
 ' Option 1 : UNC Directory Share  
 ' This option oddly asks if you would like to save on close.  
 '  
 ' sPdfFileName = "\\Mage\domdata\domino\html\pdf\panarama.pdf"  
 '  
 ' Option 2 : Store in a Lotus Notes Page element  
 '  
 sPdfFileName = "http://mage/pdf/panarama.nsf/PDFs/$file/panarama.pdf"  
 '  
 ' Option 3 : Store in the Domino HTML directory  
 '  
 ' REM %  
 '  
 ' sPdfFileName = "http://mage/pdf/panarama.pdf"  
 sFilePath = "d:\domdata\domino\html\pdf\tmp\"  
 '  
 ' Set up for getting Lotus Notes information  
 '  
 Dim session As New NotesSession  
 Dim contextDoc As NotesDocument  
 Dim dateTime As NotesDateTime  
 Dim tempNumber As Single  
 Dim rounded As Integer  
 Dim fileName As String  
 Set contextDoc = session.documentContext  
 '  
 8 Integrating Adobe Acrobat FDF  
 with Lotus Domino  
 ' This will create a random number between 0 and 100.  
 ' The number will give  
 ' us a good chance of not temporarily having the same file name in the tmp  
 ' directory at the same time. The file will briefly be in the tmp  
 ' directory,  
 ' attached to the Notes document and then deleted.  
 '  
 Randomize  
 temp = Rnd  
 rounded = Round((temp * 100), 0)  
 fileName = Cstr(rounded)  
 sFdfFileName = sFilePath & fileName & ".fdf"  
 '  
 ' FDFSetValue will set the value you pass it. See page 139 of the  
 ' FDF Toolkit Overview and Reference.  
 '  
 outputFDF.FDFSetValue "FirstName", contextDoc.FirstName(0), False  
 outputFDF.FDFSetValue "MidInit", contextDoc.MidInit(0), False  
 outputFDF.FDFSetValue "LastName", contextDoc.LastName(0), False  
 '  
 ' Get the value of the date fields. The DateOnly property  
 ' returns a string.  
 '  
 Set dateTime = New NotesDateTime( contextDoc.HireDate(0) )  
 outputFDF.FDFSetValue "HireDate", dateTime.DateOnly, False  
 Set dateTime = New NotesDateTime( contextDoc.ModDate(0) )  
 outputFDF.FDFSetValue "ModDate", dateTime.DateOnly, False  
 '  
 outputFDF.FDFSetValue "Address1", contextDoc.Address1(0), False  
 outputFDF.FDFSetValue "Address2", contextDoc.Address2(0), False  
 outputFDF.FDFSetValue "City", contextDoc.City(0), False  
 outputFDF.FDFSetValue "State", contextDoc.State(0), False  
 outputFDF.FDFSetValue "ZipCode", contextDoc.ZipCode(0), False  
 outputFDF.FDFSetValue "Country", contextDoc.Country(0), False  
 '  
 outputFDF.FDFSetValue "MAddress1", contextDoc.MAddress1(0), False  
 outputFDF.FDFSetValue "MAddress2", contextDoc.MAddress2(0), False  
 outputFDF.FDFSetValue "MCity", contextDoc.MCity(0), False  
 outputFDF.FDFSetValue "MState", contextDoc.MState(0), False  
 outputFDF.FDFSetValue "MZipCode", contextDoc.MZipCode(0), False  
 '  
 outputFDF.FDFSetValue "HomePhone", contextDoc.HomePhone(0), False  
 outputFDF.FDFSetValue "WorkPhone", contextDoc.WorkPhone(0), False  
 '  
 outputFDF.FDFSetValue "Emer1Contact", contextDoc.Emer1Contact(0), False  
 outputFDF.FDFSetValue "Emer1Phone", contextDoc.Emer1Phone(0), False  
 outputFDF.FDFSetValue "Emer2Contact", contextDoc.Emer2Contact(0), False  
 outputFDF.FDFSetValue "Emer2Phone", contextDoc.Emer2Phone(0), False  
 '  
 ' Tell it which file we're writing to and do a save.  
 '  
 outputFDF.FDFSetFile sPdfFileName  
 outputFDF.FDFSaveToFile sFdfFileName  
 '  
 ' Always close your open FDF files.  
 '  
 outputFDF.FDFClose  
 ADOBE FDF TOOLKIT  
 User Guide  
 9  
 '  
 ' This will attach the FDF file we just closed to our Notes document  
 ' and then delete it from the tmp directory.  
 '  
 Call MoveFdfToAttachment(contextDoc, sFdfFileName)  
 End Sub  
 Public Function MoveFdfToAttachment(doc As NotesDocument, fileName As  
 String) As Integer  
 '// move each attachment to a rich text field.  
 Dim attachItem As New NotesRichTextItem(doc, "fdfAttachment")  
 Dim attachObj As notesEmbeddedObject, newObjName As String  
 Call attachItem.EmbedObject(EMBED_ATTACHMENT, "", fileName, "")  
 Kill fileName  
 MoveFdfToAttachment = True  
 End Function  

Related articles about creating PDF files

Thursday, December 10, 2009

How to import data from Google Analytics to LN database?

I was trying to do such thing via Java API but get errors when run it. Did anybody do such thing?
Would be really interesting to see at least example!

Sunday, December 06, 2009

check if Bookmark or Name is exists in Word/Excel application

I did not have tasks with export data from LN to word/excel/pdf for 1 years probably. My today's task was easy, I had to export data from LN to xml, processed it using xsl, walk through resulting xml and export everything to word/excel. Then I had to copy values from resulting xml to word/excel's temlpate using bookmarks (in excel it is names).

Here is an example how to check bookrmark/names in word/excel (because before I did not have experience with Excel's names)

excel approach I got from this link

Function NameExists(TheName
as String, obj, formType as String) As Boolean

NameExists = False

Select Case formType
Case "word":
if obj.activedocument.Bookmarks.Exists(TheName) Then
NameExists = true
End If
Case "excel"
On Error Resume Next
NameExists = Len(obj.names(TheName).Name) <> 0
End Select

End Function

Friday, December 04, 2009

I'm looking for testing tools for LN. Does anybody know couple?

I'm interested in test tools that can automate testing of LN application.
Just found new one that I've never seen before. What do you think about it? Does anybody has experience with this tool? If somebody could share some experience about it would be great.

here is link to their product, there is also flash demo there.
http://smart-toucan.com/

Please advice if somebody has good approach for testing in LN.

p.s.
that's is not an advertisement. I just want to find at least 1 tool that can help us to do automate testing for LN application.

How to emulate F9 key

Sometimes F9 makes good staff for us, so here is an example (I really don't remember where I got it).

'F9
Declare Function VkKeyScan Lib "User32.dll" Alias "VkKeyScanA" ( Byval char As Integer ) As Integer
Declare Function MapVirtualKey Lib "User32.dll" Alias "MapVirtualKeyA" ( Byval wCode As Long, Byval wMapType As Long ) As Long
Declare Sub keybd_event Lib "User32.dll" ( Byval Virtual As Integer, Byval OEMScan As Integer, Byval Flags As Long, Byval ExtrInfo As Long )
Const KE_KEYDOWN& = 0
Const KE_KEYUP& = 2 

Sub F9
  On Error Goto errorproc

  Dim vk As Long
  Dim sc As Integer

  vk = &H78

  sc = Cint( MapVirtualKey( vk&, 0 ) )

  Call keybd_event( Cint( vk& ), sc%, KE_KEYDOWN&, 0 )
  Yield
  Call keybd_event( Cint( vk& ), sc%, KE_KEYUP&, 0 )
  Yield

  endofsub:
    Exit Sub
  errorproc:
    Msgbox "Error #" & Err & " on line " & Erl & " in function " & Lsi_info(2) & " : " & Error, 48, "Runtime error"
  Resume endofsub 
End Sub

Thursday, December 03, 2009

Online JS validator

I have never used JS validator before (just because I did not think about it previously) . Today I decided to use one of them. I looked around and found JSLint. It is really good tools for validation of JS. I like it ! I recomend to use it to everybody, it gives very good results.

http://www.jslint.com/

Wednesday, December 02, 2009

Re-open document using @Formula

Need to update document using re-open approach?

here is easy way:
...
@Command([FileSave]);
@Command([SwitchForm]; currentForm)


I like this approach, especially because I've never thought about such way.

Wednesday, November 04, 2009

Would you like to add google analytics to your blog (blogspot)?

Today I decided to add 'Google Analytics' to my blog, so I looked around and found couple articles that describes how to do it.

I would like to share it to all who probably think about it: setting up google analyics on your blog

Tuesday, November 03, 2009

How @UserAccess can determine No Access level?

One my fellow asked me how to determine that user don't have access to database using only @formula. So I want to share how it can be done.
We should just check it on @IsError(@UserAccess(..)) and it will return 1 for cases if you don't have access to database at all.

Monday, November 02, 2009

How to show image in LN using HTML

I had trouble with displaying image using html in LN. I did everything correctly, but the image did not appear. So I looked around and found that there is a special field
$DelayedImagesOK = "ok"

So when I added this field (CFD) on the form it started to worked fine.

But then I found if we click on place where the image should display (I meant on that icon) using right click and then click on show image the image would appear and field $DelayedImagesOK with value "ok" would be added.

Monday, October 05, 2009

process image in LN (JPEG and PNG)

I was facing with problem when I got task to process image *.jpg and *.png (get their size and resize big image).

So let me put some code here to show my approach (it is only first version and it means that there are still many issues).

I used LS2J approach.


So here is my Java Library (core):

Options:
Option Public
Option Declare

Use "ImageLib"

Initialize:

import java.awt.AlphaComposite;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;

public class JpgImage {
BufferedImage originalImage = null;
String fileName = "";
int type = 0;

public JpgImage (String m_fileName) throws IOException {

try{
fileName = m_fileName;

originalImage = ImageIO.read(new File(fileName));
type = originalImage.getType() == 0? BufferedImage.TYPE_INT_ARGB : originalImage.getType();

}catch(IOException e){
System.out.println(e.getMessage());
}
}

public int ImgResize (int w, int h)
{
String newFileName = "";
String imgFormat = "";
try{
newFileName = fileName.replace(".", "-thumb.");

if(type == 5) {
imgFormat = "jpg";
}
else {
imgFormat = "png";
}

BufferedImage resizeImage = resizeImage(originalImage, type, w, h);
ImageIO.write(resizeImage, imgFormat, new File(newFileName));

}catch(IOException e){
System.out.println(e.getMessage());
}
return 0;
}

public int getWidth (){
return originalImage.getWidth();
}

public int getHeight () {
return originalImage.getHeight();
}

private static BufferedImage resizeImage(BufferedImage originalImage, int type, int w, int h){
BufferedImage resizedImage = new BufferedImage(w, h, type);
Graphics2D g = resizedImage.createGraphics();
g.drawImage(originalImage, 0, 0, w, h, null);
g.dispose();

return resizedImage;
}
}




LS code.

Options
Option Public
Option Declare

Use "ImageTest "

Uselsx "*javacon"


function add/change image (it creates Thumbnail version of original image with max size 120x120)
%REM
add image to Body and BodyThumbnail fields
%END REM
On Error Goto processError

Dim jpgClass As JavaClass
Dim jpgImage As JavaObject
Dim jpgImageThumbnail As JavaObject
Dim jError As JavaError

Dim w As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim uidocnew As NotesUIDocument
Dim doc As NotesDocument
Dim body As NotesRichTextItem
Dim bodyThumbnail As NotesRichTextItem
Dim filepath As Variant
Dim vFileNameThumbnail As Variant
Dim tmp As String
Dim filename As String
Dim filenameThumbnail As String
Dim picH As Integer, picW As Integer
Dim picHT As Integer, picWT As Integer
Dim debug As Boolean

debug = True
If debug Then Print Lsi_info(2) & " starts at: " & Now

Set uidoc = w.CurrentDocument
Set doc = uidoc.Document

filepath = w.OpenFileDialog(False, "Please select iamge", "JPG|*.jpg|GIF|*.gif|PNG|*.png|", "", "")

If Not Isarray(filepath) Then Exit Sub

filename = filepath(0)

'** everything we'll need to access our Java classes
Dim jSession As New JavaSession

'** get the JpgImage class and instantiate an instance of it
Set jpgClass = jSession.GetClass("JpgImage")
Set jpgImage = jpgClass.CreateObject("(Ljava/lang/String;)V", fileName)

'get width and height of images
picH = jpgImage.getHeight()
picW = jpgImage.getWidth()
Call doc.ReplaceItemValue("picH", picH)
Call doc.ReplaceItemValue("picW", picW)

'attach image to as it is to body field
Call doc.RemoveItem("Body")
Set body = New NotesRichTextItem(doc, "Body")
Call body.EmbedObject (EMBED_ATTACHMENT, "", filename)

' new image
If picH > 120 Then
picHT = 120
Else
picHT = picH
End If

If picW > 120 Then
picWT = 120
Else
picWT = picW
End If

Call jpgImage.imgResize(picWT, picHT) '** shrink to 50% of the original size

If Instr(filename, ".gif") Then
Dim original_name As String
original_name = Replace(filename, ".", "-thumb.")
fileNameThumbnail = Replace(filename, ".gif", "-thumb.png")
Name original_name As fileNameThumbnail
Else
fileNameThumbnail = Replace(filename, ".", "-thumb.")
End If

Call doc.ReplaceItemValue("picHT", picHT)
Call doc.ReplaceItemValue("picWT", picWT)

'attach thumbnail version of image
Call doc.RemoveItem("bodyThumbnail")
Set body = New NotesRichTextItem(doc, "bodyThumbnail")
Call body.EmbedObject (EMBED_ATTACHMENT, "", fileNameThumbnail)
Kill fileNameThumbnail

doc.SaveOptions = "0"
Call uidoc.Close(True)

Set uidocNew = w.EditDocument(True, doc, , , , True)
Delete uidoc
Call uidocNew.Document.RemoveItem("SaveOptions")

Call uidocnew.Refresh

basta:
If debug Then Print Lsi_info(2) & " starts at: " & Now

Exit Sub
processError:
'** report any errors we get and keep on going
Set jError = jSession.getLastJavaError()
If (jError.errorMsg = "") Then
Print "Notes Error at line " & Erl & ": " & Error$
Else
Print "Error at line " & Erl & ": " & jError.errorMsg
jSession.ClearJavaError
End If

Msgbox Error$

Resume basta

End Sub


btw, then I found more interesting solution (at least I think so :-D) on nsftools.com

Wednesday, August 19, 2009

Gurus of Lotus: DOS Window appear when I run agent using C++ application

Hello guys,

This window appears each time when I run agent in my database (via external application) and this agent create document in mail database. I don't have any idea how it is possible to hide this window. It is non-friendly for user. This window allows to create document in mail database. Looks like just notification. But I don't want to show it to user.

Any ideas?

I tried to find solution and no luck, just one post at IBM
http://www-10.lotus.com/ldd/nd6forum.nsf/ReleaseAllThreadedweb/7b961338e87735ec85256f4700389b74?OpenDocument

Thanks

Saturday, July 25, 2009

Error processing calendar profile document (NoteID: NT00000906) in database mail\xxx.nsf: User's mail is being forwarded to another location

Error processing calendar profile document (NoteID: NT00000906) in database mail\xxx.nsf: User's mail is being forwarded to another location

Another one issue that I got after we upgraded Domino Server from 5 to 8.5. I read many post regarding this 'issue', but in my case the one where the CalendarProfile should be removed from mail database solved this problem

Amgr_DisableMailLookup = 1

I've had problem with running Agents with trigger 'After new mail has arrived'. After we upgraded Domino from R5 to R8.5 such agents stopped to run.

So I found that I should add
Amgr_DisableMailLookup = 1
parameter to notes.ini. It started to work then.

Tuesday, July 14, 2009

How to kill process from LN

I found this approach as very good for my purposes. It works at least . I suppose that there are another couple even better approach, so if you know them share please.

Type PROCESSENTRY32

dwSize As Long
cntUsage As Long
th32ProcessID As Long
th32DefaultHeapID As Long
th32ModuleID As Long
cntThreads As Long
th32ParentProcessID As Long
pcPriClassBase As Long
dwFlags As Long
szexeFile As String * 260
End Type
'-------------------------------------------------------
Declare Function OpenProcess Lib "kernel32.dll" (Byval dwDesiredAccess As Long, Byval blnheritHandle As Long, Byval dwAppProcessId As Long) As Long
Declare Function ProcessFirst Lib "kernel32.dll" Alias "Process32First" (Byval hSnapshot As Long, uProcess As PROCESSENTRY32) As Long
Declare Function ProcessNext Lib "kernel32.dll" Alias "Process32Next" (Byval hSnapshot As Long, uProcess As PROCESSENTRY32) As Long
Declare Function CreateToolhelpSnapshot Lib "kernel32.dll" Alias "CreateToolhelp32Snapshot" (Byval lFlags As Long, lProcessID As Long) As Long
Declare Function TerminateProcess Lib "kernel32.dll" (Byval ApphProcess As Long, Byval uExitCode As Long) As Long
Declare Function CloseHandle Lib "kernel32.dll" (Byval hObject As Long) As Long


Public Sub KillProcess(NameProcess As String)
Const PROCESS_ALL_ACCESS = &H1F0FFF
Const TH32CS_SNAPPROCESS = 2&
Dim uProcess As PROCESSENTRY32
Dim RProcessFound As Long
Dim hSnapshot As Long
Dim SzExename As String
Dim ExitCode As Long
Dim MyProcess As Long
Dim AppKill As Boolean
Dim AppCount As Integer
Dim i As Integer
Dim WinDirEnv As String

If NameProcess <> "" Then
AppCount = 0

uProcess.dwSize = Len(uProcess)
hSnapshot = CreateToolhelpSnapshot(TH32CS_SNAPPROCESS, 0&)
RProcessFound = ProcessFirst(hSnapshot, uProcess)

Do
i = Instr(1, uProcess.szexeFile, Chr(0))
SzExename = Lcase$(Left$(uProcess.szexeFile, i - 1))
WinDirEnv = Environ("Windir") + "\"
WinDirEnv = Lcase$(WinDirEnv)

If Right$(SzExename, Len(NameProcess)) = Lcase$(NameProcess) Then
AppCount = AppCount + 1
MyProcess = OpenProcess(PROCESS_ALL_ACCESS, False, uProcess.th32ProcessID)
AppKill = TerminateProcess(MyProcess, ExitCode)
Call CloseHandle(MyProcess)
End If
RProcessFound = ProcessNext(hSnapshot, uProcess)
Loop While RProcessFound
Call CloseHandle(hSnapshot)
End If
End Sub

Tuesday, June 09, 2009

'Input Enabled' formula does not export in DXL using native exporter

Today we faced with funny problem in LN 6.5.4 (I'm sure the same behavior in any another version of 6.5.X)

We do export of some LN elements and when we import it back we discovered that Input Enabled formula disappear. I checked our DXL file and found that formula was non there. Then I used simple way to check where was the problem, I create simple form, put there 1 field with Input Enabled formula and using Tools\DXL Utilities\Exporter export it to file. There was no Input Enabled formula at all. Funny issues but now we have to rewrite some places.

FYI: This works correct in R7 and ++

Monday, June 08, 2009

JavaScript libraries and reference sites

Got it from BestPracticesWebAppDevDomino8.pdf

Ajaxian.com
a site dedicated to improving Web development

devguru.com
- A another site for Web development information

Dojo
http://www.dojotoolkit.org/

jQuery

http://jquery.com
A fast, concise, JavaScript Library that simplifies working with HTML documents

JSON.org
http://json.org
The home page for JSON information

MooTools
http://mootools.net
A compact, modular, OO JavaScript framework that is designed for the intermediate to advanced JavaScript developer

Prototype
http://www.prototypejs.org/

script.aculo.us
script.aculo.us
Provides an easy-to-use, cross-browser user interface

Yahoo UI
http://developer.yahoo.com/yui
Provides a set of utilities and controls, written in JavaScript

EXT
http://extjs.com
Provides for a cross-browser UI libraries


Some useful links:

Web development tools
http://www.ibm.com/developerworks/wikis/display/dominoappdev/Web+development+tools

Web development resources
http://www.ibm.com/developerworks/wikis/display/dominoappdev/Web+development+resources

Domino resources
http://www.ibm.com/developerworks/wikis/display/dominoappdev/Domino+resources

isNumeric for web

as I think the best approach to check value in web for IsNumeric is:
function IsNumeric(inputVal,sErrorMsg) {
if (isNaN(parseFloat(inputVal))) {
alert(sErrorMsg)
return false;
}
return true
}

I also used such approach, but I don't like it anymore
function IsNumeric(expression) {
var nums = "0123456789";
if (expression.length==0)return(false);
for (var n=0; n <>
if(nums.indexOf(expression.charAt(n))==-1)return(false);
}

return(true);
}

Thursday, February 12, 2009

overload of methods/functions in Lotus Script

I make overload for any methods/functions using next approach. It is quite simple and useful from my point of view

Sub new(key As Variant)
Select Case Typename(key)
Case "STRING":
call newForString(key) or do code
Case "NOTESDOCUMENT
call newForNotesDocument(key) or do code
Case "EMPTY
call newForEmpty(key) or do code
End Select

EncryptOnSend, how can we send encrypted email even if "aim-user" does not have a key to read it?

I was facing with interesting problem, have to send encrypted email to user even if user does not have a key to open/read encrypted email. Let's say in case if I user does not have the key to read/open encrypted email I would like to send him just a message with confirmation that he received an email that was encrypted by userA. So, my main point is to catch users which do not have key to read/open encrypted emails in moment when I send these emails.
Right now Domino automatically UNencrypt emails for users which do not have a key to read/open them.
From help: EncryptOnSend property
To encrypt a document when mailed, this method looks for the public key of each recipient in the Domino Directory. If it cannot find a recipient's public key, the method sends an unencrypted copy of the document to that recipient. All other recipients receive an encrypted copy of the document.

Wednesday, February 11, 2009

how we can check LIST for empty

Today I was faced with small issue, I realised that I don't know how to check LIST variable for empty. Really, I was so confused. I've done it using next approach, but to be honest I don't like it. If anybody knows better approch, please share it here!
...
isValid = False
Forall x In myList
isValid = True
Exit Forall
End Forall
...

Wednesday, February 04, 2009

How to disable autorunning SameTime in IBM Lotus Notes 8.5

After I installed LN 8.5 each time when I run LN8.5 the sametime run also. I don't like this because I don't use it. So if you want to disable it you should add/change variable in notes.ini
IM_DISABLED=1
IM_DISABLE=1
IM_SHOW_STATUS=1
com.ibm.collaboration.realtime.application/useSystemTray=false
Please notice 2 variations of IM_DISABLED / IM_DISABLE, it depends of version of LN you have, so if one does not work for you, try another setting.

Tuesday, January 20, 2009

Transfer file to WebService and Encode/Decode base64 string

I had a task where I should give opportunity to user send file to WebService written on Java. File always should come as decode base64 string, and in WebService I should decode string to normal (it should be DXL content as result) and then import it in a special database, so I had small problem with decode/encod (dont know why but it was happen). So here this simple exmplae how to do it

public class Base64Test {
public static void main(String[] args) throws IOException {
String str = "my string";

String s = new BASE64Encoder().encode(str.getBytes("UTF-8"));
byte[] bytes = new BASE64Decoder().decodeBuffer(s);
String result = new String(bytes, "UTF-8");
System.out.println(result);
}
}