Month: July 2010

Microsoft slates IE9 beta for September 2k10

Posted on Updated on

MIcrosoft will ship a beta of Internet Explorer 9 (IE9) in September, a company executive said today.

If the timeline is accurate, the IE9 beta release will come a month later than earlier speculation, which had settled on August, a pick based in large part on PowerPoint slides purportedly from a Microsoft presentation.

Kevin Turner, Microsoft’s chief operating officer, said that IE9 would reach beta this fall. “We’re really excited about IE9, which will be beta and coming out in September,” said Turner during the company’s annual day-long presentation to Wall Street analysts.

Turner also boasted of Internet Explorer’s recent turnaround, claiming that it had gained usage share the last two months.

According to Web analytics company Net Applications, IE did increase its global share by a record six-tenths of a percentage point during June. However, Net Applications had IE losing, not gaining, ground worldwide in May.

As of June 30, IE accounted for an estimated 60.3% of all browsers used during the month.

Since March, when the company debuted a rough-around-the-edges IE9 developer preview, the company has updated the bare-bones browser twice, most recently in late June.

After Turner’s announcement of a September beta for IE9, Microsoft declined to answer additional questions, including when during the month users could expect the more stable preview, or whether the beta would be open to everyone, as the developer previews have been.

“We do not have any additional specifics to share at this time about when Internet Explorer 9 Beta will be available,” a company spokeswoman said.

Microsoft has also refused to name a release schedule for the final build of IE9. Most pundits now believe Microsoft won’t wrap up the browser until 2011.

That will be the case if Microsoft mimics the timeline it used for Internet Explorer 8 (IE8), which reached the beta milestone in March 2008 but didn’tship until March 2009.

Using IE8’s schedule as a guide, users can expect to see the final version of IE9 in September 2011.

IE9 will run on Windows Vista and Windows 7, but not on Windows XP, the nearly-nine-year-old operating system that still accounts for 68% of all versions of Windows still in use.

Internet Explorer Platform Preview requires Windows Vista or Windows 7. You can find test drive here.

free counters

How to trim string value :: JavaScript Tutorial

Posted on

