Dev

Tuesday, 29 December 2015

Login Page in asp.net


Home.aspx

<html>
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
        <asp:Label ID="Label1" runat="server" Text="User name:"></asp:Label>
        <asp:TextBox ID="Text_Username" runat="server"></asp:TextBox>
        <br />
        <br />
        <asp:Label ID="Label2" runat="server" Text="password"></asp:Label>
        <asp:TextBox ID="Text_Pwd" runat="server"></asp:TextBox>
   
        <br />
        <br />
        <asp:Label ID="LabelError" runat="server" Text="Label"></asp:Label>
   
        <br />
        <br />
        <asp:Button ID="Btn_Login" runat="server" Text="Login" OnClick="Btn_Login_Click" />
        <asp:Button ID="Btn_Cancle" runat="server" Text="Cancle" OnClick="Btn_Cancle_Click" />
   
    </div>
    </form>
</body>

</html>



Home.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

public partial class home : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Btn_Login_Click(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection("server=NameofServer;user id=sa; pwd=123; database=MyDatabase ");
        con.Open();
        string query= "SELECT userName, password FROM tbl_User WHERE userName='"+Text_Username.Text+ "'AND pwd='"+Text_Pwd.Text"'";
        SqlCommand com = new SqlCommand(query, con);
        SqlDataReader dr = com.ExecuteReader();
        if(dr.HasRows==true)
        {
            dr.Read();
            if (dr[0].ToString() == Text_Username.Text && dr[1].ToString() == Text_Pwd.Text)
            {
                Response.Redirect("Welcomepage.aspx");
            }
        }
        else{
            LabelError.Text="! Invalid UserName or Password !Try again with user name and password";
       
        }
    }
    protected void Btn_Cancle_Click(object sender, EventArgs e)
    {
        Text_Username.Text = "";
    }
}

Saturday, 26 December 2015

Difference Between GET and POST

GET
POST
We can only send limited data with GET method
we can send large amount of data with POST
GET method is not secure because data is exposed in the URL
POST method is secure because data is sent in request body
GET is the default HTTP method
We need to specify method as POST to send request with POST method.
You can bookmark GET request for e.g. Google Search.
you cannot bookmark a POST request
GET request is also cacheable
you cannot cache POST requests
GET sends data as part of URI
while POST method sends data as HTTP content
GET requests are sent as a query string on the URL:
for example:
GET index.html?name1=value&name2=value
POST requests are sent in the body of the HTTP request: for example:
POST /index.html
There is a limitation on sending data using GET method
It means we can transfer less data to sever.
POST doesn't have such limits. It means we can send large data to server.

HTTP Protocol Methods


What are HTTP Protocol Methods? Explain.

The HTTP methods are given below. These method names are case sensitive and they must be used in uppercase.
GET Method
A GET request retrieves data from a web server by specifying parameters in the URL portion of the request. This is the main method used for document retrieval.
POST Method
The POST method is used when you want to send some data to the server, for example, file update, form data, etc.
HEAD Method
The HEAD method is functionally similar to GET, except that the server replies with a response line and headers, but no entity-body.
PUT Method
The PUT method is used to request the server to store the included entity-body at a location specified by the given URL.
DELETE Method
The DELETE method is used to request the server to delete a file at a location specified by the given URL.
CONNECT Method
The CONNECT method is used by the client to establish a network connection to a web server over HTTP.
OPTIONS Method
The OPTIONS method is used by the client to find out the HTTP methods and other options supported by a web server. The client can specify a URL for the OPTIONS method, or an asterisk (*) to refer to the entire server.
TRACE Method

The TRACE method is used to echo the contents of an HTTP Request back to the requester which can be used for debugging purpose at the time of development.

Sunday, 13 December 2015

XML Schema Definition(SXD) an example

An XSD(XML Schema Definition) Example:
XML file  "shiporder.xml":

<?xml version="1.0" encoding="UTF-8"?>

<shiporder orderid="889923"
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:noNamespaceSchemaLocation="shiporder.xsd">
  <orderperson>John Smith</orderperson>
  <shipto>
    <name>Ola Nordmann</name>
    <address>Langgt 23</address>
    <city>4000 Stavanger</city>
    <country>Norway</country>
  </shipto>
  <item>
    <title>Empire Burlesque</title>
    <note>Special Edition</note>
    <quantity>1</quantity>
    <price>10.90</price>
  </item>
  <item>
    <title>Hide your heart</title>
    <quantity>1</quantity>
    <price>9.90</price>
  </item>
</shiporder>
Now we want to create a schema for the XML document "shiporder.xml"
Here is the complete listing of the schema file called "shiporder.xsd":

