IE OnResize Scripting

I ran into some ugliness recently setting an iFrame height dynamically where the script would run away on IE.  I found the answer at http://stackoverflow.com/questions/1500312/javascript-onresize-event, posted by Pim Jager.  The resulting combination of the resize and his event handling is as follows:

function getDocHeight()
{
var D = document;
return Math.max(
Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
Math.max(D.body.clientHeight, D.documentElement.clientHeight));
}

function setIframeHeight(frameId, offset)
{
document.getElementById(frameId).height = (getDocHeight()-offset)+’px’;
}

var resizeIframeTimeOut = null;

var func = function() {setIframeHeight(‘boInfoViewIframe’, 150);};

window.onresize = function(){
if(resizeIframeTimeOut != null) clearTimeout(resizeIframeTimeOut);
setTimeout(func, 100);
};

setIframeHeight(‘boInfoViewIframe’, 150);

One note about resizing elements is that IE will resize again if your new size causes the document size to grow. That was a two hour lesson for me 🙂

If you found this interesting, please share.

© Scott S. Nelson

JDBC BEA-001129

If you don’t have a LinkedIn membership, this discussion should be enough reason to sign up (for the record, I did not provide the responses to this question):

Q:

I have a problem in production environment with WebLogic 9.2 mp3.We are using Multi datasource with Oracle 9i RAC two nodes. Database team have maintaince so they took out one node out of RAC. when one of the WebLogic instance associated with connection pool to that RAC node shown the following Warning message and could not start the instance.The multi datasource is configured with algorithm-type as “Load-Balancing”

<Jun 3, 2010 3:12:23 AM EDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING>
<Jun 3, 2010 3:14:10 AM EDT> <Warning> <JDBC> <BEA-001129> <Received exception while creating connection for pool “DS2”: Io exception: The Network Adapter could not establish the connection>

What are the recommandations to avoid this kind of problems when one of the RAC nodes down and the WebLogic server should have High Availability and scalable?

Any configuration parameters need to set for this??

A:

The way 9.2 mp3 works with RAC is that the multidatasource represents a pool of datasources so if one datasource is not available it will mark that down and use the other datasources configured in the multidatasource. WLS controls the failover, not RAC and this version does not use FAN or FCF.

I assume you have test on reserve set in the connection of all the data sources as that is required to use multdatasource. This parameter is at datasource->connection pool-> advanced

“could not start the instance” means that WLS did not come up??

If you are bringing up a WLS instance without the DB up you may want to set initial connections to 0

If you found this interesting, please share.

© Scott S. Nelson

WebLogic Portal (WLP) Lost Samples in 10.3.2

Ran across a fun new quirk this morning. To make sure that source control has everything necessary for a build I maintain two workspaces and check the build in one after a check in from the other. There were two errors today. One was just weird, which is that the path of WEB-INF/src somehow became required. Annoying, but no big deal to check it in (and probably could have removed it from org.eclipse.wst.common.component and .classpath without causing an issue).

The quirky part was the second error, which was that it was unable to resolve the reference to “wlp-sample-widgets-web-lib” library. I went to the WebLogic shared libraries in preferences, and sure enough it wasn’t there. Long story short, the sample widgets are not configured in a workspace unless it is added to a project in that workspace. The fix was to remove and then add the facet back in and then OEPE installed it into the workspace.

If you found this interesting, please share.

© Scott S. Nelson

WLP Content Presenter Portlet Simplified

I find the steps at Adding the Content Presenter Portlet to be a bit hard to follow as the content loops back and forth between the sample application and your application, and has frequent references to other documentation where the link goes to the start of the document rather than the specific section necessary for the task at hand. Having always liked reading and writing Quick Start guides, I am posting this one for the WebLogic Portal Content Presenter Portlet. I will later add how to incorporate the inline editing demonstrated in the sample application once I figure it out for myself.

So, first off, I will skip ahead to explain why I start the Quick Start where I do, which is that the templates we will want to add later spit compile errors in OPOE. For that reason, I am creating a separate Portal Web Application that will later be deployed as a shared library. If you don’t need the templates from the sample  app,  you can just use your main application. If you don’t know how to get that far on your own, see the WLP Quick Start and come back here. One other caveat is that you will need a DataSync project associated with the EAR project.

Once you have whatever portal web application that will be Content Presenter enabled chosen, you need to add the necessary facets. Unlike WebLogic Workshop for WLP, you aren’t prompted to add facets when creating the project, so you need to go to the Project Properties after creating the Portal Web Application and add them.

The facet we care about is Content Presenter Framework. It does, however, have some dependencies. Fortunately, OPOE  lets you know what they are:

Adding Facets to WLP

So, rather than list them all out here, just select Content Presenter Framework under WebLogic Portal (Optional) and follow the errors for what to add. One note is that you will want Struts 1.2 instead of 1.3. Otherwise, the default version will do the trick.

To save time, I also selected the Sample Framework Components facet. You will eventually need to build your own log-in portlet, but this should do to get the Content Presenter working.

If you don’t already have one, create a .portal file for your portal web application and add the Sample Login Portlet. You could add the Content Presenter portlet at this time, but unless you are only going to have one in the application you don’t want to as it will be tied to the library instance. By adding it to new desktop  in the Portal Administration Tool (PAT), you will create a separate instance each time.

Create .portal File and Add Login

If you don’t already have some content in your repository to display, once you deploy the portal application go create some as the Content Presenter doesn’t seem to have the facility to create new content (or I haven’t figured it out yet, but if you are reading this then you haven’t either 🙂 ).

With content ready, create a portal and desktop (again, if you haven’t already) and add the content presenter portlet onto a page in the desktop (again, we do this here to have a specific instance):

Add Content Presenter Portlet to Desktop

You will also need to enable Disc on your desktop if you want the sample login portlet to work.

And…

Ta Daaaa!

At this point you can return to the standard documentation at Section 14.2.1, “Configuring the Content Presenter Portlet” for the rest of the steps as it seems to be back on track (for my taste) at that point.

If you found this interesting, please share.

© Scott S. Nelson

WebLogic Portal (WLP) Content Presenter Portlet in 10.3.2

I hope to update this post with a vastly simplified approach to using the content presentation feature. Meanwhile, I do want to point out one thing that had me spinning my time for awhile. The URI for the templates TLDs in the sample files  cause a compile error. At first I thought it was because the URI changed from http://www.bea.com/servers/content/ui/jsp/templates to http://www.bea.com/tags/wlpapps/contentui/templates, so I changed it. Then I got run-time errors because some of the methods aren’t in the new library. So I rolled back to the original values and just turned off validation for JSPs. That worked. So I am taking the approach of putting the templates into a shared library and taking the deployment hit rather than the development hit of having validations turned off for the main branch of the project. Later, I should create a build file that merges the projects at build time and drops the share library reference.

If you found this interesting, please share.

© Scott S. Nelson