Search This Blog

Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Sunday, May 5, 2013

IBM Java in Notes 9 - still version 6

Hi guys

Currently I stuck with a zipping of files with non-ASCII characters in their names.
Actually, I have a few ideas how to move ahead and resolve it but I want to wait a little because my ideas require more efforts than I expected initially.

My current solutions is next (you can download working example on the bottom of this page):

  • I have a Java library that uses standard capabilities of java.util.zip.ZipEntry and java.util.zip.ZipOutputStream. 
  • I use LS2J technology so I have a lotus script class that invokes public method from Java-class that does actual zipping.

Solution is simple and works perfect until we do not have files with non-ASCII characters in their names.

Saturday, May 4, 2013

Java console in Domino Designer does not display non-ASCII characters

Hello

I work on task about zipping of files with non-ASCII characters in their names.
During this work I discovered that Java console in Domino Designer does not display non-ASCII characters. I do not know if it is an issue or it is by design but anyway it is quite annoying and does not help me to debug solution based on LS2J.


If you want to reproduce it yourself please check my steps first.

Thursday, January 17, 2013

LS2J in Notes Form: cache or bug?

Hi guys

Do you know something about caching issues in LS2J technology?
I discovered a strange thing about it. Let me show you.
I work in IBM Notes 9 beta.

I have a database with Java library that contains a simple class with a single method

public class myTestClass {
public void someMethod() {
System.out.println("Test LS2J: 111");
}
}

I am going to use this Java class in a Notes Form and then in a Notes Agent.
Lotus script code is the same for both cases:

Option Declare
Uselsx "*javacon"
Use "TestJavaLib"

Dim js As New JavaSession
Dim myClass As JavaClass
Dim myObject As JavaObject

Set myClass = js.GetClass("myTestClass")
Set myObject = myClass.CreateObject

Call myObject.someMethod()

Let's test it for both form and agent:

Monday, January 14, 2013

Files Zipping

Hi

I want to share with you a simple solution for zipping files using Java capabilities.
On the bottom of this post you may find an nsf-file that contains one Java library - ZipFile.
'ZipFile' Java library contains one class ZipFile with a single method zipMyFile:

zipMyFile(String filesToZip, String zipFilePath, String compressionLevel, boolean withFolderTree)

Honestly speaking, I did not write it from the scratch.
I found some examples in Internet and reworked them into this solution.

Method zipMyFile works with 4 parameters:
  • a list of files you want to zip joined via '|', every file should contain an absolute path.
  • an absolute path for output zip-file
  • compression level: BEST_COMPRESSION, BEST_SPEED, DEFAULT_COMPRESSION, DEFAULT_STRATEGY, DEFLATED, FILTERED, HUFFMAN_ONLY, NO_COMPRESSION
  • boolean flag that defines if zipping files should save their folders tree inside of output zip-file. If you set this flag to 0, then all files will be zipped to the root of zip-file.

Except this Java class, database contains form 'ZipFile' for testing purposes.

Note: this solution does not check a case when user selects a few files from different folders but with the same name and parameter withFolderTree = 0. In this case user gets an error since it is impossible to have a few files with the same name in the root of zip-file.

ypastov.zipping.nsf

Friday, January 11, 2013

Show Java Debug Console

Hi guys

Did you notice that sometimes top menu option "Tools\Show Java Debug Console" does not work? I mean you click on it but java console window does not appear - just nothing happens.

I know only one way how to get it for sure (suggested by my bro):
  • Completely close Lotus Notes
  • Launch Domino Designer
  • Click on "Tools\Show Java Debug Console" to get java debug console window (with only Domino Designer launched it works always)
  • Launch Lotus Notes
I am completely sure I am not a fan of this way :-)

Do you know how to do it easier?