Deep Tech Fusion

tech related weblog

7 Magics

Successful Negotiations – 7 Easy Steps

  1. First and foremost, be prepared to walk away.
  2. Know when to forego all together.
  3. Deal at the right level.
  4. Due diligence to come prepared.
  5. Don’t take anything personally.
  6. Anticipate objections.
  7. Don’t underestimate Karma.

For more info click here

7 Levels Of Delegation

  1. Wait and be told, or do exactly what I say.
  2. Look into this and tell me what you come up with.
  3. Give me your recommendation, and other options with the pro’s and con’s of each. I’ll let you know if you can go ahead.
  4. Decide and let me know your decision. But wait for my go ahead.
  5. Decide and let me know your decision. Go ahead unless I say stop.
  6. Decide and take action, but let me know what you did.
  7. Decide and take action. You don’t need to check with me.

For more info click here

Top 7 Things System Administrators Forget To Do

  1. Forgetting to Delete a Former User’s Account.
  2. Forgetting to Regularly Search for Rootkits.
  3. Forgetting to Use a Trouble Ticket Tracking System.
  4. Forgetting to Set Up Technical Documentation and Creating a Knowledge Base.
  5. Forgetting the Risks of Flash Memory Drives.
  6. Forgetting to Manage Partial Root Access.
  7. Decide and take action. You don’t need to check with me.

For more info click here

7 Things To Expect From Your IT Partner

  1. Technical expertise — and strong communication skills.
  2. An awareness of your budget — and resources.
  3. An advocate who cuts through product hype.
  4. A long-term planner, implementer, and strategist.
  5. An industry watcher who maps technology advances and developments to your needs.
  6. A keen ability to troubleshoot and solve problems.
  7. An interest in handling all of your technology needs.

For more info click here

7 Things You Dont See In Web 2.0 From Web 1.0

  1. Best Viewed In.
  2. Get Flash Player.
  3. Tables.
  4. Click here to Enter/Launch.
  5. Flash Intros.
  6. Loading please wait….
  7. Resizing Browsers.

For more info click here

7 Things Never To Tell Your Customers

  1. Why are you doing that for him?
  2. Are you sure you can afford this?
  3. What an idiot that last guy was!
  4. We don’t have it.
  5. What a different/funny/unusual/bizarre/etc. name.
  6. I haven’t a clue about what I’m talking about, but I’ll ramble on regardless.
  7. I only work here.

For more info click here

May 22, 2007 Posted by | General | Leave a comment

Mssql 200 vs 2005

Comparison between SQL Server 2005 & 2000 .

Feature 2005 2000
Show all identity columns SELECT object_name(object_id),name
FROM sys.identity_columns;

last value of the identity column

SELECT name,last_value
FROM sys.identity_columns;
SELECT object_name(id) AS table_name, name AS column_name
FROM syscolumns
WHERE columnproperty(id,name,’IsIdentity’)=1;
Show all database names SELECT name
FROM sys.databases
FROM master..sysdatabases
Show all tables names SELECT name
FROM sys.tables;

replicated table

FROM sys.tables
WHERE is_replicated =1;
FROM sysobjects
WHERE type=’U’;
Show all Procedures names SELECT name
FROM sys.procedures;

startup procedure

startup procedure or used in replicationSELECT name
FROM sys.procedures
WHERE is_auto_executed=0;used in replicationSELECT name
FROM sys.procedures
WHERE execution_replicated=1;
FROM sysobjects WHERE type=’P’
Show all views SELECT name
FROM sys.views;

replicated view

FROM sys.views
WHERE is_replicated =1;
FROM sysobjects
WHERE type=’V’;
Show all Triggers names SELECT name
FROM sys.triggers
WHERE parent_class=1;

AFTER trigger or INSTEAD of trigger

FROM sys.triggers
WHERE type=’TR’;SELECT name
FROM sys.triggers
WHERE is_instead_of_trigger=1;
FROM sysobjects
WHERE type=’TR’;
Show all data types SELECT *
FROM sys.systypes;
FROM systypes;
Show all logins SELECT *
FROM sys.sql_logins;
FROM master..syslogins
WHERE isntgroup=0 and isntname=0;
Show all dependencies of the Objects SELECT *
FROM sys.sql_dependencies;
FROM sysdepends;
Show all error messages SELECT *
FROM sys.messages;
FROM master..sysmessages;
Show all database files SELECT name, physical_name
FROM sys.database_files;
SELECT name, filename
FROM sysfiles;
Show all computed columns SELECT name
FROM sys.computed_columns
WHERE object_id =object_id(‘table_name’);
FROM syscolumns
WHERE id =object_id(‘TableName’)
AND iscomputed=1;
Show all type of index SELECT object_name(object_id),name, type_desc
FROM sys.indexes
WHERE type_desc =’CLUSTERED’;


SELECT object_name(object_id),name, type_desc
FROM sys.indexes
WHERE type_desc =’HEAP’;


SELECT object_name(object_id),name, type_desc
FROM sys.indexes


SELECT object_name(object_id),name, type_desc
FROM sys.indexes
WHERE type_desc =’XML’;

February 7, 2007 Posted by | MSSQL | Leave a comment

Transact-SQL – Operators

  1. + (Add):
    Adds two numbers. This addition arithmetic operator can also add a number, in days, to a date.

    SELECT c.FirstName, c.LastName, VacationHours, SickLeaveHours,
        VacationHours + SickLeaveHours AS 'Total Hours Away'
    FROM HumanResources.Employee AS e
        JOIN Person.Contact AS c ON e.ContactID = c.ContactID

December 28, 2006 Posted by | MSSQL | Leave a comment

Update Word document through PHP

$filename = “C:\\document_”.date(“YmdHis”).”.doc”;

$template = “C:\\template.htm”;

$fp_temp = fopen($template, “rb”);
$fp = fopen($filename, “wb”);

$old_contents = fread ( $fp_temp, filesize ($template));
fclose ( $fp_temp);
$new_constants = str_replace(“var_username”, “Deepak”, $old_contents);

$rset = “<table width=’100%’ ><tr><td>#</td><td >Name</td><td >Date of Join</td><td >Title</td><td >Dept</td></tr>”;
$rset .= “<tr><td>123</td><td>Deepak</td><td>Oct 10, 2003</td><td>Programmer</td><td>IT</td></tr>”;
$rset .= “<tr><td>123</td><td>Sachin</td><td>Oct 10, 2005</td><td>Developer</td><td>IT</td></tr>”;
$rset .= “<tr><td>123</td><td>Amita</td><td>Oct 10, 2006</td><td>System Admin</td><td>HR & Admin</td></tr>”;
$rset .= “<tr><td>123</td><td>Deepa</td><td>Oct 10, 2002</td><td>Hr Head</td><td>HR & Admin</td></tr>”;
$rset .= “<tr><td>123</td><td>Poja</td><td>Oct 10, 2003</td><td>Developer</td><td>IT</td></tr></table>”;
$constants = str_replace(“Var_record_sets”, $rset, $new_constants);

fwrite($fp, $constants) ;

December 28, 2006 Posted by | PHP | Leave a comment


A function is a reusable code-block that will be executed by an event, or when the function is called.

Defining Functions

In JavaScript a function is defined as follows:

