Tuesday, 28 June 2011

Form Validation with JavaScript

This tutorial will show you how to create a JavaScript-enabled form that checks whether a user has filled in the form correctly before it's sent to the server. This is called form validation. First we'll explain why form validation is a useful thing, and then build up a simple example form, explaining things as we go along. At the end, there's a little exercise to keep you busy too!What is form validation?Form validation is the process of checking that a form has been filled in correctly before it is processed. For example, if your form has a box for the user to type their email address, you might want your form handler to check that they've filled in their address before you deal with the rest of the form.There are two main methods for validating forms: server-side (using CGI scripts, ASP, etc), and client-side (usually done using JavaScript). Server-side validation is more secure but often more tricky to code, whereas client-side (JavaScript) validation is easier to do and quicker too (the browser doesn't have to connect to the server to validate the form, so the user finds out instantly if they've missed out that required field!).Client-side validationClient-side form validation (usually with JavaScript embedded in the Web page)Server-side validationServer-side form validation (usually performed by a CGI or ASP script)In this tutorial we'll build a simple form with client-side JavaScript validation. You can then adapt this form to your own requirements.A simple form with validationLet's build a simple form with a validation script. The form will include one text field called "Your Name", and a submit button. Our validation script will ensure that the user enters their name before the form is sent to the server.Open this page to see it in action. Try pressing the Send Details button without filling anything in the "Your Name" field.You might like to open the source code for this form in a separate window, so that you can refer to it throughout the tutorial.You can see that the page consists of a JavaScript function called validate_form() that performs the form validation, followed by the form itself. Let's look at the form first.The formThe first part of the form is the form tag:
The form is given a name of "contact_form". This is so that we can reference the form by name from our JavaScript validation function.The form uses the post method to send the data off to a dummy CGI script on ELATED.com's server that thanks the user. In reality, you would of course send the data to your own CGI script, ASP page, etc. (e.g. a form mailer).Finally, the form tag includes an onsubmit attribute to call our JavaScript validation function, validate_form(), when the "Send Details" button is pressed. The return allows us to return the value true or false from our function to the browser, where true means "carry on and send the form to the server", and false means "don't send the form". This means that we can prevent the form from being sent if the user hasn't filled it in properly.The rest of the form prompts the user to enter their name into a form field called contact_name, and adds a "Send Details" submit button:

Please Enter Your Name

Your Name:

Now let's take a look at the JavaScript form validation function that does the actual work of checking our form.The validate_form() functionThe form validation function, validate_form(), is embedded in the head element near the top of the page:The first line (That's all there is to simple JavaScript form validation! Our example is very simple as it only checks one field. Let's expand this example with a more complex function that checks lots of form fields. We'll also look at how to check other types of fields, such as checkboxes, radio buttons and drop-down lists.A more complex formLet's look at a more complex validated form with some different types of form fields.Open this page to see it in action. Try pressing the Send Details button without filling in the form and see what happens.Again, you might like to open the source code for this form in a separate window, so that you can refer to it as we talk you through.Like our previous example, this page has a form called contact_form and a function called validate_form(). In addition to the previous text field, the form has radio buttons, a drop-down list and a checkbox.The validate_form() function now has 3 extra checks, one for each of our new fields.Validating radio buttonsAfter the contact_name text box has been checked, the gender radio buttons are validated: if ( ( document.contact_form.gender[0].checked == false ) && ( document.contact_form.gender[1].checked == false ) ) { alert ( "Please choose your Gender: Male or Female" ); valid = false; }This code checks to see whether either of the radio buttons ("Male" or "Female") have been clicked. If neither have been clicked (checked == false), the user is alerted and valid is set to false.Validating drop-down listsNext the "Age" drop-down list is checked to see if the user has selected an option. In the form, we named the first option in the drop-down list "Please Select an Option". Our JavaScript can then check which option was selected when the user submitted the form. If the first option is selected, we know the user has not selected a "real" option and can alert them: if ( document.contact_form.age.selectedIndex == 0 ) { alert ( "Please select your Age." ); valid = false; }Note that the values for selectedIndex start at zero (for the first option).Validating checkboxesFinally, the "Terms and Conditions" checkbox is validated. We want to the user to agree to our imaginary Terms and Conditions before they send the form, so we'll check to make sure they've clicked the checkbox: if ( document.contact_form.terms.checked == false ) { alert ( "Please check the Terms & Conditions box." ); valid = false; }Because we set our valid variable to false in any one of the above cases, if one or more of our checks fail, the form will not be sent to the server. If the user has not completed more than one field, then they will see an alert box appear for each field that is missing.Now you know how to write a form validation script that can handle multiple form fields, including text boxes, radio buttons, drop-down lists and check boxes!One point to note about JavaScript validation is that it can always be circumvented by the user disabling JavaScript in their browser, so for secure validation you'll need to write your validating code in your server-side scripts. However, for day-to-day use JavaScript is a quick and easy way to check over your forms before they're sent to your server.An exercise: "one field at a time" validationOur example script works by validating all the form fields at once. This can be a bit confusing for the user, especially if they've missed out more than one field, as they will get lots of alert boxes appearing and they might forget which fields they need to fill in!As an exercise, try modifying the script to only prompt the user one field at a time. For example, if they miss out the "Name" and "Gender" fields and press "Send Details", it will only prompt them for the "Name" field initially. Then, after they fill in the "Name" field and press "Send Details" again, it will prompt them for the "Gender" field.As a finishing touch, try making the script move the cursor to the field that needs filling in each time (Hint: use the focus() method to do this).Good luck!

Using Camera API with only Embedded Visual C++ 4.0 (evc4): Sample code and EVC4 workspace download

Using Camera API with only Embedded Visual C++ 4.0 (evc4): Sample code and EVC4 workspace downloadIn my previous post, I talked about how to use the new Camera API in Windows Mobile 5.0 SDK with only Embedded Visual C++ 4.0 (evc4).You can download the EVC4 workspace here. The source code is written based on the MSDN documentation on SHCameraCapture, which states: Application writers should be aware that SHCameraCapture function can cause the calling application to stop responding in cases where the calling application is minimized and then reactivated while the call to SHCameraCapture function is still blocking.The sample code is written by copying the snippets in that MSDN documentation, although I do not really find such "stop responding" mischief using the "possible sequence of events". The program shows "Capture" and "Exit" in the bottom menu bar. Clicking the left soft key launches the camera capture dialog. After clicking the Action key, the program captures videos for 15 seconds then ask for a place to save the video file.Two gotchas: The MSDN documentation says the window class of camera capture dialog is "Camera View". In my Sprint PPC6700 device, the class name is actually "WCE_IA_Camera_Main" (read the source code for a comment). The camera capture dialog still shows even after the program is closed. The function "CloseCameraDialog" is used to close it before the program shuts down (read the source code for details) BTW, the tool to find out the window class is Remote CE Spy. The default Remote CE Spy shipped with VS2005 does not work well with Windows Mobile 5.0 device. Read "Remote CE Spy shipped with Visual Studio 2005 fails to intercept windows messages" for a possible solution.

InnerHTML and Select option in IE

Hello. This is my second post.

The non-DOM property innerHTML can't add options to a tag select in Internet Explorer.

Example not working:

document.getElementById("my_select").innerHTML = " ";

The correct way to insert options in a select is using appendChild or addOption functions. But that's tiring if we are working with Ajax.

Use innerHTML is not the standard but it is very useful.

The function above, will help you to insert options like using innerHTML, in IE, Firefox or Opera.

Updated: now supports option-selected

Using my function:

var inner = " ";


select_innerHTML(document.getElementById("my_select"),inner);

The function. Add to your lib.

