Thursday, September 16, 2010

Change encoding attribute after XLST

I've done some transformation my DXL using XSLT. The funny thing was that after transformation using

// Transform
var str = docxml.transformNode(xsl);

I always got 'encoding' as UTF-16, that's not correct, so after some time I found nice solution

here is code I used:

var doc = new ActiveXObject("Microsoft.XMLDOM");

// Print initial encoding
var pi = doc.firstChild;
var eattr = pi.attributes.getNamedItem("encoding");
var encoding = eattr.value;

// Convert to string and reload (this loses the encoding)
var xml = doc.xml;

// Reset the encoding to "ISO-8859-1"
pi = doc.firstChild;
var eattr = pi.attributes.getNamedItem("encoding");
if (eattr == null) {
eattr = doc.createAttribute(
eattr.value =

// And save document with new encoding."test2.xml");

It works fine for me (and not, output option in XSL did not help)

Wednesday, September 15, 2010


I did not find that method how can I add days to my date, so here is solution:

// add days
Date.prototype.addDays = function(days) {
var secsDay = 86400000; // there are 86400000 secs in 1 day
var time = this.getTime(); // number of milliseconds since midnight of January 1, 1970.
var newdate = new Date(time + (days * secsDay));

If anybody has better solution, you are welcome!

Tuesday, September 14, 2010

'wget' as way to download files

Need to download files from our Domino server by this path http://host/myfile.log, using MS DOS command?
You can try to use wget as one of possible way to do that.
here is an exmplae of DOS command:
wget.exe http://host/myfile.log
I've run this DOS command in my JS file (yes ActiveX is required for that), but anywhere it is quite interesting approach.

Friday, September 10, 2010

Need to zip file with password in Lotus Notes?

I've task where we need to compress and protect attachments and some log files.
I did not look in Lotus Script area at all (as I'm sure it would be not possible or to difficult to do such thing). So I started to look for free RAR/ZIP Java libraries that will have what I need (compress and password).
I was surprised a bit, RAR does not have such API at all, but ZIP has already built in Domino library that allow us to zip files but... not to set password (at least I did not find).
So after couple minutes in google I've found only one free Java library that could zip files with password:
There were no problems during implementation, library is well described.
Java, Java and Java :)