-->

Friday, January 24, 2014

Computer Programming : Classification or Type of Data structures, C Programming

Data structures can be classified, keeping in view the way the elements are connected to each other, the way when they are stored in memory or the way further division of a data structure.

Linear and Non-Linear

This type of classification is on the basis of element's connection and placement. When the elements of a data structures are placed in order, means if the second element is placed after the first one, third one after the second one and so on, are called Linear Data Structures otherwise Non-Linear Data Structures. Examples of Non-linear Data Structures: Trees, Graphs etc.

Classification of Data Structure in Computer programming

ARRAY is an ordered collection of similar data elements. So, it is called as Linear Data Structure. The element are arranged in Linear order i.e. one after the other at consecutive memory locations.Similarly LINKED LIST is also a Linear Data Structure Where the elements of List are stored in Linear Order but at different memory locations, the Linear order is maintained by one of the fields of Linked List, called Link field(pointer to next node element).

On the other hand, TREE is a non-linear data structure in which the elements are stored in hierarchical order instead of linear order. In hierarchical order top most node is called root node and it may be connected to zero, one or more than one nodes. So from one element elements of the data structure are placed such that they are adjacent (connected) to more than one element, then the resulting data structure, Which is non-linear one, is called as GRAPH. Graph is a general non-linear data structure and Tree is a restricted Graph.

STACK and QUEUE are specialized data structures where insertion and deletion are restricted. STACK and QUEUE can be implemented either using one-dimensional array or linked list.

Linear data structure are also called as contiguous data structures and non-linear data structures are called as non-contiguous data structure.

Static and Dynamic

This type of classification is on the basis of Memory Allocation. The data structure modeled must be present in memory to use it i.e. memory should be allocated to the data structure to store the data in it. If the memory is allocated to the data structures at the time of compilation of programs where the data structures are used, then such type of data structures are called as static data structures. Compilation of program is translation of source program into an object program. The linear data structure ARRAY is static data structure for which memory is allocated at the time of  compilation.

On the other hand if the memory is allocated at the time of execution of program (While running) for the data structures used in the program are called Dynamic data structures. The linear data structure LINKED LIST is a dynamic data structure for which memory is allocated at the time of execution, means the memory for data structure is allocated as per the user wish at the time of executing the program.

Primitive and Non-Primitive

This type of classification is on the basis of further division. If the data structure is not further divisible to another data structure, then it is called as Primitive data structure and if it is further divisible then it is called as Non-Primitive data structure.

For example the standard data types of C like char, int, float are fall under the category of Primitive data structures where as user defined or derived data types like array, structure are further divisible so they are called Non-Primitive data structure. 

Uncompressed your compressed or zip folder using c# programming

In this example, we will show that a zip directory,which contains lots of file, converted into uncompressed folder. There are many steps for designing this algorithm, these are

Step-1 : Add 'System.IO.Compression.FileSystem' assembly into your project.
assembly exist into your windows directory

 (~/Windows/Microsoft.NET/assembly/GAC_MSIL/System.IO.Compression.FileSystem/(Your .NET Version)
How to create zip or compressed folder using c# programming

Step-2 : copy this code, paste into your source code

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO.Compression;
using System.IO;

namespace compressiondecompress
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string source = @"e:\web1";
            string dest = @"e:\web.zip";

            ZipFile.ExtractToDirectory(dest, source);


           
        }
    }
}

Code generate the following output

Uncompressed your compressed or zip folder using c# programming

How to create zip or compressed folder using c# programming

In this example, we will show that a directory,which contains lots of file, converted into compressed folder. There are many steps for designing this algorithm, these are

Step-1 : Add 'System.IO.Compression.FileSystem' assembly into your project.
assembly exist into your windows directory

 (~/Windows/Microsoft.NET/assembly/GAC_MSIL/System.IO.Compression.FileSystem/(Your .NET Version)
 
How to create zip or compressed folder using c# programming

Step-2 : copy this code, paste into your source code

 using System.IO.Compression;
using System.IO;

namespace compressiondecompress
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string source = @"e:\web";
            string dest = @"e:\web.zip";
           

            ZipFile.CreateFromDirectory(source, dest);


           
        }
    }
}

