Tuesday, January 21, 2014


HTML Enhanced Applications Using Angular JavaScript:

This article contains the matter about why to use ANGULAR-JAVA SCRIPT in your application in place of other frameworks.  It contains features and the unique qualities of ANGULAR JAVA SCRIPT through which you can easily make a better application.


You can take basic details from my last article about ANGULAR JAVA SCRIPT, 

We know that HTML is great for declaring static documents, but it does not do well for declaring dynamic views in web applications. Angular JavaScript allows you to extend HTML tags, features and vocabulary for your….

http://www.c-sharpcorner.com/UploadFile/2072a9/angular-javascript1/

ADD SOME CONTROL:



 



Data Binding:
Data binding is an automatic way of performing operations of DBMS, generally updating. Whenever
the model changes it performs some set of operations to modify applications.
In short it changes with the change in view of application. this is also awesome because it directly eliminates the DOM manipulation from the list of things you have to threaten about.

Controller:
CONTROLLERS in ANGULAR JAVA SCRIPT are the behavior behind the DOM elements. ANGULAR JAVA SCRIPT allows you to express the behavior in a clean readable, understandable and flexible form without the usual boilerplate of updating DOM, registering callbacks or watching model changes.

Plain JavaScript:
Unlike other frameworks, there is no need to inherit from proprietary types in order to wrap the model in accesses methods.
ANGULAR JAVA SCRIPT models are plain old JavaScript objects. This provides  your application code these wonderful features-

- Flexibility
- Robustness
- Testable
- Maintainable
- Reusable
- Free from Boilerplate
In dependency



Drawing A Back end:





Deep Linking:

 A deep link effects where the user is in the application, this is useful so users can bookmark and email links to locations within apps. Round trip applications get this feature automatically through code.
 But in case of AJAX (Asynchronous JavaScript & XML) applications this feature is unavailable. ANGULAR JAVASCRIPT joins the benefits and functionalities of deep link with desktop application like behavior.

Form Validation:

 Form validation is most useful thing in current scenario. It is used in each and every type of applications, website etc. where we do use form functionality. It provides these features-


 - Authentication

 - Authorization

 - integrity





Validation can be at both client and server side but Client side form validation Is an important part of great user experience. ANGULAR JAVASCRIPT allows you to declare the validation rules of the form without having to write a long JAVASCRIPT code.

Server Communication: 

ANGULAR JAVASCRIPT provides built in services on top of the XHR as well as various other back ends using third party libraries. It confirms simplifying your code by handling asynchronous return of data. 

.
.
.
.

__________________________________________________________
for more knowledge about this and other geeky stuff, please visit:

http://www.c-sharpcorner.com/UploadFile/2072a9/html-enhanced-applications-using-angular-javascript/
__________________________________________________________

Monday, January 20, 2014

Introduction to JSON


This article is about the basics of JavaScript Object Notation (JSON). The following describes JSON:
  • light weight text data interchange format
  • language independent
  • easy to understand
  • self describing
Description

JSON is nothing but a lightweight text data interchange format, that is widely used for describing data. It is easily converted to most programming languages for use in many APIs such as:
  • Flicker
  • Twitter
  • Instagram
  • Photobucket
  • Google Geocoder
  • Tumblr
  • Yahoo Travel
  • Yahoo Answers
  • Yelp
And so on, now offers their result in this format.

It’s a way of annotating data that’s relatively easy for programmers to perform operations like read and write. This helps explain the current context of the use of JSON. It works similarly to Asynchronous JavaScript and XML (AJAX), that generally depends upon the concepts of JavaScript.

Programmers have searched for an easy way to transfer data. Converting JSON to something usable in JavaScript takes one line of code and automatically works in all types of web browsers. 

JSON Objects
Creation of objects in JSON is done between a pair of curly brackets. Objects in JSON can have multiple values in this scenario too.

Example

Single pair value in JSON

firstname”:“abhishek , “lastname”:”jaiswal”},

Multiple pair value in JSON

firstname”:“abhishek , “lastname”:”jaiswal”},
firstname”:“ashish” , “lastname”:”verma”},
firstname”:“gopi” , “lastname”:”chand”},
firstname”:“hari” , “lastname”:”prakash”},
firstname”:“prashant” , “lastname”:”kumar”},
firstname”:“pratiyush” , “lastname”:”anand”},

JSON Array

Just as in other programming languages JSON also uses square [] brackets for representing an array.

Moreover an array can have multiple objects.

Example
{“student:[firstname”:“abhishek , “lastname”:”jaiswal”},
firstname”:“ashish” , “lastname”:”verma”},
firstname”:“gopi” , “lastname”:”chand”},
firstname”:“hari” , “lastname”:”prakash”},
firstname”:“prashant” , “lastname”:”kumar”},
firstname”:“pratiyush” , “lastname”:”anand”},


The preceding example shows basic structure if the JSON.

Why JSON?

There are several technologies like JSON, one of the most famous and used among those languages is XML. But there are several differences that create hurdles between JSON and XML. These hurdles provide these functionalities to JSON, that are not present in XML. Some of these features of JSON are as follows:
  • There are no ending Tags in JSON.
  • No reverse word concept in JSON
  • JSON uses functionality of ARRAYS
  • Ease of read and write operations
  • Easily works with JavaScript
  • can be used in enhancing functionalities of AJAX
  • is shorter
  • can be parsed using JavaScript
