Showing posts with label Programming-language. Show all posts
Showing posts with label Programming-language. Show all posts

Tuesday, August 6, 2013

Form Elements(HTML)

FORM

    • Form on a web page allows user to enter data that is sent to a server for further processing
    • An HTML FORM is a section of document containing normal text, markup and some special elements.
    • That special elements is known as “Controls”.
    • FORM tag tells the browser where the form starts and ends.
    • You can add all kinds of HTML tags between the <FORM> and </FORM>.
    • The purpose of form element is to present a fill out form to be used for an actions such as registration, queries etc.
    • HTML defines the following control types:
    • Buttons
      • Submit
      • Reset
      • Push
    • Checkboxes
    • Radio Button
    • Menus
    • Text
    • Files
    • Hidden Controls
    • Object Controls

Form Attributes 


  • Action
This attribute specifies a form processing agent
  • EncType
This attribute specifies the content type used to submit the form to the server
  • Name
Specifies the FORM name
  • Method
This attribute specifies which HTTP method will be used to submit the form data set.


GET

    • While Using Back button, GET request is re-executed
    • GET method pages can be bookmarked
    • Page can be hacked
    • Page can be cached
    • since form data is in the URL and URL length is restricted
    • GET is less secure compared to POST
    • Values will be displayed in the browser's address bar
    • GET method should not be used for sending sensitive information
    • It can't be more than 255 characters long.


POST

    • The browser usually alerts the user that data will need to be re-submitted.
    • POST method pages cannot be bookmarked.
    • Page never hacked
    • Page not cached
    • No restrictions
    • POST is safer than GET
    • POST method variables are not displayed in the URL
    • POST method can be used for sending sensitive information
    • Whereas no such maximum length limitation holds for the POST request.


<INPUT> ELEMENT

    • This tag is used to obtain user input in a variety of ways.
    • It tells the server the type of data to be submitted by the form.
    • Attributes:
      • Type
      • Name
      • Value
      • Size
      • Maxlength
      • Checked
      • Src
      • Align


<TYPE> ATTRIBUTE

    • It determines which control will be created on the form.
    • It can take any of the following values:
      • Text
      • Password
      • Checkbox
      • Radio
      • Image
      • Hidden
      • Submit
      • Reset
      • Button
      • File


<INPUT Type=“TEXT”>
It is used to create a single line text input field.

<INPUT Type=“PASSWORD”>
In this type the input text is rendered in a way to hide the characters.
This control is used for sensitive input such as password.
<INPUT Type=“CHECK BOX”>
Creates an on-screen checkbox for users to make multiple selections.
Checkbox is an on or off switch.
When the switch is checked the value is “yes” else “no”.
This allows user to select more than one value for a given property.
<INPUT type=“CHECKBOX” NAME=“CH1” VALUE=“A” Checked>

<INPUT Type=“RADIO”>
Creates an on-screen radio button for user to make a single selection.
It is also an on or off switch.
The radio button value is only submitted with the form when the switch is on.
<INPUT type=“RADIO” NAME=“RD1” VALUE=“Yes” Checked”>

<INPUT Type=“IMAGE”>
Creates a graphical submit button.
The image value of the type attribute has only one difference from the submit attribute.
<INPUT TYPE=“IMAGE” SRC=“submit_image.gif”>
<INPUT Type=“HIDDEN”>
Creates an element that is not visible by the user.
<INPUT TYPE=“HIDDEN” value=“lotus”>

<INPUT Type=“SUBMIT”>
Creates a submit button.
When this button is activated by the user, the form is submitted to the location specified by the action attribute of the form element.
<INPUT TYPE=“SUBMIT” value=“Submit the Form”>
<INPUT Type=“RESET”>
Creates a reset button.
When this button is activated by the user, all of the form’s controls have their values reset to the initial values specified in the controls on the form.
<INPUT TYPE=“RESET” VALUE=“Reset the Form”>

