Feeds:
Posts
Comments

Static Vs Dynamic websites – what’s the difference?

 

What are static and dynamic websites?

There are many static websites on the Internet, you won’t be able to tell immediately if it is static, but the chances are, if the site looks basic and is for a smaller company, and simply delivers information without any bells and whistles, it could be a static website. Static websites can only really be updated by someone with knowledge of website development. Static websites are the cheapest to develop and host, and many smaller companies still use these to get a web presence.

Advantages of static websites

  • Quick to develop.
  • Cheap to develop.
  • Cheap to host.  

Disadvantages of static websites

  • Requires web development expertise to update site.
  • Site not as useful for the user.
  • Content can get stagnant.

Dynamic sites on the other hand can be more expensive to develop initially, but the advantages are numerous. At a basic level, a dynamic website can give the website owner the ability to simply update and add new content to the site. For example, news and events could be posted to the site through a simple browser interface. Dynamic features of a site are only limited by imagination. Some examples of dynamic website features could be: content management system, e-commerce system, bulletin / discussion boards, intranet or extranet facilities, ability for clients or users to upload documents, ability for administrators or users to create content or add information to a site (dynamic publishing).

Advantages of dynamic websites

  • Much more functional website.
  • Much easier to update.
  • New content brings people back to the site and helps in the search engines.
  • Can work as a system to allow staff or users to collaborate. 

Disadvantages of dynamic websites

  • Slower / more expensive to develop.
  • Hosting costs a little more.  

Summary

Many sites from the last decade are static, but more and more people are realising the advantages of having a dynamic website. Dynamic websites can make the most of your site and either use it as a tool or create a professional, interesting experience for your visitors.

 

Active Server Page (ASP)

What is ASP?

 

An Active Server Page (ASP) is an HTML page that includes one or more scripts (small embedded programs) that are processed on a Microsoft Web server before the page is sent to the user. An ASP is somewhat similar to a server-side include or a common gateway interface (CGI) application in that all involve programs that run on the server, usually tailoring a page for the user. Typically, the script in the Web page at the server uses input received as the result of the user’s request for the page to access data from a database and then builds or customizes the page on the fly before sending it to the requestor.

 

ASP is a feature of the Microsoft Internet Information Server (IIS), but, since the server-side script is just building a regular HTML page, it can be delivered to almost any browser. You can create an ASP file by including a script written in VBScript or JScript in an HTML file or by using ActiveX Data Objects (ADOs) program statements in the HTML file. You name the HTML file with the “.asp” file suffix. Microsoft recommends the use of the server-side ASP rather than a client-side script, where there is actually a choice, because the server-side script will result in an easily displayable HTML page. Client-side scripts (for example, with JavaScript) may not work as intended on older browsers.

 

Active Server Pages or ASP, as it is more commonly known, is a technology that enables you to make dynamic and interactive web pages. ASP uses server-side scripting to dynamically produce web pages that are not affected by the type of browser the web site visitor is using.The default scripting language used for writing ASP is VBScript, although you can use other scripting languages like JScript (Microsoft’s version of JavaScript). ASP pages have the extension .asp instead of .htm, when a page with the extension .asp is requested by a browser the web server knows to interpret any ASP contained within the web page before sending the HTML produced to the browser. This way all the ASP is run on the web server and no ASP will ever be passed to the web browser.

Any web pages containing ASP cannot be run by just simply opening the page in a web browser. The page must be requested through a web server that supports ASP, this is why ASP stands for Active Server Pages, no server, no active pages. As ASP was first introduced by Microsoft on it’s web server, Internet Information Services (IIS), that runs on Windows 2000/XP Pro/NT4, it is this web server that ASP pages usually run best on.


 

What is (W3c)?

W3c

The W3C was started in 1994 to lead the Web to its full potential by developing common protocols that promote its evolution and ensure its interoperability.

What is the W3C?

1.             W3C Stands for the World Wide Web Consortium

2.             W3C was created in October 1994

3.             W3C was created by Tim Berners-Lee

4.             W3C was created by the Inventor of the Web

5.             W3C is organized as a Member Organization

6.             W3C is working to Standardize the Web

7.             W3C creates and maintains WWW Standards

8.             W3C Standards are called W3C Recommendations

How the W3C Started

The World Wide Web (WWW) began as a project at the European Organization for Nuclear Research (CERN), where Tim Berners-Lee developed a vision of the World Wide Web.

