Advantages and Disadvantages of AJAX

Now Mr. Pravin presents reasons to use and why not to use AJAX.
To help you decide whether AJAX is for you or not, here are some of the advantages it has over classic web development techniques:

1. The interface is much more responsive, as explained before, because only a small part of the page is transferred at a time. The user has the feeling that changes are instantaneous.

2. Waiting time is reduced – when the visitor submits a form, they no longer have to wait for the entire page to be rebuilt and re-transmitted by the server. Instead, only the relevant content changes, and in non-critical cases, the visitor can still work while the data is being submitted.

3. If a page section encounters an error, other sections are not affected (if not logically linked) and the data already entered by the user is not lost. This way, the application fails graciously, without causing head-aches for the users.

4. Traffic to and from the server is reduced considerably – because you do not have to send the entire page content (CSS, images, static sections), the bandwidth usage is most likely to decrease.

5. Real-Time Form Data Validation: Form data such as user IDs, serial numbers, postal codes, or even special coupon codes that require server-side validation can be validated in a form before the user submits a form.

6. Auto completion: A specific portion of form data such as an email address, name, or city name may be auto completed as the user types.

The Disadvantages of AJAX
As with most new web development techniques, AJAX has its critics. There are a couple of disadvantages that need to be considered before considering an AJAX-based solution:
1. Building an AJAX-powered application can increase development time and costs. It is usually considered more difficult than building a classic web application, because of the mixture of technologies and the special concern about everything going smoothly. However, because it is dealing with relatively known technologies, AJAX is not rocket science.
2. Although AJAX relies on existing and mature technologies like JavaScript, HTML and CSS, the available frameworks and components still need to completely mature. Tools like the Dojo toolkit or the Rico framework are just a milestone on this long road.
3. Using AJAX to asynchronously load bits of content into an existing page conflicts with the way we are used to navigate and create bookmarks in modern browsers. Because viewing some part of the page information no longer corresponds to a newly loaded page, the browser history and bookmarks will not be able to restore the exact page state. Also, clicking the Back button in a browser might not have any effect, since the URL was unchanged (even if parts of the page were changed). To overcome these problems you must implement a way to save the current page state so that it can be restored later on, when called from a bookmark or from the browser history.
4. AJAX is not meant to be used in every application. One of the main reasons for this stays in the fact that Google cannot index it. "Suppose you are building an e-commerce site. A complete AJAX application would be a mistake because search engines won't be able to index it. And without a search engine, a site won't be able to sell products." Keeping this in mind, a much better idea than creating complete AJAX applications would be to scatter AJAX features within the application.
5. The biggest concern with AJAX is accessibility. This is because not all browsers (especially older ones) have complete support for JavaScript or the XMLHttpRequest object. Some of the visitors do have browsers with the required features, but they choose or have to turn off JavaScript support. When you design the application you must make sure that a fail-safe solution exists for those users, so it can be accessed by anyone.
Furthermore, the way to access and use the XMLHttpRequest object in Internet Explorer and other browsers is different, which leads to a fork in the code and the need to treat each case separately.
6. Debugging: AJAX applications are also difficult to debug because the processing logic is embedded both in the client and on the server.
7. Viewable Source: The client-side JavaScript technology may be viewed simply by selecting View Source from an AJAX-enabled HTML page. A poorly designed AJAX-based application could open itself up to hackers or plagiarism (illegal use or stealing or copying).
8. The last disadvantage lies in the actual XMLHttpRequest object itself. Due to security constraints, you can only use it to access information from the host that served the initial page. If you need to display information from another server, it is not possible within the AJAX paradigm.
Given these advantages and disadvantages of AJAX, you have to decide whether you need to use it or not before you start the design and implementation of your next project
The AJAX approach to building web applications shed a new light on the web and help close the gap between web applications and desktop applications in terms of usability and responsiveness. As the technique approaches maturity, many benefits and pitfalls will be uncovered, but the overall principles promise to revolutionize the web as we know it.

