Friday, March 28, 2014

Sql server authenticate Mode

In Sql server authenticate Mode:
1)Windows
2)Form
3)Sql server
4)Bassic

Sql server support Mode:
1)Windows
2)Mixed(Windows and Sql Server)

SQL Server supports two authentication modes, Windows authentication mode and mixed mode.
  • Windows authentication is the default, and is often referred to as integrated security because this SQL Server security model is tightly integrated with Windows. Specific Windows user and group accounts are trusted to log in to SQL Server. Windows users who have already been authenticated do not have to present additional credentials.
  • Mixed mode supports authentication both by Windows and by SQL Server. User name and password pairs are maintained within SQL Server.

We recommend using Windows authentication wherever possible. Windows authentication uses a series of encrypted messages to authenticate users in SQL Server. When SQL Server logins are used, SQL Server login names and passwords are passed across the network, which makes them less secure.

Thursday, March 27, 2014

Reverse String

Word Reverse 

Dim Name As String = "He is palying in a ground"
            Dim sb1 As New StringBuilder()
            Dim a() As String = Name.Split(" ")
            Dim sb11 As String = ""
            For Each xxx As String In a
                sb11 = xxx + " " + sb11
            Next
            Console.Write(sb11.ToString())

// By Recerse method
 Array.Reverse(a)
 Console.Write(String.Join(" ", a))



 String Reverse 

 Dim characters As Char() = Name.ToCharArray()
            Dim sb As New StringBuilder()
            For i As Integer = Name.Length - 1 To 0 Step -1
                sb.Append(characters(i))
            Next
   Console.Write(sb.ToString())



////////////////
 Dim x() As Integer = {1, 2, 4, 5, 6}
            For i As Integer = 0 To x.Length - 1
                x(i) = x(i) * 5
                Console.WriteLine(x(i))
            Next

Output:5 10 20 25 30

Fibonacci series

 Public Sub ChildClass1()
            Dim t1 As Integer = 0
            Dim t2 As Integer = 1
            Dim display As Integer = 0
            Dim num As Integer = 200
            While display < num
                Console.WriteLine(display)
                t1 = t2
                t2 = display
                display = t1 + t2
            End While

Tuesday, March 25, 2014

CRUD Command in entity framework

  //select command        
         int idToupdate = Convert.ToInt32(Request.QueryString["id"].ToString());
            db_testCon db = new db_testCon();
            tblCustomer tb = db.tblCustomers.Single(p => p.CustomerID == idToupdate);
            TextBox1.Text = tb.City;          
           
            and            
        db_testModel.db_testcon db = new db_testcon();
        Repeater1.DataSource = db.tblCustomer;
        Repeater1.DataBind();
           
            //update  commnd
           
             int idToupdate = Convert.ToInt32(Request.QueryString["id"].ToString());
        db_testCon db = new db_testCon();
        tblCustomer tb = db.tblCustomers.SingleOrDefault(a=>a.CustomerID==idToupdate);
        tb.City = TextBox1.Text;
        db.SaveChanges();
       
       
        //Add Command
       
        db_testcon db = new db_testcon();
        tblCustomer tb = new tblCustomer();
        tb.CompanyName = TextBox1.Text;
        tb.ContactName = TextBox2.Text;
        tb.City = TextBox3.Text;
        db.tblCustomer.AddObject(tb);
        if (db.SaveChanges() == 1) { Response.Redirect("et.aspx"); }
       
       
        //delete command
        int idToupdate = Convert.ToInt32(Request.QueryString["id"].ToString());
        db_testcon db1 = new db_testcon();
        tblCustomer tb = db1.tblCustomer.SingleOrDefault(a => a.CustomerID == idToupdate); 
        db1.tblCustomer.DeleteObject(tb);
        db1.SaveChanges();

Wednesday, March 19, 2014

How to get Ip adress from json?

1. jsonip.com: is a free utility service that returns a client's IP address in a JSON object with support for JSONP, CORS, and direct requests. It serves millions of requests each day for websites, servers, mobile devices and more from all around the world.

All you need to do is to make a call to jsonip.com.
1$(document).ready(function () {
2    $.get('http://jsonip.com', function (res) {
3        $('p').html('IP Address is: ' + res.ip);
4    });
5});

2. Smart-IP.net
: Smart IP for today is one of the leading services providing to it's users all the required information about IP-addresses and everything related to them.
1$(document).ready(function () {
2    $.getJSON('http://smart-ip.net/geoip-json?callback=?', function(data) {
3        $('p').html('My IP Address is: ' + data.host);
4    });
5});
Along with the IP address, this service also provide Geo location details as well like Country, latitude, longitude etc. Following are the properties which are returned as JSON response by this service.
1data.host;
2data.countryName;
3data.countryCode;
4data.city;
5data.region;
6data.latitude;
7data.longitude;
8data.timezone;