Database Applications for Managers Spring 2008  BU4040

Home  |  Syllabus  |  Journal  | Project Exam Research  |  Gallery

Journal Wednesday

 April 9th, 2008

Find a Website that supports C++ one with Java

-Today we will run a simple Telephone operator program and make it work on page.

-This program on page 703

-How does it work if you can explain it will be on the final and worth 20pts.


 

Essay for final -Why does the manager needs to be acquainted with the databases and related issues. How much is lost by not knowing the related issues.

-Encryption

Q1- Your task is to encrypt all sensitive data (security, privacy) in your database and get rid of the original data (delete files or fields ). -The key for running the encryption is "the quick brown fox jumps over the lazy dog". program is not case sensitive, deal with special characters and numbers in your own creative way. To test your program decrypt the data to get to original database. The test data input is HELLO and the encrypted output you should get is PTFFB. Hint, you may want to use an other key for numbers and special characters.(40 points)

"the quick brown fox jumps over the lazy dog"
 abcdefghijklmnopqrstuvwxyz, skip letters that are repeated such as "o", "e"

Q2- You are to design a database from scratch using any file access and memory access mode (sequential, random, array, object, etc.) Be unique and creative. You may want to use C++ or any programming language you are familiar with. show your data file and queries.(30 points)

 

Q3- you are to design a database using access, DB2, Oracle, etc. Use your own SQL query to access the similar data as in question two. (30 points)

Aliweb

From Wikipedia, the free encyclopedia

 
Jump to: navigation, search

ALIWEB (Archie Like Indexing for the WEB) can be considered the first Web search engine, as its predecessors were either built with different purposes (the Wanderer, Gopher) or were literally just indexers (Archie, Veronica and Jughead).

First announced in November 1993[1] by developer Martijn Koster, and presented in May 1994[2] at the First International Conference on the World Wide Web at CERN in Geneva, ALIWEB preceded WebCrawler by several months.[3]

ALIWEB allowed users to submit the locations of index files on their sites[4][3] which enabled the search engine to include webpages and add user-written page descriptions and keywords. This empowered webmasters to define the terms that would lead users to their pages, and also avoided setting bots (e.g. the Wanderer) which used up bandwidth. As relatively few people submitted their sites, ALIWEB was not very widely used.

Martijn Koster, who was also instrumental in the creation of the Robots Exclusion Standard,[5][6] detailed the background and objectives of ALIWEB with an overview of its functions and framework in the paper he presented at CERN.[2]

Koster explicitly and unequivocally repudiates the commercial "aliweb.com" website.[7]

 

WHAT IS CGI (COMMON GATEWAY INTERFACE)

CGI stands for Common Gateway Interface and is a simple protocol (standard) to establish a communication (interaction) between your Web page (located anywhere) via a browser and your program that resides on a Web server. The CGI program (e.g. C++, or Perl) processes data submitted by a form and performs requested tasks such as searching. After submitting a form, the browser uses HTTP to make a request for the URL of a CGI program. The Web server receives the request and executes the CGI program with the data that is passed. The output of the CGI program is usually in the form of a web page which is sent back through the Web server to the requesting browser. An example of CGI usage is a database program that runs on the Internet and lets individuals manipulate the database through the web.

Note that a CGI program is executable and resides in a special directory under the direct control of a Webmaster, commonly known as /cgi-bin, so that the Web server is directed to execute the CGI program rather than just display it to the browser.

 

 

WRITING A CGI IN C++

 

A CGI takes information from forms on a Web page, processes it, and sends a page back to the user. A CGI program written in C++ is nothing more than just another C++ program that accepts a string as its input and breaks down the input string into tokens (words) and identifies and processes the input based on the requested task. CGI is language independent and the languages Perl and Python or even a script language such as Unix shell can be used to write a CGI program. One caution, do not try to use Java to write a CGI; instead, use Java Servlets. The language Perl, because of its sophisticated pattern matching (regular expressions), has been the language of choice for writing CGI programs. However, you can stick to C/C++ and write a CGI, rather than using other languages.

 

In summary, in order to write a simple CGI program in C++, use the input routines of C++ cin or getline( ) to take the data as if it were on a standard input (stdin) with the understanding of how the inputs are separated from each other (e.g. by & or by ; ). After that, a CGI program is another C++ program and when all processing is done, at the end, the CGI program has to communicate to the web page or create a new one. The CGI communicates back to the web page through the standard output (stdout) such as cout with embedded HTML tags inside the quotations. Note that the CGI program takes input from the HTML form and encodes it (URL encoding) by making a single string, since URL does not allow spaces. Instead of spaces, separators (delimiters) such as & (ampersand) and = (equal sign) are used. In the following example, the string with two input data such as the first name and last name are separated with & is sent to the CGI and the program has to strip the f= and save the values correspondingly. For simplicity, we are using one letter for the name of the field.

f=John&f=Doe

 

 

C++ CGI PROGRAM

 

The following HTML file consists of a form with one input data and we want to send the input and get a response by echoing the input back. At first, an HTML file is created and, in the form tag, the action is specified by indicating the name of the executable CGI program (e.g. ebrahimi.cgi) which resides in the /cgi-bin directory. The method of sending the data to the CGI program is POST where the data is sent via the program’s standard input in contrast to the other method GET where the data is sent through a program variable name known as environment variable. For the sake of simplicity, the field’s name is chosen as one character (e.g. f ) which with the = sign makes two characters (e.g. f =). One job of the CGI is to strip off these two characters and save the rest (e.g. value). The following CGI program takes the encoded URL, strips the first two characters, and saves the rest of the string into another string (e.g. str2), which is echoed back to the user. 

 

Note that the "Content-type: text/html\n\n" in

cout<<"Content-type: text/html\n\n";

will inform the server that the CGI program is about to send data to the user in the form of an HTML page. Make sure to include the newline (\n).

 

If you need to convert the above C++ program to C language for the reason of speed, you only need to change cin to scanf(“%s”,  ) and cout to printf( “%s”, ) and make sure to include #include <stdio.h>.


 

 


 

CGI is to get the impute from the form a string and strip the unnecessary characters and put it to the right variable.