Tim Berners-Lee – the inventor of the World Wide Web – is now the Director of the World Wide Web Consortium (W3C).

W3C was created in 1994 as collaboration between the Massachusetts Institute of Technology (MIT) and the European Organization for Nuclear Research (CERN), with support from the U.S. Defence Advanced Research Project Agency (DARPA) and the European Commission.
Standardizing the Web

W3C is working to make the Web accessible to all users (despite differences in culture, education, ability, resources, and physical limitations)

W3C also coordinates its work with many other standards organizations such as the Internet Engineering Task Force, the Wireless Application Protocols (WAP) Forum and the Unicode Consortium.

W3C is hosted by three universities:

·         Massachusetts Institute of Technology in the U.S.

·         The French National Research Institute in Europe

·         Keio University in Japan

W3C Members

Because the Web is so important (both in scope and in investment) that no single organization should have control over its future, W3C functions as a member organization.

Some well known members are:

·         IBM

·         Microsoft

·         America Online

·         Apple

·         Adobe

·         Macromedia

·         Sun Microsystems

The Full List of Member Organisations includes a variety of software vendors, content providers, corporate users, telecommunications companies, academic institutions, research laboratories, standards bodies, and governments.

W3C Recommendations

The most important work done by the W3C is the development of Web specifications (called “Recommendations”) that describe communication protocols (like HTML and XML) and other building blocks of the Web.

Each W3C Recommendation is developed by a work group consisting of members and invited experts. The group obtains its input from companies and other organizations, and creates a Working Draft and finally a Proposed Recommendation. In general the Recommendation is submitted to the W3C membership and director, for a formal approval as a W3C Recommendation.

Virtual Machine (VM)

What is Virtual Machine (VM)?

 

A virtual machine (VM) is an environment usually a program or operating system, which does not physically exist but is created within another environment. In this context, a VM is called a “guest” while the environment it runs within is called a “host.” Virtual machines are often created to execute an instruction set different than that of the host environment. One host environment can often run multiple VMs at once. Because VMs are separated from the physical resources they use, the host environment is often able to dynamically assign those resources among them.

The phrase “virtual machine” is commonly used to describe Sun Microsystems’ Java runtime environment, the Java virtual machine (JVM), in which Java-specific commands are interpreted. The JVM is a virtual machine in that it executes code compiled specifically for it – known as byte code – and abstracts use of resources for this byte code. The Java programming language does not rely on platform – specific instruction sets, such as APIs specific to any one operating system, to display output or access resources such as files. Instead, the JVM creates virtualized resources which the byte code accesses. These actions are then passed on to the machine’s actual resources.

A user interacting with a virtualized server can view the server as a physical machine, in the sense that the user would see access to machines resources like hard disks, RAM, Processors and Ethernet connections. In fact, all of these machine resources are virtual For instance, instead of accessing a real hard disks, the user is accessing a construct of the host environment. This construct then accesses the real disk to record the data.

“A running program is often referred to as a virtual machine – a machine that doesn’t exist as a matter of actual physical reality. The virtual machine idea is itself one of the most elegant in the history of technology and is a crucial step in the evolution of ideas about software. To come up with it, scientists and technologists had to recognize that a computer running a program isn’t merely a washer doing laundry. A washer is a washer whatever clothes you put inside, but when you put a new program in a computer, it becomes a new machine. . . The virtual machine: A way of understanding software that frees us to think of software design as machine design.

FireFox Features.

Pros & Cons of Firefox over Internet Explorer:

 

Recent report tells that in March over 2.6 million people visited the Firefox website. It is a rise in records if we compare with 2.2 million in January. Estimates that as many as instead of Internet Explorer, 20 per cent of technical computer users have tried or are using Firefox which is the survey of US-based PC Magazine. If we compare net browsing percentage of common net users, Firefox penetrates widely which is estimated to be 5 per cent.

Competition in web browsing from Firefox has prompted Microsoft to increase the release of its next Internet Explorer, version 7.there are both advantages and disadvantages to using Firefox. Mozilla Firefox certainly makes the new browser easy to try. Firefox web browser is free for downloading. There are no excess advertisements, annoying characteristics of many other free software packages in Firefox.

We can import all Internet Explorer settings, bookmarks, cookies, and your browser history after installing Firefox, It does not cause any harm to your system and become the default browser So Firefox is technically is a harmless browser.

Firefox performance seems moderately faster than Internet Explorer. Firefox renders web pages differently by using a painterly, top-down effect, and text and graphics which appears just a tad faster in Firefox than in Explorer.

Some functions of Firefox is same as the Internet Explorer. Keyboard shortcuts such as hitting Ctrl-Home in the address bar to automatically fill in the “.com” after a word you type, work similarly same in Firefox.

Firefox’s options’ panel makes downloading simple to establish a place to put downloaded files by default. By using Internet Explorer, users constantly get puzzled by really where on their hard drives their downloaded files end up. With Firefox’s “download manager” of Firefox cause less problem of misplacing downloaded files.

We can use Firefox in a tabbed interface mode. Firefox places newly opened Web sites in a separate tab within the same browser window. This feature hugely decreases clutter on your Windows taskbar. But in Internet Explorer, we have to open a browser window; a new icon appears in your taskbar. if you Open twelve browser windows, and your taskbar will quickly fill by these twelve browser. you can invoke a windows XP feature to collect icons from the same program to cancel taskbar clutter.

A big advantage of Firefox over Internet Explorer is bookmark management window. We have to do huge & lengthy work to organise, delete bookmarks & favourites in internet explorer. Firefox makes easy all type of selection of multiple bookmarks at once which is going to organise or delete.

Firefox provides with keyboard shortcuts for common task like going backwards and forwards, to the top of the page and to the bottom, also for getting particular features of the Web browser, which contain the history panel of recently-visited sites. Firefox always retains integration with existing e-mail setup. There are some disadvantages in Firefox yet to be solved.

Slow Initial Loading: When you load Firefox after booting up your system, Firefox does take a lot of time to start. We can see this in faster and new PCs. Firefox team have claimed that the main reason for IE loading speedy is that it loads along with the Operating System, Opera loads in just a few seconds while Firefox loads in around 10-15 seconds.

Lack of HTML Editor : In Firefox, the View-Source option, let you only outlook the source and not edit. Web designers who want to edit HTML, etc, it is very irritating to open a separate Notepad window, load the HTML page and then load Firefox.

Older Versions: Net users browse with older versions of Mozilla Firefox (pre 1.5) because 1.5 did not really come with many feature upgrades. Firefox is Open source, people running older versions are at excessive risk thanks to the fact that after virus fixes, the exact nature of the virus can be known to everyone and hackers may target users of older versions.

JSON

 

What is JSON?

 

JSON stands for JavaScript Object Notation which is a data structuring format that is extremely clean and lightweight. Even though JSON is native to JavaScript (as in, it can be turned into an object directly by JavaScript), it is quite easy to handle with other languages, making it an ideal replacement of XML when JavaScript is involved with the exchange of data

 

JSON Features.

 

Lightweight data-interchange format.

> Compared to XML

Simple format.

> Easy for humans to read and write.

> Easy for machines to parse and generate.

JSON is a text format

> Programming language independent.

> Uses conventions that are familiar to programmers of the C-family.

    of languages, including C, C++, C#, Java, JavaScript, Perl, Python.

 

 

XML vs JSON

In my opinion, JSON should be used instead of xml, whenever JavaScript is on the receiving or sending end of the data. The reason for this is that when you use XML in JavaScript, you must write script or use libraries to handle the DOM objects to extract the data you need, whereas with JSON, it simply IS an object. This keeps overhead down and requires less CPU usage when preparing the data, not to mention it also decreases the amount of code you must write. There are many libraries out there for all the widely used languages for handling JSON with ease. This is debatable, but I also believe that even in a non-native language, parsing JSON will be faster due simply to a more lightweight data structure. In XML, there is a lot of bytes wasted and more memory required by the parser to keep track of tag names of varying sizes. I should also mention that some languages, such as PHP 5, actually have built-in libraries for handling JSON! Very cool!

  

Why Use JSON over XML

 

Lighter and faster than XML as on-the-wire data format.

JSON objects are typed while XML data is type less.

> JSON types: string, number, array, Boolean,

> XML data are all string

Native data form for JavaScript code

> Data is readily accessible as JSON objects in your JavaScript code vs. XML data needed to be parsed and assigned to variables through tedious DOM APIs.

> Retrieving values is as easy as reading from an object property in your JavaScript code.

 

 

JSON Structures

 

A collection of name/value pairs

> In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array

An ordered list of values

> In most languages, this is realized as an array, vector, list, or sequence

These are universal data structures supported by most modern programming languages.

 

 

Example: JSON Object

 

var myJSONObject = {“bindings”: [

{"ircEvent": "PRIVMSG", "method": "newURI", "regex": "^http://.*"},

{"ircEvent": "PRIVMSG", "method": "deleteURI", "regex": "^delete.*"},

{"ircEvent": "PRIVMSG", "method": "randomURI", "regex": "^random.*"}

]

};

 

 

The (JSON) SYNTAX:

{

”tweet” : {”photoid” : “url”,“username” : “Qais_8822340”,

“message” : “Working in Assignment 2 & Practical Exam!”,

“date” : July 17, 2008”}

}

 

The (XML) SYNTAX:

<tweet>

<photoid>The URL Address</photoid>

<username> Qais_8822340</username>

<message> Working in Assignment 2 & Practical Exam!</message>

<date> July 17, 2008”</date>

</tweet>

 

Comparison XML vs JSON.

 

  • XML parsing is very generic, you don’t have to care about the Types. JSON parsing on the other hand is very tricky.
  • XML has the data representation and semantics attached to it. JSON is very good for data representation.
  • Perhaps JSON data over the HTTP is faster than the XML.
  • As a developer the code to parse XML is much cleaner than the code to parse JSON.
  • Evaluating the JSON on JS is much faster and efficient. Due to its inherent support on JS, the learning cycle and manipulation of JSON data is faster than manipulation of XML by JS.
  • For WEB2.0/RIA applications, where there is a frequent data transfer between the browser and server, it makes sense to get the response in JSON and manipulate it in the browser.
  • I have used XML as domain models representation. It can contain the cross references, can contain types and attach semantics with the help of Schema.
  • JSON does not have any namespaces. I am not sure if this is an added advantage for JSON.
  • JSON Does not have validator. Developer is supposed to validate what ever he gets.
  • I love the random access XML via XPath. Can i do the same thing in JSON.
  • XLink, XQuery are some of the cool things i like on the XML.
  • I can represent the entire design of a system as XMI. It has references, schema support, i can validate, etc…

Blogging Task 6 (jQuery)

 What is JQuery

JQuery is a new type of JavaScript library. It is not a huge, bloated framework promising the best in AJAX – nor is it just a set of needlessly complex enhancements – jQuery is designed to change the way that you write JavaScript.

JQuery is a JavaScript library that takes this motto to heart: Writing JavaScript code should be fun. JQuery achieves this goal by taking common, repetitive, tasks, stripping out all the unnecessary markup, and leaving them short, smart and understandable.

JQuery is an amazing JavaScript library that makes it easy to create wonderful web effects in just a few lines of code. As the website says:”

JQuery is a JavaScript library that takes this motto to heart: Writing JavaScript code should be fun. JQuery achieves this goal by taking common, repetitive, tasks, stripping out the entire unnecessary markup, and leaving them short, smart and understandable.”

Maybe you are thinking… “Why I would need another JavaScript library”? Just give a try and you will see how simple and powerful it is even if you have already used Moo.fx, Scriptaculous, TW-SACK or Prototype.

Why I should use JQuery?

Simple. In just one glance at the source code of a page using JQuery you’ll see how easy it is to use, how much it accomplishes in so few lines of code, and how graceful it is.

My mind was opened one day when I stumbled across some code written with JQuery. I was flipping through the RSS feeds and reading my daily dose of web design blogs when I came across an example of JavaScript loveliness that used JQuery. Truth be told, the code on that site had some browser related bugs… but the concept was something I hadn’t seen before.

What about the code?

The code looked almost simple. Like nothing I had seen before. It made sense. I started reading through the documentation and was amazed to see how much could be done with so little extra code.

When you can use JQuery?

You should use JQuery when you need:

  • A small library that gives you powerful control over the Document Object Model
  • With very little effort or work on your part

Or

  • Quick access to AJAX
  • Without a lot of bloat (overhead – wasted code)
  • And some basic animation effects to spice things up
  • jQuery supports CSS 1-3 and basic XPath.
  • jQuery is about 19kb in size.
  • jQuery works in Firefox 3.0+, Internet Explorer 7+, Safari 3.1+, and Opera 8.5+.
  • jQuery and Prototype can be used together!
  • jQuery owns a strong and very flexible mechanism for adding in methods and functionality, bundled as plugins

