Monday, October 11, 2010

xPage: date picker does not work in IE8

Just found that standard date picker does not work properly in IE8 (it always refresh page when we click on date/time picker. That's not funny :/ question - why do all another browsers work fine?

Workaround
http://www-10.lotus.com/ldd/nd85forum.nsf/0/579744cf7198e21785257731006c9cea?OpenDocument

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: http://dotnet.itags.org/dotnet-tech/66097/

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

// 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;
doc.loadXML(xml);

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

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


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

Wednesday, September 15, 2010

Date.prototype.addDays

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));
this.setDate(newdate.getDate());
}


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: http://code.google.com/p/winzipaes/
There were no problems during implementation, library is well described.
Java, Java and Java :)