37 sites, 19,934 entries and counting...     Get a free blog; Join a Weblog Network!
Top

patterns

December 19, 2009

Patterns being patterns, theres not a lot of unseen information here. Patterns are just a concise way to represent the knowledge embodied in the many AJAX applications that are out there. The point is to discover best practices by investigating how developers have successfully traded off conflicting design principles. AJAX is all about usability, so the patterns focus particularly on delivering usability in the face of constraints, most notably: user capabilities and expectations, bandwidth limits, the stateless nature of HTTP, the complexity of JavaScript.
AJAX is a new term, but XMLHttpRequest and related technologies have been around for a while. I know that, but the introduction of a single umbrella term nevertheless constitutes a tipping point which is forcing web development to move heavily in a certain direction. AJAX is only a name, but names can be tremendously important.

these are some points……..
Minimise traffic between browser and server so that the user feels the application is responsive.
Be clear on the interaction mode being used – regular HTML versus AJAX versus desktop application so that the user can predict what will happen next .. no surprises.
While avoiding confusion, borrow from conventions of HTML and desktop applications so that the user can rapidly learn how to use your application.

Introducing the ASP.NET Ajax Framework

April 15, 2009

Ajax is a popular technology that is used in many different ways on the World Wide Web. It has become a technology of choice for building fast and responsive user interface. This artical takes a brief look at the features of some of the more widely used ASP.NET Ajax frameworks.
The What and Why of Ajax
Before we delve deep into the Ajax frameworks, let’s have a quick recap of what Ajax and why it is so popular. The word Ajax is and acronym for Asynchronous JavaScript and XML. It is a combination of different technologies, used for building rich and responsive user interfaces. The benefits of using Ajax include:
faster page renderings and support for partial page updates
rich and, responsive user interface
reduced consumption of server resources
Common ASP.NET Ajax frameworks
The most common Ajax frameworks that can be used with ASP.NET are:
Atlas
AJAXPro.NET
MagicAJAX.NET
Anthem.NET
ASP.NET Ajax

A simple feedback of AJAX for beginners

January 27, 2009

Website script holds large importance as far as popularity and usage convenience are concerned. As an innovative web language AJAX may not be very popular as it has come quite recently as compared with other web languages which have been around for last 10 years or more. For beginners a quick feedback of AJAX can be helpful.

AJAX is really faster in its application as it does not need connection to server every time you ask for the information. Call back process for required information from users is capable enough to avoid sluggishness of page view. Data updation has been made quite simple and there is no need to review the entire contents. The system can select the bits to update. AJAX uses those scripts which are normally supported by all major browsers.

If you are planning to develop a new website, you can try AJAX. Online tutorials are available to get basic start up guidelines also.

Life Cycle of AJAX

January 26, 2009

A Typical Life Cycle or Process of AJAX

Life cycle of AJAX is more similar to a traditional GUI than a traditional web application. It has DOM objects who acts like GUI widgets. The used script has capacity to register even listeners on DOM objects and respond accordingly after manipulating DOM.

There is an important part of the event-processing cycle in server is evoked sometimes. As the server calls are asynchronous, the even listening and event responding are done separately.

The normal AJAX life cycle consists of following stages:

1. The webpage is visited by internet users simply by clicking the targetted link or searching an URL. Thereafter the page gets initialised and loaded. In order to handle the user input callbacks are present in the system which acts after this.
2. When a key is pressed it’s called an event which is a query or click in common words. On such events browser sends the information request to the server which in turn responds to give back required information as bites.
3. The response of the server is translated through callback process to made viewable to the user.
4. The callback function then updates the DOM objects and javascript variables if present.
5. Generally the process of requesting information and giving callbacks are free to server to increase convenience and speed.
6. Some AJAX applications are short term and terminated once the request is completed.

AJAX: Introduction and Advantage

January 25, 2009

Basics of AJAX:

AJAX is defined or termed as Asynchronous Javascript and XML. It’s a new avtar of modern day website creation. AJAX is one of the programming techniques which has primarily made popular after 2005 by Google. No doubt about it that AJAX has set innovative and new standads of programming. AJAX has enabled webmasters create better, faster and more user-friendly web applications with its base of Javascript and HTTP.

