Archive

Archive for the ‘Web Technologies’ Category

simple AHAH (Asynchronous HTML And HTTP) library

November 12, 2008 Leave a comment

Just thought of sharing a very simple javascript AHAH library and quickly demo a simple usage in one line of code. AHAH works very similarly to AJAX but without the X of Ajax. It unables you to dynamically update your page content without a whole page refresh. Instead of parsing XML data back you could simply return html. Here is how simple it is to dynamically reload your page content using AHAH.

File: ahahlib.js

Step1: Create a javascript file and copy the code in the following steps.

Step2: Write the following function to specify the XMLHTTPrequest object from different browsers

function getXMLHTTPreq(){
try {
req = new XMLHttpRequest(); /* Firefox */
} catch (e){
try{
req = new ActiveXObject(“Msxml2.XMLHTTP”);  /* previous versions of IE7 */
} catch (e) {
try {
req = new ActiveXObject(“Microsoft.XMLHTTP”); /* IE7+ */
} catch (err) {
req = false;
}
}
}
return req;
}

Step3: Create a function to write the return text to the designated document page element

var http = getXMLHTTPreq(); //XMLHTTPrequest object
function responseAHAH(pageElement) {
var output = ”;
if(http.readyState == 4){
if(http.status == 200){
output = http.responseText;
document.getElementById(pageElement).innerHTML = output;
}
}
}

Step4: Create the function that will be called from your html

/* call this AHAH function for dynamic html content display*/
function getAHAH(url, pageElement, LoadingMessage)
{
document.getElementById(pageElement).innerHTML = LoadingMessage;
http.onreadystatechange
= function(){responseAHAH(pageElement);};
http.open(“GET”, url, true);
http.send(null);

}

Example:

<script language=”Javascript” src=”ahahlib.js”></script>

<input type=”text” id=”mypage” name=”mypage” size=50>
<input type=”button” onClick=”getAHAH(document.getElementById(‘mypage’).value, ‘displaydiv’, ‘Loading content…’)” value=”Display page content”>
<br>
<div id=”displaydiv”></div>

In the above example, we have an input text to let you display whatever page you want to.

ahah

In displayTasks.php you may have simple echo strings to complex server side data thrown from database.

<?php
echo “Task1:<br><b>Configure SQL Server…<b>”;
?>

In step2, the xmlhttprequest object property readyState reports on the status of the request where

0=uninitialized, 1=loading, 2=loaded, 3=interactive, 4=completed

The status property returns the HTTP status code as 200 returns a successful request.

Advertisements

Microsoft HTTPAPI/2.0 disabling Apache

November 7, 2008 209 comments

I’be been working on php for 2 months now and developing on my laptop with WAMP installed before uploading to work’s dev server. Now working with SQL Server instead of MySQL, I’ve installed SQL SERVER 2008 CTP for test and suddently Apache went down as port 80 was used by Microsoft HTTPAPI/2.0.

I then found SSRS (SQL Server Reporting Services) was still running after uninstalling SQL Server 2008 as it features a web service even though IIS is not installed according to wiki.

I couldn’t find any info on google relating to this small issue that puzzled me for a short while. i hope this helps finding ppl stupid like me sometimes to solve their problem

Let’s party at “Mix on Campus”

October 29, 2007 Leave a comment

mixoncampus.jpg 

“Mix on Campus” is coming to QUT; yet another great Microsoft event on campus. Microsoft Australia is inviting all tertiary students and lecturers from University and Tafe around Brisbane to come to this free web design and web developer event. It’s a great get together with fellow students and lecturers, learn the latest web trends and technologies, and hear from industry experts. Best of all, it’s FREE and straight off after exams!! Top that with some great give-away prices and it will be as awesome as Tech.Ed 2007 and Remix for academics. I’m not sure what technologies will be presented yet but expect a glance of Visual Studio 2008, Silverlight, and Expression.

Check out the official blog ,invite your facebook contacts! and register NOW!

Venue: QUT Gardens Point Campus, Room 117, B block, 2 George Street, Brisbane

Date and Time: 20/Nov 10am to 4pm

Registration: http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032356512&Culture=en-AU