<INPUT Type=“BUTTON”>
Creates a generalized button.
Unlike the submit or reset buttons, it has no predetermined action.
<INPUT TYPE=“BUTTON” Value=“Click me”>

<INPUT Type=“FILE”>
Creates a control which is used for file uploading.
The field consists of a text entry box for a filename as well as a button immediately to the right of the field, which is usually labeled BROWSE.
Pressing the Browse….. Button allows the user to browse the local system to find a file to specify for upload.
<INPUT TYPE=“FILE”>


<SELECT>
  • The SELECT element is used to create a list of choices either as a dropdown menu or a list box.
  • Each of the choices in the list is an OPTION element.
  • There are two tags involved in creating select lists, the <SELECT> tag and the <OPTION> tag.
  • The <SELECT> tag offsets the lists .
Attributes:

  • Name
Assigns a name to the element.
  • Size
Numbers of rows in the list that should be visible on the form.
  • Multiple
This boolean attributes allow multiple selections.
  • Disabled
Locks the field where user can’t change the value. Even user cant select option, cant copy text and the field is not even sent if the form is submitted.


<OPTION>
    • Used along with <SELECT> to create select lists.
    • The <OPTION> is used to list the possible values. It has only two attributes.
    • Selected
      • When set this boolean attribute specifies that this option is pre-selected.
    • Value
      • This attribute specifies the value to be submitted for this choice, if the choice is selected,when the form is submitted.

  >Eg:
<SELECT NAME=“listname”>
<OPTION value=“LIST1”>ITEM1
<OPTION value=“LIST2”>ITEM2
<OPTION value=“LIST3”>ITEM3
<OPTION value=“LIST4”>ITEM4
</SELECT>

<TEXTAREA>
The TEXTAREA element is similar to the INPUT element’s text type.
Instead of single line text box, a multi-line text input control is created.
Because there are many lines of text within the <TEXTAREA> element, it is not possible to set the default text for the textarea using the VALUE attribute.
The default text is placed between the <TEXTAREA> …………</TEXTAREA> tags.

>ATTRIBUTES

  • NAME:
Assigns a name to the element.
  • ROWS:
Specifies the number of visible text lines.
  • COLS:
Specifies the visible width in a average character widths.

  >Eg:
<TEXTAREA NAME=“ADDRESS”ROWS=“2” COLS=“20”>……….
</TEXTAREA>

<FIELDSET> ELEMENT

  • It defines a group of form elements as being logically related.
  • The browser draws a box around the set of fields to indicate that they are related.
  • <FIELDSET> is a block level element, so there is no need to use <P> tag between fieldsets


  >Example:
<FIELDSET>
<INPUT TYPE=“Checkbox” name=“sports”>Sports
<INPUT TYPE=“Checkbox” name=“Shopping”>Shopping
<INPUT TYPE=“Checkbox” name=“Music”>Music
<INPUT TYPE=“Checkbox” name=“Dancing”>Dancing
</FIELDSET>

<LEGEND> ELEMENT

  • It is used with <FIELDSET>to give a title to each set of fields.

<FIELDSET>
<LEGEND>Hobbies</LEGEND>
<INPUT TYPE=“Checkbox” name=“sports”>Sports
<INPUT TYPE=“Checkbox” name=“Shopping”>Shopping
<INPUT TYPE=“Checkbox” name=“Music”>Music
<INPUT TYPE=“Checkbox” name=“Dancing”>Dancing
</FIELDSET>

Frame Element(HTML)

FRAME


    • Frame allows you to divide the page into several rectangular areas and to display a separate document in each rectangle.
    • Each of those rectangle is known as “Frame”.
    • Using frames, you can display multiple HTML document in the same browser window.
    • Each HTML document is called a frame, and each frame is independent of the others.


FRAMESET

    • The frameset element holds one or more <FRAMESET> or <FRAME> elements. Each frame element can hold a separate document.

