Archive for April, 2007

CHAPTER 2 THE NUTS AND BOLTS OF (Web site)

Wednesday, April 25th, 2007

CHAPTER 2 THE NUTS AND BOLTS OF AJAX the purpose of the Factory pattern is to determine which type to instantiate at runtime. That way, when the resulting object is referenced, the methods being queried should exist. The downside to dynamic languages is that you don t know whether your code works until you actually test it. There is no such thing as a JavaScript compiler, and hence it is not possible to know if your code works or does not work. This is partially what can make developing with JavaScript tedious as you may have to wade through a series of syntax errors before being able to test and debug your source code. However, do not think that JavaScript is an environment where you need to use printouts to see what the code is doing. Mozilla includes a very sophisticated and useful debugger that makes it simple to figure out what your JavaScript code is doing. Defining an XMLHttpRequest Factory Getting back to the Factory pattern and instantiation of XMLHttpRequest, the pattern is needed because each browser (for example, Firefox, Internet Explorer, and Safari) has a different way of instantiating the XMLHttpRequest object, and using the Factory pattern is the only way to mask the decision of the object instantiation. If you search the Internet (query XMLHttpRequest factory ), you ll find a multitude of techniques proposed to abstract the instantiation of XMLHttpRequest. As much as I would like to reference a toolkit or factory, there is a problem with doing so. A web browser is by default a cross-platform end client, or at least mostly a cross-platform end client. Using a comprehensive toolkit to create cross-browser applications is like creating a cross-platform toolkit for the Java environment. Like the Web, Java is cross-platform, and adding a layer on top complicates development and distribution of the application. The aim of this book is to focus on those methods, properties, and objects that are cross-browser compatible and when necessary introduce very lightweight functions or classes. The instantiation of the XMLHttpRequestobject is an example where it is necessary to introduce a lightweight function. The XMLHttpRequest Factory pattern is illustrated as follows: function FactoryXMLHttpRequest() { if(window.XMLHttpRequest) { return new XMLHttpRequest(); } else if(window.ActiveXObject) { var msxmls = new Array( ‘Msxml2.XMLHTTP.5.0′, ‘Msxml2.XMLHTTP.4.0′, ‘Msxml2.XMLHTTP.3.0′, ‘Msxml2.XMLHTTP’, ‘Microsoft.XMLHTTP’); for (var i = 0; i < msxmls.length; i++) { try { return new ActiveXObject(msxmls[i]); } catch (e) { } } } throw new Error("Could not instantiate XMLHttpRequest"); }
Note: If you are looking for cheap webhost to host and run your apache application check Vision apache web hosting services

CHAPTER 2 THE NUTS AND BOLTS OF (Web file server)

Wednesday, April 25th, 2007

Most popular web site - CHAPTER 2 THE NUTS AND BOLTS OF

Wednesday, April 25th, 2007

CHAPTER 2 THE NUTS AND BOLTS OF (Best web hosting)

Tuesday, April 24th, 2007

CHAPTER 2 THE NUTS AND BOLTS OF (Ipower web hosting)

Tuesday, April 24th, 2007

Tomcat web server - CHAPTER 2 THE NUTS AND BOLTS OF

Tuesday, April 24th, 2007

Web site domain - CHAPTER 2 THE NUTS AND BOLTS OF

Tuesday, April 24th, 2007

Apache web server tutorial - CHAPTER 2 THE NUTS AND BOLTS OF

Monday, April 23rd, 2007

Web server setup - CHAPTER 2 THE NUTS AND BOLTS OF

Monday, April 23rd, 2007

CHAPTER 2 The Nuts and (Web host server)

Monday, April 23rd, 2007