function select_innerHTML(objeto,innerHTML){
/******
* select_innerHTML - corrige o bug do InnerHTML em selects no IE
* Veja o problema em: http://support.microsoft.com/default.aspx?scid=kb;en-us;276228
* Versão: 2.1 - 04/09/2007
* Autor: Micox - Náiron José C. Guimarães - micoxjcg@yahoo.com.br
* @objeto(tipo HTMLobject): o select a ser alterado
* @innerHTML(tipo string): o novo valor do innerHTML
*******/
objeto.innerHTML = ""
var selTemp = document.createElement("micoxselect")
var opt;
selTemp.id="micoxselect1"
document.body.appendChild(selTemp)
selTemp = document.getElementById("micoxselect1")
selTemp.style.display="none"
if(innerHTML.toLowerCase().indexOf(""
}
innerHTML = innerHTML.toLowerCase().replace(/

Monday, 27 June 2011

SQL Server Tutorials on Date Time

One of the most frequently asked question by SQL developers, is on handing Date, Time and other related datetime values in SQL Server. Developers are always looking out for solutions which demand either converting Date Time Values or finding date time ranges and so on. Madhivanan and I have already written a couple of articles on handling DateTime in SQL Server. In this post I will share some of the links with you.

Hope you find them useful. If you do, make sure you retweet and let the other devs know about this link list.

FLOOR a DateTime in SQL Server

SQL Server: Insert Date and Time in Separate Columns

SQL Server: Group By Days and Create Categories

SQL Server: Insert Date and Time in Separate Columns

SQL Server: Group By Year, Month and Day

SQL Server: First and Last Sunday of Each Month

SQL Server: First Day of Previous Month

SQL Server: Convert to DateTime from other Datatypes

Date Difference in SQL Server in Days, Hours, Minutes and Seconds

Display Dates in a Particular Format in SQL Server

Truncate Hour, Minute, Second and MilliSecond in SQL Server

Calculate Interest on an Amount Between two Dates using SQL Server

Working with Different Time Zones in SQL Server 2008

Print Dates without Day or Time in SQL Server

Calculate Age from Date Of Birth using SQL Server

Replace SQL Server DateTime records of a column with UTC time

Calculate Average Time Interval in SQL Server

List all the Weekends of the Current Year using SQL Server

Create Date Ranges for Consecutive dates in a SQL Server Table

SQL Query to find out who attended office on Saturday

Convert Date to String in SQL Server

Convert Character string ISO date to DateTime and vice-versa

Select dates within the Current Week using SQL Server

Generate a Start and End Date Range using T-SQL

Convert From EST to GMT Time and vice versa in SQL Server

Convert DateTime to VarChar in SQL Server

How to Display DateTime Formats in Different Languages using SQL Server

Finding the Business Days In a Quarter and Number them in SQL Server 2005/2008

Find the WeekEnds in this Quarter or Year using SQL Server 2005/2008

Comparing Dates In Two Columns using SQL Server\

Some Common DateTime Formats in SQL Server 2005/2008

First weekday of a month in SQL Server

DATENAME() function in SQL Server 2005

Return date without time using Sql 2005

Sunday, 26 June 2011

camera tutorial (phonegap)

Capture

Provides access to the audio, image, and video capture capabilities of the device.

Objects

Capture
CaptureAudioOptions
CaptureImageOptions
CaptureVideoOptions
CaptureCB
CaptureErrorCB
ConfigurationData
MediaFile
MediaFileData

Methods

capture.captureAudio
capture.captureImage
capture.captureVideo
MediaFile.getFormatData

Scope

The capture object is assigned to the navigator.device object, and therefore has global scope.

// The global capture object
var capture = navigator.device.capture;

Properties

supportedAudioModes: The audio recording formats supported by the device. (ConfigurationData[])
supportedImageModes: The recording image sizes and formats supported by the device. (ConfigurationData[])
supportedVideoModes: The recording video resolutions and formats supported by the device. (ConfigurationData[])

Methods

capture.captureAudio: Launch the device audio recording application for recording audio clip(s).
capture.captureImage: Launch the device camera application for taking image(s).
capture.captureVideo: Launch the device video recorder application for recording video(s).

Supported Platforms

Android
BlackBerry WebWorks (OS 5.0 and higher)

capture.captureAudio

Start the audio recorder application and return information about captured audio clip file(s).

navigator.device.capture.captureAudio(
CaptureCB captureSuccess, CaptureErrorCB captureError, [CaptureAudioOptions options]
);

Description

This method starts an asynchronous operation to capture audio recordings using the device's default audio recording application. The operation allows the device user to capture multiple recordings in a single session.

The capture operation ends when either the user exits the audio recording application, or the maximum number of recordings, specified by the limit parameter in CaptureAudioOptions, has been reached. If no value is provided for the limit parameter, a default value of one (1) is used, and the capture operation will terminate after the user records a single audio clip.

When the capture operation is finished, it will invoke the CaptureCB callback with an array of MediaFile objects describing each captured audio clip file. If the operation is terminated by the user before an audio clip is captured, the CaptureErrorCB callback will be invoked with a CaptureError object with the CaptureError.CAPTURE_NO_MEDIA_FILES error code.
Supported Platforms

Android
BlackBerry WebWorks (OS 5.0 and higher)

Quick Example

// capture callback
var captureSuccess = function(mediaFiles) {
var i, path, len;
for (i = 0, len = mediaFiles.length; i < len; i += 1) { path = mediaFiles[i].fullPath; // do something interesting with the file } }; // capture error callback var captureError = function(error) { navigator.notification.alert('Error code: ' + error.code, null, 'Capture Error'); }; // start audio capture navigator.device.capture.captureAudio(captureSuccess, captureError, {limit:2}); Full Example


Capture Audio







Saturday, 25 June 2011

Diet mixers make people drunk faster

The Scotsman News just reported that DIET mixers in alcoholic drinks get people drunk quicker than full-sugar alternatives, scientists have found.
Taking a drink with sugar-free versions of mixers, such as tonic water, cola, bitter lemon and lemonade, produces higher blood-alcohol levels.
The findings were revealed by Dr Chris Rayner, of the Royal Adelaide Hospital in Australia, at a conference in the United States. Dr Rayner, the lead author of the study, found that combining alcohol with a mixer containing artificial sweeteners resulted in significantly higher levels of blood-alcohol than the same drink taken with an ordinary mixer.
The blood-alcohol concentration peaked at 66 per cent higher, according to a study in which volunteers were given an orange-flavoured vodka drink made with either a diet or non-diet mixer.
An alcohol counselling organisation warned that people choosing to have a diet mixer should be aware of the effect.
Dr Rayner, appearing yesterday at Digestive Disease Week, a conference in Los Angeles, said:
“More and more people are choosing diet drinks as a healthier alternative.
“What people do not understand is the potential side-effects that diet-mixed alcoholic drinks may have on their body’s response to alcohol.”
Researchers studied eight volunteers, tracking the rate at which the regular and diet alcoholic drink was emptied from the stomach and their subsequent blood-alcohol levels for three hours.
It took 21 minutes for half the diet drink to leave the stomach, compared with regular drinks, which took 36 minutes.
Peak blood-alcohol concentrations were found to be “substantially greater” with diet drinks at 0.05 per cent, while regular drinks measured at 0.03 per cent.
Dr Peter Rice, a senior Dundee University psychiatry lecturer specialising in alcohol misuse, said the key advice to people was to know their own limits.
However, Dr Rice added the main factor affecting absorption of alcohol was still likely to be the amount of food in the stomach.
Paul Waterson, of the Scottish Licensed Traders Association, said it was already known that fizzy drinks increased the rate of alcohol absorption.
Click here for the full story as reported in the Scotsman


http://cgpage.com/diet-mixers-make-people-drunk-faster/

android e-book

Step 1. Preparing Your Development Computer

Before getting started with the Android SDK, take a moment to confirm that your development computer meets the System Requirements. In particular, you might need to install the JDK, if you don't have it already.

If you will be developing in Eclipse with the Android Development Tools (ADT) Plugin—the recommended path if you are new to Android—make sure that you have a suitable version of Eclipse installed on your computer as described in the System Requirements document. If you need to install Eclipse, you can download it from this location:

http://www.eclipse.org/downloads/

The "Eclipse Classic" version is recommended. Otherwise, a Java or RCP version of Eclipse is recommended.
Step 2. Downloading the SDK Starter Package

The SDK starter package is not a full development environment—it includes only the core SDK Tools, which you can use to download the rest of the SDK components (such as the latest Android platform).

If you haven't already, get the latest version of the SDK starter package from the SDK download page.

If you downloaded a .zip or .tgz package (instead of the SDK installer), unpack it to a safe location on your machine. By default, the SDK files are unpacked into a directory named android-sdk-.

If you downloaded the Windows installer (.exe file), run it now and it will check whether the proper Java SE Development Kit (JDK) is installed (installing it, if necessary), then install the SDK Tools into a default location (which you can modify).

Make a note of the name and location of the SDK directory on your system—you will need to refer to the SDK directory later, when setting up the ADT plugin and when using the SDK tools from the command line.
Step 3. Installing the ADT Plugin for Eclipse

Android offers a custom plugin for the Eclipse IDE, called Android Development Tools (ADT), that is designed to give you a powerful, integrated environment in which to build Android applications. It extends the capabilites of Eclipse to let you quickly set up new Android projects, create an application UI, debug your applications using the Android SDK tools, and even export signed (or unsigned) APKs in order to distribute your application. In general, developing in Eclipse with ADT is a highly recommended approach and is the fastest way to get started with Android.

If you'd like to use ADT for developing Android applications, install it now. Read Installing the ADT Plugin for step-by-step installation instructions, then return here to continue the last step in setting up your Android SDK.

If you prefer to work in a different IDE, you do not need to install Eclipse or ADT. Instead, you can directly use the SDK tools to build and debug your application. The Introduction to Android application development outlines the major steps that you need to complete when developing in Eclipse or other IDEs.
Step 4. Adding Platforms and Other Components

The last step in setting up your SDK is using the Android SDK and AVD Manager (a tool included in the SDK starter package) to download essential SDK components into your development environment.

The SDK uses a modular structure that separates the major parts of the SDK—Android platform versions, add-ons, tools, samples, and documentation—into a set of separately installable components. The SDK starter package, which you've already downloaded, includes only a single component: the latest version of the SDK Tools. To develop an Android application, you also need to download at least one Android platform and the associated platform tools. You can add other components and platforms as well, which is highly recommended.

If you used the Windows installer, when you complete the installation wizard, it will launch the Android SDK and AVD Manager with a default set of platforms and other components selected for you to install. Simply click Install to accept the recommended set of components and install them. You can then skip to Step 5, but we recommend you first read the section about the Available Components to better understand the components available from the Android SDK and AVD Manager.

You can launch the Android SDK and AVD Manager in one of the following ways:

From within Eclipse, select Window > Android SDK and AVD Manager.
On Windows, double-click the SDK Manager.exe file at the root of the Android SDK directory.
On Mac or Linux, open a terminal and navigate to the tools/ directory in the Android SDK, then execute:

android

Figure 1. The Android SDK and AVD Manager's Available Packages panel, which shows the SDK components that are available for you to download into your environment.
Available Components


To download components, use the graphical UI of the Android SDK and AVD Manager to browse the SDK repository and select new or updated components (see figure 1). The Android SDK and AVD Manager installs the selected components in your SDK environment. For information about which components you should download, see Recommended Components.


By default, there are two repositories of components for your SDK: Android Repository and Third party Add-ons.

The Android Repository offers these types of components:

SDK Tools — Contains tools for debugging and testing your application and other utility tools. These tools are installed with the Android SDK starter package and receive periodic updates. You can access these tools in the /tools/ directory of your SDK. To learn more about them, see SDK Tools in the developer guide.
SDK Platform-tools — Contains platform-dependent tools for developing and debugging your application. These tools support the latest features of the Android platform and are typically updated only when a new platform becomes available. You can access these tools in the /platform-tools/ directory. To learn more about them, see Platform Tools in the developer guide.
Android platforms — An SDK platform is available for every production Android platform deployable to Android-powered devices. Each SDK platform component includes a fully compliant Android library, system image, sample code, and emulator skins. To learn more about a specific platform, see the list of platforms that appears under the section "Downloadable SDK Components" on the left part of this page.
USB Driver for Windows (Windows only) — Contains driver files that you can install on your Windows computer, so that you can run and debug your applications on an actual device. You do not need the USB driver unless you plan to debug your application on an actual Android-powered device. If you develop on Mac OS X or Linux, you do not need a special driver to debug your application on an Android-powered device. See Using Hardware Devices for more information about developing on a real device.
Samples — Contains the sample code and apps available for each Android development platform. If you are just getting started with Android development, make sure to download the samples to your SDK.
Documentation — Contains a local copy of the latest multiversion documentation for the Android framework API.

The Third party Add-ons provide components that allow you to create a development environment using a specific Android external library (such as the Google Maps library) or a customized (but fully compliant) Android system image. You can add additional Add-on repositories by clicking Add Add-on Site.
Recommended Components

The SDK repository contains a range of components that you can download. Use the table below to determine which components you need, based on whether you want to set up a basic, recommended, or full development environment:
Environment SDK Component Comments
Basic SDK Tools If you've just installed the SDK starter package, then you already have the latest version of this component. The SDK Tools component is required to develop an Android application. Make sure you keep this up to date.
SDK Platform-tools This includes more tools that are required for application development. These tools are platform-dependent and typically update only when a new SDK platform is made available, in order to support new features in the platform. These tools are always backward compatible with older platforms, but you must be sure that you have the latest version of these tools when you install a new SDK platform.
SDK platform You need to download at least one platform into your environment, so that you will be able to compile your application and set up an Android Virtual Device (AVD) to run it on (in the emulator). To start with, just download the latest version of the platform. Later, if you plan to publish your application, you will want to download other platforms as well, so that you can test your application on the full range of Android platform versions that your application supports.
+
Recommended
(plus Basic) Documentation The Documentation component is useful because it lets you work offline and also look up API reference information from inside Eclipse.
Samples The Samples components give you source code that you can use to learn about Android, load as a project and run, or reuse in your own app. Note that multiple samples components are available — one for each Android platform version. When you are choosing a samples component to download, select the one whose API Level matches the API Level of the Android platform that you plan to use.
Usb Driver The Usb Driver component is needed only if you are developing on Windows and have an Android-powered device on which you want to install your application for debugging and testing. For Mac OS X and Linux platforms, no special driver is needed.
+
Full
(plus Recommended) Google APIs The Google APIs add-on gives your application access to the Maps external library, which makes it easy to display and manipulate Maps data in your application.
Additional SDK Platforms If you plan to publish your application, you will want to download additional platforms corresponding to the Android platform versions on which you want the application to run. The recommended approach is to compile your application against the lowest version you want to support, but test it against higher versions that you intend the application to run on. You can test your applications on different platforms by running in an Android Virtual Device (AVD) on the Android emulator.

Once you've installed at least the basic configuration of SDK components, you're ready to start developing Android apps. The next section describes the contents of the Android SDK to familiarize you with the components you've just installed.

For more information about using the Android SDK and AVD Manager, see the Adding SDK Components document.
Step 5. Exploring the SDK (Optional)

Once you've installed the SDK and downloaded the platforms, documentation, and add-ons that you need, we suggest that you open the SDK directory and take a look at what's inside.

The table below describes the full SDK directory contents, with components installed.
Name Description
add-ons/ Contains add-ons to the Android SDK development environment, which let you develop against external libraries that are available on some devices.
docs/ A full set of documentation in HTML format, including the Developer's Guide, API Reference, and other information. To read the documentation, load the file offline.html in a web browser.
platform-tools/ Contains platform-dependent development tools that may be updated with each platform release. The platform tools include the Android Debug Bridge (adb) as well as other tools that you don't typically use directly. These tools are separate from the development tools in the tools/ directory because these tools may be updated in order to support new features in the latest Android platform.
platforms/ Contains a set of Android platform versions that you can develop applications against, each in a separate directory.
/ Platform version directory, for example "android-11". All platform version directories contain a similar set of files and subdirectory structure. Each platform directory also includes the Android library (android.jar) that is used to compile applications against the platform version.
samples/ Sample code and apps that are specific to platform version.
tools/ Contains the set of development and profiling tools that are platform-independent, such as the emulator, the Android SDK and AVD Manager, ddms, hierarchyviewer and more. The tools in this directory may be updated at any time using the Android SDK and AVD Manager and are independent of platform releases.
SDK Readme.txt A file that explains how to perform the initial setup of your SDK, including how to launch the Android SDK and AVD Manager tool on all platforms.
SDK Manager.exe Windows SDK only. A shortcut that launches the Android SDK and AVD Manager tool, which you use to add components to your SDK.

Optionally, you might want to add the location of the SDK's tools/ and platform-tools to your PATH environment variable, to provide easy access to the tools.
How to update your PATH
Next Steps

Once you have completed installation, you are ready to begin developing applications. Here are a few ways you can get started:

Set up the Hello World application

If you have just installed the SDK for the first time, go to the Hello World tutorial. The tutorial takes you step-by-step through the process of setting up your first Android project, including setting up an Android Virtual Device (AVD) on which to run the application.

Following the Hello World tutorial is an essential first step in getting started with Android development.

Learn about Android

Take a look at the Dev Guide and the types of information it provides.
Read an introduction to Android as a platform in What is Android?
Learn about the Android framework and how applications run on it in Application Fundamentals.
Take a look at the Android framework API specification in the Reference tab.

Explore the development tools

Get an overview of the development tools that are available to you.
Read the Introduction to Android application development.
Read Using Hardware Devices to learn how to set up an Android-powered device so you can run and test your application.

Follow the Notepad tutorial

The Notepad Tutorial shows you how to build a full Android application and provides helpful commentary on the Android system and API. The Notepad tutorial helps you bring together the important design and architectural concepts in a moderately complex application.

Following the Notepad tutorial is an excellent second step in getting started with Android development.

Explore some code

The Android SDK includes sample code and applications for each platform version. You can browse the samples in the Resources tab or download them into your SDK using the Android SDK and AVD Manager. Once you've downloaded the samples, you'll find them in /samples//.

Visit the Android developer groups

Take a look at the Community pages to see a list of Android developers groups. In particular, you might want to look at the Android Developers group to get a sense for what the Android developer community is like.

Troubleshooting
Ubuntu Linux Notes

If you need help installing and configuring Java on your development machine, you might find these resources helpful:
https://help.ubuntu.com/community/Java
https://help.ubuntu.com/community/JavaInstallation
Here are the steps to install Java and Eclipse, prior to installing the Android SDK and ADT Plugin.
If you are running a 64-bit distribution on your development machine, you need to install the ia32-libs package using apt-get::

apt-get install ia32-libs

Next, install Java:

apt-get install sun-java6-jdk

The Ubuntu package manager does not currently offer an Eclipse 3.3 version for download, so we recommend that you download Eclipse from eclipse.org (http://www.eclipse.org/ downloads/). A Java or RCP version of Eclipse is recommended.
Follow the steps given in previous sections to install the SDK and the ADT plugin.

Other Linux Notes

If JDK is already installed on your development computer, please take a moment to make sure that it meets the version requirements listed in the System Requirements. In particular, note that some Linux distributions may include JDK 1.4 or Gnu Compiler for Java, both of which are not supported for Android development.

android sdk

Download the Android SDK

Welcome Developers! If you are new to the Android SDK, please read the steps below, for an overview of how to set up the SDK.

If you're already using the Android SDK, you should update to the latest tools or platform using the Android SDK and AVD Manager, rather than downloading a new SDK starter package. See Adding SDK Components.
Platform Package Size MD5 Checksum
Windows android-sdk_r11-windows.zip 32837554 bytes 0a2c52b8f8d97a4871ce8b3eb38e3072
installer_r11-windows.exe (Recommended) 32883649 bytes 3dc8a29ae5afed97b40910ef153caa2b
Mac OS X (intel) android-sdk_r11-mac_x86.zip 28844968 bytes 85bed5ed25aea51f6a447a674d637d1e
Linux (i386) android-sdk_r11-linux_x86.tgz 26984929 bytes 026c67f82627a3a70efb197ca3360d0a

Here's an overview of the steps you must follow to set up the Android SDK:

Prepare your development computer and ensure it meets the system requirements.
Install the SDK starter package from the table above. (If you're on Windows, download the installer for help with the initial setup.)
Install the ADT Plugin for Eclipse (if you'll be developing in Eclipse).
Add Android platforms and other components to your SDK.
Explore the contents of the Android SDK (optional).

To get started, download the appropriate package from the table above, then read the guide to Installing the SDK.

basic of gps

What is GPS?
Simply put, Global Positioning System or GPS, is a technology that can give your accurate position anywhere on earth (latitude/longitude). You need a special GPS receiver that can receive signals from satellites.
Does it work in India? What are the problems faced by GPS users in India?
Yes. It works anywhere on the planet where you can receive signals from the satellite. You will need a pretty clear view of the sky for GPS to work, so it won't work inside buildings, underground or even in a forest. Few years back, GPS wasn't available to it's full accuracy, but since the year 2000 it is available with full accuracy anywhere in the world and to anyone who buys a GPS receiver.
Who owns this system?
The Global Positioning System is owned and operated by United States Department of Defence. But it is available freely to anyone in the world for use. Other countries have developed similar Satellite Navigation Systems of their own. For example, European Union is developing a system called Galileo and Russia has an operational system called GLONASS. Many modern receivers are capable of using signals from all these systems.
Can civilians use GPS?
Yes it is allowed for civilian use, with no restriction. There are two kind of GPS signals,
C/A code: which is the civilian signals and given acuracy about 8-15m
P code - which is military signal and only US military can use that, which is more accurate.
There are high-end civilian receivers available, called dual-frequency receivers, which uses part of P-code, not the full signal, and gives higher accuracy than single frequency receivers.
Is there a fee for using GPS?
GPS is free for use. There is no subscription or monthly fees to pay. You need to buy a receiver that is capable of receiving the signals. But if you want to use add-on services like, differential correction for better accuracy, there may be additional fee.
Do WAAS ( Wide Area Augmentation System ) enabled GPS receivers work in India?
Unfortunately No. WAAS is a US specific system and users cannot receive WAAS signals in India. The receiver will continue to work, but without WAAS corrections.
There is a WAAS-compatible augmentation system called GAGAN being implemented by the Indian government. Once ready, WAAS receivers will work in India.
How accurate is the position given by GPS?
Accuracy varies depending on the type of GPS unit. In general, you can expect the position to be within 15m of its true position on earth. Techniques like Differential GPS (D-GPS) can give accuracy less than 3m. Advanced techniques like satellite augmentation, carrier-phase GPS are used for very accurate surveys and can be accurate within centimeters. You can find links to vendors of these high end systems in Buy GPS Equipment page.

Twitter Delicious Facebook Digg Stumbleupon Favorites More