But…

If you need super fancy effects for animation, drag and drop, and super smooth animation then you’ll probably want to use Prototype and one of the many great library created to enhance the effects.

What does minify mean?

Minify, in computer programming languages, is the process of removing all unnecessary characters from source code, without changing its functionality. These unnecessary characters usually include white space characters, new line characters, comments and sometimes block delimiters; which are used to add readability to the code, but are not required for it to execute.

Minified source code is especially useful for interpreted languages deployed and transmitted on the Internet (such as JavaScript), because it reduces the amount of data that needs to be transferred. Minified source code may also be used as a kind of obfuscation.

Minify Example:

1:  <target name=”minifyJs”>

   2:      <foreach item=”Line” in=”JavaScripts.txt” property=”jsFilename”>

   3:          <echo message=”Minifying JavaScript file: ${jsFilename}” />

   4:          <exec basedir=”.”

   5:              program=”jsmin.exe”

   6:              commandline=”${jsFilename} tempJS_min.js”

   7:              workingdir=”.”

   8:              failonerror=”true” />   

   9:          <move file=”tempJS_min.js” tofile=”${jsFilename}” overwrite=”true” />

  10:      </foreach>

  11:  </target>

 

 

The $(document).ready() function has a ton of advantages over other ways of getting events to work. First of all, you don’t have to put any “behavioral” markup in the HTML. You can separate all of your javascript/jQuery into a separate file where it’s easier to maintain and where it can stay out of the way of the content. I never did like seeing all those “javascript:void()” messages in the status bar when I would hover over a link. That’s what happens when you attach the event directly inside an <a href> tag.

On some pages that use traditional javascript, you’ll see an “onload” attribute in the <body> tag. The problem with this is that it’s limited to only one function. Oh yeah, and it adds “behavioral” markup to the content again. Jeremy Keith’s excellent book, DOM Scripting, showed me how to create an addLoadEvent function to a separate javascript file that allows for multiple functions to be loaded inside it. But it requires a fair amount of code for something that should be rather straightforward. Also, it triggers those events when the window loads, which leads me to another advantage of $(document).ready().

With $(document).ready(), you can get your events to load or fire or whatever you want them to do before the window loads. Everything that you stick inside its brackets is ready to go at the earliest possible moment — as soon as the DOM is registered by the browser, which allows for some nice hiding and showing effects and other stuff immediately when the user first sees the page elements.

Chainability

Basically, what chainability means is that you can perform some method on an object and then immediately follow that result with a dot and a new method acting on what was returned. This leads to the nice possibility of writing short, concise and easy-to-understand code like this:

$(“container”).elmsByClass(“mandatory”).addEvent(“blur”, validateInput);

The code above finds all the elements with the CSS class “mandatory” amongst the children of an element named “container”. It then loops through all of the returned elements and applies an onblur event to them to call a function named validateInput.

As you can see from this, fairly complex operations will be one-liners in the code, helping you to focus on other tasks. There’s no limit to how much chaining you can do. However, my recommendation to get legible code enables an easy overview, use chaining, but moderately. If you do it in ten consecutive steps it might look cool, but it’s not that much fun trying to maintain or debug it later.

Explain the following code and its connection with AJAX:

This is jQuery’s low-level AJAX implementation. See $.get, $.post etc. for higher-level abstractions that are often easier to understand and use, but don’t offer as much functionality (such as error callbacks).

$.ajax() returns the XMLHttpRequest that it creates. In most cases you won’t need that object to manipulate directly, but it is available if you need to abort the request manually.

$.ajax() takes one argument, an object of key/value pairs, that are used to initialize and handle the request. See below for a full list of the key/values that can be used.

Example:

Retrieve the latest version of an HTML page.

 