Who Is Using AJAX?

Lets see what Mr. Pravin has to share today.

AJAX is already widely used in web development. One of the most important players on the AJAX scene is Google. With Gmail, Google Groups, Google Suggest or Google Maps, AJAX is being put to good use by millions of visitors every day. The user interfaces respond quickly and are pretty intuitive, leaving no time for users to admire a blank screen.

AJAX is used in Meebo to allow users to connect to multiple instant messaging networks from a web-based application, and in Flickr, to allow photo sharing and tagging.
KTML is an online visual HTML editor that emulates the familiar Microsoft Word. You can use it for web content authoring just as you would use any other desktop-based text editor.
MX Query Builder is a visual tool for creating and managing SQL queries. It runs in a browser window, but can be launched from Macromedia Dreamweaver. Its many panels allow asynchronous interaction with your database. When you're done, you can save your query and use it in Dreamweaver as a regular record set.

These projects demonstrate that Ajax is not only technically sound, but also practical for real-world applications. This isn’t another technology that only works in a laboratory. In addition, Ajax applications can be any size, from the very simple, single-function Google Suggest to the very complex and sophisticated Google Maps.

How Does AJAX Works?

Classic Web Application:
The classic web application model works like this: Most user actions in the interface triggers an HTTP request back to a web server. The server does some processing — retrieving data, crunching numbers, talking to various legacy systems — and then returns an HTML page to the client.
This approach makes a lot of technical sense, but it doesn’t make for a great user experience. While the server is doing its thing, what’s the user doing? That’s right, waiting. And at every step in a task, the user waits some more.
Obviously, if we were designing the Web from scratch for applications, we wouldn’t make users wait around. Once an interface is loaded, why should the user interaction come to a halt every time the application needs something from the server? In fact, why should the user see the application go to the server at all?

AJAX Web Application:
An Ajax application eliminates the start-stop-start-stop nature of interaction on the Web by introducing an intermediary — an Ajax engine — between the user’s interface and the server. It seems like adding a layer to the application would make it less responsive, but the opposite is true. Instead of loading a webpage, at the start of the session, the browser loads an Ajax engine — written in JavaScript and usually tucked away in a hidden frame. This engine is responsible for both rendering the interface the user sees and communicating with the server on the user’s behalf. The Ajax engine allows the user’s interaction with the application to happen asynchronously — independent of communication with the server. So the user is never staring at a blank browser window and an hourglass icon, waiting around for the server to do something.

Working


Classic:

When the visitor requests a page, the server will send the full HTML and CSS code at once. After the visitor fills in a form and submits it, the server processes the information and rebuilds the page. It then sends the full page back to the client. And so on.

AJAX:
When using AJAX, the page is loaded entirely only once, the first time it is requested. Besides the HTML and CSS code that make up the page, some JavaScript files are also downloaded: the AJAX engine. All requests for data to the sever will then be sent as JavaScript calls to this engine. The AJAX engine then requests information from the web server asynchronously. Thus, only small page bits are requested and sent to the browser, as they are needed by the user. The engine then displays the information without reloading the entire page. This leads to a much more responsive interface, because only the necessary information is passed between the client and server, not the whole page. This produces the feeling that information is displayed immediately, which brings web applications closer to their desktop relatives.
In AJAX-powered applications, HTTP requests for data can be made completely in the background, without the user experiencing any interruptions. This means the user can continue working and using the application, while the necessary page sections are received from the server.

References: Refernces remains the same as for previous articles by Mr. Pravin K. Dubey on AJAX. We wish him luck for providing his knowledge and sharing it.

Defining AJAX

Now, this one is in continuation of the AJAX research compiled by Mr. Praving K. Dubey.

Read it !! Get informed and leave your valuable comments for us.

