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:
- (Form for this this week
- database part later) Allow people to get on your mailing list,
possibly with categories like new products, gas-fired barbecues, trail
conditions, event cancellations, or volunteer opportunities.
- Viewing products, or a selection of products. Game schedules for
a particular team, or location.
- Ordering something: a T shirt, a VIA rail train hat, a
quantum decryption chip, or an issue of your newsletter.
- Posting news items - for administrators only.
- Seeing the latest news, or all the current sports news (a
category) - by the public.
- Maintain an inventory of what's available. To sell, or tools
available for volunteers....
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.
- Sign in to the class by using my sign-up form. (This will give you a "secret code" that you will need for exams.).
- Some SQL practice (see below)
- 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.
- Open a terminal on your
- Mac or Linux computer, and type yourusername@osiris.ubishops.ca
type your password when asked, and you are now "on osiris"
- 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.
- psql timetable
- \d students
- insert into students
values(...);
The rest:
- Find some courses to register in (at least 3, including CSC107B01)
- Do a select query that lists your courses, with at least course,
title, and prof, and
- 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"
- 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.
- If you skipped cs 203, you are
starting fresh, and might need to look at some of the early lab
instructions for that course.
- Put your new page on
Osiris, in your directory named www, and name it index.html (unless you chose the 2nd option in 1.)
- Include on Osiris a form, allowing the public to (for instance)
join your mailing list.
- It is generally not a good
idea to allow the public to both enter information, and also be able to
view it, as this invites the equivalent of "spam"
- 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.
What to expect next week:
- Setting up a database, and defining one or more tables, and
- Writing a php page (file) that inserts the new data from your
form into your database.
What to expect in class meanwhile:
- Introduction to relational databases, and the SQL language.
- Review of HTML, Forms, and PHP. Bring your questions: "How do
I..."
- Special concerns for bilingual pages (We're in Canada, eh?) --
Character encoding, entities (
é
), cookie to
remember preference.