Due Wednesday, 10/15/2014 by 11:00pm
The CS143 project may be completed individually or in teams of two, the choice is up to each student. Partnership rules consist of the following:
Please make sure to submit your work jointly - do not turn your project in twice, once for each partner.
The primary purpose of this first "PHP warm-up" part is for us to provide you with a whole bunch of basic information, and to get everyone up-to-speed on our computing systems and the languages and tools we will be using. Those of you who have done some Web programming before, especially in PHP, may find this project part nearly trivial. Those of you who haven't will find it merely straightforward. With all that said, please don't start at the last minute -- as with all programming and systems work, everything takes a bit of time, and unforeseen snafus do crop up.
We will be using VirtualBox to run the Linux operating system in a virtual machine. VirtualBox allows a single machine to share resources and run multiple operating systems simultaneously. Read our VirtualBox setup instruction (Windows) (Mac) and follow the instructions to install VirtualBox and our virtual-machine image on your own machine. (Particularly, if you are a mac user and see an "vboxnet0" error, please make sure you follow our mac instruction above step by step.)
The provided virtual machine image is based on Ubuntu 7.10, MySQL 5.0.45, Apache 2.2.4, and PHP 5.2.3. You will need to use the provided VirtualBox guest OS to develop and test all projects for this class. Your VirtualBox guest is essentially a Linux machine, which is a variant of Unix. If you are not familiar with Unix, now is the time to read the Unix Tutorial for Beginners to learn the basic Unix commands.
In this part of the project you will familiarize yourself with Apache2/PHP by building a small Web calculator application in PHP.
${HOME}/www/
directory in the guest OS, which is aliased (or symbolic linked) to the VirtualBox shared directory. All files in ${HOME}/www/
are served by the guest Apache server and are accessible at http://[guest IP]/~cs143/
from your host browser. Note that ${HOME}
is common Unix notation to refer to your home directory, which is /home/cs143/
in our setup and [guest ip] is the IP of your guest machine, which is set up to be 192.168.56.20.
http://[guest IP]/~cs143/calculator.php
. At the minimum, your calculator application should satisfy the following requirements.
In implementing your calculator, you may find the PHP functions, preg_match()
and eval()
helpful. If you are not familiar with regular expression, read a tutorial on regular expression like Mastering regular expression in PHP. If you are not familiar with the HTML input forms, you may also find our tutorial on PHP input handling helpful.
To accommodate the emergencies that students may encounter, each team has 4-day grace period for late submission. The grace period can be used for any part of the project in the unit of one day. For example, a student may use 1-day grace period for Project 1A and 2-day grace period for Project 2B. Any single project part may not be more than 2 days late. Note that even if a team submits a project 12 hours late, they would need to use a full day grace period to avoid late penalty. If your project is submitted late, we will automatically use the available days in your grace period unless you specifically mention otherwise in the README file.
Please submit the following files electronically:
calculator.php
source code. Again, please make sure that all URLs in your code are relative. You may get zero point otherwise. Visit the Project 1A submission page to submit electronically by the deadline. In order to accomodate the last minite snafu during submission, you will have 30-minute window after the deadline to finish your submission process. That is, as long as you start your submission before the deadline and complete within 30 minutes after the deadline, we won't deduct your grade period without any penalty.
A: We will not use any positive sign before a number, but a negative sign needs to be supported. For example, we may test expressions like "3*-2" or "-2/-3" or "1+-1".
A: All fractional numbers will have a leading zero in our test, but you are welcome to handle .123