$.ajax({

  url: “test.html”,

  cache: false,

  success: function(html){

    $(“#results”).append(html);

  }

});

 

 

Blogging Task 5 : AJAX

What is AJAX?

Ajax stands for Asynchronous JavaScript And XML. It is a web development technique used for creating interactive web applications and the logical next step in the services-oriented architecture revolution. With Ajax, user interfaces from within the browser can use web services as their data source to store and retrieve information.

 

Ajax is a group of interrelated web development techniques used for creating interactive web applications. With Ajax, web applications can retrieve data from the server asynchronously in the background without interfering with the display and behaviour of the existing page. Data is retrieved using the XMLHttpRequest object or through the use of Remote Scripting in browsers that do not support it. Despite the name, the use of JavaScript, XML, and Asynchrony is not required.

 

With AJAX you can:

  • Parse and work with XML documents.
  • Make requests to the server without reloading the page.
  • Create next-generation interfaces with reusable AJAX components.
  • Enhance existing pages using powerful AJAX controls with support for all modern browsers.
  • Access remote services and data from the browser without tons of complicated script.
  • Take advantage of the improved efficiency and ease of use in Visual Studio 2008, with its built-in support for ASP.NET AJAX, improved JavaScript support, and a new Web page designer interface.

 

AJAX History.

The first use of the term in pubic was by Jesse James Garrett in February 2005. Garrett thought of the term when he realized the need for a shorthand term to represent the suite of technologies he was proposing to a client.

 

Although the term “Ajax” was coined in 2005, most histories of the technologies that enable Ajax start a decade earlier with Microsoft’s initiatives in developing Remote Scripting. Techniques for the asynchronous loading of content on an existing Web page without requiring a full reload date back as far as the IFRAME element type (introduced in Internet Explorer 3 in 1996) and the LAYER element type (introduced in Netscape 4 in 1997, abandoned during early development of Mozilla).

 

Microsoft’s Remote Scripting or MSRS, introduced in 1998 acted as a more elegant replacement for these techniques, with data being pulled in by a Java applet with which the client side could communicate using JavaScript.

 

This technique worked on both Internet Explorer version 4 and Netscape Navigator version 4 onwards. Microsoft then created the XMLHttpRequest object in Internet Explorer version 5 and first took advantage of these techniques using XMLHttpRequest in Outlook Web Access supplied with the Microsoft Exchange Server 2000 release.

 

Asynchronously in AJAX.

Using JavaScript technology, an HTML page can asynchronously make calls to the server from which it was loaded and fetch content that may be formatted as XML documents, HTML content, plain text, or JavaScript Object Notation (JSON). The JavaScript technology may then use the content to update or modify the Document Object Model (DOM) of the HTML page. The term Asynchronous JavaScript Technology and XML (Ajax) has emerged recently to describe this interaction model.

 

XMLHTTPRequest

The XMLHttpRequest object is the key to AJAX. It has been available ever since Internet Explorer 5.5 was released in July 2000, but not fully discovered before people started to talk about AJAX and Web 2.0 in 2005.

XMLHttpRequest (XHR) is an API that can be used by JavaScript, JScript, VBScript and other web browser scripting languages to transfer and manipulate XML data to and from a web server using HTTP, establishing an independent connection channel between a web page’s Client-Side and Server-Side.

Microsoft first implemented the XMLHttpRequest object in Internet Explorer 5 for Windows as an ActiveX object. Engineers on the Mozilla project implemented a compatible native version for Mozilla 1.0 (and Netscape 7). Apple has done the same starting with Safari 1.2.

XMLHTTPRequest in IE.

With the XMLHttpRequest object, Internet Explorer clients can retrieve and submit XML data directly to a Web server without reloading the page. To convert XML data into renderable HTML content, use the client-side XML DOM or Extensible Stylesheet Language Transformations (XSLT) to compose HTML elements for presentation.

 

if (window.XMLHttpRequest)
{
   var oReq = new XMLHttpRequest();
   oReq.open("GET", "http://localhost/test.xml");
   oReq.send();
   alert(oReq.statusText);
}

 

 

 

XMLHTTPRequest in Firefox.

On Firefox, there is one request that very predictably breaks things.
But the way things break is odd. That request works flawlessly; but
then *any* call to XMLHttpRequest’s “open” method after that throws an
exception; control never reaches the server-side code that’s being
called. Creating a new XMLHttpRequest object solves the problem.

 

var req = new XMLHttpRequest();

req.open(‘GET’, ‘file:///home/user/file.json’, false);

req.send(null);

if(req.status == 0)

  dump(req.responseText);

ReadyState Role in HttpRequest

 

The readyState property indicates the current state of the request. It returns a 4-byte integer.

This property is read-only and has the following defined values

  • UNINITIALIZED(0)
    The object has been created, but has not been initialized (the open method has not been called).
  • LOADING(1)
    The object has been created but the send method has not been called.
  • LOADED(2)
    The send method has been called and the status and headers are available, but the response is not.
  • INTERACTIVE(3)
    some data has been received. You can get the partial results using the responseBody and the responseText properties.
  • COMPLETED(4)
    All the data has been received, and is available.

 

Benefits of XMLHttpRequest:

 

  • It has the abort () function.
  • It is faster and easier then IFrame.
  • Can set/get all HTTP headers.
  • Numerous frameworks are dedicated to Ajax.
  • Can make requests to pages not set up for AJAX.
  • Can make HTTP requests using any type (GET, POST, PROPFIND, and so on).
  • Supports full control over POST requests, allowing for any type of data encoding.
  • It allows exchanging XML file with the server, that become accessible with the DOM interface, IFrame doesn’t.

 

What is XML?

The Extensible Mark-up Language (XML) is a general-purpose specification for creating custom mark-up languages. It is classified as an extensible language because it allows its users to define their own elements. Its primary purpose is to facilitate the sharing of structured data across different information systems, particularly via the Internet.

Structured information contains both content (words, pictures, etc.) and some indication of what role that content plays (for example, content in a section heading has a different meaning from content in a footnote, which means something different than content in a figure caption or content in a database table, etc.). Almost all documents have some structure. A mark-up language is a mechanism to identify structures in a document. The XML specification defines a standard way to add mark-up to documents.

XML was developed by an XML Working Group (originally known as the SGML Editorial Review Board) formed under the auspices of the World Wide Web Consortium (W3C) in 1996. It was chaired by Jon Bosak of Sun Microsystems with the active participation of an XML Special Interest Group (previously known as the SGML Working Group) also organized by the W3C. The membership of the XML Working Group is given in an appendix. Dan Connolly served as the Working Group’s contact with the W3C.

 

The design goals for XML are:

v     XML shall be straightforwardly usable over the Internet.

v     XML shall support a wide variety of applications.

v     XML shall be compatible with SGML.

v     It shall be easy to write programs which process XML documents.

v     The number of optional features in XML is to be kept to the min ideally zero.

v     XML documents should be human-legible and reasonably clear.

v     The XML design should be prepared quickly.

v     The design of XML shall be formal and concise.

v     XML documents shall be easy to create.

v     Terseness in XML mark-up is of minimal importance.

What’s a Document?

The number of applications currently being developed that are based on, or make use of, XML documents is truly amazing (particularly when you consider that XML is not yet a year old)! For our purposes, the word “document” refers not only to traditional documents, like this one, but also to the myriad of other XML “data formats”. These include vector graphics, e-commerce transactions, mathematical equations, object meta-data, server APIs, and a thousand other kinds of structured information.

So XML is Just Like HTML?

No. In HTML, both the tag semantics and the tag set are fixed. An <h1> is always a first level heading and the tag <ati.product.code> is meaningless. The W3C, in conjunction with browser vendors and the WWW community, is constantly working to extend the definition of HTML to allow new tags to keep pace with changing technology and to bring variations in presentation (style sheets) to the Web. However, these changes are always rigidly confined by what the browser vendors have implemented and by the fact that backward compatibility is paramount. And for people who want to disseminate information widely, features supported by only the latest releases of Netscape and Internet Explorer are not useful.

XML specifies neither semantics nor a tag set. In fact XML is really a meta-language for describing mark-up languages. In other words, XML provides a facility to define tags and the structural relationships between them. Since there’s no predefined tag set, there can’t be any preconceived semantics. All of the semantics of an XML document will either be defined by the applications that process them or by style sheets.

So XML Is Just Like SGML?

No. Well, yes, sort of. XML is defined as an application profile of SGML. SGML is the Standard Generalized Mark-up Language defined by ISO 8879. SGML has been the standard, vendor-independent way to maintain repositories of structured documentation for more than a decade, but it is not well suited to serving documents over the web (for a number of technical reasons beyond the scope of this article). Defining XML as an application profile of SGML means that any fully conformant SGML system will be able to read XML documents. However, using and understanding XML documents does not require a system that is capable of understanding the full generality of SGML. XML is, roughly speaking, a restricted form of SGML.

For technical purists, it’s important to note that there may also be subtle differences between documents as understood by XML systems and those same documents as understood by SGML systems. In particular, treatment of white space immediately adjacent to tags may be different.

Why XML?

In order to appreciate XML, it is important to understand why it was created. XML was created so that richly structured documents could be used over the web. The only viable alternatives, HTML and SGML, are not practical for this purpose.

HTML, as we’ve already discussed, comes bound with a set of semantics and does not provide arbitrary structure.

SGML provides arbitrary structure, but is too difficult to implement just for a web browser. Full SGML systems solve large, complex problems that justify their expense. Viewing structured documents sent over the web rarely carries such justification.

This is not to say that XML can be expected to completely replace SGML. While XML is being designed to deliver structured content over the web, some of the very features it lacks to make this practical, make SGML a more satisfactory solution for the creation and long-time storage of complex documents. In many organizations, filtering SGML to XML will be the standard procedure for web delivery.

JavaScript

What is JavaScript?

JavaScript is a compact, object-based scripting language for Web pages. JavaScript code embedded into your HTML pages can enhance them with many interesting elements, from swapping images when you move a cursor over them, to multi-level drop-down menus.

You can create really sophisticated and almost application-like pages with the help of JavaScript. You don’t need any special software other than a text editor and a Web browser, and you don’t need access to a Web server. You can create and test all your JavaScript code right on your own computer.

JavaScript and Java

Although the names are almost the same, JavaScript isn’t the same as Java. These are two different techniques for Internet programming. Java is a real programming language, and you can create real programs with it.

JavaScript is a scripting language. You could even say that JavaScript is rather an extension to HTML than a separate computer language. It’s so tightly integrated with HTML that you could call it “JavaScript mark-up language.” JavaScript coders don’t care too much about real programming; they just make different nice effects by inserting small JavaScript code fragments into their Web pages.

The drawbacks of JavaScript

Right now the biggest problem is the imperfect JavaScript implementations that today’s browsers offer. Although all major browsers that are version 3.0 or higher include JavaScript support, they deal with JavaScript differently.

In fact, different versions of the same browser handle JavaScript differently. This makes it difficult to create a complicated JavaScript code that work across all browsers. So always check your pages on as many different browsers (and even platforms) as possible.

What do JavaScript code look like?

Like HTML, JavaScript is just text that can be typed into a text editor. Its code is embedded in HTML within a <SCRIPT> tag. Some old browsers don’t understand this tag. To prevent them from treating your JavaScript as HTML, always use this trick involving HTML comments…

 

 

<html>
<head>
<script type=”text/javascript”>
<!–
function PrintDate() {
  today = new Date();
  document.write(‘Date: ’, today.getMonth()+1, ‘/’, today.getDate(), ‘/’, today.getYear());
}
//–>
</script>
</head><body>
<p align=”right”>
<script type=”text/javascript”>
<!–
PrintDate();
//–>
</script>
</p>
THE REST OF YOUR PAGE.
</body>
</html>

 

 

The power of JavaScript

JavaScript has one particular feature that makes it an interactive and power tool – event handling. You can trigger the JavaScript program by various events. For example, when the page loads, when it quits, when you pass your cursor over a link, or when you click on a button or a link.

Here’s a list of the common event handlers, that all popular browsers can deal with…

 

Event

When it’s triggered

onAbort

An image is stopped from loading because the user either hits Stop or leaves the page.

onBlur

An element, such as a window, frame, or form field, loses focus; that is, when the user clicks on something else.

onClick

The user clicks on the particular element.

onChange

The value of a form field changes, for example, when the user types in some data.

onDblClick

The user double-clicks on the particular element.

onError

A loading error happens, like a missing image.

onFocus

The user puts the focus on the target element, by clicking on it or tabbing to it.

onKeyDown

A key on the keyboard is pushed down, regardless of whether it’s then held down or released.

onKeyPress

This event is repeatedly triggered as long as a key is held down.

onKeyUp

A key on the keyboard is released.

onLoad

The browser completely loads the page.

onMouseDown

A key on the mouse is pushed down, regardless of whether it’s then held down or released.

onMouseMove

The mouse moves.

onMouseOut

The pointer moves out of the target area.

onMouseOver

The pointer moves over the target element.

onMouseUp

A key on the mouse is released.

onReset

The Reset button of a form is clicked.

onResize

A window or frame is resized by the user.

onSelect

The user highlights text in a form field.

onSubmit

A form is submitted.

onUnload

The user leaves the page.

 

« Newer Posts - Older Posts »