22 November, 2007

Action-like URL

In VBScript, in an ASP page, I was looking for a way to declare a querystring parameter without giving it a specific value. In the requested page, I just wanted to check the presence of that particular parameter. My URL looks like this :

http://www.mesconges.fr/comprendre.asp?autoplay

The presence of the autoplay parameter indicate to comprendre.asp to run the first flash video once the page is loaded. Requesting comprendre.asp directly would result in no specific action after the load.

Believe me, it was not easy to test the difference between a querystring parameter that has no value and no parameter at all !
You have to play with :

isObject
isNull
isEmpty
<> ""
and so on...

The best way I found was : Not IsEmpty(request.querystring("autoplay"))

07 November, 2007

Restart Windows Server

Under windows server as under windows since 2000 version, if you don't find the Shutdown button in the start menu, don't worry, you can easily restart whith the MS-DOS console.
Click the start menu, choose "execute...", type "cmd" for opening the command line and type "shutdown -r".
The -r option tells the system to shutdown and then restart. Very usefull if your server is located somewhere in India and you don't want to pay fees for a employee to go pressing physically on the server start button !

18 April, 2007

Instructor for the NATIW

Next week, I am leading a workshop at Nomades Ateliers in Geneva.
The first day will be dedicated to AJAX and the second to the Dojo Toolkit.
Just after that, Sebastien Gruhier will lead a workshop about Ruby on Rails. Next week will 100% Web 2.0 !!
Fell free to read about the workshop and register.

14 February, 2007

workaround to make AJAX calls on Internet Explorer 6

I have found a nice alternative to the traditional try catch method to make AJAX calls work on every browser. Place the following code on top of your Javascript script.
if (!window.XMLHttpRequest) {
window.XMLHttpRequest = function() {
return new ActiveXObject('Microsoft.XMLHTTP');
}
}

This hack defines a function called XMLHttpRequest if XMLHttpRequest doesn't exist natively on the browser.
With this method, you can make AJAX calls with 'new XMLHttpRequest()' even on IE 6 or 5.5.
var ajax_call = new XMLHttpRequest();
...


UPDATE : Thanks to comments on Ajaxian, I added the "window." prefix to the declaration of the XMLHttpRequest function in order to work properly on IE 6 and not redefineing the XHR native object on IE 7.