<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="shiporder">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="orderperson" type="xs:string"/>
      <xs:element name="shipto">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="name" type="xs:string"/>
            <xs:element name="address" type="xs:string"/>
            <xs:element name="city" type="xs:string"/>
            <xs:element name="country" type="xs:string"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="item" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="title" type="xs:string"/>
            <xs:element name="note" type="xs:string" minOccurs="0"/>
            <xs:element name="quantity" type="xs:positiveInteger"/>
            <xs:element name="price" type="xs:decimal"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="orderid" type="xs:string" use="required"/>
  </xs:complexType>
</xs:element>
</xs:schema>

Difference between SAX and DOM

Both SAX and DOM are used to parse the XML document

SAX
DOM
It stands for Simple API for XML
It stands for Document Object Model
SAX is event-based 
DOM is tree model
In SAX, events are triggered when the XML is being parsed
In DOM, there are no events triggered while parsing.
Parses node by node
Stores the entire XML document into memory before processing
Doesn’t store the XML in memory
Occupies more memory
We can’t insert or delete a node
We can insert or delete nodes
Top to bottom traversing
Traverse in any direction.


Wednesday, 8 April 2015

How to make your pc faster than before?

Making PC faster
To make you PC faster than before flow the the following steps:


Step 1:Go to start then click run and then type regedit

Step 2: Select HKEY_CURRENT_USER and then select control panel folder

Step 3: Then select desktop folder

Step 4: You will see registry setting at your right hand side after that select menu show delay and                     then right click and select modify.

Step 5:You will see edit string option -----> default value data is 400
            you have to change it to 000

Step 6: Restart your computer. You will see your computer is much more faster than before.


Friday, 3 April 2015

Designing One Pass Assembler

One Pass Assembler
Introduction:
Assembler is a software program that converts the assembly language to machine language. Machine languages consist entirely of numbers and are almost impossible for humans to read and write. Assembly languages have the same structure and set of commands as machine languages, but they enable a programmer to use names instead of numbers. Each type of CPU has its own machine language and assembly language, so an assembly language program written for one type of CPU won't run on another. Programmers use assembly language when speed is essential or when they need to perform an operation that isn't possible in a high-level language. Assembler is the step comes in between a source code and .exe file. The assembler creates object codes.
A two-pass assembler reads through the source code twice. Each read-through is called a pass. On pass one the assembler doesn't write any code. It builds up a table of symbolic names against values or addresses. On pass two, the assembler generates the output code, using the table to resolve symbolic names, enabling it to enter the correct values. The advantage of a two-pass assembler is that it allows forward referencing in the source code because when the assembler is generating code it has already found all references.
Fig: Different files created by assembler


Project description:
This is the design of assembler project as a mini project under the term paper topic of the system software. In this project I will demonstrate how the assembler will produce and interact with the various databases to convert the assembly language source program to machine instruction that can be understood by the particular machine after linking the object code using linker.
          In this project I am going to develop the following databases to convert source code in assembly language to object code
·         Symbol table
·         Literal table
·         Base table
Technology to be used:
To convert the source code in assembly language into the machine code c language is used.
Limitation:
As a initial programmer in the field of designing the assembler, in this project I have taken one static example to show how assembler generate the various databases and interact through those database in first pass and second pass to convert the source code into the object code. Although assembler generate object code(.obj), assembly listing(.lst) and cross reference file(.crf), here Iam going to generate only the object code.
Further scope:
Although as a initial programmer in the field of assembler design I have taken a static example for this project, It can be develop on generalized assembler that will work for every source code that user will give as a input.
C code
//Design of assembler
#include<stdio.h>
#include<string.h>
#include<conio.h>
#include<stdlib.h>
void print(char *p,int loc,int len,char ra);
void main()
{
char *p[9][4] = {{"PRG1","START","",""},
                                   {"","USING","*","15"},
                                   {"","L","1","FIVE"},
                                   {"","A","1","FOUR"},
                                   {"","ST","1","TEMP"},
                                {"FOUR","DC","F'4'",""},
                                {"FIVE","DC","F'5'",""},
                                {"TEMP","DS","1F",""},
                                {"","END","",""}};
                int i,j=0,location_counter=0;
                int regno;
                clrscr();
                printf("\n");
                printf("   Source code in assembly language is as follows:\n");
                printf("------------------------------------------------------\n");
                for (i=0;i< 9;i++)
                {
                for(j=0;j< 4;j++)
                 {
                    printf("%s\t",p[i][j]);
                 }
                    printf("\n");
                }
                getch();
                printf("\n\nPress enter to get the symbol for above assembly code.\n");
                getch();
                printf("\n Symbol Table:\n ");
                printf("\nSYMBOL\tVALUE\tLENGTH\tRelocatable/Absolute\n");
                printf("---------------------------------------------\n");
                /*code for symbol table*/
                for(i=0;i< 9;i++)
                { if(strcmp(p[i][1],"START")==0)
                   {
                    print(p[i][0],location_counter,1,'R');
                    }
                    else if(strcmp(p[i][0],"")!=0)
                    {
                                print(p[i][0],location_counter,4,'R');
                                location_counter=4+location_counter;
                    }
                    else if(strcmp(p[i][1],"USING")==0)
                    {
                    }
                    else
                    {
                    location_counter=4+location_counter;
                    }
                }
                printf("----------------------------------------\n");
                                getch();
                                clrscr();
                //code for literal table
                printf("\n\nPress enter to get the literal table for above assembly code.\n");
                getch();
                printf("\n Literal Table:\n ");
                printf("\nLiteral\tVALUE\tLENGTH\tRelocatable/Absolute\n");
                printf("---------------------------------------------\n");
                location_counter=0;
                for(i=0;i<9;i++)
                {
                  if((strcmp(p[i][2],"F'4'")==0)||(strcmp(p[i][2],"F'5'")==0))
                  {
                                print(p[i][2],location_counter,4,'R');
                                location_counter=4+location_counter;
                  }
                     else if((strcmp(p[i][0],"")==0)&&(strcmp(p[i][1],"USING")!=0))
                    {
                                location_counter=4+location_counter;
                    }
                }
                printf("-----------------------------------------------");
getch();
/* code for base table */
 printf("\nPress enter to get the Base table for above assembly code.\n");
                getch();
                printf("\n Base Table:\n ");
                printf("\nReg.No\t Avalibility Indicator\t Content of base Reg.\n");
                printf("\t(1 byte character) \t\n");
                printf("------------------------------------------------------\n");
                regno=0;
                for(i=0;i<=15;i++)
                {
                  if(regno!=15)
                  {
                                printf("%d\t\t'N'\t\t -\n",regno);
                                regno++;
                  }
                     else
                    {
                      printf("%d\t\t'Y' \t\t\n ",regno);
                    }
                }
                printf("-------------------------------------------------------");
getch();
}
//-----------------------------------------
void print(char *p,int loc,int len,char ra)
{
printf("%s\t%d\t%d\t%c\n",p,loc,len,ra);

}
##End##