JSON vs XML
  • Referenced Example
  • <html>  
  • <head>  
  •     <title>Record</title>  
  • </head>  
  • <body>  
  •     <h1>Basics of JSON </h1>  
  •     <p>  
  •         Name <span id="”jName”"></span>  
  •         <br />  
  •         Roll_No <span id="”jRoll_No”"></span>  
  •         <br />  
  •         ID <span id="”jID”"></span>  
  •         <br />  
  •         DOB <span id="”jDOB”"></span>  
  •         <br />  
  •     </p>  
  •     <script>  
  •         var JSONobject= {  
  •             “Name” : “abhishek”,  
  •             “Roll_No” : 123,  
  •             “ID” : “CSE”,  
  •             “DOB” : “JAN 01”,  
  •             );  
  •         document.getElementById  
  •         (“jName)inner.HTML=JSONobject.Name  
  •   
  •         document.getElementById  
  •         (“jRoll_No”)inner.HTML=JSONobject. jRoll_No  
  •   
  •         document.getElementById  
  •         (“jID)inner.HTML=JSONobject.ID  
  •   
  •         document.getElementById  
  •         (“jDOB)inner.HTML=JSONobject.DOB  
  •     </script>  
  • </body>  
  • </html


  • Output


Sunday, January 12, 2014

C# | DELEGATES

We all learned how to implement REFERENCE TYPEs using languages constructs like
 
  • ·         CLASSES
  • ·         REFERENCES

These references types allow programmers to create instances of objects and use them in special ways to accomplish development procedure aims.
Classes allows us to create object that contained members with attribute or the functionality. While on other hand interface allows us to declare a set of attributes and behavior that all objects implementing them can expose them publicly or privately.
Now am introducing a new reference type DELEGATE.


A delegate is a C# language element that allows programmers to reference a method for their development work. Generally C or C++ programmers are much more familiar with the concept of delegate in comparison to other.

C# DELEGATE | Features

  •      Maximum Flexibility
  •      Several built in functionalities at runtime
  •    Manipulation of variables



C# DELEGATE | Description

Delegates provide flexibility and scalability, so that is can be used according to the requirement or goal of your development procedure. There is less boundation limits of delegates. Interfaces also can be used in place of delegates but due to some extra functionality programmers do prefer delegate in place of other reference methods.


C# DELEGATE | Declaration

Declaration of delegates is somewhat similar like methods. Except that delegate have an extra feature of delegate modifier. Delegate modifier are terminated through semi colon(;) and requires no implementation

Ex:
public delegate int Comparer(object obj1, object obj2)


C# DELEGATE | Delegate Handler

Delegate handler methods works as follows:

Public static int CompareFirstNames(object name1, object name2);
{
……
}


Reference Example:

using System;
public delegate int Comparer(object obj1, object obj2);
public class Name
{
    public string FirstName = null;
    public string LastName = null;

    public Name(string first, string last)
    {
        FirstName = first;
        LastName = last;

    }
    public static int CompareFirstNames(object name1, object name2)
    {
        string n1 = ((Name)name1).FirstName;
        string n2 = ((Name)name2).FirstName;

        if (String.Compare(n1, n2) > 0)

        {
            return 1;
        }
        else if (String.Compare(n1, n2) < 0)
        {
            return -1;
        }
        else
        {
            return 0;
        }
    }
    public override string ToString()
    {
        return FirstName + " " + LastName;
    }
}
class SimpleDelegate
{
    Name[] names = new Name[6];
    public SimpleDelegate()
    {
        names[0] = new Name("abhishek", "jaiswal");
        names[1] = new Name("ashish", "verma");
        names[2] = new Name("gopi", "chand");
        names[3] = new Name("hari", "prakash");
        names[4] = new Name("prashant", "kumar");
        names[5] = new Name("pratiyush", "anand");

    }
    static void Main(string[] args)
    {
        SimpleDelegate sd = new SimpleDelegate();
        Comparer cmp = new Comparer(Name.CompareFirstNames);
        Console.WriteLine("\nBefore Sorting: \n");
        sd.PrintNames();
        sd.Sort(cmp);
        Console.WriteLine("\nAfter Sorting: \n");
     sd.PrintNames();
    }
 
    public void Sort(Comparer compare)

    {
        object temp;
     for (int i=0; i < names.Length; i++)
        {
            for (int j=i; j < names.Length; j++)
            {
             
                if ( compare(names[i], names[j]) > 0 )
                {
                    temp = names[i];
                    names[i] = names[j];
                    names[j] = (Name)temp;
                }
            }

        }
    }

    public void PrintNames()
    {
      Console.WriteLine("Names: \n");
        foreach (Name name in names)
        {
            Console.WriteLine(name.ToString());
        }
    }

}
Creation of Search BOX in C#.NET


There are certain logics of creating search boxes in DOTNET framework. Some programmers go with custom search box while other goes with google’s default search box. Both of the methods work efficiently and produce correct result.
But here is a different technique of creating search box in DOTNET framework, using C#.net. these techniques are
  • Custom Search Box
  • Google's Default Search Box
  • Through KEYWORD matching

Code:



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Configuration;
using System.Data;
using System.Data.SqlClient;


public partial class Search : System.Web.UI.Page
{

    SqlConnection con;
    SqlDataAdapter adap;

  protected void Page_Load(object sender, EventArgs e)
    {

        if (Session["login"] == null)
        {
            Response.Redirect("LoginMessage.aspx");
        }


    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            con = new SqlConnection(ConfigurationManager.ConnectionString[""].ConnectionString);

            con.open();

            string cmdst = "select UserName, UserMobile, UserEMail from UserRegistration where UserName='"+ TextBox1.Text.Trim() +"'";

            adap = new SqlDataAdapter(cmdst, con);

            DataSet ds = new DataSet();

            adap.Fill(ds);

            GridView1.DataSource = ds.Tables[0];
            GridView1.DataBind();



        }
        catch (Exception pp)
        {

        }
    }
}

Example: