Posted on by Jim Skon
Goal
To examine and set up an SQL based C++ or Python Web phone directory using MySQL
You will use from the following project: https://github.com/jimskon/PhoneBookComplete or https://github.com/jimskon/PhoneBookPython
The project can be tried here: https://cslab.kenyon.edu/class/ssd/skon/PhoneAppComplete/phoneApp.html or https://cslab.kenyon.edu/class/softdev/skon/PhoneAppPython/phoneApp.html
Method
Step 1 – Get the demo software running from your account and with your Database:
Download either the C++ or Python code from the github project (links above)
Get the PhoneBookComplete or PhoneBookPython project with the following command (only works if you have a github account, and have accessed the collaborate invitation I sent):
git clone https://github.com/jimskon/PhoneBookComplete
git clone https://github.com/jimskon/PhoneBookPython
Get it running. You will need to:
- Create your own version of the database.
- Create the Folder PhoneBookComplete in /var/www/html/class/softdev/yourusername/
- Change the names (skon) in the software
- in Makefile change user to your username
- in the Javascript (phoneApp.js) change the, and cgi program name to your username:$.ajax({ url: ‘/cgi-bin/<i><b>skon</b></i>_phoneAppComplete.cgi?deleteid=’+$(this).attr(‘ID’)+’&operation=delete’,
- In PhoneBook.h or phoneApp.py to change USER and DB to your username and PASS to your student ID
#define HOST “localhost”
#define USER “yourusername”
#define DB “yourusername”
#define PASS “yourmyslpasssword” - In phoneApp.cpp change logfile name you your username
- Add a PhoneBookComplete or PhoneBookPython directory to your web directorymkdir /var/www/html/class/softdev/username/PhoneAppComplete mkdir /var/www/html/class/softdev/username/PhoneAppPython
- Type “make” to build and deploy your application
- Add the Routines to the Database (see next step)
- Go to the app in a browser (with your username):https://jimskon.com/class/softdev/username/PhoneAppComplete/
- https://cslab.kenyon.edu/class/ssd/<i><b>username</b></i>/PhoneAppPython/
- Add some records to the data base.
Below is the structure of the database table you will need. You need to create a table named “Phonebook” with the same fields and types, in you database:

Note the “AUTO_INCREMENT” for the ID field. This field is used as the unique ID for every row, and can be used for unambiguously referring to a record when changing or deleting. The “AUTO_INCREMENT” attribute assigns unique inter values for each record in a sequence. To do this click the “A_I” box for the field (you must scroll to the right to see it). This check box is available both then creating the table, and when editing the structure.
Step 2 – Get the system to work with your database.
Turn in a link to you running application.
