Web Programming Languages

About this project

This project attempts to perform different CGI and dynamic web operations in a variety of languages. The languages are all configured to use CGI, so we can use Apache to serve them up without a lot of extra configuration.

The project uses these languages and technologies: PHP, Perl, Python, Ruby, JavaScript, and Ajax.

The project performs these functions and activities: HTML tables and forms, server directory and file access, and MySQL database access.

How to use it

To use the project, select a language or technology from the upper list, then select an activity or function from the lower list.

The databases are live, so any changes or additions you make will be visible to other users of the site.

Languages and Technologies

PHP

PHP can present the dynamic code inline with the regular HTML. The other languages must print out all the HTML as dynamic code, or else include it from template files.

Perl, Python, Ruby

These interpreted script langauges can be used for CGI by doing these steps:

JavaScript

JavaScript cannot do many server functions such as file access and database access, but it can simulate these functions using HTML5 local storage. For this reason, the JavaScript code modifies its own databases, which are indepdent of the databases used by the other server langauges.

Ajax, JSON, and XML

These are single-page applications. (SPA's). Once the home page is initially loaded, no reloads are required, even when changing views. They use HTML and JavaScript on the front end, and also a back end data server written in PHP. The data server could have been written in any of these other languages. The server generates the information unique to each view.

The Ajax version transfers the entire HTML content of the "content" div on every page change.

The JSON version transfers only the data, which is assembled into HTML content by the client. The data transferred is smaller, but more work is done on the client.

The XML version transfers only the data, which is assembled into HTML content by the client. The XML data is larger than the JXON data.

Functions and Activities

The project attempts to perform the following basic functions in each language:

  1. Draw a table that has dynamic data.
  2. Read a list of image files from a directory, and draw the images with captions.
  3. Read data from a file and draw it in an HTML table.
  4. Write data from an HTML form into the same table.
  5. Read data from a MySQL database and draw it in an HTML table.
  6. Write data from an HTML form into the same MySQL database.

This demonstrates the basic functions necessary for any web site:

Servers and Installation

After copying the code to a new server, the following must usually be done:

  1. Install the MySQL tables using the scripts in the data directory. Some adjustments to the connect scripts may be necessary.
  2. Compile the C++ and Java code. Some adjustments to the make scripts for C++ and Java may be necessary.
  3. Determine if Ruby and C# (Mono) are installed on the server. (PHP, Perl, Python, g++, and javac are usually already installed.) Some adjustments to the warnings on the Ruby and Java pages may be necessary.

Statistics

PHP files (used for Ajax server also)61
HTML files19
Python files14
Ruby files12
Perl files12
JavaScript files12
CSH files3
SQL files2
CSS files1
Total code files 171