I heard many people saying that AJAX is a new technology used in web development. But in fact AJAX is neither new, nor a technology. It’s really several technologies, each flourishing in its own right, coming together in powerful new ways to build a friendlier web. Ajax incorporates:
• Standards-based presentation using XHTML and Cascading Style Sheet (CSS).
• Dynamic display and interaction using the Document Object Model (DOM).
• Data interchange and manipulation using Extensible Markup Language (XML) and XSLT
• Asynchronous data retrieval using XMLHttpRequest and JavaScript binding everything together.

XML is used to store and move information between the client and server, HTML and CSS to format the output and JavaScript to bind all of these elements together in a dynamic manner.
Role of Each Terminology
HTML and CSS is used to display the information in the browser. To present information to the client, you still need to use the language that browsers understand: HTML for content and CSS for layout and formatting.
In the age of dynamic websites, displaying content is not enough. You have to first retrieve it from a dynamic data source, and process it for final output. This is where XML and XSLT come into play.

Getting the information from the server and in the user's browser is the next step. The XMLHttpRequest JavaScript object is used for this part.
Once the information is displayed, you need to modify it dynamically. For this, you will use the Document Object Model (or DOM, for short). To provide dynamics to a static HTML page, DOM manipulation is used to alter the properties of already created page elements. It is done through JavaScript and allows (for example) a div element to become visible, or a button to gray-out when a certain selection has been made.

The glue that holds all these elements together is JavaScript. This allows retrieving dynamic information, displaying and modifying the page elements. JavaScript is a lightweight programming language used to perform various tasks on the web client.
The notion AJAX has come to define a development framework, which aims to improve web page usability.

As you can see from the list above, none of the technologies used within AJAX are new. What is new is the way these technologies are used together to create new types of web applications that are much more responsive and intuitive than the existing ones. To illustrate this, just have a look at Gmail and Google Maps. The user interfaces are quick in providing the user with the desired information, by performing the minimum of page reload possible.
This new approach to user interaction and application responsiveness is part of a wider technology trend, aimed at making the Internet friendlier and faster.

Generics in Java : An introduction

You are working with your team of developers and you have created a List to hold some values in it.
The other day a new team-member joins the team and starts working on the code.
He uses the List created by you to add items of different data-types (say string, long, Human etc.)
The code compiles sucessfuly, but will give a run-time error when you process the List at some point of time (e.g. sum-up all the numbers stored in the List).
Then there comes Generics to rescue you.

Lets see how as explained by Ms. Sindhu Kumari.

Generics are possibly the most talked about feature of Java 5. It sounds scary, but actually it is simply an enhancement to java programming language for compile-time type safety.
Lets understand the need for introducing generics.
Arrays in Java have always been type safe—an array declared as type String (string[]) can't accept Integers (or ints), Humans, or anything other than Strings. But what about the collection classes such as List, Map, Set, Vector and so on….

Observe this:
List myList = new ArrayList(); // can't declare a type
myList.add("Fred"); // OK, it will hold Strings
myList.add(new Human()); // and it will hold Humans too
myList.add(new Integer(42)); // and Integers...

A non-generic collection can hold any kind of object! A non-generic collection is quite happy to hold anything that is NOT a primitive.
This meant that all the care has to be taken by the programmer, because there was no way to guarantee the collection type. Usually, If we try to assign an int to a boolean reference or a String to a Horse reference, you get a compilation error by the java compiler, but with collections,the door is always open for all kind of objects.
And since a collection could hold anything, the methods that get objects out of the collection could have only one kind of return type—java.lang.Object. That meant that even for taking a String out of a list that is meant to hold String objects only, we need to do a cast :
String s = (String) myList.get(0);
And since you couldn't guarantee that what was coming out really was a String (since you were allowed to put anything in the list), the cast could fail at runtime, giving you a ClassCastException.
So, generics takes care of both ends (the putting in and getting out) by enforcing the type of your collections. Let's update the String list:

List myList = new ArrayList();
myList.add("Fred"); // OK, it will hold Strings
myList.add(new Human()); // compiler error!!


Perfect. That's exactly what we want. By using generics syntax—which means putting the type in angle brackets , we're telling the compiler that this collection can hold only String objects. The type in angle brackets is referred to as either the "parameterized type," "type parameter," or of course just old-fashioned "type."
So, now that what you put IN is guaranteed, you can also guarantee what comes OUT, and that means you can get rid of the cast when you get something from the collection. Instead of
String s = (String)myList.get(0); // pre-generics, when a
// String wasn't guaranteed
we can now just say
String s = myList.get(0);


And of course you can declare a type parameter for a method argument, which then makes the argument a type safe reference:
void takeListOfstrings(List strings) {
strings.add("foo"); // no problem adding a String
}


Return types can obviously be declared type safe as well:
public Set getStudentList()
Set students = new HashSet();
// more code to insert students
return students;
}

Conclusion:
Among all the features introduced in Java 5, generics is the most powerful one. Java developers need a little time to get used to generics. But when they start using it, they surely will save time and efforts...by writing easier and more robust code.

References :

Inheritence in C#

Multiple inheritence is not supproted by C#. But there is a solution to this using interfaces. Lets see how as explained by Ms. Asha Bora.

We know inheriting from a class is a powerful mechanism, but the real power of inheritance comes from inheriting from an interface.
Interface allows you to truly separate the "what" from "how". The interface tells what the name is, return type and parameter of the method are. Exactly how the method is implemented is not a concern of the interface. It represent how you want an object to be represent rather then how it happens to be implemented in a particular moment.

Syntax to declare interface: To declare the interface we use the interface keyword.
Eg:
interface IComparable
{
int xyz();
}


Points to be noted about Interface:
  • Interface should not contain any variable.
  • Interface should not have any constructor. Since a constructor contains the statements to initialize the variable of an object, but interface does not contain any variable.
  • A Destructor is also not allowed in an interface. Since it contain the statement to destroy the object instance.
  • No need to supply the access specifier to the methods. Since all the methods are public by default in an interface.
  • We cannot nest any types like enums , class, structs, interfaces, delegates inside an interface.
  • A class which implements an interface needs to implements all the members of the interface.

A class can inherit from a single class but can implement from multiple interfaces. An interface can inherit multiple interfaces. So we say that in C# multiple inheritance is applicable only through Interfaces, but not via classes.
A class or structure that implements an interface also implements the base interface of its inherited interface.
A class can extend another class and implement an interface at the same time. The base class is named first followed by a comma, followed by the interface.
eg:
class Defaultclass
{

}
class XYZ: Defaultclass, IComparable
{
...
}


Inheriting interface: we have declared an interface in the above example called IComparable, the below examples shows how a interface inherit another interface…
interface IOrder : IComparable
{
void abc();
}

3g / GPRS / EDGE

:-) -I have a 3G phone !!
:-I -They have an EDGE phone !!
:-( -You have a GPRS phone !!

These days everyone is conversing like above; and in INDIA even if these terms are not technically meant to people but everybody is aware that these two technologies influence the choices of their mobile phone. Lets know about these technologies in brief.

Both are the telecommunication technologies to transfer data.

3G:
from wikipedia :: is the third generation of mobile phone standards and technology, superseding 2G, and preceding 4G.
3G technologies enable network operators to offer users a wider range of more advanced services while achieving greater network capacity through improved spectral efficiency. It is often suggested by industry sources that 3G can be expected to provide 384 kbit/s at or below pedestrian speeds, but only 128 kbit/s in a moving car.

GPRS:
from wikipedia :: General Packet Radio Service (GPRS) is a packet oriented Mobile Data Service available to users of Global System for Mobile Communications (GSM). It provides data rates from 56 up to 114 kbit/s.

There is one more technology that is talked about many times with 3G is EDGE.

EDGE:
from wikipedia :: Enhanced Data rates for GSM Evolution (EDGE), Enhanced GPRS (EGPRS) is a digital mobile phone technology that allows increased data transmission rates and improved data transmission reliability. It comes somewhere between 2G and 3G techonologies of data transfer and communication.