Monthly Archives: January 2011

Useful Javascript Frameworks : An Introduction

JavaScript is the industry standard client-side scripting language that is used in web applications.Over the past few years, there’s been a small renaissance in JavaScript as a language. A variety of projects have sprung up to build reusable JS libraries and frameworks — and at this point, a good number of them have matured and shown staying power that they’re worth taking a serious look at and relying on in professional projects.

JavaScript has grown in popularity in parallel with the Web and today is supported by all major browsers and new web technologies. JavaScript has been extended over time to deliver high-performing and incredibly impressive Web user experiences, using technologies including Adobe Flash, AJAX, and Microsoft Silverlight.

As JavaScript is used increasingly for “serious” development on the Web, the lessons that have been learned and the tools that have been invented along the way are being consolidated and shared by developers in the form of libraries and frameworks. However, since JavaScript is such a flexible and dynamic language, each framework can present very different approaches to the problems of web development — each with its own pros and cons.

Some of the most popular and useful Javascript frameworks are :

1. Prototype : Prototype was one of the first JavaScript libraries to gain prominence during the Web 2.0 resurgence. When the term AJAX was first coined in 2005, making cross – browser XMLHttpRequests was a minefield of browser – specific code. Prototype assists you in your quest for cross – browser compatibility by smoothing out the rough edges of event handling by providing a common method for binding events to their respective handlers and providing a common interface for creating AJAX requests that work in all browsers. It also gives you a cross – browser way to manipulate the DOM, by handling the special cases in all browsers, and allowing you to focus on just writing code without cluttering up your code with
browser – specific “ if – else ” statements.

javascript frameworks 2

javascript frameworks

2. YUI : The entire Yahoo! User Interface Library (YUI), unzipped, is about 50 MB. It includes assets, examples, tests, documentation, and the three flavors of files in which the main library is available. You can find the library at .

The library is broken down along four major groups:
– YUI Core
– Utilities
– Controls/Widgets
– CSS Tools

Each group in turn is broken down into individual components that can be used as needed without having to include the entire library on a site. All components have a dependency on the YAHOO Global Object which lays out some needed groundwork. After that, most components also need the DOM Collection and the Event Utility. Each component comes in a minified version, a standard version, and a debug version. The latter logs all kinds of information to the logger allowing the inner workings of
components to be tracked. The debug version is always the heaviest and should never be used in a production environment.

3. ExtJS : Ext JS has a large control library available to developers using jQuery, Prototype, and of course YUI. Using the simple technique of namespacing, developers could rest assured the Ext JS control library would not conflict with their core JavaScript library of choice. A few months after the release of Ext JS 1.0, a version 1.1 was released offering a new “ adapter ” based solely on Ext JS code (free of external dependencies). Since then, the Ext JS team has maintained the “ adapter ” abstraction layer while continuing to add to its rich control library.

Even with its humble beginnings of a single data grid, the Ext JS library is not your typical JavaScript library of functions. Of course, Ext JS has all the general functionality that developers have come to expect from JavaScript libraries (high – performing traversal of the DOM, manipulating CSS and HTML, simplified AJAX execution, handling of XML and JSON data, and so on). But Ext JS has aimed at providing developers with a complete, themed control library, which is easy to extend, easy to use á la carte, and is so visually attractive that it virtually sets the standard. To date, Ext JS has surpassed each of these goals.

4. Dojo : Dojo is an open-source framework that began life as an effort to unify a handful of separate DHTML toolkits and JavaScript utility libraries. As such, the Dojo toolkit offers all the amenities expected from modern JavaScript frameworks. You ’ ll find basic language enhancements, as well as the usual tools for dealing with DOM manipulation and AJAX requests.

Where Dojo really shines, though, is with its facilities for building user interfaces and whole applications using declarative HTML markup. Rather than piecing together applications with long stretches of object initialization code and wiring up DOM elements, Dojo offers the ability to scan the page itself for setup cues in Dojo – specific attributes and conventions.

