Tags: %TAGME{ tpaction="" web="Main" tag="" }% view all tags

SQL Based Phone Directory

Moodle Entry

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/expertlearningsystems/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)

This should be done with the followings:

  1. (MAC) Open a terminal
    type: "ssh username@cslab.kenyon.edu"
    Enter your student ID as the password

    (Windows) Download Putty. Run Putty. Enter "cslab.kenyon.edu" for IP, Hit open. Hit "Ok" for the security warning. Enter your Kenyon username and your student ID for password.

  2. 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/expertlearningsystems/PhoneBookComplete git clone https://github.com/expertlearningsystems/PhoneBookPython
 

Get it running. You will need to:

  1. Create your own version of the database.
  2. Create the Folder PhoneBookComplete in /var/www/html/class/ssd/yourusername/
  3. 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 "<i>skon</i>" #define DB "<i>PhoneAppDB</i>" #define PASS "<i>password</i>"
    • In phoneApp.cpp change logfile name you your username
  4. Add a PhoneBookComplete or PhoneBookPython directory to your web directory
    mkdir /var/www/html/class/ssd/username/PhoneAppComplete mkdir /var/www/html/class/ssd/username/PhoneAppPython
  5. Type "make" to build and deploy your application
  6. Add the Routines to the Database (see next step)
  7. Go to the app in a browser (with your username):
    https://cslab.kenyon.edu/class/ssd/<i><b>username</b></i>/PhoneAppComplete/
  8. https://cslab.kenyon.edu/class/ssd/<i><b>username</b></i>/PhoneAppPython/
  9. 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:

Screen_Shot_2018-02-15_at_4.27.14_PM.png

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 refering 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 avalable both then creating the table, and when editing the structure.

Step 3 - Get the system to work with your database.

Turn in a link to you running application.

Topic revision: r1 - 2020-01-22 - JimSkon
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback