Btw, I believe that last semester’s students still have all their stuff in the Redis instances you guys are now using. Feel free to flush their work (the command is “FLUSHDB” at the Redis command line) before adding your stuff.
-
Flush your Redis instance
-
Fear is the mind killer
Here’s today’s XP-bearing activity if you want to practice with it before the quiz.
Btw, the full Bene Gesserit Litany Against Fear runs like this:
“I must not fear.
Fear is the mind-killer.
Fear is the little-death that brings total obliteration.
I will face my fear.
I will permit it to pass over me and through me.
And when it has gone past, I will turn the inner eye to see its path.
Where the fear has gone there will be nothing. Only I will remain.”
— Dune, Frank Herbert
-
Hobby Manager: final version
From today’s class, here’s our final version of the “Hobby Manager” app:
- The 12:30pm class’s git bundle
- The 3:30pm class’s git bundle
(To unpack a git bundle on your system, type “git clone nameOfGitBundle.git“.)
-
Quiz #5 posted!
Quiz #5 is a 60-minute, closed-Python and closed-Redis affair that is due on April 2nd at midnight. Good luck!
-
Connecting to Redis on cpsc
Remember that you’ll need to do two things to connect properly to Redis on cpsc: authenticate with the password I gave in class today, and select the correct instance.
From the command line:
$ redis-cli 127.0.0.1:6379> auth theClassPassword OK 127.0.0.1:6379> select yourInstanceNumber OK 127.0.0.1:6379[yourInstanceNumber]>
From Python:
import redis r = redis.Redis(password="theClassPassword", db=yourInstanceNumber, decode_responses=True, charset='utf-8')
-
Hobby Manager: in progress
From today’s class, the first cut at our “Hobby Manager” app:
- The 12:30pm class’s git bundle
- The 3:30pm class’s git bundle
(To unpack a git bundle on your system, type “git clone nameOfGitBundle.git“.)
-
Assignment #7 posted!
As promised, assignment #7 has arrived and is due next Friday. Good luck, and happy coding!
-
Maddie’s survey
Madelyn Maddie would appreciate it if you would take the time to complete this survey that she’s using as part of an independent study.
-
CPSC programming contest!
This year’s CPSC Programming Contest will take place on April 11th at 6pm! It involves free pizza, snacks, music, and fun! You should definitely mark this on your calendar if you haven’t already, and be sure to sign up with or without teammates. (You can indicate on the form if you’d like to be paired up on a team, and Ian, the contest maestro, will assign you companions.)
Additionally, I will award extra credit for all participants: +1XP for each problem your team gets correct. Also, any team that beats yours truly will receive the coveted opportunity to throw a whipped cream pie in my face in a public setting! This is a great way to humiliate me that you should be sure to take advantage of.
-
sick today
no class or office hours today (mar 20) – send email
-
Final bundles posted
From today’s class, the “final” versions of our SQLite-backed ice cream database:
- The 12:30pm class’s git bundle
- The 3:30pm class’s git bundle
(To unpack a git bundle on your system, type “git clone nameOfGitBundle.git“.)
-
The “Details” tab
Several people have asked me questions of the form “hey Stephen, have you graded my X yet?” Note that you can check this yourself by clicking on the “Details” tab of the scoreboard and entering your info. This will show you all the XP you’ve earned so far this semester, in all their glory.
-
Therapeutic
The scoreboard has been updated with lots of stuff, including assignments 3 through 5, quiz #3, and the latest codingbat/leetcode points. Also, a sweet surprise for Stephen: nobody in the class managed to mess up the Honor pledge for quiz #3, which requires a clumsy email back and forth to correct! As a reward for this collective ability to follow instructions, everyone gets +1XP. Enjoy!
Also: props to kanarwithdamar, Lisan al-Gaib, P@$$WORD, GoldCannon, and suspiciouslyEven for reaching the “Chocolate Therapy” level, and to John Database for climbing up to “Minter Wonderland“!
-
Quiz #4 posted!
Quiz #4 has been posted, and is due on March 18th at midnight. It contains no material from today (or even anything post-spring-break, actually) so fire away!
-
DB World Tour stop 1 (a.k.a. assignment #6) posted!!
Okay, time to get excited!! The first milestone for your most excellent DB Tour project has been posted, and is due in little over a week. Get those creative juices flowing, and get cracking!!
-
Buy ice cream here!
From today’s class:
- The 12:30pm class’s git bundle
- The 3:30pm class’s git bundle
(To unpack a git bundle on your system, type “git clone nameOfGitBundle.git“.)
-
Important: homework turn-in confusion
Hmm. What I meant for you guys to turn in for your “assignment #4’s” was:
- A git repo, with these contents:
- Your customer_service.py program that allows the user to interactively purchase tickets
- Your SQLite database file that has all the stuff from galactic in it (and optionally, other rows left over from your assignment #3)
- Optionally, Python code in some other file (perhaps “bulk_import.py” or some such) that does your assignment #4 bulk-import loading, although I don’t actually need that for grading.
Instead, I’m getting lots of people whose “customer_service.py” file isn’t actually their customer service program at all, but appears instead to be their assignment #4 bulk-import code. I’m also getting people seem to have expected me to run their bulk-import code to populate their database with galactic stuff, instead of including an SQLite database that already has the galactic stuff included.
All this is taking me longer than I want to mess around with. And it has proven to be too onerous to try to dig up old assignment #3 submission emails, which may not even be compatible with any schema changes you had to make to accommodate galactic in assignment #4, etc.
**So, since I’m old and tired and want to make the process of grading 52 of these as streamlined as possible, I’m going to have everyone resubmit your assignment #3/#4 according to the above specifications. The subject line for the email should be “CPSC/DATA 350 Assignment #3/#4 resubmission”.
To be crystal clear: when I open your email, it should contain a git bundle as an attachment. When I clone that git bundle, I should then have (1) a customer_service.py file which does the whole assignment #3 thing, and which works on (2) your assignment #4 database file that contains all the galactic data. Also note: I will not be running any code to actually perform the bulk import; the results of that importing process should already be reflected in the database.
Submissions will be graded in the order they are received.
- A git repo, with these contents:
-
To run your flask app on cpsc.umw.edu
We’ve been working on localhost so much that I think I forgot to ever tell you guys how to get your Flask app running on the actual internet on the cpsc server. Duh.
The answer is, when you start Flask, do it this way:
$ flask run -h 0.0.0.0 -p yourPortNumber
The 0.0.0.0 is literal. The yourPortNumber” should be replaced with your port number.
-
First “real” DB-powered Flask apps
From last week’s class:
- The 12:30pm class’s git bundle
- The 3:30pm class’s git bundle
(To unpack a git bundle on your system, type “git clone nameOfGitBundle.git“.)
-
Quiz #3 posted!
Quiz #3 has been posted to Canvas, and is due after spring break. It’s a short one, timed at 30 minutes.
-
Assignment #5 posted!
In case you want to get ahead over spring break, assignment #5 has been posted and is beckoning to you. It is actually due the Thursday after we get back.
-
Another possible workaround for connecting to Maria
At least one student has reported that if they include the “--skip-ssl” at the end of their connnection command, like this:
$ mariadb -u yourusername -pyourpassword -h cpsc.umw.edu -P 3306 galactic --skip-ssl
that it worked for him. Give it a shot if nothing else is working.
-
Practice query solutions posted
Here are my solutions to the extra credit activity that was due today.
-
Assignments 3 and 4, and spring break
I’ve been having so much fun that I sorta forgot that next week is spring break. 😀
So, here’s some important news regarding assignments 3 and 4:
- Assignment 4 is now due the Sunday after spring break, not before. Organize your time however you wish. (Obviously I will still accept the assignment if it’s turned in by the original date!)
- I’m actually not going to grade Assignment 3 separately at all. Wait, hear me out. To grade your console interface, I’m going to query your database, order tickets, etc., only after it’s populated with the galactic stuff. That way, I know what the contents should be, how many tickets should be left on each flight, etc.
A few implications for point #2, above:
- If you didn’t submit assignment 3, it’s your lucky day: you get a reprieve. I’m not even going to check who turned it in and who didn’t. (However, you’ll have significantly extra work to do for assignment 4, because you’re going to have to write the Python console interface for assignment 3 in addition to doing the bulk import for assignment 4. Happy spring break.)
- If you did get assignment 3 submitted, but for some reason fail to submit assignment 4, yes I’ll go back and grade your assignment 3 and give you points for it. Fair is fair.
- If you don’t ever get assignment 3 submitted, but do submit assignment 4, yes I’ll figure out a way to grade your assignment 4 and give you points for it. Fair is fair.
- For most of you — who did submit assignment 3 and who will submit assignment 4 by March 9 — you will receive one lump sum of up to +80XP when I grade assignment 4 sometime during the second week of March.
-
Temporary MariaDB connection woes
If you’re having trouble reaching the galactic database, read carefully.
- You already have a MariaDB account, but the question is what password you’re using. The password should still be the original one that Ian sent you when you got an account on the cpsc.umw.edu server at all. So if you’ve changed your cpsc password since then with the passwd Linux command, be advised that this does not change your MariaDB password. You’re still on the old one.
- Btw, if you’d like to change your MariaDB password (either to match your Linux system password, or anything else) you can do so at the MariaDB command line with the command: “SET PASSWORD = 'new_password';“.
- Ian is working on getting everyone read-only access to the galactic database needed for the homework. Until then, you are free to access the read-write version using the username and password I used in class. If you’ve forgotten that username/password, here’s a hint: the username is someone you know, and I mentioned that the specific password was chosen “because Ian is a smart-aleck.” If you still don’t know, email me and I’ll tell you these values. Please DO NOT post them anywhere publicly.
-
Homework #4 is posted!
No rest for the weary — get ready for the impedance mismatch of the century: a bulk import assignment from mine to yours. It’s due next Sunday, and is not for the faint of heart. Happy importing!
-
Last week’s code posted
From last week:
- The final versions of our B&J console programs:
- The bulk import programs:
-
Clarification on extra credit example tables
The “sample answer tables” I gave for each question in the extra credit activity are only intended to give the shape of the answer, not any actual answer on any particular database. Apparently I posted a previous version of my SQLite Ben & Jerry’s database at some point, and some students were entering their queries against that database and expecting to come up with the same numerical answers as on the activity. Do not expect this to be the case.
(Btw, I intended this activity to be a pencil-and-paper affair where you figured out the correct query by looking at the schema page we’ve been using in class, not a use-the-computer affair where you typed SQL queries at the SQLite prompt. I guess now that people are doing it that second way, I can’t really outlaw it, but it wasn’t my intent.)
-
Transaction demonstration
From yesterday’s class, the code that used transactions so that multiple copies of it simultaneously accessing the same SQLite database didn’t interfere with each other in a destructive way.
-
Extra credit query practice
You can earn up to +5XP by legibly writing queries to answer this set of questions. You are allowed to work in groups of up to 4 on this activity.
To claim these XP, turn in your legible solutions to my “350” manila envelope no later than 5pm, Monday 24. If you worked in a group, be sure to write everyone’s name on your submission.
-
SQLite command line atrocities
For those of you following the SQLite formatting hassle, here’s today’s ChatGPT debugging session, which ended ambiguously.
-
Today’s code posted
From today’s class:
- The additional practice queries (and sample solutions)
- The B&J console program:
Taking the time to go through the rest of the questions on item #1 on your own would be an excellent and praiseworthy idea.
-
Assignment #3 posted!
Assignment #3 has been posted, and is due next Sunday Feb. 23rd at midnight. Good luck!
-
Beet it!
A quick shout out to John Database and GoldCannon for being the first to reach the “Beet It” level!
Trivia question for the masses: what’s different about “Beet it” than any of the other semester’s levels?
-
Question 9 on quiz #2: explanation
A couple students asked a question about Item 9 on the quiz: why is the answer 5, not 4? The tables in question were PETS:
+----------------------+----------+----------+ | owner | dog | numYears | +----------------------+----------+----------+ | Laura Ingalls Wilder | Jack | 5 | | Veronica Mars | Backup | 3 | | Robert Barone | Chamsky | 9 | | Laura Ingalls Wilder | Bandit | 2 | | Fourth Doctor | K9 | 4 | | Sarah Jane Smith | K9 | 8 | | Raj Koothrappali | Cinnamon | 5 | | Emily Elizabeth | Clifford | 6 | +----------------------+----------+----------+
and CHARACTERS:
+-----------------------------+----------------------+-------+ | show | character | debut | +-----------------------------+----------------------+-------+ | Little House on the Prairie | Laura Ingalls Wilder | 1974 | | Clifford the Big Red Dog | Emily Elizabeth | 2000 | | Doctor Who | Fourth Doctor | 1974 | | Doctor Who | Sarah Jane Smith | 1973 | | The Mandalorian | Greef Karga | 2019 | +-----------------------------+----------------------+-------+
The query in question was this:
select count(*) from pets join characters on owner=character;
The students asked, “why doesn’t this give you 4 rows, since table rows must be unique and therefore Laura Ingalls Wilder can’t appear twice?”
But realize that this query isn’t a “select owner” or “select distinct(owner)“; rather, it’s a “select *“. So therefore, you’re counting the entire number of rows returned by the join, not the number of distinct owner names (or any other attribute).
If you get rid of the count(*) and just use * to see the whole table of results, you get:
+----------------------+----------+----------+-----------------------------+----------------------+-------+ | owner | dog | numYears | show | character | debut | +----------------------+----------+----------+-----------------------------+----------------------+-------+ | Laura Ingalls Wilder | Jack | 5 | Little House on the Prairie | Laura Ingalls Wilder | 1974 | | Laura Ingalls Wilder | Bandit | 2 | Little House on the Prairie | Laura Ingalls Wilder | 1974 | | Fourth Doctor | K9 | 4 | Doctor Who | Fourth Doctor | 1974 | | Sarah Jane Smith | K9 | 8 | Doctor Who | Sarah Jane Smith | 1973 | | Emily Elizabeth | Clifford | 6 | Clifford the Big Red Dog | Emily Elizabeth | 2000 | +----------------------+----------+----------+-----------------------------+----------------------+-------+
As you can see: 5 rows, with no duplicate rows.
-
Please tell me about incorrectly scored quiz items
If you miss points on a quiz question that you clearly had correct, but simply entered in a different format than I was expecting, please don’t just accept the loss and sulk. Instead, tell me about it.
For example, suppose the answer to some question was:
stephen
but for your answer you entered:
"stephen"
Depending on the exact nature of the question, this is quite possibly just as “correct” an answer as the one the quiz was looking for, yet it will be marked wrong because it wasn’t expecting you to put quotation marks.
All such answers should be regraded, and you should tell me about them. (Note that this is not an open invitation for you to tell be about the individual items you legitimately missed because you put the wrong answer. Only the ones where your obvious intent was to give the correct answer, but differences in formatting choices got in the way.)
-
No, SQLite is not allowed on the quiz
I thought this would have been obvious, I guess, but in case not: no, you are not permitted to use the SQLite command line while taking the quiz. (If you think about it, the quiz would be pointless if you could do that, since anyone who knew how to type could get the questions right, even if they knew nothing about databases. The quiz is testing your understanding of the material in class, not your ability to type.)
-
Office hours partially canceled next Tuesday
Unfortunately, I won’t be able to make my usual 11:30am-12:30pm office hours on Tuesday, Feb. 18th. I will be there for the 2-3:30pm block, though.
-
Clarification on “open-notes” quizzes
For quizzes, you are allowed to use all handouts from class, any “cheat sheets” or other things posted on the class website, etc. Basically, anything written down that you want to use is okay. The only things that are not okay are programs (like the Python command line, or ChatGPT.)
-
From today’s class
From today’s class:
- Sample solutions to the first nine queries on the page I handed out
- the beginnings of the ice cream purchasing console app we started on
-
Today’s queries posted
From today’s class, the queries against the B&J database that (1) reviewed selects, wheres, froms, Cartesian products, and joins, and (2) introduced group bys, havings, order bys, limits, and offsets. (Whew!)
-
Office hours on Zoom today
At the usual time, at the same link we’ll be using for class (see Canvas announcement).
-
Questions (and answers) about class tomorrow
Will we have class tomorrow? Yes! See Zoom link in Canvas announcement.
Is class mandatory? No, class is never mandatory. You are big boys and girls, and can come and go whenever you choose. If you don’t think you will benefit from being there, you are free to skip any class at all, including tomorrow’s.
If I don’t come, should I get the notes from a classmate? Yes, as always.
What if I don’t have the proper Zoom equipment? This situation should be exceedingly rare in the post-Covid age, but I will attempt to record tomorrow’s lecture and post it on Canvas for anybody who isn’t able to “come to class.”
-
Quiz #2 posted!
Quiz #2 has been posted, and is due Saturday, Feb 15th at midnight. It’s timed at 45 minutes, and covers all the material from class and readings up through and including Tuesday Feb 11th’s class. Good luck!
-
Virginians and snow *eye-roll*
Really? Where I come from there at least have to be a few flakes falling first.
Anyway, we’re holding to a good pace so far this semester, and I do not want to fall behind. And given past UMW history, my bet is that class is canceled for more than just tomorrow. So here’s the official dealio:
- Enjoy your day off tomorrow. Fair’s fair. But:
- If class is also canceled for Wednesday and/or Thursday, we will have class those days at the appointed time on Zoom. If you need to bust out your webcam or dust off your lens, you’ve got over 24 hours to do that.
See you guys Wednesday, regardless!
-
Today’s code posted
From today’s class, the SQL code to recreate our bootstrapped database:
-
Assignment #2 posted!
Assignment #2 has been posted, and is due next Thursday at midnight. Note carefully: this assignment will probably take a medium amount of time if your assignment #1 was pretty clean, but a large amount of time if your assignment #1 had lots of mistakes. (This is because you’ll need to fix all those mistakes — or use Stephen’s solution instead — for assignment #2.)
-
Stephen’s assignment #1 solution
Here’s my solution to assignment #1. If you got less than 35XP or so for this assignment, I strongly suggest you carefully look over my solution, and perhaps use it instead of your own as a basis for assignment #2.
-
Quiz #1 posted!
Quiz #1 has been posted to Canvas, and is due on Friday at midnight. It is open-book and open-notes, closed-other-humans and closed-AI-assistants-such-as-ChatGPT, and timed at 60 minutes.
Good luck!
-
“Tail numbers”
Abe, a pilot in our class, just now told me that there is in fact an “AID-type thing,” which is called a tail number, and it’s written on the fuselage. Call it what you wish on your homework!
-
Walk-in tutoring
Walk-in tutoring is available for this class (and others)!
- Kenzie: Wednesdays, 6-8pm, Farmer 025
- Matt: Thursdays, 6-8pm, Farmer 026
-
The present and the past
This may seem inconsistent, but it’s the law in Stephenworld: your database does need to know who flew last October 29th’s United 277, but it does not need to know what runway United 277 might have had reserved on that date — all that it needs to know about runway reservations is what runways are currently reserved. (In other words, information about flight crew assignments must be kept in perpetuity, whereas your database only needs to know what current flight has each runway reserved, if any.)
-
On pilots and copilots
Clarifications around crew members:
- Crew assignments are not normally the same from day to day. (If Charlie/Julie were the pilot/co-pilot on this morning’s United 678, they are very likely not going to be the pilot/co-pilot on tomorrow’s United 678.)
- All crew members who are certified to fly a type of plane can be either the pilot, or the co-pilot, for a flight that uses that type of plane. (There’s no such thing as “being certified to co-pilot a Boeing 747, but not certified to pilot it.”)
- Every crew member is a pilot on some flights, and a co-pilot on others. (They’re rotated so they don’t get too fatigued.)
- Your database does need to know who the pilot is, and who the co-pilot is, for a given day’s flight, not merely “who the two crew members are.” If I go to your database and ask “who was the co-pilot for yesterday’s American 113?” your database is not allowed to respond, “well, Sallie and Jeff were the two crew members, but I’m really not sure which one was the pilot and which was the co-pilot.” (Hint: I think you’ll want two different one-to-many associations in this part of your design, not a single many-to-many association.)
-
AID
I don’t know if there is something like this in reality (I’m sure there is, though) but we’re going to say that all physical airplanes have an “AID” (“airplane ID”) which is globally unique.
-
Email means email
Clarification: when I say to “email me” (with questions, to turn in an assignment, etc.) I really do mean “email me” (to stephen _AT_ umw _DOT_ edu), not “send me a Canvas message” (which I normally do not see and do not read).
-
Assignment #1 posted!
Assignment #1 has been posted, and is due a week from today at 5pm (not midnight) to the “350” manila folder hanging outside my office door. If you have any uncertainty about what any of the requirements mean, please be sure to ask! If you don’t ask, and misinterpret a requirement as a result, you’ll miss out on points that you might otherwise have received.
Procrastinate on this to your peril!
-
codingbat.com practice
You can earn up to +2XP per week by spending 30 minutes (per week) completing codingbat.com problems. All you need to do to claim these points each week is send me an email on Friday of the given week with subject line “CPSC/DATA 350 codingbat XP“. In the body of the email, you should type “I spent 30 minutes this week working Python exercises on codingbat.com,” followed by the Honor Pledge and your full name as a signature.
Happy coding!
-
Assignment #0 posted!
Your first graded assignment of the semester — getting used to Python or brushing out the cobwebs — has been posted, and is due Tuesday, Jan 21st at midnight. Send questions!
-
Scoreboard sign-up!
Okay everybody, it’s time to earn your very first XP (experience point) of the semester, which is not only admirable in itself but is also required in order to earn any other XP at all!
All you need to do is head over to the Scoreboard (see link at top of page) and add yourself as a new student. Be sure to choose a screen name that is super secret, that you have never used before, and that you will not reveal to anyone.
-
Welcome!
Greetings, Earthlings, and welcome to the spring 2025 version of CPSC/DATA 350: Applications of Databases with Stephen! This site is gonna be hip-hoppin’ with all kinds of great stuff real soon, so stay tuned!