29 October 2011

Getting started with android development - installation in windows platform

Hi,
For getting started with android development,
  • First you need is JDK
  • Next is Eclipse
  • To Make programming and debugging easy, android provides and Eclipse plugin called ADT or Android development tools.
    • Install ADT 
      • Start Eclipse, then select Help > Install New Software....
      • Click Add, in the top-right corner.
      • In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the following URL for the Location:  
        https://dl-ssl.google.com/android/eclipse/
      • Click OK
      • In the Available Software dialog, select the checkbox next to Developer Tools and click Next.
      • In the next window, you'll see a list of the tools to be downloaded. Click Next.
      • Read and accept the license agreements, then click Finish.
      • When the installation completes, restart Eclipse.
    • Configure ADT
      • Download Android SDK and extract it.
      • Start Eclipse.
      • Select Window > Preferences
      • Select Android from the left panel.
      • For the SDK Location in the main panel, click Browse... and locate your downloaded SDK directory.
      • Click Apply, then OK.
      • Add Platforms and other components 
        • select Window > Android SDK and AVD Manager
          OR
          Double-click the SDK Manager.exe file at the root of the Android SDK directory.
        • Select the components you required and say Install.
          ( SDK Tool, SDK Platform tools and SDK Platform are the basic ones.)
Here we done with it, now you can start with the development,
Hope you enjoyed, Click on +1 and don't forget to put some comments.

26 October 2011

Nullable value types

Some times, we came to a situation where we need to put null value into a Integer variable, or into any other value types( We can take an example of database operations, it may possible that even Bool(bit) column in table contains null value.)

In such situation Nullable types comes into picture.

What exactly Nullable types are:

  • Its an instance of System.Nullable struct
  • It just represents a value type which even can be assigned to a null value.

Example:
public class NullableTypesTest
{
    static void Main()
    {
        Nullable<int> IntPriNumber=null;
        if (IntPriNumber.HasValue == true)
        {
            System.Console.WriteLine("Varibale has value and its "+IntPriNumber.Value);
        }
        else
        {
            System.Console.WriteLine("Varibale dont have a value");
        }
}

Some points about Nullable types:

  • We cannot create Nullable types based on reference types.
  • Nullable types have some important 
    • properties like 
      • HasValue - returns true/false indicating variable contains value or not.
      • Value - return the value it contains.
    • methods like
      • GetValueOrDefault() - return default value in case of variable contains null value,
        Example
         
        
             Nullable<int> x=55;
             
             //Print 55
             System.Console.WriteLine(x.GetValueOrDefault());
             
             Nullable<int> y=null;
             
             //Print 0
             System.Console.WriteLine(y.GetValueOrDefault());
        
  • Alternative way of defining nullable types is
    T? variable=some value
    where T is a value type.
    Example
    int? temp=55

02 October 2011

Validation Controls

Validation is the key feture in any application dvelopement.
And when it comes to asp.net validation, there are 2 types of validations
  •   Client Side 
    •  In this type of validation, validation is been performed in client side with the help of some client side scripts like Javascript. 
    •  The Bad thing about the Client side validation is you were never quite sure if the requesting browser would understand the scripting code(usually in java script or vb script) that you used for the validation. So, it was usually better, especially for critical Web applications, to bring the validation to the server. 
  • Server Side
    • Here server side scripts are been used. 
    •  The bad thing about server-side validation is that it requires trips back and forth to the server. This takes a lot of resources and makes for a slower-paced form for the user.


Asp.net Validation Server Controls
  • These are the controls provided by Microsoft which provides both client and server side validation and thus used for validating user input. 
  • If we are using such controls for validation, then its not we who decide whether to perform client side or server side validation, its Asp.net engine(depending on the browser which made the request),which indicates your page's functionality varies depending on the requesting browser. 
  •  Here is a list of the validation controls 
    • RequiredFieldValidator 
      The RequiredFieldValidator control is used to ensures that a input field is not skipped in the entry. The control fails validation if the value it contains does not change from its initial value when validation is performed. If all the fields in the page are valid, the page is valid.
    • RegularExpressionValidator
      The RegularExpressionValidator control confirms that the entry matches a pattern(let say \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)* which is for email address) defined by a regular expression.
    • RangeValidator
      The RangeValidator control tests whether an input value falls within a given range.
    • CompareValidator
      The CompareValidator control compares the value of one control to another, or to an explicit value in the control's ValueToCompare property,Even we can use this for Datatype Validation(like we have to enusre that user can eneter only integer values).
    • CustomValidator
      The customvalidator control allows writing custom validation for a control. So, if the others validators are not useful for a specific validation, it is possible to write server side validation function or a client side validation function.
    • ValidationSummary
      A ValidationSummary control is displayed when Page validation fails. It "polls" each of the validation controls on the page and aggregates the text messages exposed by each.
Reference links

Hope it helped,will post in detail,how to use this controls in future posts.
Thanks,Happy programming, awaiting for comments

01 October 2011

Between operator in Sql



Scenario: Consider you have a Table Say Student with Column say Age.
Student--
Age
-----
1
2
3
3
4
5
6
5

Question: What will be the result of the following query? With reason
(Use of query analyzer is not permitted,just think and answer)

Declare @Number1 int=4
Declare @Number2 int=2
SELECT * FROM Student
      WHERE Age BETWEEN  @Number1 and @Number2



Things are upgraded

My Dear readers, I am really thankful for being supportive all these years. This site was the first blog site I ever created in my life...