Example:
<frameset cols="25%,50%,25%">
<frame src="frame_a.htm" />
<frame src="frame_b.htm" />
<frame src="frame_c.htm" />
</frameset>
NOFRAME

    • The <noframes> tag is used for browsers that do not handle frames.
    • The noframes element can contain all the elements that you can find inside the body element of a normal HTML page.
    • The noframes element is most used to link to a non-frameset version of the web site or to display a message to users that frames are required.
    • The noframes element goes inside the frameset element.


ROWS
“pixels|percents” defines the row height of each row(vertical) within the frameset. The value of each row height is a comma separated list of sizes
COLS
“pixels|percents” defines the column width of each column(horizontal) within the frameset.The value of each column width is a comma separated list of sizes
ONLOAD
“script” to specify client-side scripting actions to perform when the frame is loaded.
ONUNLOAD
“script” to specify client-side scripting actions to perform when the frame is removed
FRAMEBORDER
To give border around all frames
BORDER
Controls width of all borders
BORDERCOLOR
To change the color of the frame borders
<FRAME> ELEMENT
Defines a frame.
Each frame must contained within a Frameset document that defines the dimension of the frame.
ATTRIBUTE

    • SRC
    • Name
    • NoResize
    • Scrolling-value(Yes,no or auto)
    • Marginheight
    • MarginWidth
    • FrameBorder-Value(0 or 1),Specifies whether or not to display a border around a frame


Monday, August 5, 2013

Introduction to HTML

HTML

    • HTML stands for Hyper Text Markup Language.(The markup is the instructions for displaying or printing the text.)
    • HTML is not a programming languages but it is a markup language.
    • A markup language is a set of markup tags.
    • HTML uses markup tags to describe web pages.
    • It is a descriptive markup language that describes the structure and behavior of a web documents.
    • HTML was created by Tim Berners-Lee
    • HTML is a set of code that can be embedded in text to add formatting and linking information.
    • It allows these different kinds of data to be displayed together.    
    • HTML is nothing more than a plain text file that allows for the inclusion of two kinds of text:
      • The Content
        • Text or information to be displayed or played back on the client’s screen.
      • The Markup
        • Text or information to control the display or to point to other information items in need of display .

HTML TAGS

    • Tags are the instructions that are embedded directly into the text of the document.
    • An HTML tag is a signal to the browser that it should do something other than just throw text up on the screen.
    • By conventional all HTML tags begin with an open an angle bracket(<) and end with close angle bracket(>).
    • HTML is specified as TAGs in an HTML document(i.e. Web Page)
    • There are two types of HTML tags:
      • Paired Tags
      • Singular Tags( stand-alone tags/ unpaired tags)

Paired Tags


    • A tag is said to be a paired tag if the text is placed between a tag and its companion tag.
    • In paired tags, the first tag is referred to as opening tag and the second tag is referred to as closing tag.
      • Example:
        • <i>Welcome</i>
        • Here, <i> is called opening tag and </i> is called a closing tag
      • Here are some more examples
        • <html>
        • <head>
        • <title>
        • <body>
        • <p>
        • <h#>
        • <address>
        • <nobr>
        • <center>
        • <block quote>
        • <pre>
        • <font>
        • <strike>
        • <b>
        • <i>
        • <big>
        • <small>
        • <sub>
        • <sup>
        • <u>
        • <lists>
        • <div>
        • <strong>

 Singular tag
    • A Singular tag does not have a companion tag.
    • Singular tags are also known as unpaired tags or Stand-Alone tags.
      • Example:
        • <br>
        •  <hr>
      • This tags does not require any companion tag.
        • <doctype>
        • <br>
        • <hr>
        • <basefont>
        • <meta>
HTML Tag


    • Some HTML tags require additional information to be supplied to them.
      • For example:-
        • When a picture is placed on the screen, information like the height and the width of the picture can be specified.
    • Additional information supplied to an HTML tag is known as Attributes of a Tag.
    • Attributes are written immediately following the tag, separated by a space.
      • <table border="1">
    • Multiple attributes can be associated with a tag, also separated by space.

HTML document 

    • An HTML document contains two distinct parts:
    • The head
    • The body.
    • The head contains information about the document that is not displayed on the screen.
    • The body contains everything else that is displayed as part of the web of page

<HTML>
<HEAD>
…………..
<!-- header information & it is not displayed on the page
</HEAD>
<BODY>
…………..
<!-- all the HTML for display>
</BODY>
</HTML>
Head Eement

    • <HEAD> contains general information, or meta-information, about the document.
    • The head of the HTML document is an unordered collection of information about the document.
    • The main head element is a <TITLE> tag.
    • The contents of the <HEAD> are not displayed as part of the document text
    • It is just written after the <HTML> tag.
      • <TITLE>
      • <BASE>
      • <ISINDEX>
      • <NEXTID>
      • <LINK>
      • <META>
      • <STYLE>
      • <SCRIPT>

Title Element

    • The title of a document is specified by the TITLE element.
    • The TITLE element should occur in the HEAD of the document.
    • There may be only one title in any document.
    • It should identify the content of the document.
    • The <TITLE> element is not part of the body text, it is displayed in the window title.
    • It may not contain anchors, paragraph or any highlighting or other HTML Tag.
    • The title may be used to identify the node in a history list.
    • Your title should be descriptive but short, less than 64 characters.

Body Element 

    • It specifies the main content of the document.
    • Body tag is placed immediately after the closing head tag(</Head>) and before any image or text included in the document.
    • The body of the HTML document contains all the text and images that make up the page together with all the HTML elements that provide the control or formatting of the page.
    • It is possible to control the document color scheme and background by specifying certain attributes in the <BODY ….> declaration.
      • Attributes are
        • used to point to an image file
        • BgColor: allow settings of background color
        • Text: used to change the text color

For Additional Quarries Please put Your Valuable Comment (!) 

Wednesday, July 31, 2013

Overview of C Programming Language

Basic Information About C Programming Language

Computer Component

Hardware
    • Hardware is the equipment, or the devices, associated with a computer.

Software
    • The instructions that tell the computer what to do are called software or programs.
    • Program written by programmers

Hardware and software accomplish four major operations:

    • Input
    • Processing
    • Output
    • Storage.

Types of Language

High – level Language
    • Language in human readable form are known as high – level language.
    • E.g. C, C++, Java etc.
Low – level Language
    • Language in the form of 0s and 1s is known as low level language.
    • Also known as machine language

Types of Error

Syntax Error
    • Refers to an error in the syntax of a sequence of characters or tokens for particular programming language.
    • Syntax error will be display at compile time.
Logical Error
    • Error occurs because of logic of code is known as logical error.
    • It will be display at run time.

Compiler and Interpreter

    • It is one kind of program to convert high level language into low level language.
    • Interpreter check code line by line if error than display error.
    • Compiler check whole code and than display list of errors.

Reserve Keywords

    • Some words are reserved for special purpose which are known as reserve keywords.
    • Reserve keywords are not used as an name of variable, functions, class etc.
    • The keywords must be written in lower case only.

Identifiers

    • Identifiers refer to the names of variables, functions and arrays.
Rules for identifiers
    • Must consists of only letters, digits, or underscore.
    • First character must be an alphabet (or underscore).
    • Only first 31 characters are significant.
    • Cannot use a reserve keyword.
    • Must not contain white space.

Constants

    • Constants refer to fixed values that do not change during the execution of program.

Backslash Character Constant

C Programming Backslash Character

Variables

    • Variable is a named location of memory that is used to hold a value.
    • Its value can be modified during the program execution.
    • We can also say that variable is an identifier that is used to represent a single value.