hi all..
hope everything is good at your end ..
today, there is a smal tip for javascript users …
umm infact not a tip but a utility function to trim string values ..
i was working on a project i had a need to trim user input befor submitting to server side
here is the quick way to do this .
<script type=”text/javascript” language=”javascript”>
function trim(paramString){
return paramString.replace(/^\s*/, “”).replace(/\s*$/, “”);
and thats it …
happy development 🙂

free counters

Event Object :: JavaScript Tutorial

Posted on Updated on

Hello All …

Hope enjoying most enjoyable activity .i.e development 🙂 i love it … really love it ..

Today i will try to explain something related to javascript event object. By using JavaScript, we have the ability to create dynamic web pages. Events are actions that can be detected by JavaScript.

Every element on a web page has certain events which can trigger a JavaScript. For example, we can use the onClick event of a button element to indicate that a function will run when a user clicks on the button. We define the events in the HTML tags.

Examples of events:

  • A mouse click
  • A web page or an image loading
  • Mousing over a hot spot on the web page
  • Selecting an input field in an HTML form
  • Submitting an HTML form
  • A keystroke

Note: Events are normally used in combination with functions, and the function will not be executed before the event occurs!

I will give you some example scripts for reading out event properties. There are very serious browser incompatibilities in this area.

As soon as we want to read out information about the event, we’re inundated by an immense amount of properties, most of which do not work in most browsers. See the Event compatibility tables for a quick overview or the W3C DOM Compatibility – Events page for a complete overview.

I am not going to give an alphabetical list of properties, since it wouldn’t help a bit to make you understand all this — the situation is too confusing. Instead I’ve written five scripts to ask five questions of the browser.

  1. What is the type of the event?
  2. Which HTML element is the target of the event?
  3. Which key was pressed during the event?
  4. Which mouse button was pressed during the event?
  5. What was the mouse position during the event?

Please note that in these scripts I’ve been very strict in my object detection. I first create cross-browser event access, then I check if the browser supports each individual property before using it.

What is the type of the event?

This is the only question with a true cross-browser answer: use the typeproperty to read out the type:

function doSomething(e) {
	if (!e) var e = window.event;

Which HTML element is the target of the event?

W3C/Netscape says: the target. No, says Microsoft, the srcElement. Both properties return the HTML element the event took place on.

function doSomething(e) {
	var targ;
	if (!e) var e = window.event;
	if ( targ =;
	else if (e.srcElement) targ = e.srcElement;
	if (targ.nodeType == 3) // defeat Safari bug
		targ = targ.parentNode;

The last two lines of code are especially for Safari. If an event takes place on an element that contains text, this text node, and not the element, becomes the target of the event. Therefore we check if the target’snodeType is 3, a text node. If it is we move to its parent node, the HTML element.

Even if an event is captured or bubbles up, the target/srcElement always remains the element the event took place on.

Other targets

There are some more targeting properties. I discuss currentTarget on the Event order page and relatedTargetfromElement and toElement on the Mouse events page.

Which key has been pressed?

This one is relatively easy. First get the code of the key (a = 65) from thekeyCode property.

When you’ve read out the key code, send it through the methodString.fromCharCode() to obtain the actual key value, if necessary.

function doSomething(e) {
	var code;
	if (!e) var e = window.event;
	if (e.keyCode) code = e.keyCode;
	else if (e.which) code = e.which;
	var character = String.fromCharCode(code);
	alert('Character was ' + character);

There are some subtleties that may make the key events hard to use. For instance, the keypress event fires as long as the user keeps the key pressed. However, in most browsers the keydown event also keeps firing as long as the key is pressed. I’m not sure this is a good idea, but it’s what happens.

Which mouse button has been clicked?

There are two properties for finding out which mouse button has been clicked: which and button. Please note that these properties don’t always work on a click event. To safely detect a mouse button you have to use the mousedown or mouseup events.

which is an old Netscape property. Left button gives a value of 1, middle button (mouse wheel) gives 2, right button gives 3. No problems, except its meager support (and the fact that it’s also used for key detection).

Now button has been fouled up beyond all recognition. According to W3C its values should be:

  • Left button – 0
  • Middle button – 1
  • Right button – 2

According to Microsoft its values should be:

  • Left button – 1
  • Middle button – 4
  • Right button – 2

No doubt the Microsoft model is better than W3C’s. 0 should mean “no button pressed”, anything else is illogical.

Besides, only in the Microsoft model button values can be combined, so that 5 would mean “left and middle button”. Not even Explorer 6 actually supports this yet, but in the W3C model such a combination istheoretically impossible: you can never know whether the left button was also clicked.

In my opinion W3C has made some serious mistakes in defining button.

Right click

Fortunately you most often want to know if the right button has been clicked. Since W3C and Microsoft happen to agree on this one and givebutton a value of 2, you can still detect a right click.

function doSomething(e) {
	var rightclick;
	if (!e) var e = window.event;
	if (e.which) rightclick = (e.which == 3);
	else if (e.button) rightclick = (e.button == 2);
	alert('Rightclick: ' + rightclick); // true or false

Please note that, although Macs have only one mouse button, Mozilla gives a Ctrl–Click a button value of 2, since Ctrl–Click also brings up the context menu. iCab doesn’t yet support mouse button properties at all and you cannot yet detect a right–click in Opera.

Mouse position

As to the mouse position, the situation is horrible. Although there are no less than six mouse coordinates property pairs, there is no reliable cross–browser way to find the mouse coordinates relative to the document we need.

These are the six property pairs — see also the Event compatibility tables or the W3C DOM Compatibility – Events page.

  1. clientX,clientY
  2. layerX,layerY
  3. offsetX,offsetY
  4. pageX,pageY
  5. screenX,screenY
  6. x,y

I explained the problem, W3C’s vagueness and the use of pageX/Y andclientX/Y in my slightly outdated Evolt article.

The screenX and screenY properties are the only ones that are completely cross–browser compatible. They give the mouse position relative to the entire computer screen of the user. Unfortunately this information is completely useless: you never need to know the mouse position relative to the screen — well, maybe only if you want to place another window at the mouse position.

The other three property pairs are unimportant. See the W3C DOM Compatibility – Events page for a description.

Correct script

This is the correct script for detecting the mouse coordinates:

function doSomething(e) {
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	// posx and posy contain the mouse position relative to the document
	// Do something with this information

happy development 🙂 have nice time …

free counters

Android Application Development Tutorial :: Part 2 (Setting up your system)

Posted on Updated on

Hello All …
hope everything is good at your end ..
Here is a 2nd part of my tutorial on Android Application Development. The first part was just an introduction to this series. Today you will learn how to setup your system to start android application development.

Android applications, like most mobile phone applications, are developed in a host-target development environment. In other words, youdevelop your application on a host computer (where resources are abundant), and download it to a target mobile phone for testing and ultimate use.

To write your own Android mobile phone applications, you’ll first need to collect the required tools and set up an appropriate development environment on your PC or Mac. Linux, Windows, and Macintosh are all supported development environments, and i’ll tell you how to install the latest set of tools on each. Then i’ll show you any configuration you need to do after the tools are installed (setting PATH environment variables and the like), again for each of the three operating systems. And finally i’ll write a short little “Hello, Android” application that demonstrates what needs to be done to get a generic application running. Probably it will be in next part.

The Android SDK supports several different development environments. For this tutorial i will focus on using Eclipse, because it is the best integrated with the SDK, and, hey, it’s free. No matter which operating system you are using, you will need essentially the same set of tools:

  • The Eclipse Integrated Development Environment
  • Sun’s Java Development Kit (JDK)
  • The Android Software Developer’s Kit (SDK)
  • A special Eclipse plug in: the Android Developer Tool (ADT)

Since you’re probably going to develop on only one of these operating systems, skip to the appropriate section that pertains to your selected operating system.

Creating an Android Development Environment
The Android Software Development Kit supports Windows (XP and Vista), Linux (Ubuntu Dapper Drake), and Mac OS X (10.4.8 or later) as host development environments. Installation of the SDK is substantially the same for any of the operating systems, and most of this description applies equally to all of them. Where the procedure differs, i will clearly tell you what to do for each environment.

1. Install Eclipse: The Android SDK requires Eclipse version 3.2 or 3.3 (also known as Europa) or later. If you do not have that version of Eclipse installed yet, you will need to go to eclipse download page to get it, and you might as well get version 3.3 since that package includes the required plugins mentioned in the next step. You want the version of the Eclipse IDE labeled “Eclipse IDE for Java Developers,” and obviously you want the version for your operating system. Eclipse will ask you to select a mirror site, and will then start the download.

Windows (XP or Vista)
The Eclipse download comes as a big ZIP file that you install by extracting the files to your favorite directory. I assume that you extracted to C:/eclipse. Eclipse is now installed, but it will not show up in your Start menu of applications. You may want to create a Windows shortcut for C:/eclipse/eclipse.exe and place it on your desktop, in your Start menu, or someplace else where you can easily find it.
Linux and Mac OS X
The Eclipse download comes as a big tarball (.gz file) that you install by extracting the files to your favorite directory. For now, i ‘ll assume that you extracted to /usr/lib/eclipse.

2. Check for Required Plugins: You can skip this step if you just downloaded a current version of Eclipse as we recommended. If you are using a pre-installed version of Eclipse that was already on your PC, you need to make sure you have the Java Development Tool (JDT) and Web Standard Tools (WST) plug-ins installed. You can easily check to see whether they are installed by starting Eclipse and selecting menu options “WIndows -> Preferences…” The list of preferences should include one for “Java” and one for “Web and XML.” If they aren’t on the list, the easiest thing to do is reinstall Eclipse, as described in the previous step. Installing “Eclipse IDE for Java Developers” will automatically get the needed plugins.

3. Install JDK: The Android SDK requires JDK version 5 or version 6. If you already have one of those installed, skip to the next step. In particular, Mac OS X comes with the JDK version 5 already installed, and many Linux distributions include a JDK. If the JDK is not installed, go to javaSE download page and you’ll see a list of Java products to download. The one you want is JDK 6 Update n for your operating system, where n is 6 at the time this is written.

Windows (XP and Vista)
Select the distribution for “Windows Offline Installation, Multi-language.”
Read, review, and accept Sun’s license for the JDK. (The license has become very permissive, but if you have a problem with it, alternative free JDKs exist.)
Once the download is complete, a dialog box will ask you whether you want to run the downloaded executable. When you select “Run,” the Windows Installer will start up and lead you through a dialog to install the JDK on your PC.

Select the distribution for “Linux self-extracting file.”
Read, review, and accept Sun’s license for the JDK. (The license has become very permissive, but if you have a problem with it, alternative free JDKs exist.)

You will need to download the self-extracting binary to the place you want to install the JDK on your filesystem. If that place is a system wide directory (such as /usr/local), you will need root access. After the file is downloaded, make it executable (chmod +x jdk-6version-linux-i586.bin) , and execute it. It will self-extract to create a tree of directories.
Mac OS X
Mac OS X comes with JDK Version 5 already loaded.

4. Install Android SDK: This is where you’d start if you already have the right versions of Eclipse and the JDK loaded. The Android SDK is distributed through Google’s code site . You will need to read, review and accept the terms of the license to proceed. When you get to the list of downloads, you will see a table of distributions. Select the one for your operating system (XP and Vista use the same distribution). The package (file) names include the release number.

The file you download is another archive file, as with Eclipse: a ZIP file on Windows, a tar-zipped file for Linux and MacOS X. Do the same thing as for Eclipse: extract the archive file to a directory where you want to install Android, and make a note of the directory name (you’ll need it in Step 7). The extraction will create a directory tree containing a bunch of sub-directories, including one called tools.

5. Update Environment Variables: To make it easier to launch the Android tools, add the tools directory to your path.

Under Windows XP, click on Start, then right-click on My Computer. In the pop-up menu, click on Properties. In the resulting System Properties dialog box, select the Advanced tab. Near the bottom of the Advanced tab is a button, “Environment Variables,” that takes you to an Environment Variables dialog. User environment variables are listed in the top half of the box, System environment variables in the bottom half. Scroll down the list of System environment variables until you find “Path,” select it, and click the “Edit” button. Now you will be in an Edit System Variable dialog that allows you to change the environment variable “Path.” Add the full path of the tools directory to the end of the existing Path variable and click “OK.” You should now see the new version of the variable in the displayed list. Click “OK” and then “OK” again to exit the dialog boxes.

On Windows Vista, click on the Microsoft “flag” in the lower left of the desktop, then right-click on Computer. At the top of the resulting display, just below the menu bar, click on “System Properties.” In the column on the left of the resulting box, click on “Advanced system settings.” Vista will warn you with a dialog box that says “Windows needs your permission to continue”;- click “Continue.” Near the bottom of the “System Properties” is a button labeled “Environment Variables” that takes you to an Environment Variables dialog. User environment variables are listed in the top half of the box, System environment variables in the bottom half. Scroll down the list of System environment variables until you find “Path,” select it, and click the “Edit” button. Now you will be in an Edit System Variable dialog that allows you to change the environment variable “Path”. Add the full path of the tools directory to the end of the existing Path variable, and click “OK.” You should now see the new version of the variable in the displayed list. Click “OK” and then “OK” again to exit the dialog boxes.

On Linux, the PATH environment variable can be defined in your ~/.bashrc ~/.bash_profile file. If you have either of those files, use a text editor such as gedit, vi, or Emacs to open the file and look for a line that exports the PATH variable. If you find such a line, edit it to add the full path of the tools directory to the path. If there is no such line, you can add a line like this:

export PATH=${PATH}:your_sdk_dir/tools

where you put the full path in place of


On MacOS X, look for a file named .bash_profile in your home directory (note the initial dot in the filename). If there is one, use an editor to open the file and look for a line that exports the PATH variable. If you find such a line, edit it to add the full path of the tools directory to the path. If there is no such line, you can add a line like this:

export PATH=${PATH}:your_sdk_dir/tools

where you put the full path in place of


6. Install the Android Plugin (ADT): Throughout this series, i will make use of the Android Development Tool plugin that Google supplies for use in building Android applications. The plugin is installed in much the same way as any other Eclipse plugin:

Start Eclipse, if it’s not already running.

From the menu bar, select “Help -> Software Updates -> Find and Install…”

  • In the Install/Update dialog, select “Search for new features to install” and click on “Next.”
  • In the Install dialog, click on “New Remote Site.” A “New Update Site” dialog pops up. Enter a name for the plugin (“Android Plugin” will do), and the URL for updates: Click “OK.”
  • The new site should now appear in the list of sites on the Install dialog. Click “Finish.”
  • In the Search Results dialog, select the checkbox for “Android Plugin -> Developer Tools” and click “Next.”
  • The license agreement for the plugin appears. Read it, and if you agree, select “Accept terms of the license agreement” and click “Next.” Click “Finish.”
  • You will get a warning that the plugin is not signed. Choose to install it anyway by clicking “Install All.”
  • Restart Eclipse.
  • After Eclipse restarts, you need to tell it where the SDK is located. From the menu bar, select “Window -> Preferences.” In the Preferences dialog, select “Android” in the left hand column.
  • Use the “Browse” button to navigate to the place you installed the Android SDK, and click on “Apply,” then on “OK.”

Congratulations–you have installed a complete Android development environment without spending a penny. As you’ll see in this and subsequent chapters, the environment includes a very sophisticated set of tools to make Android programming easier, including:

An Integrated Development Environment based on Eclipse, arguably the premier IDE for Java development. Eclipse itself brings many valuable development features. Google and OHA have taken advantage of Eclipse’s extensibility to provide features customized for Android, including debugging capabilities that are tuned to the needs of mobile application developers like you.

A Java development environment and Dalvik virtual machine that build on Sun’s JDK foundation to provide a very sophisticated programming environment for your applications.

A complete mobile phone emulator that allows you to test your applications without having to download them to a target mobile phone. The emulator includes features for testing your application under different mobile phone communication conditions (fading, dropped connections, etc.).

Test tools, such as TraceView, which allow you to tune your application to take best advantage of the limited resources available on a mobile phone.

feel free to comment and give suggestion … if i missed anything kindly let me know ..

happy development 🙂
free counters

New Features in C# 4.0

Posted on Updated on

Visual Studio 2010 is packed with new and enhanced features that simplify the entire development process from design to deployment. Customize your workspace with multiple monitor support. Create rich applications for SharePoint and the Web. Target multiple versions of the .NET Framework with the same tool. Eliminate the dreaded “no repro” problem with IntelliTrace. And much more.

Visual Studio 2010 is here!And of course this means that C# 4.0 is also here. Let’s do a quick review of the new language features added in this release.


The dynamic keyword is a key feature of this release. It closes the gap between dynamic and statically-typed languages. Now you can create dynamic objects and let their types be determined at run time. With the addition of the System.Dynamicnamespace, you can create expandable objects and advanced class wrappers, and you can provide interoperability between different languages, including dynamic ones. Here is one quick example:

dynamic contact = new ExpandoObject();

contact.Name = “Patrick Hines”;

contact.Phone = “206-555-0144”;

Covariance and Contravariance

Variance on generic type parameters in interfaces and delegates is another important feature of this release. It doesn’t add much new functionality, but rather makes things work as you expected them to in the first place. The major advantage is hidden in this simple line, which didn’t compile until C# 4.0:

IEnumerable<Object> objects = new List<String>();
The ability to implicitly convert references for objects instantiated with different type arguments makes it much easier to reuse code. Read the Covariance and Contravariance FAQ to learn more about this feature.

Optional (or Default) Parameters

People have been asking for this feature since C# 1.0. Three versions later, it’s finally here.

Now you can assign a default value to a parameter right within the method declaration. The user of the method can either pass a value or simply skip the argument. In the latter case, the default value is passed to the method.

Method declaration:

public static void SomeMethod(int optional = 0) { }

Method calls:
SomeMethod(); // 0 is used in the method.


Named Arguments

The order of parameters in a method declaration and the order of arguments you pass when calling the method don’t need to match anymore. You can provide arguments in any order you like by specifying parameter names in a method call. This might also improve the readability of your code.

var sample = new List<String>();

sample.InsertRange(collection: new List<String>(), index: 0);

sample.InsertRange(index: 0, collection: new List<String>());

Read more about optional parameters and named arguments on MSDN.

Improved COM Interop

The introduction of the dynamic keyword, optional parameters and named arguments enables improvement of COM interop. So, no more ugly code like this:

var excelApp = new Excel.Application();

// . . .

excelApp.get_Range(“A1”, “B4”).AutoFormat(


Type.Missing, Type.Missing, Type.Missing,

Type.Missing, Type.Missing, Type.Missing);

You can now simply write the following:

excelApp.Range[“A1”, “B3”].AutoFormat(


By the way, this code uses one more new feature: indexed properties (take a closer look at those square brackets after Range.) But this feature is available only for COM interop; you cannot create your own indexed properties in C# 4.0. For more information about new COM interop features, once again, refer to MSDN.

What Else?

Of course, C# benefits not only from new language features, but also from improvements to its integrated development environment (IDE) and to the .NET Framework.

Here are some links for further reading:

Happy coding
free counters