Monday, April 16, 2012

Grails boostrap method injection

When getting the domain class name use the following:

String className =

Monday, April 9, 2012

iframe resizing


The problem is getting the iframe to automatically resize based on the content of the child iframe.

The majority of the solutions to this problem found on the web, expect that both the parent and the child iframe belong to the same domain, and thus avoid the "cross domain" security restriction when accessing the childIFrame.body.scrollHeight  property.


When I found this post
he gave me the idea of posting event messages between the parent and child iframe.

I decided to use the jQuery plugin found here for posting messages

Basically, it works as follows. The child iframe posts a message to the parent with its scroll height upon loading the page. The parent listens for messages and when it is received, it adjusts the height of the iframe according to the scroll height it receives from the child iframe. See the example code below:

<script type="text/javascript">

    $(document).ready(function() {

                function(e) {
                    var h = Number( /.*if_height=(\d+)(?:&|$)/, '$1' ) );
                    if ( !isNaN( h ) && h > 0 ) {                        
                function(e) {
                    return true;


<iframe id="snvFrame" src="<%= PhenomeConfig.getInstance().getIncidentalSNPsUrl() %>" width="100%" frameborder="0" height="100%" allowtransparency="true">


        <script type="text/javascript">

             $(document).ready(function() {                
                $.postMessage({ if_height: $(document).height() }, 'http://localhost:8989/phenbank/incidentalSNPs.html');                



Monday, April 2, 2012

Grails Domain class reflection on properties

If you want to determine what the persistent fields are for a domain class at runtime using reflection, try the following:

         DefaultGrailsDomainClass dgdc = new DefaultGrailsDomainClass(clazz)"properties="+dgdc.getPersistentProperties())