5. Mootools : MooTools is a compact, modular, object – oriented JavaScript framework.Unlike jQuery, which implements a domain – specific language of its own, MooTools stays firmly rooted in standard JavaScript and augments it. As opposed to the near Java – esque system of isolated modules and on – demand dependencies offered by YUI and imposed by Dojo, MooTools is loaded with HTML script tags and relies on JavaScript’s built – in facilities for namespaces and modularity through object literals and closures. the “ Moo ” in MooTools, in case you were wondering, stands for “ My Object Oriented ” JavaScript Tools.

Understanding OOPS concepts

We live in an object-oriented world. You are an object. You interact with other objects.
In fact, you are an object with data such as height and hair color. You also have methods that you
perform or are performed on you, such as eating and walking.
So what are objects? In OOP terms, an object is a structure for incorporating data and the
procedures for working with that data. For example, if you were interested in tracking data associated
with products in inventory, you would create a product object that is responsible for maintaining and
working with the data pertaining to the products. If you wanted to have printing capabilities in your
application, you would work with a printer object that is responsible for the data and methods used to
interact with your printers.
When you interact with objects in the world, you are often only concerned with a subset of their
properties. Without this ability to abstract or filter out the extraneous properties of objects, you would
find it hard to process the plethora of information bombarding you and concentrate on the task at hand.
As a result of abstraction, when two different people interact with the same object, they often deal
with a different subset of attributes.
When constructing objects in OOP applications, it is important to incorporate this concept of
abstraction. If you were building a shipping application, you would construct a product object with
attributes such as size and weight. The color of the item would be extraneous information and filtered
out. On the other hand, when constructing an order-entry application, the color could be important and
would be included as an attribute of the product object.
Another important feature of OOP is encapsulation. Encapsulation is the process in which no direct
access is granted to the data; instead, it is hidden. If you want to gain access to the data, you have to
interact with the object responsible for the data. In the previous inventory example, if you wanted to
view or update information on the products, you would have to work through the product object. To
read the data, you would send the product object a message. The product object would then read the
value and send back a message telling you what the value is. The product object defines what operations
can be performed on the product data. If you send a message to modify the data and the product object
determines it is a valid request, it will perform the operation for you and send a message back with the
You experience encapsulation in your daily life all the time. Think about a human resources
department. They encapsulate (hide) the information about employees. They determine how this data
can be used and manipulated. Any request for the employee data or request to update the data has to be
routed through them. Another example is network security. Any request for the security information or a
change to a security policy must be made through a network security administrator. The security data is
encapsulated from the users of the network.
Polymorphism is the ability of two different objects to respond to the same request message in their own
unique way. For example, I could train my dog to respond to the command bark and my bird to respond
to the command chirp. On the other hand, I could train them to both respond to the command speak.
Through polymorphism I know that the dog will respond with a bark and the bird will respond with a
How does this relate to OOP? You can create objects that respond to the same message in their own
unique implementations. For example, you could send a print message to a printer object that would
print the text on a printer, and you could send the same message to a screen object that would print the
text to a window on your computer screen.
Most objects are classified according to hierarchies. For example, you can classify all dogs together as
having certain common characteristics such as having four legs and fur. Their breeds further classify
them into subgroups with common attributes such as size and demeanor. You also classify objects
according to their function. For example, there are commercial vehicles and recreational vehicles. There
are trucks and passenger cars. You classify cars according to their make and model. To make sense of the
world, you need to use object hierarchies and classifications.
You use inheritance in OOP to classify the objects in your programs according to common
characteristics and function. This makes working with the objects easier and more intuitive. It also
makes programming easier because it enables you to combine general characteristics into a parent
object and inherit these characteristics in the child objects. For example, you can define an employee
object that defines all the general characteristics of employees in your company. You can then define a
manager object that inherits the characteristics of the employee object but also adds characteristics
unique to managers in your company. The manager object will automatically reflect any changes in the
implementation of the employee object.
Aggregation is when an object consists of a composite of other objects that work together. For example,
your lawn mower object is a composite of the wheel objects, the engine object, the blade object, and so
on. In fact, the engine object is a composite of many other objects. There are many examples of
aggregation in the world around us. The ability to use aggregation in OOP is a powerful feature that
enables you to accurately model and implement business processes in your programs.

An Introduction to jQuery : You shouldn’t wait to try it

jQuery is an open-source JavaScript kit for building Web applications so dynamic they jump off the page. Filled with special controls like calendars and tab folders, and special effects like wipes and fade-ins, jQuery is gaining popularity rapidly.

Perhaps most important, jQuery gives you excellent support for Ajax applications. Ajax is what allows you to access a Web server from a browser without a page refresh—that is, there’s no blinking, no flicker when you
download data behind the scenes with Ajax; you just download the data and then you can display it in a Web page using dynamic HTML techniques. No fuss no muss—and the end result is an application that looks more like a desktop application than a Web application.

jQuery is a JavaScript library full of tools ready to be used—which means that it’s prewritten JavaScript, ready for you to put to work in your own Web pages. jQuery specializes in letting you select elements in a page, and it does that better than any other JavaScript library. You’ll see how to create wrapped sets of elements in jQuery, so you can handle multiple elements at the same time. You’ll also see how to manipulate wrapped sets of elements by changing their appearance, style, visibility, text, and even their HTML.

jQuery also comes packed with super-powerful utility functions, such as functions that let you determine which browser the user has and what its capabilities are. jQuery provides many utility functions.

jQuery is known for its visual effects, which include slick-looking wipes, in which a sheet of color wipes over an element, and fades, in which an element and its background fade from view.

Some features of jQuery are as follows :

jQuery Is Cross-Browser

jQuery Supports Ajax

jQuery Selectors

jQuery Handles Page Loads

jQuery Lets You Create HTML

jQuery Supports Animation and Effects

Objective C : An Introduction

You have been hearing about C, C++, C#, but what is this Objective-C?

Objective-C is a reflective, object-oriented programming language which adds Smalltalk-style messaging to the C programming language. (Wikipedia)

This definition is ofcourse the crux but not simple enough to understand, so lets break it into bits and piece to make it easy to eat. Objective-C is a cross-platform language, so you’ll find it on many systems: the Mac, ofcourse, but also Linux, UNIX, Windows, and more—and its core programming code stays the same across all those platforms.

Objective-C is actually a layer built on top of the C language, and everything that works in standard (that is, ANSI) C works in Objective-C. Objective-C also adds tons of object-oriented features to the original C language.

The extension for Objective-C code files is .m.

Objective-C implementations use a thin runtime  written in C which adds little to the size of the application. In contrast, most object oriented systems at the time that it was created used large virtual machine runtimes. Programs written in Objective-C tend to be not much larger than the size of their code and that of the libraries.

Using Objective-C, you can write professional programs that make use of many objectoriented features—from the basics up to advanced class inheritance and exception (run-time error) handling.

What is URL Canonicalization ?

Canonicalization is the process used by search engines to determine the best URL or website address when several different choices exist. This is a common issue that is predominantly related to home page files at the root level. For example, to a web user, the following URLs all appear to be the same:

However, search engines view the above URLs as different pages. Web servers see each URL differently and treat each independently; therefore each of the above URLs could display different content if desired. When a search engine attempts to “canonicalize” a URL, it seeks to choose the best page to represent the website.

canonicalization, www vs. non-www, redirects, duplicate urls, 302 “hijacking,” etc. comes under URL normalization problems. Canonicalization is the process of picking the best url when there are several choices, and it usually refers to home pages. The goal of the normalization process is to transform a URL into a normalized or canonical URL so it is possible to determine if two syntactically different URLs may be equivalent.

If more than one result appears on the search engine result pages, you may want to correct the issue using a 301 redirect on your web server. The 301 redirect will instruct the search engine as to which URL you desire to be “canonical.” In addition, this 301 redirect will permanently readdress to the specified URL. So, Try to use same url for a same location everywhere in your web site.