AJAX is based on 4 web standards which are well defined and supported by all major browsers.

1. JavaScript
2. XML
3. HTML
4. CSS

Basic Advantage of AJAX

Faster Updation: If you want to update the data base of your web AJAX provides an unique feature to reduce consumption of time. Unlike other web languages where you need to update the entire data base every time you need to update the contents, however with AJAX you need to spend time only on updation of the contents which actually requires to be done so. AJAX selects the contents from the web which needs updation giving eage to the process.

Faster Response: AJAX enables faster responses to the inputs even if the changes are not done on server. The unique advantage of AJAX is its ability to reload the individual pages separately giving a user friendly benefit and users may perceive the site functioning faster.

Faster Connection: With AJAX it’s not required to connect the webpage with server every time. Some times it saves the interaction between them to increase functionality and speed. It allows webpage to request for smaller bits of information rather than asking for the entire page to load again and again which increases speed as well. AJAX is a technology related to browser which is independent of web server.

ASP.NET: GridView Control

January 9, 2009

One of the reasons why I’m impressed with asp.net’s rich set of controls is its GridView control. This control displays your data in a table structure complete with delete, update and select features. It even has paging in case you have lots of records in your database. The best thing about this paging is that everything is done for you, the links, the paging number, the paging labels and others. If you click a page link, it will retrieve the next set of record(s) for you without changing any SQL query. For example, you can use this SQL query to retrieve all records of the table.

select * from [table_name];

In MySQL, you would need to supply the LIMIT keyword in order to get a specific set of rows. With GridView’s paging feature enabled, everything is done for you. Neat huh. Took me like a day in getting this one to work though because I had problems with the update and delete function. Since I am using MySQL, turns out when you do parameters in your query commands, the @ sign does not work because it is only for MS SQL. You would have to change the @ to ?.

Take this sample asp.net code for a GridView control as an example. This assumes you have a working database connection to MySQL. If you do not know how to connect to a MySQL in asp.net, go here to use the custom MySQLProvider classes by Rakotomalala Andriniaina.

<asp:SqlDataSource ID=”srcUsers” runat=”server”
ProviderName=”MySql.Data.MySqlClient”
ConnectionString=”"
SelectCommand=”select pkid, username, email, creationdate from users”
DeleteCommand=”delete from users where pkid = ?pkid”
UpdateCommand=”update users set email = ?email where pkid = ?pkid”
>

<PagerSettings Mode=”NextPrevious” PreviousPageText=”" />

If you read e-books regarding asp.net, the queries used are for MS SQL. It’s been a long time since I dabbled with MS SQL, so when I read about it, I thought the @ sign for parameters were required for any database used. Took me some time to know that ? has to be used. See the DeleteCommand and UpdateCommand properties of the SqlDataSource tag.

How you design your GridView control is up to you. With styles, you can override how the table would look like. The other GridView like control that I had used before that looks like asp.net’s version is the datagrid taglib for Java. The downside with using the taglib is that if your SQL query returns lots of rows, it may not load fast and may use up resources in doing so because it gets all records at one time. Asp.net’s GridView control totally impressed me in more ways.

AJAX - Request a Server

December 6, 2008

To send off a request to the server, we use the open() method and the send() method.

The open() method takes three arguments. The first argument defines which method to use when sending the request (GET or POST). The second argument specifies the URL of the server-side script. The third argument specifies that the request should be handled asynchronously. The send() method sends the request off to the server. If we assume that the HTML and ASP file are in the same directory, the code would be:
xmlHttp.open(”GET”,”time.asp”,true);
xmlHttp.send(null);
Now we must decide when the AJAX function should be executed. We will let the function run “behind the scenes” when the user types something in the username text field:

Name:
Time:

function ajaxFunction()
{
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject(”Msxml2.XMLHTTP”);
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject(”Microsoft.XMLHTTP”);
}
catch (e)
{
alert(”Your browser does not support AJAX!”);
return false;
}
}
}
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
document.myForm.time.value=xmlHttp.responseText;
}
}
xmlHttp.open(”GET”,”time.asp”,true);
xmlHttp.send(null);
}

Name:
Time:

AJAX - The XMLHttpRequest Object

December 6, 2008

Before sending data to the server, we have to explain three important properties of the XMLHttpRequest object.
The onreadystatechange Property

After a request to the server, we need a function that can receive the data that is returned by the server.

The onreadystatechange property stores your function that will process the response from a server. This is not a method, the function is stored in the property to be called automatically. The following code sets the onreadystatechange property and stores an empty function inside it:
xmlHttp.onreadystatechange=function()
{
// We are going to write some code here
}
The readyState property holds the status of the server’s response. Each time the readyState changes, the onreadystatechange function will be executed.

Here are the possible values for the readyState property:
o-The request is not initialized
1-The request has been set up
2-The request has been sent
3-The request is in process
4-The request is complete
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
// Get the data from the server’s response
}
}
The data sent back from the server can be retrieved with the responseText property.

In our code, we will set the value of our “time” input field equal to responseText:
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
document.myForm.time.value=xmlHttp.responseText;
}
}

December 6, 2008

To understand how AJAX works, we will create a small AJAX application.

First, we are going to create a standard HTML form with two text fields: username and time. The username field will be filled in by the user and the time field will be filled in using AJAX.

The HTML file will be named “testAjax.htm”, and it looks like this (notice that the HTML form below has no submit button!):

Name:
Time:

The keystone of AJAX is the XMLHttpRequest object.

Different browsers use different methods to create the XMLHttpRequest object.

Internet Explorer uses an ActiveXObject, while other browsers uses the built-in JavaScript object called XMLHttpRequest.

To create this object, and deal with different browsers, we are going to use a “try and catch” statement. You can read more about the try and catch statement in our JavaScript tutorial.

Let’s update our “testAjax.htm” file with the JavaScript that creates the XMLHttpRequest object:

function ajaxFunction()
{
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject(”Msxml2.XMLHTTP”);
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject(”Microsoft.XMLHTTP”);
}
catch (e)
{
alert(”Your browser does not support AJAX!”);
return false;
}
}
}
}

Name:
Time:

First create a variable xmlHttp to hold the XMLHttpRequest object.

Then try to create the object with XMLHttp=new XMLHttpRequest(). This is for the Firefox, Opera, and Safari browsers. If that fails, try xmlHttp=new ActiveXObject(”Msxml2.XMLHTTP”) which is for Internet Explorer 6.0+, if that also fails, try xmlHttp=new ActiveXObject(”Microsoft.XMLHTTP”) which is for Internet Explorer 5.5+

If none of the three methods work, the user has a very outdated browser, and he or she will get an alert stating that the browser doesn’t support AJAX.

AJAX Http Requests

December 6, 2008

In traditional JavaScript coding, if you want to get any information from a database or a file on the server, or send user information to a server, you will have to make an HTML form and GET or POST data to the server. The user will have to click the “Submit” button to send/get the information, wait for the server to respond, then a new page will load with the results.

Because the server returns a new page each time the user submits input, traditional web applications can run slowly and tend to be less user-friendly.

With AJAX, your JavaScript communicates directly with the server, through the JavaScript XMLHttpRequest object

With an HTTP request, a web page can make a request to, and get a response from a web server - without reloading the page. The user will stay on the same page, and he or she will not notice that scripts request pages, or send data to a server in the background.
AJAX was made popular in 2005 by Google (with Google Suggest).

Google Suggest is using the XMLHttpRequest object to create a very dynamic web interface: When you start typing in Google’s search box, a JavaScript sends the letters off to a server and the server returns a list of suggestions.

The XMLHttpRequest object is supported in Internet Explorer 5.0+, Safari 1.2, Mozilla 1.0 / Firefox, Opera 8+, and Netscape 7.

Next Page »

Nevis Hotel - Credit Card Consolidation - Debt Consolidation - Credit Counseling
Bottom