Data Types

    • It is a type of data that can be represent in the value of data element.
    • It defines the type of constant which is going to store into the variable.
    • Compiler will allocate memory for variable based on data type.

Comments

    • Sometime we want to write comment in the program which is not an executable part of our source code.

There are two types of comment

Single line comment ( // )
    • E.g. // This is a single line comment
Multi line comment ( /* ------------ */)
    • E.g. /* Program name : sum.cpp
      Definition : To calculate the sum */

Declaring Variable

    • Before using the variable, you have to define variable to give information to compiler.
    • Syntax
      Datatype VariableName;
    • E.g.
      int StudentId;
      char Name;
      float Average;
      double SumOfSalary;
    • Statements used to declare variable is known as declarative statement.
    • When we declare a variable
    • Space for a variable is set in memory to hold a value of the specified data type.
    • That space is associated with the variable name.
    • That space is associated with a unique address.
    • E.g. int StudentId;

Variable Initialization

    • At the time of variable declaration we can assign default value which is known as variable initialization.
    • E.g. int StudentId = 25;

Assigning value to variable

    • We can also assign the value to the variable.
    • The statement which assign value to the variable is known as assignment statement.

C Program Structure

Preprocessor Directive
Global Declaration
User Defined Functions
int main()
{ Local Declaration
Statements }

Output Function : printf()

    • printf( ) is a function defined in stdio.h header file.
    • It reads data from the computer’s memory and display it on standard output device.
    • printf stands for print formatted.
    • On success, the total number of characters written is returned otherwise return negative number.
      • Syntax :
        printf(“control string”, VariableList);
      • Ex.
        Input Code :
        printf(“Welcome to home”);
        Output is : Welcome to home
      • Ex.
        Input Code : int StudentId = 10;
        printf(“%d”, StudentId);
        Output is : 10
    • You can also combine message and value of variable.
      • Ex.
        Input Code : int StudentId = 10;
        printf(“Id of student is %d”, StudentId);
        Output is : Id of student is 10
    • You can also specify the width of field.

      • Syntax :
        printf(“%field-width FS”, VariableName);
      • E.g.
        Input Code : int No = 2563;
        printf(“%3d”, No);
        Output : 256

Input Function : scanf()

    • It is input formatting function.
    • It will read data from standard input and stored in given variable.
    • scanf stands for scan formatted.
    • Remember that leading white spaces are ignored.
    • On success, the function returns the number of items successfully read.
    • In the case of an input failure before any data could be successfully read, EOF is returned
      • Syntax :
        scanf(“Control String”, &VariableList);
      • E.g.
        int No;
        scanf(“%d”, &No);
        char Str;
        scanf(“%c”, &Str);
    • You can't use message in scanf function.
    • If you want to display message for user understanding than use printf function.
      • E.g.
        int No;
        printf("Enter one number:¨);
        scanf("%d", &No);
    • Width is used to specified that maximum number of characters to be read.
    • But if the whitespace character found before width, that only many characters are going to be stored.
      • E.g.
        int No;
        scanf(“%2d”, &No);

Operator

    • Unary Operator
      • Operator which required one operand is known as unary operator.
    • Binary Operator
      • Operator which required two operand is known as binary operator.
    • Ternary Operator
      • Operator which required three operand is known as ternary operator.


Goto Statement

    • We can change the normal sequence of execution by transferring control to other part of the program using goto statement.
    • Syntax: goto label_name;
    • Here the label name should be valid identifier which may appear in anywhere in the program.

Break Statement

    • The break statement uses to come out from a loop.
    • It can be used to force to end the loop before its natural end.
    • Remember that break statement can only used with loop statements and switch statement.

Continue Statement

    • The continue statement skip the rest part of the loop and transfer control at the beginning of the loop for next iteration.

Switch Statement

    • We can choose statements to execute based on some value.
    • This can be achieve using nested if….else statement. But it is very complex.
    • C language provide switch statement to avoid this type of complexity.