CS 207 Lab 1

Week of 22-26 January 2021

Generally what you need for the coming labs

To give scope to your lab exercises in this class, you need to imagine or invent or use some actual organization or business. It could be a recreational trail, an online seller of electronic gadgets, a hockey league, a singer-songwriter's fan club, a student newspaper, tours to the moon, etc.

In general, you need to know that databases usually contain many: many and many:one relationships. A club member may participate in several activities, each activity may involve many members. A pizza may have many toppings.

You want to be able to implement a variety of database actions, including searching, adding and modifying data, for example:

What to do this week:

As you may have no form at all yet, or in the other extreme completely satisfactory ones, do the minimum of both steps 2 and 3, and all the rest of either one.
  1. Sign in to the class by using my sign-up form. (This will give you a "secret code" that you will need for exams.).
  2. Some SQL practice (see below)
  3. Create a "main" page for your organization, and some form. If you skipped 203, create your "Home page," name it index.html - this is necessary for me to find your work!

2. SQL

You now have an account on osiris.ubishops.ca, which uses the linux operating system. You might need to read some Notes on Using Linux, that I wrote also for cs216. (ignore anything about "x2go", that doesn't exist on Osiris)

Osiris has a web server and a database server (psql). You are also a database user, and have a database, both with the same name as your osiris login. (I think)

Minimum: Put yourself in the table STUDENTS of database TIMETABLE, use your actual linux login name (account code) -- I expect to find you there.
  1. Open a terminal on your
    1. Mac or Linux computer, and type yourusername@osiris.ubishops.ca
      type your password when asked, and you are now "on osiris"
    2. Windows computer, [download and] open PuTTY, put in host: osiris.ubishops.ca
      A black window will open, ans ask for your username, and then password.
  2. psql timetable
  3. \d students
  4. insert into students values(...);
The rest:
  1. Find some courses to register in (at least 3, including CSC107B01)
  2. Do a select query that lists your courses, with at least course, title, and prof, and
  3. Copy both the select query and its result from the terminal, and paste into the form below. (Wait until you read the next bit before sending!)

3. Your "site"

Minimum: In the form below, tell me where your existing form is, and the schema for your database tables you will be using to record the results.

The rest: Create page(s) for your "organization"
  1. If you have an existing "Home page" on Osiris, rename it, and link to it from your new page, which will now bare the name index.html. (You could mentioning that you are the maintainer of the new group's website)
    OR
    If you prefer to keep your really nice existing home page, put an obvious link near the top if it to a new page for your CS 207 work,
    OR
    Incorporate the new form into your existing index.html. In any case, say something about how your form is going to work.
  2. If you skipped cs 203, you are starting fresh, and might need to look at some of the early lab instructions for that course.
  3. Put your new page on Osiris, in your directory named www, and name it index.html (unless you chose the 2nd option in 1.)
  4. Include on Osiris a form, allowing the public to (for instance) join your mailing list.
  5. Since we won't be setting up databases right now, you may use as the form action: /jensen/echo.php for now, and change the action next week.
You well be evaluated on having your name in students, and your form easily found on Osiris.

Tell me that you are done, and what you did:

Your Linux code
Name of the page with your form:
What you did this week, or the select query from SQL:

What to expect next week:

  1. Setting up a database, and defining one or more tables, and
  2. Writing a php page (file) that inserts the new data from your form into your database.

What to expect in class meanwhile:

  1. Introduction to relational databases, and the SQL language.
  2. Review of HTML, Forms, and PHP. Bring your questions: "How do I..."
  3. Special concerns for bilingual pages (We're in Canada, eh?) -- Character encoding, entities (é), cookie to remember preference.