Code generate the following output
How to create zip or compressed folder using c# programming

Thursday, January 23, 2014

Computer Programming: WebControl class and their properties, methods and events

All Web server controls exists within the System.Web.UI.WebControls.WebControl namespace and can be used on any Web Form. Here is the hierarchy of WebControl class
System.Object
    System.Web.UI.Control
        System.Web.UI.WebControls.WebControl

Public Properties of the WebControl class

AccessKey : Obtains the access key that allows you to quickly navigate to the Web server control.
Attributes : Obtains the collections of the arbitrary attributes (for rendering only) that do not correspond to properties on the control.
BackColor : Obtains the background color of the Web server control.
BorderColor : Obtains the border color of the Web control.
BorderStyle : Obtains the border style of the web server control.
BorderWidth : Obtains the border width of the Web server control.
ControlStyle : Obtains the style of the web server control. This property is used primarily by control developers.
ControlstyleCreated : Gets a value indicating whether a Style object has been created for the ControlStyle property. This property is primarily used by control developers.
CssClass : Obtains the Cascading Style Sheet (CSS) class rendered by the Web server control on the client.
Enabled : Obtains a value indicating whether themes apply to this control.
EnableTheming : Obtains a value indicating whether themes apply to this control.
Font : Obtains the font properties associated with the Web server control.
ForeColor : Obtains the foreground color(typically the color of the text) of the Web server control.
HasAttributes : Set a value indicating whether the control has attribute set
Height : Obtains the height of the Web server control.
SkinID : Obtains the skin to apply to the control.
Style : Obtains a collection of text attributes that will be rendered as a style attribute on the outer tag of the web server control
TabIndex : Obtains the tab index of the Web Server control.
ToolTip : Obtains the text displayed when the mouse pointer over the Web server control.

Public Methods of WebControl class


ApplyStyle : Copies any non-blank elements of the specified style to the web control. It also overwrites any existing style elements of the control.
CopyBaseAttributes : Copies the properties that are not encapsulated by the style object from the specified web server control to the web server control that this method is called from. This method is used primarily by control developers.
MergeStyle : Copies any non-blank elements of the specified style to the web control, but will not override any existing style elements of the control. This method is used primarily by control developers.
RenderBeginTag : Writes the opening tag of the specified markup element to the output stream.
RenderEndTag : Writes the end tag of a markup element to the output stream.

Computer Programming : Introduction to data structure , C Programming


One of  the major applications of computer is data processing. Nowadays computer are widely used in data processing. Data is nothing but a raw fact that is processed to produce the meaningful   information .Data that is to be processed is to be represented  in memory   of computer . In C we can use the name of data types like int , float, char, to represent the data .When an integer and real data is to be processed int and  float serve the purpose respectively. When we go into the depth of data  usage and to represent the real world situation only basic data types like int and float are not enough. So the need of data structures. As data types are being used to represent the data, they are called data structures.

 Data Structures is a mathematical or logical model, which is used to represent the data; i.e. to organize data, modelled to represent the real world situation, to work like a real word application.
Simply speaking, to structure the data type (data type itself being data  Structure) , under a single unit is called as data structure.

Information and Meaning