Saturday, 7 February 2015

Full Forms of Computer Terminology

Important Full Forms of Computer Terminology
-----------------------------------------------------------------------
1) GOOGLE : Global Organization Of Oriented Group Language Of Earth .
2) YAHOO : Yet Another Hierarchical Officious Oracle .
3) WINDOW : Wide Interactive Network Development for Office work Solution
4) COMPUTER : Common Oriented Machine Particularly United and used under Technical and Educational Research.
5) VIRUS : Vital Information Resources Under Siege .
6) UMTS : Universal Mobile Telecommunications System .
7) AMOLED: Active-matrix organic light-emitting diode
8) OLED : Organic light-emitting diode
9) IMEI: International Mobile Equipment Identity .
10) ESN: Electronic Serial Number .
11) UPS: uninterrupted power supply .
12) HDMI: High-Definition Multimedia Interface
13) VPN: virtual private network
14) APN: Access Point Name
15) SIM: Subscriber Identity Module
16) LED: Light emitting diode.
17) DLNA: Digital Living Network Alliance
18) RAM: Random access memory.
19) ROM: Read only memory.
20) VGA: Video Graphics Array
21) QVGA: Quarter Video Graphics Array
22) WVGA: Wide video graphics array.
23) WXGA: Wide screen Extended Graphics Array
24) USB: Universal serial Bus
25) WLAN: Wireless Local Area Network
26 ) PPI: Pixels Per Inch
27 ) LCD: Liquid Crystal Display.
28 ) HSDPA: High speed down-link packet access.
29 ) HSUPA: High-Speed Uplink Packet Access
30 ) HSPA: High Speed Packet Access
31 ) GPRS: General Packet Radio Service
32 ) EDGE: Enhanced Data Rates for Global Evolution
33 )NFC: Near field communication
34) OTG: on-the-go
35) S-LCD: Super Liquid Crystal Display
36) O.S: Operating system.
37) SNS: Social network service
38) H.S: HOTSPOT
39) P.O.I: point of interest
40) GPS: Global Positioning System
41) DVD: Digital Video Disk / digital versatile disc
42)DTP: Desk top publishing.
43) DNSE: Digital natural sound engine .
44) OVI: Ohio Video Intranet
45) CDMA: Code Division Multiple Access
46) WCDMA: Wide-band Code Division Multiple Access
47) GSM: Global System for Mobile Communications
48) WI-FI: Wireless Fidelity
49) DIVX: Digital internet video access.
50) APK: authenticated public key.
51) J2ME: java 2 micro edition
53) DELL: Digital electronic link library.
54) ACER: Acquisition Collaboration Experimentation Reflection
55) RSS: Really simple syndication
56) TFT: thin film transistor
57) AMR: Adaptive Multi- Rate
58) MPEG: moving pictures experts group
59) IVRS: Interactive Voice Response System
60) HP: Hewlett Packard