Lab 2

Part 1 Apache and MySQL
  1. Find the XAMPP control panel from the Windows menu. Click it to start and you will see the below screen. Start MySQL and Apache if you want using phpMyAdmin to manage MySQL database contents. The "Admin" button of MySQL will be switched on after you start MySQL.

  2. create a working directory lab2 and download the source files from week2 and week3 tutorial folder. Import all files into Eclipse.
  3. export "sb*.py" and "pydb*.py" files or copy from your working directory to "../xampp/cgi-bin/" directory

  4. start xampp control panel and click the "Start" button of Apache and MySQL

  5. modify server config and python location in first line of all server side files and test run all programs.

  6. install pymysql and test run "pydbp3.py"

    • Shift+Right-Click to start command prompt in the directory created
    • type "pip install pymysql"
    • download the sample database from www.mysqltutorial.org or use the one in week3 tutorial folder
    • type 127.0.0.1 or localhost
    • click phpMyAdmin and import the SQL file to create the sample database.

    • choose the "mysqlsampledatabase.sql", uncheck the the "Enable foreign key checks" check box
    • open "localhost/cgi-bin/pydbp3.py" with IE/Chrome

Part 2 Programming exercises.

  1. Given the sbUsingClientClassWithErrorhandling.py programmes from lab 4 and 5 (Canvas Page Week 9) in 121COM last semester, design and implement a GUI simple billing system which produces the customer table in a scrolling text window.

  2. Copy and modify the content of mysqlsampledatabase.sql and paste into the SQL execution area of phpMyadmin to create a table to store customer name, address, and balance.

  3. Create a python program to implement the simple billing application using the table created in task 2, and display the customer table below.

    Customer Table

    customerNameAddressBalance
    Baba Li 2000 E. 21st Street 450.00
    Jay Law 9103 Problem Area -25.00
    Sue Wong 9102 Kowloon Circle 4.50

  4. Rewrite "sbsort.py" and "sbsearch.py" to implement the sorting and searching functions using the table created.

  5. Design and implement a GUI version of billing system with sorting menu as follows: