-->

Friday, October 10, 2014

Characteristics of Programming : C Language

Now, let us see “What is programming? What are the characteristics of good programming?”

Definition: The art of writing or designing the programs to provide a solution to the well-defined problem is called programming. As the saying goes ‘practice makes a man perfect’, developing such an art requires thorough practice. The following 10 characteristics if followed in a proper way will improve the quality of programming :

Characteristics of good Programming:
  1. Accurate
  2. Efficient
  3. Maintainable
  4. Portable
  5. Readable
  6. Reliable
  7. Robust
  8. Usable
  9. Documentation
  10. Indentation

Now, let us see, “the characteristics of programming” in detail.

Accurate: The programming of a program is based on a certain problem. The problem must be pie-defined clearly with specification of requirements. It is expected from the programmer to design a program that strictly follows these requirements. So, the designed program must be accurate to perform the specified task. Such characteristic of programming is referred ‘accurate’.

Efficient: Every program designed by programming utilizes the resources of the computer system. It is expected from the programming that the designed program utilizes these resources in an efficient manner. It means the program must not spend much time or over use the processor in executing its coded instructions. Such characteristic of the programming is referred ‘efficient’.

Maintainable: When proper structuring method is used in programming, the designed program can be made maintainable. Here maintainable means the ability to change as per the new needs. With very little modification a program should work for the new needs. Such characteristic of programming is referred ‘maintainable”.

Portable: It is expected from the designed program that it can be carried to any platform to solve the task. If the programming is done keeping many systems rather than one system in mind the designed programs are portable. Once the program is portable, it can be easily transferred from one machine to an other. Such characteristic of programming is referred ‘portable’.

Readable: The program designed by the programmer must be self readable as he is the first reader. Generally the designed program is also read by co-programmers or others. So, the designed program must contain proper comments to explain the coded instructions. This commenting will help in understanding and reading the program. Such characteristic of programming is referred ‘readable’.

Reliable: The designed program must perform as per the need all the time. It should also produce the intended results for any sort of inputs. In case of improper inputs, it should stop only after displaying proper error messages. These will indicate the cause of termination of the program. Such programs are created with the ‘reliable’ characteristic of the programming.

Robust: The designed program is expected to continue with its functionality even at the unexpected errors. It is the art of programming that takes care of all the possible errors before com¬pleting the design. Such programs keep on doing their work even at worst situations. Such characteristic of programming is referred ‘robust’.

Usable: The designed program must be easy to use. It must be designed with proper interactive messages so that the user can easily get accustomed to it. Proper thinking in interface design will prove its worthiness. The documentation of the program must be prepared in good format to train the users. Such characteristic of the programming is referred ‘usable’.

Documentation: The usage of comments or remarks to explain the coded instructions and the modules of the program is called documenting the program. Such documented program will also help in providing other characteristic of the programming. The comments will help to find the errors as well as to rectify them. When the program is lengthy one proper documentation will properly connect the components of the program. It improves the readability as well as usability of the program. Such characteristic of programming is referred ‘documentation’.

Indentation: The coded instructions of the designed program must properly match with beginning and ending of the structures or compound statements. Especially in case of C language, the compiler understands the code even if it is not properly indented. The indentation is mainly required for the users or programmers not for the compiler. The indentation improves the clarity of the program as well as its understanding. It will also help in debugging that is to remove the errors. Such characteristic of the programming is referred 'indentation'.

Wednesday, October 8, 2014

Life Cycle of applet

In the previous article, we have already learned about basics of applet.

Life Cycle of applet

1. init() : init method is used to initialize the applet. Before doing anything, must to initialized, so same thing with the applet. Like, in the games.
Before play any games, must to initialized all the  drivers in the system, which is necessary for the games. In the applet, init method is invoked only once, also that method invoked after param tag, which is inside in <applet></applet> tag.

2. start() : This is invoked after the initialization completed. It is used to start the applet, also automatic start. When user navigate to the web page, if
web page contain applet code then it start automatically also start when user moves from other web pages.

3. paint () : This method is invoked just after start() method. Actually only this method is responsible to design the applet, also responsible for repaint the browser, if applet is stooped. It has contain graphics argument as a parameter, through Graphics class we can design any graphics in the applet like rectangle, oval etc. Graphics class inherit from java.awt class.
4. stop() : This method is invoked, just after when the user moves to other browser tab from current applet tab.

5. destroy() : This method is invoked only that time when user close the browser. You can say, opened web page contain applet code , on that time applet is running
properly but in case if user close the browser, applet instance is automatically deleted from the page and destroy method is called automatically.

Example of Applet

The following is a simple applet named HelloWorld.java

import java.applet.*;
import java.awt.*;
public class HelloWorld extends Applet
{
public void paint (Graphics g)
{
g.drawString ("Hello World", 30, 50);
}
}

The first line of code define, imports some packages, which is used for design the applet. Here are two class that is applet and awt. In the second line of code, we have a class "HelloWorld" which is inherited from Applet class. This Applet class inside in java.applet.* package. Through the Graphics class, we can design new object in the applet. This class inherited from java.awt.*. In this example, we have to draw a string with height and width argument(width=30, height=50).
With the help of applet tag, we will show the output in any browser, which support applet. Applet tag is:
  <applet code="HelloWorld.class" width=50 height=60></applet>

This tells the viewer or browser to load the applet whose compiled code is in HelloWorld.class (in the same directory as the current HTML document), and to set the initial size of the applet to 50 pixels wide and 60 pixels high.

Monday, October 6, 2014

Basics of applet

Applet is a small java program that run in browser, but JVM is required for run applet in browser. Basically applet is used where user want to put some dynamic content into html page.
There are some features and advantages of Applet

Features:


  1. It is a java class file, which is inherit from java.applet.Applet class.
  2. A applet class file don't take main() method for entry point.
  3. Applet codes are embedded in HTML page
  4. For run the applet code in browser, must to install JVM in the client machine
  5. During the execution of applet code in browser, code first to download in the client machine.

Advantages:


  1. Very less response time because Applet designed for client machine. If applet is used for server machine then server take more time to execute applet code.
  2. More secure
  3. Platform independent, so it can run on any platform that is windows, Linux, UNIX, etc.
  4. Use for dynamic application


Disadvantages of applet


  1. For run to its code in browser, must to installed JVM plugin

Thursday, October 2, 2014

Forms of JavaBeans

In the previous article, we have already learn about basic concept of java bean, today i am talking about java beans forms.
Java Beans can appear in two forms:
  1. Visual
  2. Non visual.
Visual is more common, as the majority of Java Beans are extensions of Swing or AWT components. Some Beans may be simple GUI elements such as a specialized button or slider. Others may be sophisticated visual software components such as a diagram component offering different ways to present the bounded data. They all have in common that they can be customized at design time in a builder tool.

Java Beans can also be non visual yet still be customizable using a builder-tool. They do not have to be derived from a specific class or interface, it is recommended that they implement the Serializable interface. In respect of the source code there is no real difference noticeable between a Java Bean and a “normal” Java class. Basically what differs the source code of a “normal” class from a Java Bean is that the latter adheres to the Java Beans API specification in terms of how it is developed. Only the strict adherence to this specification ensures that builder tools can assist a developer to work with Java Beans. For many solutions you can either develop a conventional Java class where you have to write your own code for setting its properties or you can build a Java Bean which allows you To set the properties through the builder tool. Eventually both methods result in code just that in the latter case the builder tool creates the code automatically in the background according to your selection.

Introduction of JavaBeans

A Java Bean is a software component that has been designed to be reusable in a variety of different environments. There is no restriction on the capability of a Bean. It may perform a simple function, such as checking spelling of a document, or a complex function, such as forecasting the performance of a stock portfolio. A Bean may be visible to an end user. One example of this is a button on a graphical user interface. A Mean may also be invisible to a user. Software to decode a stream of multimedia information in real time is an example of this type of building block. A Bean may be designed to work autonomously on a user’s workstation or to work in cooperation with a set of other distributed components. Software to generate a pie chart from a set of data points is an example of a Bean that can execute locally.

A Bean that provides real-time price information from a stock or commodities exchange would need to work in cooperation with other distributed software to obtain its data.

Java Beans components, or beans, are reusable software components that follow simple naming and design conventions so they present a standard interface to other beans, programs, and tools. In the next video tutorial i will learn about forms of java beans.

Wednesday, October 1, 2014

File types, Text and Binary in C

