-->

Friday, January 24, 2014

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.

Computer Programming: Control class properties, methods and events

The System.web.UI.Control class is the base class for all Web server controls. This class is derived directly from the object class, which resides in the System namespace. Here is the hierarchy of the control class:
System.Object
      System
             web.UI.Control

Public Properties of control class

AppRelativeTemplateSourceDirectory : Obtains the application-relative virtual directory of the Page or UserControl that contains this control
BindingContainer : Obtains the control that contains this control's data binding
ClientID : Obtains the server control identifier generated by ASP.NET
Controls : Obtains a ControlCollection object that represents the child controls for a specified server control in the UI hierarchy
EnableTheming : Obtains a value indicating whether themes apply to his control.
EnableViewState : Obtains a value indicating whether the server control persists its view-state, and the view-state of any child controls it contains.
ID : Obtains the programmatic identifier assigned to the server control
NamingContainer : Obtains a reference to the server control's naming container, which creates a unique namespace for differentiating between server controls with the same System.Web.UI.Control.ID property Value.
Page : Obtains a reference to the Page instance that contains the server control.
Parent : Obtains a reference to the server control's parent control in the page control hierarchy
Site : Obtains information about the container that hosts the current control when rendered on a design surface.
SkidID : Obtains the skin to apply to the control.
TemplateControl : Obtains a reference to the template that contains this control
TemplateSourceDirectory: Obtains the virtual directory of the Page or UserControl that contains the current server control.
UniqueID : Obtains the unique , hierarchically-qualified identifier for the server control.
Visible : Obtains a value that indicates whether a server control is rendered as UI on the page.

Public Method of control class

ApplyStyleSheetSkin : Helps in applying the style properties defined in the page style sheet to the control
DataBind : Helps in binding a data source to the invoked server control and all its child controls.
Dispose : Helps in enabling a server control to perform final clean up before it is released from memory.
FindControl : Helps in searching the current naming container for the specified server control.
Focus : Helps in setting input focus to a control.
HasControls : Helps in determining if the server control contains any child controls
RenderControl : Helps in output server control content and stores tracing information about the control if tracing is enabled.
ResolveClientUrl : Helps in getting a URL that can be used by the browser.
ResolveUrl : Helps in converting a URL into the desired format
SetRenderMethodDelegate : Helps in assigning an event handler delegate to render the server control and its content into its parent control.

Public Events of Control Class

DataBinding : Occurs when the server control binds to a data source
Dispose : Occurs when a server control is released from memory, which is the last stage of the server control life cycle when an ASP.NET page is requested.
Init : Occurs when the server control is initialized, which is the first step in the life cycle.
Load : Occurs when the server control is loaded into the page object.
PreRender : Occurs when the server control is about to render to its containing Page object.
Unload : Occurs when the server control is unloaded from memory.
© Copyright 2013 Computer Programming | All Right Reserved