function functionName(arguments) {
  • The definition starts with the keyword function.
  • This is followed by the name of the function.
  • After that comes a set of parentheses containing the arguments the function is expecting to receive. Each argument must be a variable name. These variables are created by declaring them as arguments and are local to the function.
  • After this comes the curly braces that delimit the statement block that makes up the body of the function.
  • The last statement in the statement block should be a return statement, which returns control back to whatever called the function. The keyword return can stand alone or it can be followed (with no intervening line break) by a value to be returned. If no value is specified, then the function returns undefined.
function testVal(x) {
  if (isNaN(x)) {
    window.alert ('x is not a number!');
function strangeEquation(x, y, q) {
  var z = x * y;
  var p = q - 7;
  return (z * x % (y + 1)) / p;

Invoking Functions

You invoke, or call, a function by name. The name needs to be followed by a set of parentheses that contain zero or more values to be passed to the function. The number of values being passed should be equal to the number of arguments the function has. The values are assigned to the arguments in the order in which they appear in the list.

Invoking a function:

x = 'bob';
x = 1;
y = 2;
q = 3;
strangeEquation(x, y, q);

If you want to pass values of a certain type, you need to test for this yourself since JavaScript, being an untyped language, does not check.

If you pass too many values, then the additional values do not get assigned to named arguments. They can still be accessed within the function, just not as named variables.

If you pass too few values then the remaining arguments will be undefined. JavaScript will not error out on this, but your code most probably will not run correctly.


In JavaScript, function definitions can be nested. This is a reasonably unique feature. It exists because JavaScript uses functions to define objects (which are discussed elsewhere) and sometimes objects have functions defined internally, thus requiring a function within a function.

There are strict limits on where nested functions can be defined. A function can only be defined at the top level of the wherever it is defined. What this means is that it can be defined at the global level, or inside functions, but they cannot be defined within any other type of statement block. So, for instance, you cannot define a function inside an if statement.

Some browsers consider a function defined within another function to be local to that function. Therefore nesting functions is not a good idea unless you have a reason for local sub-functions defined within functions (such as the object instance noted above).

Advanced Function Features

This section can be confusing, so don’t panic.

This material covers advanced features of functions. Since functions are also intimately related to objects, we also look at some other aspects of functions when we look at objects.

The Function constructor

JavaScript has a Function constructor which allows you create a variable and assign it a function as a value.

var q = new Function('a', 'b', 'return a / b;');

The Function constructor takes any number of arguments, each of which must be defined as a string, and the last of which must be the body of the code for the function.

A function defined this way can still be invoked by the variable named,
res = q(20, 5), but technically it has no name. Instead the function name is a variable that contains a reference to that function as a value.

Such function are referred to as anonymous functions, since there is no way to refer to them by name. The benefit of declaring a function this way is that it is reparsed each time it is run, meaning, you could replace the strings that define the arguments and function body with variables, dynamically assign values to these variables, and thus rewrite the function each time it ran.

Sound confusing? Here is an example:

// declare our function
// use a variable for the body
  var c;
  var q = new Function('a', 'b', c);
// set our body variable and invoke
  c = 'a / b';
  y = q(20, 10);
// y is now equal to 2
// reset our body variable and invoke
  c = 'a * b';
  y = q(20, 10);
// y is now equal to 200
// changing the variable also
// changed the function

Since the function is reparsed each time, it can really slow down processing if it is run repeatedly.

Function Literals

Function literals are similar to the Function constructor, except they allow you to use normal syntax to assign an anonymous function a variable. Although function literal were introduced in JavaScript 1.2, they had some quirks that were not resolved until 1.5, so test your code carefully.

The syntax is as follows:

var q = function(a, b) { return a / b; }

Function literals are only parsed once and then remain static. This means they don’t change until you reload the document they are in.

The function literal allows a name to be given to the function, but that name is only usable within the function. This allows for recursive functions. Even if you do name it, you can’t reference outside the function except by the variable it was assigned to.

// the self reference here will work
var q = function summation(b) {
  if (b < 2) return 1;
  else return b + summation(b-1);
// this call will work
z = q(20);
// this call will nott
z = summation(20);

The practical upshot of these two function features is that functions can be treated like any other type of data and assigned as values to variables. This means they can be passed to other variables. Since they are treated as an object, they are passed by reference, not by value.

The Arguments Object

All functions have a property called the arguments object. It is an array that contains a list of values of all arguments passed to the function.

If you pass five arguments to a function only expecting three, only the first three will be assigned to the argument names defined with the function, but the other two are still addressable through the arguments object.

The simplest thing you can do with it is test to make sure the right number of arguments were passed. It’s length is property is equal to the number of arguments passed. If it is not equal to the number expected you have the option of actively generating an error to prevent the code from running on bad data.

function strangeEquation(x, y, q) {
  if (arguments.length != 3) {
    return 'invalid number of arguments';
  var z = x * y;
  var p = q - 7;
  return (z * x % (y + 1)) / p;

One benefit of this object is that it allows function to be created that accept an arbitrary number of arguments. For instance, you could have a function where the first argument is named and contains what to do with the data being passed, and all the rest of the arguments could be a random number of unnamed arguments that contain the data to be processed.

function whichWay(x) {
  for(var iter = 1; iter < arguments.length; iter++) {
    thisWay(x, arguments[iter]);

Function Properties

As an object, a function has other properties as well.

One is the length property, which specifies how many arguments the function is expecting.

Another is the prototype property, which we will discuss when we discuss objects.

As with objects, you can also define properties for functions. This allows you to create values that persist across repeated calls to the function. To create a new property, you can just assign it a value.

Since the function declaration is parsed before the code in the script is executed, we can put the initialization statement outside of the function.

q.counter = 0;
function q(x) {

Each time function q runs, it will increment the property q.counter by one.

Now wait, you may ask, didn’t I say elsewhere that things have to be defined at some prior point in the code for JavaScript to find them and yet here is the function after the command to add a property to it.

Yes to both cases. The statement of things needing to be defined previously in the code has to do with the fact that JavaScript can have multiple code blocks in the same HTML document.

The property declaration is before the function it changes, but it is part of the same code block. What JavaScript does when it encounters a piece of script is it loads the entire script, from <script> to </script> tag, parses it, and then immediately runs any code that is not inside functions.

This means that things further down in the document will not yet be defined, including things in other sets of script tags, but everything in this set of script tags will be defined at execution time.

It is still, however, good practice to not use anything before it is defined in the code.

The top-level properties and functions can be used on all of the built-in JavaScript objects.

Top-level Functions

FF: Firefox, N: Netscape, IE: Internet Explorer







Decodes an encoded URI





Decodes an encoded URI component





Encodes a string as a URI





Encodes a string as a URI component





Encodes a string




Evaluates a string and executes it as if it was script code





Checks if a value is a finite number





Checks if a value is not a number





Converts an object’s value to a number



Parses a string and returns a floating point number





Parses a string and returns an integer





Converts an object’s value to a string



Decodes a string encoded by escape()                                 



For more information click here.

Top-level Properties







A numeric value that represents positive or negative infinity





Indicates that a value is “Not a Number”





Indicates that a variable has not been assigned a value




December 18, 2006 Posted by | JAVASCRIPT | Leave a comment

Custom JavaScript functions

10) addEvent()

Surely a staple to event attachment! Regardless to what version you use written by whatever developer, it does what it says it does. And of course as you might of known, I’ve put together quite a handy version myself recently of addEvent() with some help from the contest winner and Mark Wubben along with a few minor syntax adjustments. But just to be fair to Scott Andrew, here is the original that started it all.
Scott Andrew’s original addEvent() function

function addEvent(elm, evType, fn, useCapture) {
if (elm.addEventListener) {
elm.addEventListener(evType, fn, useCapture);
return true;
else if (elm.attachEvent) {
var r = elm.attachEvent(‘on’ + evType, fn);
return r;
else {
elm[‘on’ + evType] = fn;

9) addLoadEvent()

Originally written by Simon Willison and highly adopted by many others as a simple way to add events to trigger after the page has loaded. This of course attaches all your events to the onload event handler which some still see as necessary, nevertheless it does exactly what it’s supposed to, and does it well.
addLoadEvent() by Simon Willison

function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != ‘function’) {
window.onload = func;
else {
window.onload = function() {

Of course another method is to simply assign multiple event listeners to the window by using addEvent() as described in number 10 as follows:
assigning multiple load events to window


8) getElementsByClass()
Originially written by nobody in particular. Several developers have implemented their own version and no one single version has proven to be better than another. As you might expect, my humble self has even had a crack at it. This function was spawned from developers needing a quick and elegant way of grabbing elements by a className and to a developer’s surprise, it’s not an original DOM method as one might think…afterall, we have getElementById, getElementsByName(), getElementsByTagName, what the hell happened to getElementsByClass??? Here it is in all its glory:

getElementsByClass by Dustin Diaz

function getElementsByClass(searchClass,node,tag) {

	var classElements = new Array();

	if ( node == null )

		node = document;

	if ( tag == null )

		tag = '*';

	var els = node.getElementsByTagName(tag);

	var elsLen = els.length;

	var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');

	for (i = 0, j = 0; i < elsLen; i++) {

		if ( pattern.test(els[i].className) ) {

			classElements[j] = els[i];




	return classElements;


Simply add a class name to the beginning of the funciton and the 2nd and 3rd arguments are optional and the magic is done for you!

7) cssQuery()

version 2.0.2

getElementsByTagName? Pah!


cssQuery() is a powerful cross-browser JavaScript function that enables querying of a DOM document using CSS selectors. All CSS1 and CSS2 selectors are allowed plus quite a few CSS3 selectors.



elements = cssQuery(selector [, from]);

where selector (required) is a valid CSS selector and from (optional) is a document, element or array of elements which is filtered by selector.

The function returns a JavaScript array of elements. If there is no match, an empty array is returned.

Some examples:

// find all paragraphs that are direct descendants //  of the document body var tags = cssQuery("body > p");  // find all elements with the "href" attribute var tags = cssQuery("[href]");  // find all anchor elements with "href" equal to "#" var tags = cssQuery("a[href='#']"); // find all images contained by the above anchors var images = cssQuery("img", tags);  // find all lists var tags = cssQuery("dl,ol,ul");  // query an external xml document var tags = cssQuery("my|:root>my|link", myXMLDoc);  // just plain complicated var complex = "p>a:first-child+input[type=text]~span"; var tags = cssQuery(complex);

6) toggle()

<a href=’; target=’_parent’><img src=’;n=af051ed1&#8242; border=’0′ alt=”></a>

To be totally honest, there are probably more variations of this function than there needs to be. The history of ‘toggling’ basically comes down to showing/hiding an element upon an event being fired. To make matters much simpler, I too have put one together. But by no means is it considered the ultimate toggle function, but it does do the basic functionality of showing and hiding.

toggle() by the masses

function toggle(obj) { 
	var el = document.getElementById(obj); 
	if ( != 'none' ) { = 'none'; 
	else { = ''; 

5) insertAfter()

As far as I know, Jeremy Keith sort of came up with this idea even though one would have thought this too would be a DOM core method. But just like getElementsByClass, it isn’t. So rather than pulling the function straight out of the book, I’ll leave that up to you to buy it yourself. Instead I’ve pulled this simple method from public domain:

insertAfter() on public domain

function insertAfter(parent, node, referenceNode) { 
	parent.insertBefore(node, referenceNode.nextSibling); 

4) inArray()

This too is very sad that this isn’t part of the DOM core functionality. But hey, it makes for fun references like this! This function however isn’t quite a function; it’s a prototype that extends the DOM Array object. I remember one day thinking to myself “surely I can do this in PHP, it’s gotta be in JavaScript.” Well, this extension makes it work just like you’d expect if you’re a PHP developer. Here is a version from EmbiMEDIA

inArray Prototype Array object by EmbiMedia

Array.prototype.inArray = function (value) { 
	var i; 
	for (i=0; i < this.length; i++) { 
		if (this[i] === value) { 
			return true; 
	return false; 

3, 2, & 1) getCookie(), setCookie(), deleteCookie()
<a href=’; target=’_parent’><img src=’;n=af051ed1&#8242; border=’0′ alt=”></a>

I honestly don’t know what I would do without these guys. I hate the DOM implementations of setting cookies in JavaScript. In PHP it’s so easy, and it’s easy for one main reason, they work just like the functions below. All three of these functions were found to be public domain and free to use.

getCookie(), setCookie(), deleteCookie() open domain

function getCookie( name ) {
var start = document.cookie.indexOf( name + "=" );
var len = start + name.length + 1;
if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
return null;
if ( start == -1 ) return null;
var end = document.cookie.indexOf( ';', len );
if ( end == -1 ) end = document.cookie.length;
return unescape( document.cookie.substring( len, end ) );

function setCookie( name, value, expires, path, domain, secure ) {
var today = new Date();
today.setTime( today.getTime() );
if ( expires ) {
expires = expires * 1000 * 60 * 60 * 24;
var expires_date = new Date( today.getTime() + (expires) );
document.cookie = name+'='+escape( value ) +
( ( expires ) ? ';expires='+expires_date.toGMTString() : '' ) + //expires.toGMTString()
( ( path ) ? ';path=' + path : '' ) +
( ( domain ) ? ';domain=' + domain : '' ) +
( ( secure ) ? ';secure' : '' );

function deleteCookie( name, path, domain ) {
if ( getCookie( name ) ) document.cookie = name + '=' +
( ( path ) ? ';path=' + path : '') +
( ( domain ) ? ';domain=' + domain : '' ) +
';expires=Thu, 01-Jan-1970 00:00:01 GMT';

Prototype function $

function $() {
var elements = new Array();
for (var i = 0; i < arguments.length; i++) {
var element = arguments[i];
if (typeof element == 'string')
element = document.getElementById(element);
if (arguments.length == 1)
return element;
return elements;

December 18, 2006 Posted by | JAVASCRIPT | 1 Comment

deep Web , surface Web & deep link.

deep Web
Content on the Web that is not found in most search engine results, because it is stored in a database rather than on HTML pages. Viewing such content is accomplished by going to the Web site’s search page and typing in specific queries. LexiBot was the first search engine to actually make individual queries to each searchable database that it finds (see LexiBot). Also known as the “invisible Web”.
Password-protected content on the Web available only to members and subscribers.


A search engine from BrightPlanet Corporation, Sioux Falls, SD ( that was the first to provide results from the deep Web. Designed as PC software for the individual searcher, it locates Web sites with content databases and sets up individual queries that would normally have to be manually entered one at a time.

Introduced in 2000, LexiBot evolved from the Mata Hari search engine from Visual Metrics Corp., which merged with Paulsen Marketing Communications Inc., to form BrightPlanet. LexiBot’s successor is Deep Query Manager (DQM), built with similar technology but accessed through one’s browser and behaving more like an ASP enterprise tool.

Check out here

surface Web
Content on the Web that is found in search engine results. Descriptive data and metatags on the Web pages themselves reveal the page’s contents and can be identified by the various search engine technologies.
The unsecured part of the Web that is available to the general public without a password.

deep link
A hyperlink to a page on a Web site that is not the home page. Although Web sites and blogs routinely provide countless deep links to other Web sites, the subject is somewhat controversial. Owners of some sites have complained that deep links bypass the ads on their home pages and cause them financial harm. Nevertheless, search engines index any and all pages found on the Web and offer billions of deep links on their results pages every day.

December 16, 2006 Posted by | WEB | Leave a comment

Deep Blue

A super computer developed by researchers at {IBM} to explore the use of {parallel processing} to solve complex computing problems. It is known as the first computer to beat the current chess World Grand Master. Deep Blue started it’s life as a PhD project at {Carnegie Mellon University} by PhD students Feng-hsiung Hsu and Murray Campbell. Chiptest, as it was known then, consisted of a custom designed chip hosted in a {Sun} 3/160 computer. The project moved over to IBM in 1989 when Hsu and Campbell joined IBM. {Deep Thought}, as it was known by then, played for the first time against Garry Kasparov in the same year. The game of two matches was easily won by Kasparov.
The next match against Kasparov took place in February 1996. By then the machine was again renamed, at that time it was known as Deep Blue. It was also heavily re-engineered: it was by then running on a 32-node {RS/6000} cluster, each containing 8 custom designed chips. Alas, Kasparov won again. The breakthrough finally happened in February 1997: with both the algorithm and the raw speed significantly improved, Deep Blue beat Kasparov 3.5:2.5. {HOME (}. (1997-06-16)

December 16, 2006 Posted by | PROGRAMMING | Leave a comment

Ajax Cache-Control

A ”’Web cache”’ sits between one or more Web servers (also known as origin servers) and a client or many clients, and watches requests come by, saving copies of the responses — like HTML pages, images and files (collectively known as representations) — for itself.
Then, if there is another request for the same URL, it can use the response that it has, instead of asking the origin server for it again.

When developing with Ajax-based application we need to disable Cache.

This can be done by various different way….

Some of them are discussed here…..

Without Using Headers

* Ajax – Cache Busting with Javascript — [fool the browser]

Browsers are notorious at hanging on tenaciously to cached pages. Even when you use all manner of fancy headers like ””Pragma: no-cache” or “Cache-Control: must-revalidate”” you’ll often find that you receive a cached page rather than a ‘live’ one. Here’s something else you can try:

To the URL which requests the page, ”’add a random (and meaningless) variable and value pair”’. The value should be different each time, and although it will have no effect on the called page, it helps to fool the browser into thinking it has to return a page from a URL it’s never visited before, rather than realising it has it in cache.
A good way to do this in Javascript is to add a random number:
var myDate = new Date();
var myTime = myDate.getTime();
var url=’http://localhost/call_to_ajax.php?rand=’+myTime;‘GET’, url);

Now, each time we call the page whose address is stored in url, we append a meaningless variable rand with a random value,

eg: http://localhost/call_to_ajax.php?rand=321;

* Http: A Caching XmlHttpRequest Wrapper

A wrapper for XmlHttpRequest that supports forced caching on FireFox and forced non-caching on IE.
XmlHttpRequest is a class available in client-side JavaScript for making new HTTP requests from within a page. It is implemented as a built-in object in Safari and FireFox, and as an ActiveX object on Internet Explorer.
More about wrapper class is at;

Download this wrapper from

Using Headers

* PHP – Files

we need to add the following line into the files which will call by open method of object createRequestObject class.

e.g.‘GET’, ‘call_to_ajax.php’);
so we need to add following line into the ”’call_to_ajax.php”’ file.

header(‘Expires: Fri, 09 Jan 1981 05:00:00 GMT’);
header(‘Cache-Control: no-store, no-cache, must-revalidate’);
header(‘Cache-Control: post-check=0, pre-check=0’, FALSE);
header(‘Pragma: no-cache’);

* .htaccess – Files

First enables expires and headers module of apache [httpd.conf]
LoadModule expires_module modules/
LoadModule headers_module modules/

Then add the following lines into .htaccess file
### activate mod_expires
ExpiresActive On
### Expire everything else 1 day before
ExpiresDefault “modification M-3600”
### Apply a Cache-Control header to call_to_ajax.php

Header append Cache-Control “public, must-revalidate”

* PERL – Files

Add the following lines of call_to_ajax.cgi or file
print “Content-type: text/html\n”;
print “Expires: Thu, 29 Oct 1998 17:04:19 GMT\n”;
print “\n”;

References and Further Information
Caching Tutorial
Brian D. Davison’s Web Caching and Content Delivery Resources
Hypertext Transfer Protocol — HTTP/1.1

December 5, 2006 Posted by | AJAX, APACHE, JAVASCRIPT, PERL, PHP | 1 Comment