Sunday, August 22, 2010

HTTP MAIL SERVER


CERTIFICATE

This is to certify that Tanveen Raza, Sandeep Singh, Sushant Gupta, student friendship School of Engineering and Technology B. Tech (Computer Science and Engineering) from 2008-12 batch have been successfully carried out their project.

While they were busy with a good knowledge of web design and implementation, during the period they were assigned to the project, titled "Mail Server". They have done this project using HTML, JSP, MySQL and Apache Tomcat Server.

During the project there was a positive attitude towards the achievement of project activities.



ABSTRACT

The project earlier Mail Server is a kind of "Mail Management System, which attempts to property services available mailing lists now emulate a day, such as Gmail, Hotmail, etc. .. It is based on Internet communication protocols and is an online sytem that can be used anywhere in the world via the Internet.

The main objective of the proposed system is to provide broadcast services to different customers online. Listed below are the various services provided by the system

Read Mail
Compose Mail
Send a message
Delete Mail
In addition to the above services are offered, there are many other services related to all those who opstellen database like lists of contacts from one customer, etc. The operating principle of the above project is simply based on the fact that a collection of profiles of different users, which are stored in the database and is retrieved via different protocols.

With a profile, we mean that the user exists on the system and was checked with the system that makes good use of security mechanism.

Since the above project aims to achieve comparable results to other providers of broadcasting services to produce by means of exploiting the concepts of Java and the management system database making it unable to interact with other management systems e-mail, because it does not support SMTP, POP protocols and uses the HTTP protocol (an exception to other providers of courier). The reason is security concerns and other restrictions Protocol mismatch.

It is based on MySQL DBMS system can handle multiple clients at once without any database problem. Here, all e-mails are stored in the MySQL database, as well as the Sender ID and the ID of Mailer. Each user can be member of this system, no charge.



INTRODUCTION

HTTP Mail Server is a very interesting topic because it is based on HTTP and SMTP not POP, all e-mails are managed by the HTTP programming in this project. It is self-Mail Server and Mail Management Project and all subjects Hot Java will be used (wire, processing files and streaming, downloading files, etc. Database Connectivity). There is no need of SMTP, POP only works over HTTP. Now, all transactions on the Net via HTTP instead of FTP so it is new and consume fewer resources.



1.1 Purpose

HTTP Mail Server is based on the Internet system, you can use it anywhere in the world via the Internet. In fact, the collection of profiles of users who have already registered. After winning the " Mail management "system allows the user

· Read the e-mail
· Set the Mail
The · Send Mail
• Deleting Mail
He can not deliver mail to other management system interaction, because it is not based on SMTP, POP is a protocol private protocols for the management system e-mail. It is based on MySQL DBMS system can handle multiple clients simultaneously without any database problem. Here, all mails are stored as files with the database ID of the sender and the Mailer ID. Each user can be member of this system, no charge.



1.2 Description of Project



The "HTTP Mail Server is a project management e-mail within the network, under the registered users. Users can easily register using their personal information and choose a username and password. Only registered users can log into the system. Once logged registered users can keep their inbox, sent e-mails of a project. They can also send emails to other registered users with attachments or without attachments. Displays all information stored in the database and the hard disk as a file.

Our project is very advanced and easy to use. By clicking on a button, users can get online registration, are able to e-mails, check their inbox, outbox, draft. The administrator has the authority to conduct an operation in the Web application, as can the update, find and delete information from one part of the application.

• The fundamental objective of this project is to send and receive e-mails.
• For creating databases of various entities involved in this system.
· Maintain database contains information on the different users are available.
· The implementation of this system, user information to retrieve messages.
• The user can see the total number of emails available in their inbox.

· Users have the authentication delete or save messages on electronic design.

· The administrator can maintain and view the user profile.

Syntax of JSP directives are as follows:

%">attribute directive "

taglib: taglib is used to create custom tags in JSP pages (custom code to enable us to provide our own words) to define.
en de eigenschap kan worden:">Example: and the property can be:
1.language = "java" This tells the server that the page uses Java. Current specification supports only JSP Java. % java"">Example: "
3.session = "true"
When this value is true session data available to the JSP page otherwise not. By default, this value is true.
= "error.jsp"">Example: = "error.jsp"
4.errorPage is used to treat exceptions untreated into the page.
% error.jsp"">Example:
">
Advantages of JSP

