Tuesday, August 19, 2008

Knol, Beyond blogging...

 

 

knol-logo

 

We guys Blog, and now Google tells us to go beyond it. In words of Google, a knol is an authoritative article about a specific topic.

In first look, it seems like a combination of Blogs and Wikipedia. Here you create articles as you do in Blogs, but they are consolidated as in Wiki. There can be contributors, communities and collaborations. Moreover, you can have revisions. You can review Knols, post comments and reply to comments. So this makes it more like forums.


I found some really nice topics in there like Blood Transfusion, Muscle Cramps and the best part is, that these topics are by authentic people from respective fields. Google verifies experts so their content is genuine.

 

So go on....

Add your piece of knowledge to KNOL

 

http://knol.google.com/k/knol#

 

Oh by the way, I loved the way it uses AJAX. Really SUPERFAST

Friday, August 01, 2008

AJAX (Updated Function)

Hi friends,

Here I present an updated way of using AJAX. In my previous post, I explained the use of AJAX through 3 functions. First one will create object, second will send request, and third will receive the response.

Now I have combined these three functions to one. Here it is...

function getPage(CallPage, DivToPopulate)
{
// Declare Object
var httpObject=false;
if(window.XMLHttpRequest) {
// Opera 8.0+, Firefox, Safari
httpObject=new XMLHttpRequest();
}
else if(window.ActiveXObject) {
//Internet Explorer
httpObject=new ActiveXObject("Microsoft.XMLHTTP");
if(!httpObject){
httpObject=new ActiveXObject("Msxml2.XMLHTTP");
}
}
else{
alert("Your Browser is not compatible to use this application");
}
// Show some default message in the Div, that will contain the Content
document.getElementById(DivToPopulate).innerHTML = 'Loding Content...';

//Cache work around
var datevar = new Date();
var timevar = datevar.getTime();
var timestamp= 'TEMP=' + timevar + Math.random();
if (CallPage.indexOf("?") > 0)
{
CallPage = CallPage + '&' + timestamp;
}
else
{
CallPage = CallPage + '?' + timestamp;
}

httpObject.open("GET", CallPage, true);
httpObject.onreadystatechange = function(){
if (httpObject.readyState == 4) {
var txt = httpObject.responseText;
// Show content
document.getElementById(DivToPopulate).innerHTML = txt;
}
};
httpObject.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
httpObject.send(null);
// Function by Vikramjit R.Rai http://www.vikramjits.com
// For any help, feel free to contact vikramjit.rooprai@gmail.com
}

USAGE:

Simply call the getPage function with two arguments. First is the page to be called and second is the DIV to be populated with the contents of the Page called.

that's it...

Happy Coding :)