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.

Params Array in C#

Worried about Overloading a method due to unpredictable inputs!!
Here is a solution to this provided by C# and explained by Ms. Asha Bora.

Param arrays are very useful if you want to write methods that can take variable numbers of arguments, possibly of different types as parameter. If any one is familiar with OOPS then, he must be grinding his teeth in frustration at this sentence…Since in OOPS you use overloaded methods for this problem.

Overloading is the technical term for declaring two or more methods with the same name in the same scope. Overloading handles a situation where type and number of parameters vary. Where as param array can handle the situation if the types of parameter do not vary. While declaring a method suppose you are not sure about the number of arguments passed as a parameter, then we can use the param array.

How to declare Params array:
class A
{
public static int Array_Min(params int [] paramList)
{
//code
}
}


The effect of params keyword is that it allows you to call it by using any number of integer arguments. For example to find the minimum of 2 integer values, we would write it as:
int min=A.Array_Min(1,2);

The compiler translates this call into code similar to this:
int []array=new int[2];
array [0]=1;
array [1]=2;
int min=A.Array_Min(array);
similarly to find the minimum of 3 integer values,we would write the code as: int min=A.Array_Min(1,2,3);


Points to be noted about params arrays:
· You can use params keyword on only one dimensional arrays.
· You can’t overload a method based solely on the params keyword. The params keyword does not form part if a method’s signature, for example:
//compile time error: duplication declaration
public static int Min(int[]paramList)…
public static int Min(params int[]paramList)…
· You are not allowed ref or out params arrays, for example:
//compile-time errors
Public static int Min(ref params int[]paramList)…
Public static int Min(out params int[]paramList)…
· A params array must be the last parameter i.e. You can have only one params array per method.

A params int array is very useful since it allows any number of int arguments in a method call. you can use a param object array to declare a method that accepts any number of arguments of objects, allowing the arguments to be passed of any type.
· you can even pass it no arguments at all,
· you can also call it by passing the null as the argument,
· you can pass it an actual array ,
· you can pass any other arguments of different types and these arguments will automatically be wrapped inside an object array.