">One of the main reasons why Java Server Pages has become what he is and he is still in development is the overwhelming noodzaak technology to simplify application design by separating dynamic content from static data model. Another advantage of the use of JSP is that it allows a clearer separation of roles of the internet / HTML designer from a software developer. JSP technology has a number of attractive benefits which are recorded as follows:
1. JSP technology is platform independent, in its dynamic web pages, web servers, servers and underlying components. It is, JSP pages to perform well without any effort on any platform, works on any web server and application server compatible. JSP pages are accessible from any Web server.
2. JSP technology emphasizes the use of reusable components. These components can be combined or manipulated in the direction of developing more targeted components and design pages. This reduces the development of non-point development time, are very different JSP servlet, but they have been compiled in preparation for the implementation of servlets and executed by a JSP engine, which is installed on a server 'Web-enabled application such as BEA WebLogic and IBM WebSphere.
">
">

· JRE (Java Runtime Environment)

The J2SE(TM) Runtime Environment (JRE) is intended for software developers and vendors to redistribute with their applications.

The J2SE Runtime Environment contains the Java virtual machine, runtime class libraries, and Java application launcher that are necessary to run programs written in the Java programming language. It is not a development environment and does not contain development tools such as compilers or debuggers.

Runtime Environment

To run your application, a user needs the J2SE Runtime Environment, which is freely available from Sun. Or, you can redistribute the J2SE Runtime Environment for free with your application, according to the terms of the Runtime Environment's license.

The final step in the deployment process occurs when the software is installed on individual user system. Installation consists of copying software onto the user's system, then configuring the user's system to support that software. You should ensure that your installation procedure does not overwrite existing JRE installations, as they may be required by other applications.

Required vs. Optional Files

The files that make up the J2SE Runtime Environment are divided into two categories: required and optional. Optional files may be excluded from redistributions of the J2SE Runtime Environment at the licensee's discretion. The following section contains a list of the files and directories that may optionally be omitted from redistributions with the J2SE Runtime Environment. All files not in these lists of optional files must be included in redistributions of the runtime environment.

Optional Files and Directories

The following files may be optionally excluded from redistributions. These files are located in the jre1.5.0 directory, where is the update version number. Solaris and Linux filenames and separators are shown. Windows executables have the ".exe" suffix. Corresponding files with _g in name can also be excluded.

· Apache Tomcat

Apache Tomcat (or Jakarta Tomcat or simply Tomcat) is an open source servlet container developed by the Apache Software Foundation (ASF). Tomcat implements the Java Servlet and the JavaServer Pages (JSP) specifications from Sun Microsystems, and provides a "pure Java" HTTP web server environment for Java code to run.[4]

Tomcat should not be confused with the Apache web server, which is a C implementation of an HTTP web server; these two web servers are not bundled together. Apache Tomcat includes tools for configuration and management, but can also be configured by editing XML configuration files. Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages technologies. The Java Servlet and JavaServer Pages specifications are developed under the Java Community Process.

Apache Tomcat is developed in an open and participatory environment and released under the Apache License version 2. Apache Tomcat is intended to be a collaboration of the best-of-breed developers from around the world. We invite you to participate in this open development project. Apache Tomcat powers numerous large-scale, mission-critical web applications across a diverse range of industries and organizations.

· HTML (Hyper Text Markup Language)

Introduction:

· HTML is a language for describing web pages.

· HTML stands for Hyper Text Markup Language

· HTML is not a programming language, it is a markup language A markup language is a set of markup tags

· HTML uses markup tags to describe web pages.

HTML Tags

· HTML markup tags are usually called HTML tags.

· HTML tags are keywords surrounded by angle brackets like

· HTML tags normally come in pairs like and

· The first tag in a pair is the start tag, the second tag is the end tag.

· Start and end tags are also called opening tags and closing tags.

· CSS (Cascading Style Sheets)

Introduction

· CSS stands for Cascading Style Sheets.

· Styles define how to display HTML elements.

· Styles were added to HTML 4.0 to solve a problem.

· External Style Sheets can save a lot of work.

· External Style Sheets are stored in CSS files.

When tags like , and color attributes were added to the HTML 3.2 specification, it started a nightmare for web developers. Development of large web sites, where fonts and color information were added to every single page, became a long and expensive process. To solve this problem, the World Wide Web Consortium (W3C) created CSS.In HTML 4.0, all formatting could be removed from the HTML document, and stored in a separate CSS file. All browsers support CSS today.[5]

· Java Script

Introduction

JavaScript is the most popular scripting language on the internet, and works in all major browsers, such as Internet Explorer, Firefox, Chrome, Opera, and Safari.

· JavaScript was designed to add interactivity to HTML pages.

· JavaScript is a scripting language.

· A scripting language is a lightweight programming language.

· JavaScript is usually embedded directly into HTML pages.