Basically the raw facts containing numbers, characters, collection of characters are called as ‘data’. Such data must be collected in order to  Process it. The processed data that gives meaning, placed properly
under the respective headings is called as Information. Processed form of the raw facts(data) is called as Information. The data processing is done to place the data in its meaningful format . As mentioned in the 
Introduction part; data structure is important to collect data that is to be Processed to produce meaningful information. Nowadays Information is one of the major important resources of any successful business. With the help of the available information processed through the computer benefits In making proper decisions at various levels of business management. Even information as a resource is placed along with the level of other resources like finance and human. So, understanding the importance of information to be produced from the data processing is necessary in order to see the importance of data structure. Look at the following CASH MEMO of a co-operative store and you will realize the meaning of information . Find out the data part of the information:
In the above information, the entries like 10502,30/01/2004, Shreya  S.Dandin,1145, 1146, Pencil,6,2,3,2.30,12.0,13.80  ect. Have no meaning Unless otherwise they are placed under or after proper heading or label. So they form data for this information .collectively when all these data are placed under proper label or heading they provide meaning. So the Above CASH MEMO is information .Of course to produce such information the raw fact (data) may be collected or processed .In processing either the raw facts collected may be used to calculate the further data and all are part of collected data and the produced data (if any) are placed under proper heading or column to produce information.

Look at the following RESERVATION CUM BAOARDING CARD of Rajasthan State Transport  Corporation and you can realize the meaning of information .You can also find out the data part of the information:




In the above information, the entries like H01040743,  PILE0001704, Deluxe,  Jaipur,  Pilani, 21/02/2004,  16,30,SHREYA, SMRITI,  PRAMOD,  PRASHANT,   VAIBBHAVI,   ANUPAMA,     F,   M,  21,9, 75.00, 450.00 etc. have no meaning unless otherwise they are placed under or after proper heading or label. So they from data for this information. Collectively when all these data are placed under proper label or heading they provide meaning .So the above RESERVATION CUM BOARDING CARD is information . Of course to produce such information the raw fact (data) may be collected or processed.

Wednesday, January 22, 2014

Punctuators and Operators used in NetBeans: Java

Separators

The following nine ASCII characters are the separators (punctuators):
      ( )                            {  }                    [  ]            ;             ,           .

Operators

The following 37 token are the operators, formed from ASCII characters:

Punctuators and Operators used in NetBeans: Java

Literals and its Types used in NetBeans part-2: Java

According to earlier article we have read about literals and some of its types used in Java Programming. We have discussed about the integer literals and floating literals, remaining are in this article.

Boolean Literals

The Boolean type has two values, represented by literals true and false formed from ASCII letters.
A Boolean literals is always of type Boolean. It is either Boolean value true or Boolean value false.

Character Literals

A character literal is one character enclosed in single quotes, e.g., ‘z’. The rule for writing character constant is given below:
A character literal in Java must contain one character and must be enclosed in single quotation marks.
Java allows you to have certain nongraphic characters in character constants. Nongraphic character are those character that cannot be typed directly from keyboard e.g. backspace, tabs, carriage return etc. these nongraphic character can be represented by using escape sequences. An escape sequence is represented by a backslash (\) followed by one or more characters.
Following table gives a listing of escape sequences:

Literals and its Types used in NetBeans: Java

In above table, you see sequences representing \, ‘ , “ and ? also. Though these character can be typed from the keyboard but when used without escape sequence, these carry a special meaning and have a special purpose, however, if these are to be typed as it is, then escape sequence should be used.

The following are the example of char literals:
Literals and its Types used in NetBeans: Java
Unicode escape are processed very early and thus must not be represented through \uHn for sequence that have their unique represented escape sequence e.g. \n or \r etc.

String literals

‘Multiple character’ constants are treated as string literals. The rule for writing string-literals is given below:
A string literals is a sequence of zero or more characters surrounded by double quotes. Each character may be represented by an escape sequence.
A string literals is of class type String. Following are legal string literals:

“abc”                              size 6bytes (each character takes 2 bytes)
“\ab”                               size 4 bytes (\a is one character)
“seema\’s pen”                size 22 bytes
(note: \a and  \’ are escape sequences)

Null Literal

The null type has one value, the null reference, represented by the literals null, which is formed from ASCII characters. A null literal is always of the null type.

© Copyright 2013 Computer Programming | All Right Reserved