Friday, May 28, 2010

learn aruba.it to use DynDNS.org

Hi,


since last weekend I migrated the tomcat server to a small server without static IP. To do that I use DynDNS.org.

1. Make a DynDNS.org account
2. Create a Hosts Service on DynDNS.org




3. Netgear configuration: Send the IP on DynDNS.org




4. Aruba.it configuration: Use the Hosts Service, who you created on DynDNS.org

- Enter "Client Area" and go to DNS configuration

remove www record


add record www with host .homeip.net

Thursday, May 13, 2010

WebApp: block UI when lost the connection with jquery

Hi,

I use ajax call for update the gui in a web project. When the device go out of the network, works the gui wrong.
So I implmented a ajax function, that check the connection and when the device is offline, the GUI will blocked.

To do that, I use: jquery.js and jquery.blockUI.js


var launchfilleIntervall;
var isBlocked = false;

function isServerLost() {

    jQuery.ajax({
        type: "POST",
        url: "ServerLostServlet",
        dataType:"xml",
        data:"",
        timeout: 250,
        success:function(response){
            if (isBlocked) {
                $.unblockUI();
            }
            isBlocked = false; 
 
            // do something        
},
        error:function (xhr, ajaxOptions, thrownError){
            if (!isBlocked) {
                $.blockUI();
            }
            isBlocked = true;
            
        }    
    });
}

function stopAjax() {
    if (launchfilleIntervall) {
        window.clearInterval(launchfilleIntervall);
    }
}

function startAjax() {
    if (!launchfilleIntervall) {
        launchfilleIntervall = window.setInterval('isServerLost()', 1500);
    } 
}
 
I change the HTML source and add to the body tag:
onload="startAjax()" 
onunload="stopAjax()"