· JavaScript is an interpreted language (means that scripts execute without preliminary compilation).

· Everyone can use JavaScript without purchasing a license.

What can a JavaScript do?

· JavaScript gives HTML designers a programming tool - HTML authors are normally not programmers, but JavaScript is a scripting language with a very simple syntax! Almost anyone can put small "snippets" of code into their HTML pages.

· JavaScript can put dynamic text into an HTML page - A JavaScript statement like this: document.write("

" + name + "

") can write a variable text into an HTML page.

· JavaScript can react to events - A JavaScript can be set to execute when something happens, like when a page has finished loading or when a user clicks on an HTML element.

· JavaScript can read and write HTML elements - A JavaScript can read and change the content of an HTML element

· JavaScript can be used to validate data - A JavaScript can be used to validate form data before it is submitted to a server. This saves the server from extra processing

· JavaScript can be used to detect the visitor's browser - A JavaScript can be used to detect the visitor's browser, and - depending on the browser - load another page specifically designed for that browser

· JavaScript can be used to create cookies - A JavaScript can be used to store and retrieve information on the visitor's computer.

· Mysql

Introduction

MySQL is a relational database management system (RDBMS) that runs as a server providing multi-user access to a number of databases. The MySQL development project has made its source code available under the terms of the GNU General Public License, as well as under a variety of proprietary agreements. MySQL is owned and sponsored by a single for-profit firm, the Swedish company MySQL AB, now owned by Sun Microsystems, a subsidiary of Oracle Corporation. Members of the MySQL community have created several forks such as Drizzle and MariaDB. Both forks were in progress before the Oracle acquisition (Drizzle was announced 8 months before the Sun acquisition).

Creating Tables

To create table we use the CREATE TABLE statement. The usual form of this statement is:[6]

CREATE TABLE [IF NOT EXISTS] table_name(

column_list

) type=table_type

MySQL supports IF NOT EXISTS after CREATE TABLE statement to prevent you from error to create table which already exists on the database server. table_name is the name of table you would like to create. After that, you can define a set of columns which is usually in this form: column_name data_type(size) [NOT] NULL. And finally, you can specify the storage engine type you prefer to use for the table. MySQL supports various storage engines such as InnoDB, MyISAM... If you don't explicit declare storage engine type, MySQL will use MyISAM by default.

In our classicmodels sample database, to create employees table we can apply the statement above as follows:

CREATE TABLE employees ( employeeNumber int(11) NOT NULL,

lastName varchar(50) NOT NULL,

firstName varchar(50) NOT NULL,

extension varchar(10) NOT NULL,

email varchar(100) NOT NULL, 0);

Showing and Describing Tables in a Database

In order to show all tables in a database you use SHOW TABLES statment, the server will returns all tables name of the current selected database you work with.

Selecting Data with SQL

SQL IN allows you to select values which match any one of a list of values. The usage of SQL IN is as follows:

SELECT column_list

FROM table_name

WHERE column IN ("list_item1","list_item2"…)

The column in WHERE clause does not need to be in column_list you selected, but it has to be a column in the table table_name. If the list has more than one value, each item has to be separated by a comma.

· Java Database Connectivity (JDBC)

The Java Database Connectivity (JDBC) API is the industry standard for database-independent connectivity between the Java programming language and a wide range of databases – SQL databases and other tabular data sources, such as spreadsheets or flat files. The JDBC API provides a call-level API for SQL-based database access.

JDBC driver types

JDBC drivers are divided into four types or levels. Each type defines a JDBC driver implementation with increasingly higher levels of platform independence, performance, and deployment administration. The four types are:

  • Type 1: JDBC-ODBC Bridge
  • Type 2: Native-API/partly Java driver
  • Type 3: Net-protocol/all-Java driver
  • Type 4: Native-protocol/all-Java driver

Type 1 Driver - JDBC-ODBC bridge

The JDBC type 1 driver, also known as the JDBC-ODBC bridge, is a database driver implementation that employs the ODBC driver to connect to the database. The driver converts JDBC method calls into ODBC function calls.

Functions

  • Translates query obtained by JDBC into corresponding ODBC query, which is then handled by the ODBC driver.
  • Sun provides a JDBC-ODBC Bridge driver. sun.jdbc.odbc.JdbcOdbcDriver. This driver is native code and not Java, and is closed source.
  • Client -> JDBC Driver -> ODBC Driver -> Database
  • There is some overhead associated with the translation work to go from JDBC to ODBC.

Advantages

  • Almost any database for which ODBC driver is installed, can be accessed.
  • A type 1 driver is easy to install.

Disadvantages

  • Performance overhead since the calls have to go through the JDBC overhead bridge to the ODBC driver, then to the native db connectivity interface.
  • The ODBC driver needs to be installed on the client machine.
  • Considering the client-side software needed, this is not suitable for applets.

RESULT AND DISCUSSION

4.1 User Interface Design

The User Interface design is a proposed design of the mail server.

1. Login

The figure below shows the login page for “HTTP Mail Server”. This page is used to authenticate every user. Options like Sign up, Admin Login and Forgot password are available on this page.

2. Home Page

The figure below shows the home page of “HTTP Mail Server” after login. Various options like Inbox, Outbox, Drafts, and Compose are available. Clicking on them would lead to individual pages. Sign Out option available would help us leave our account so that it is not accessible by others and would take us back to the login page.

3. Inbox

The figure below shows the inbox page for “HTTP Mail Server”. This page contains the mail messages sent from other users.

4. Outbox

The figure below shows the outbox page for “HTTP Mail Server”. This page contains the sent mail messages sent to other users.

5. Draft

The figure below shows the draft page for “HTTP Mail Server”. This page contains the saved messages by the users.

6. Compose

The figure below shows the compose page for “HTTP Mail Server”. This page is used to compose the mail messages.

7. File Attachment

The figure below shows the file attachment page for “HTTP Mail Server”. This page is used to attach the file to the mail messages.

8. Admin Login

The figure below shows the login page for “HTTP Mail Server” administrator. This page is used to authenticate the admin.

9. Admin home page

The figure below shows the administrator home page for “HTTP Mail Server”. This page contains the detail information of registered users.

10. Signup

The figure below shows the registration page for “HTTP Mail Server”. This page contains the personal information of the user to be filled during registration along with the security question and answer in case we forget our password. After filling in the details and clicking on the submit button would create our account.

11. Forgot Password

The figure below shows the Forgot Password page for “HTTP Mail Server”. The following option can be used in case we forget our password and the new password would either be mailed to our alternate user id or after providing the security ques and answer, it would help us to change our password.

Wednesday, August 11, 2010

Designing DFA






















CERTIFICATE



This is to certify that Mr. Varun Arora, Mr. Ujjwal Saini and Mr. Vivek Sharma of B.Tech. in Computer Science Engineering have carried out the work presented in the project of entitled “Designing DFA using C++” as a part of Third year programme of Bachelor of Technology in Computer Science from Amity School of Engineering and Technology, Amity University, Noida, Uttar Pradesh under my supervision.



Acknowledgements

We would like to thank the people who helped us in completing this project. We express our Gratitude to Mr. Ramen Ghosh to give us a chance to work on such an interesting topic, which helped us a lot in increasing our knowledge as well as our scope so we thank you sir for letting us to choose this project.

We owe a lot of credit to our parents and friends who supported us in our project landing to the completion of the project. We would also like to thank our elders for giving us important information for our project. And thanks to all others for extending the fullest cooperation during the preparation of the project and assisting us in their every possible way for its successful completion. We also confirm that the project submitted by us is totally authentic and the research undertaken was not copied from external sources.


Abstract



This project relates to design a DFA (Deterministic Finite Automata) with the given inputs using graphics in C programming language. In the theory of computation, a deterministic finite state machine is a finite state machine where for each pair of state and input symbol there may be several possible next states. The machine starts in the specified initial state and reads in a string of symbols from its alphabet. The automaton uses the state transition function T to determine the next state using the current state, and the symbol just read or the empty string. However, "the next state of an DFA depends not only on the current input event, but also on an arbitrary number of subsequent input events. Until these subsequent events occur it is not possible to determine which state the machine is in". If, when the automaton has finished reading, it is in an accepting state, the DFA is said to accept the string, otherwise it is said to reject the string.


Requirement Analysis and Specification


To design a program or software that will be a FA( Finite Automata ) tool that will handle different types of Automata like NFA( non deterministic finite Automata ), DFA( deterministic finite automata ) etc.

Expected solution:-

The problem to design the above mentioned tool is programming language independent and hence can be made on different platforms but if the selection is to be made out of programming language, the available choices to design a DFA and check the acceptance of any string to that DFA are:-

  1. Java:-JFLAP is a software with formal language topics including NFA, non deterministic push down automata, TM, and several types of grammars. It also allows one to convert NFA to DFA which can be modified further.
  2. C/C++:-In C/C++, graphics libraries can be used to draw NFA or DFA depending upon the transition table which contains transitions between the states and initial and final state which is to be input before the designing of DFA and then the program will also ask for a string of input alphabets which will be checked for the acceptance to that DFA.

Opted solution:-

As in Java, the JFLAP tool already designed, there is no such programming software in C which draws DFA or check the acceptance of string. The opted solution is designing of DFA using C/C++ and graphics library present with C/C++ programming language.

Software Requirement:-

Windows: xp, 2000 or 98. Turbo c or broadband C++ with graphics library. For vista or windows 7, virtual pc is required.



Input Table Format

D

A

B

q1

q4

q2

q2

q3

q7

q3

q1

q4

q4

q8

q2

q5

q7

q6

q6

q1

q8

q7

q1

-

q8

q3

q7




Algorithm


1. Step 1. Declare Structure node {

int num;

int xc, yc;

int ina;

int inb;

}

Step 2. Initialise graphics

Step 3. Display Welcome Screen

Step 4. Input number of states

Step 5. If number of states greater than 8, go to step 4.

Step 6. Initialise center of states according to number of states.

Step 7. Call table (states). Algorithm 2.

Step 8. Call state input (). Algorithm 3

Step 9. Call draw (). Algorithm 4

Step 10. Call Check (). Algorithm 5

Step 11. Exit.

2. Table (states)

Step 1. Put values of transitions if no transition then put ‘-‘

Step 2. Draw table according to number of states as

D

A

B

Q1

-

-

Q2

-

-

Q3

-

-

3. State input ()

Step 1. Input Transition

Step 2. For state from i=1 to number of states

Repeat steps 3 to 7

Step 3. Input transition of states q: for input a

Step 4. If qi – a – is greater than number of states go to step 3.

Step 5. Input transition of states q: for input b

Step 6. If qi – b– is greater than number of states go to step 5.

Step 7. Draw table call table () Algorithm 2.

Step 8. Input initial state is

Step 9. If is greater than number of states go to step 8.

Step 10.Input Final state fs

Step 11. If fs greater than number of states, go to step 10.

Step 12. Display ‘>‘ for initial state and ‘ * ‘ for final state.

4. Draw ()

Step 1. For states from i = 1 to number of states

Repeat step 2

Step 2. If transition of state qi = qi , put a (*) inside the state(circle) else

Draw states qi for input a and b

Step 3. Draw double circle for final state and arrow for initial state.

5. Check ()

Step 1. Ask user if he/she want to check the acceptance of string to that DFA

If yes

Go to step 2

Else

Go to step 5

Step 2. Input the string

Step 3. Check whether it contains alphabets other than ‘a’ and ‘b’

If yes

Show error and go to step 1 else go to step 4

Step 4. Displays the transition of states for that string and call table () Algorithm 2.

Step 5. Displays thank you page.



Implementation and Software Requirement


This project can be used to obtain a DFA by giving the transition of various different states on a particular input alphabet. This program can also check the acceptance of a string (That is the machine is in accepting state after the acceptance of string, or not).

The set of all strings accepted by an DFA is the language the DFA accepts. This language is a regular language.This project is designed using the concepts of C/C++ languages using turbo C++ compiler and graphics in C++.The project is based on Theory of automata. The deterministic Finite Automata is designed through taking input as set of states and the transition from one state to another by giving an input. The project is made using Turbo c++ and the language used for making this project is the language C. In this the graphics library of C is also used to design the automata machine. And this program will also check the acceptance of the given string by transiting from one state to another, if the automata stop at accepting state then the string is accepted, else it will show an error.


Conclusion

In this project the concept of c++ and graphics is used. In this first the user is ask to enter the number of states (max 8). Then the transition table appears. Then it asks the user to enter the values for transition of various states that is for “a” and “b” respectively. Then on entering the values for transition of various states the table will appear indicating the states to which transition has to take place. It will keep on asking to enter the values till the maximum number of states is reached.

After this it asks to enter the initial state and final state. Now the table is complete with the initial state indicated by “>” and the final state by “*”. Now press enter to get the equivalent DFA. Here the red color line indicates the transition for value “a” and Green color line indicates the transition for value “b”.

“*” indicates self state.

Achievement

This project deals with the designing of DFA using c++ and graphics. The program uses graphics functions, 
which we have learnt in c++. 
In this project concepts of Theory of automata and Computer Graphics have been used which were taught
 in the early semesters.
As this project is based on TAC, the concept of DFA is successfully implemented and also to check the acceptance 
of any string to that DFA being designed by the program is taken from TAC. To draw the states and showing the transition of states in Transition Diagram, some concepts of Computer Graphics have been used like Bresenham's Algorithm to draw the states shown by circles, Rotation algorithm to join the states according to transition table. Basic graphics concepts such as rectangle, line colors etc. have also been used.