Aug 01 2008
Windows Vista Performance Tuning e-Book from Microsoft
Microsoft has released e-book for optimizing Windows Vista. Improve Performance Quickly and Easily. Here is the link.
Aug 01 2008
Microsoft has released e-book for optimizing Windows Vista. Improve Performance Quickly and Easily. Here is the link.
Jul 22 2008
Ubuntu Tweak is the must have tool for any ubuntu users. The new version is 0.3.4 and it has helped me quite a lot to tweak Ubuntu Hardy settings easily. So Ubuntu users and lovers go and grab this magnificient tool and make most out of your Ubuntu.
Happy Tweaking!
Jul 21 2008
Jul 18 2008
Microsoft has released ASP.NET MVC Preview 4. It has one of the most awaited release since, Microsoft’s first attempt to make MVC based framework (not Web Forms). It can be downloaded from Codeplex.
Useful Links:
Jul 12 2008
Ajax stands for Asynchronous Javascript and XML. It is an amalgamation of both new and old technologies - old because it uses already existing technologies and new because it integrates these existing technologies that few considered previously. Ajax is a technology that complements Web 2.0 and the integration of many web services at once.
Though ‘x’ of Ajax stands for XML, instead of XML another format has been gaining wide acceptance and momentum as a medium for information interchange which is called JSON aka JavaScript Object Notation. JSON is an open format describing how to represent JavaScript objects in a simple text representation that can be easily created and parsed. In other words, one can send data to the browser encoding as JSON objects instead of XML, and the JSON objects can be converted easily into JavaScript objects. Three major advantages of JSON:
1. No manual parsing necessary because JSON itself is an object whereas XML is typeless.
2. JSON frees us from having to parse data. DOM manipulation is not necessary with JSON.
3. The physical size of JSON data is less than that of XML. That is why JSON is also called “Fatless XML”.
<Students> <Student> <Name>Pajwal Tuladhar</Name> <Faculty>BIM</Falculty> <GPA>3.52</GPA> <Age>22</Age> </Student> </Students>
.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, “Courier New”, courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }
{“Students”:[
{“Name”:“Prajwal Tuladhar”,“Faculty”:“BIM”,“GPA”:“3.52″,“Age”:“22″},
{“Name”:“Max Payne”,“Faculty”:“MBA”,“GPA”:“3.90″,“Age”:“25″},
{“Name”:“Ada Lovelace”,“Faculty”:“BBA”,“GPA”:3.25,“Age”:22}
]}
Ajax.html file
<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=ISO-8859-1″>
<title>Ajax 2</title>
<script type=”text/javascript” src=”js/prototype.js”></script>
<script type=“text/javascript”>
window.onload = function() {
$(‘CmdMakeRequest’).onclick = function() {
var uri = “data2.php”;
new Ajax.Request(uri, {
method : “post”,
onSuccess : function(t) {
var r = eval(‘(’ + t.responseText +‘)’);
//alert(r.Students[0].GPA);
var e = $(‘ResponseContainer’);
r.Students.each(function(o) {
var t = document.createElement(‘table’);
e.appendChild(t);
createTableCell(“Name”, o.Name, t);
createTableCell(“Faculty”, o.Faculty, t);
createTableCell(“GPA”, o.GPA, t);
createTableCell(“Age”, o.Age, t);
var h = document.createElement(“hr”);
e.appendChild(h);
});
}
});
};
};
function createTableCell(cellKey, cellValue, t) {
var tr = document.createElement(“tr”);
var tdKey = document.createElement(“td”);
tdKey.appendChild(document.createTextNode(cellKey));
tdKey.width = “130px”;
var tdValue = document.createElement(“td”);
tdValue.appendChild(document.createTextNode(cellValue));
tr.appendChild(tdKey);
tr.appendChild(tdValue);
t.appendChild(tr);
}
</script>
<style type=”text/cs”>
.request-container {
border: 1px solid red;
padding: 10px;
margin: 10px;
}
input {
font: 14px;
font-weight: bold;
}
</style>
</head>
<body>
<div class=”request-container”>
<input type=”button” id=”CmdMakeRequest” value=”Make Request” />
</div>
<div id=”ResponseContainer”> </div>
</body>
</html>
data.php file
<?php
header(“Content-type: application/jsonrequest”);
$json_data = array(
“Students” => array(
array(
“Name” => “Prajwal Tuladhar”,
“Faculty” => “BIM”,
“GPA” => “3.52″,
“Age” => “22″
),
array(
“Name” => “Max Payne”,
“Faculty” => “MBA”,
“GPA” => “3.90″,
“Age” => “25″
),
array(
“Name” => “Ada Lovelace”,
“Faculty” => “BBA”,
“GPA” => 3.25,
“Age” => 22
)
)
);
echo json_encode($json_data);
?>
I have used json_encode() function to encode json data. It is available from PHP 5 or if you are using PHP 4 you can download it from here. By making simple Ajax.Request Object of prototype you can request JSON data and after evaluating it by using eval keyword it is converted into Javascript Object. I have made table to display the data. But the dynamic DOM generation of table is not working on IE (thatswhy IE sucks). But this is only a simple example of how one can use JSON in this data intensive world of web and make most of it.
Fig. Before making request
Fig. After making request
Fig. JSON Response
Fig. JSON Header
Useful Links