Pages

Wednesday, March 23, 2011

Crash a Domino Server - an other SSJS did it

In addtion to what I have found previously - http://ozinisle.blogspot.com/2011/03/crash-domino-server-oops-ssjs-did-it.html, I happened to stumble upon an other code fragment that did it. I mean crashing my domino server.

This time its a more serious one to be aware of. Because the following line of code works perfectly until it breaks. So be care full.

viewHandle.getColumnValues(colNumber)

where, viewHandle is a NotesView object.

Hope this helps :)

Wednesday, March 16, 2011

@DbColumn - An other way in SSJS

In addition to my recent adventure on crashing a domino server, the following work around helped me fix the issue and it seems to be an elagant way to get the column values from a view column

var viewHandle:NotesView=database.getView(viewName)
return viewHandle.getColumnValues(colNumber-1)

Crash a Domino Server - oops SSJS did it

In an attempt to simulate @DbColumn using SSJS, i used a few lines of code which included the following,

doc.getColumnValues();


To my astonishment, I found that my domino server had crashed. Yes the server it self had crashed every time it read this code fragment.

I have coded a few lines in the past that crashed Lotus notes client/designer, but never had the opportunity to crash a server. And now it took me XPages to do it :)

Looking for a work around :(

Monday, March 14, 2011

Execute Client Scripts in the After Page Load event of XPage

 In order to execute client side scripts in the after page load events of an XPage, one must use dojo to accomplish it. I think I know an other way to do this, but the one posted below seems simple and effective to me. All you got to do is add the following to your XPage and test it for your self

     dojo.addOnLoad(yourJavascriptFunction)


Hope this helps :)

Wednesday, March 9, 2011

Triggering Client script from server side : Xpages

Triggering client script from server side on XPages saves developers in many scenarios.
I missed them so badly until I came to know about the "xp:onComplete" tag.

Associate this property to the event handler of any of the controls with partial refresh enabled and voila you are ready to go.

The following is a simple example on getting the property to work in xpages.


Ensure that the control does not have full update enabled cos, this method would work only when partial refresh is enabled

Handling "java.lang.OutOfMemoryError" - notes.ini Keyword: JavaMaxHeapSize

Syntax: JavaMaxHeapSize=number of bytes

Example: JavaMaxHeapSize=67108864

Default value: 67108864 (64mb)

Description:
Specifies the maximum--not initial--size the Java heap can reach. The Java Virtual Machine (JVM) starts out at 16MB of heap space and most of it is uncommitted. If the JVM needs more heap than it currently has, it will expand the heap in increments but will not exceed the maximum. Exceptions such as "java.lang.OutOfMemoryError" indicate that a heap has reached its maximum size. You can specify the number of bytes directly or use the suffix "MB" to indicate megabytes, for example, specifying "64MB" is the same as specifying "67108864."

Resource obtained from : http://www.lntoolbox.com/en/notesini-reference/bycategory/serverconfiguration/14-Server_Configuration/1148-javamaxheapsize.html
Hope this helps :)

Empty Contents of an IFrame - Javascript

Following is one effective way that can help one to empty the contents of an iFrame.

window.frames['iFrameID'].location.href="about:blank";

Following are a few other methods that might work,

window.frames[['iFrameID'].location.href=" ";

window.frames[['iFrameID'].location.reload();
window.frames[['iFrameID'].document.close();
window.frames[['iFrameID'].document.body.innerHtml="";

hope this helps :)

Tuesday, March 1, 2011

Accessing parent from an iFrame

Accessing a the parent page which contains an iframe from with in the iFrame is as follows,

var parentDOMDoc=parent.document

again, access restrictions are applicable here i.e if the IFrame's document are not in the same domain as the parent frame, then you may be denied access to it's contents due to security features of most browsers.

Accessing iframe contents using javascript

The following is a way to access the contents of an IFrame.

var ifrm = document.frames["myIFrame"].document.forms[0]

This should return the form element associated with the iframe. In most cases where the above code fails try using window.frames instead of document.frames and that would work.

On top of this if the IFrame's document is not in the same domain as the parent frame, then you may be denied access to it's contents due to security features of most browsers.