As discussed earlier the C language provides flexibility for the programmers to write file handling programs to store and process data. Such data files contain the data effectively in two formats. So, on the basis of the format structure of the files are of two types, Text File and Binary File.

Text File

In a text file a stream of characters are stored sequentially without any formatting. So, it is very simple to handle but direct access is not possible because any value or character is not stored after fixed number of bytes. Even though the numbers are stored in the form of characters only and the record length is not fixed if the records are stored. Again the records are also stored in the character format of the individual fields.

Similarly, since text files only process characters, generally they can only read or write data one character at a time. But the flexible C Language provides file handling functions to read and write formatted data and lines of text in a text file. But these functions again basically process data one character at a time. The normal functions used to handle the text file are getc(),fgetc(),fgets(), fputs(), putc(),fputc(),fscanf() and fprintf(). These functions transfer the character/s to and from the text file.

Depending on the requirements of the OS (Operating System), newline character may be converted to or from carriage-return/linefeed combination depending on the data is being written to, or read from, the file. Other character conversions may also occur to satisfy the storage requirements of the OS. These translations occur transparently and they occur while processing a text file.

Binary File

A binary file is not much different to a text file. It is also a collection of bytes. But the transfer of data is purely in the form of bytes as stored in main memory. Any number of bytes can be transferred at a time, in binary file. But the length of the bytes transferred is fixed. So, the binary files contain the data in fixed length record format. That is the reason they are more effective than text files. One important advantage of fixed length is that of accessing the record directly. The direct access is possible only in case of the binary files. It is basically because when a record is written to a binary file form the memory, the complete memory block is written. The number of bytes transferred is fixed. In the same manner when the data is read from the binary file the number of bytes is transferred to the memory at the provided address. The file handling functions provided to handle the binary files are fread() and fwrite(). This fixed length transfer is advantageous for direct access but the size of the file increases. So, in comparison to text files the binary files are advantageous in direct access at the cost of the size. Thus a selection of type of file is decided keeping the accessibility of data in mind.

A binary file is also referred to as a character stream but differ in the following ways:

• No special processing of the data occurs and each byte of data is transferred unprocessed to or from the disk.

• C Language places no constraints on the file, and it may be read from, or written to, in any manner.

Binary files can be either processed sequentially or randomly. The processing of a binary file using random access techniques involves moving the file pointer position to an appropriate place in the file before reading or writing data. This indicates a second characteristic of binary files; the binary files are generally processed using read and write operations simultaneously. For example, for the creation and processing a database file the best choice is a binary file. A record update operation will involve locating the appropriate record, reading the record into memory, modifying it in some way, and finally writing the record back to disk at its appropriate location in the file. These kinds of operations are common to many binary files, but are rarely found in applications that process text files.

The type of the file to be processed is decided at the time of opening a file. At the time of opening a file the mode of operation is mentioned indicating text file or binary file. The function fopen() provides the capability of opening a file. By default the file is opened in text mode. If the binary file is to be processed then it is explicitly defined as “b” along with the other required mode character ‘r’, ‘w’ or ‘a’.

When the file is opened the mode of operation is specified. It indicates the types of files “text” and "binary". The text file is advantageous in terms of size and the binary file in terms of random or direct access.

Online Movie ticket booking System project in ASP.NET

Introduction 

Through this software, You can reserve your movie hall ticket online. Basically this system categories in two parts, the first part related to visitor who want to book ticket and second part is related to admin who handle all the privileges like user account, payment account etc. When visitors visit the home page of this site then they will see the first interface of the project that is movie name with full description and book now button. When visitors click on book now button then they will go to the next page that is login page. If the visitors are authenticated person then no need to register again, simply login into the account. After login they will see the seat no , visitor can reserve multiple seat at a time.

Module of the project

  • Viewer module
  • Admin module

Software requirement to run this software

Visual Studio 2013 and windows 8

How to run this project

1. First to open the project in visual studio 2013 
2. Click to green color of triangle button, also you can use ctrl+f5.

Project Module

1. Visitor, who want to reserve seat
2. Admin

Snap Shot of the project

Ticket Booking snap

Ticket Booking snap

Ticket Cancel Snap

Ticket Cancel Snap


How to Download the project

Mail me : narenkumar851@gmail.com
© Copyright 2013 Computer Programming | All Right Reserved