CPSC 350

  • Syllabus
  • Office
  • Readings
  • Sheets
  • Levels
  • XP
  • Scoreboard
  • How I’m feeling

    My recovery is going quite well so far, but all the same I think I need another slow day before I’m ready to re-enter the rat race which is UMW campus. So class and office hours are canceled for Monday, April 13th, but I plan on resuming office hours as scheduled on Tuesday, April 14th at the usual time.

    Apr 12
  • Surgery success

    For anybody following this developing story, my surgery seems to have gone well and the doctor is pleased. He did think, however, that Monday might be too aggressive to plan on a return to the classroom. I’m going to see how I feel. I might come in that day if I feel good enough (and that my voice can sustain a pair of 2-hour classes), or I might do Zoom, or cancel altogether. Stay tuned on this website for the latest details!

    Apr 9
  • Praise God!

    Aetna came through at the eleventh hour today, and said they would cover my surgery. So I’ll be under the knife tomorrow morning bright and early, and will be canceling all my campus appointments (including class and office hours) for this week.

    If all goes well, I’ll be back in the saddle on Monday. Stay tuned for details.

    Apr 7
  • Old stuff in your Redis instance

    If you see a bunch of old stuff in your Redis instance that you don’t recognize, it’s probably from whichever student had that instance number last semester, and they didn’t empty their trash before they left that course.

    Basically: nuke it. You can either systematically DEL the stuff you see when you do KEYS *, or, as a heavier hammer, do the FLUSHDB command. Realize that the FLUSHDB command will irreversibly nuke everything in your current instance, so triple-check that (1) you’re on the correct instance and (2) you really do want to nuke all the stuff. Lmk if you have any questions or doubts.

    Apr 6
  • Quiz #5 posted!

    Quiz #5 has been posted, and is due Wednesday at midnight. It is open-book and open-notes, closed-Python and closed-Redis, closed-AI and closed-other-humans, and closed-notes-or-materials-from-students-who-have-previously-taken-this-class. It is timed at 60 minutes. Good luck!

    Apr 5
  • Today’s code (Redis-backed hobby manager) posted

    Today’s code is in these bundles:

    • hobbies_10am.git
    • hobbies_2pm.git

    If you want to run them (as opposed to just perusing the code), be sure to unpack them this way:

    $ git clone hobbies_10am.git surgery
        ...or...
    $ git clone hobbies_2pm.git surgery
    
    Mar 30
  • Assignment #7 posted!

    Assignment #7 has been posted, and is due next Tuesday at midnight. We haven’t covered Redis’s “sorted sets” data structure yet, but we will on Wednesday. In the meantime, you already know the deets on the other data structure options, and I’m confident you can already choose how to architect most of your data.

    Please work on your assignment #7 while deployed on your first port number, leaving your assignment #6 running on your second port number. That way, I can grade your stable assignment #6 while you’re working on your assignment #7 and we won’t interfere with each other.

    Mar 30
  • Office hours tweak for Tues 3/31

    On Tuesday (tomorrow), office hours will be:

    1. Online, instead of in person (see Canvas for the usual Zoom link), and
    2. 10:30-11:30am instead of the usual 10-11am.
    Mar 30
  • Bonus points

    I attempted to dutifully award all the +5XP bonus points to those who turned in assignment #4 and/or assignment #5 by the original March 12 due dates. Microsoft email actually doesn’t make that very easy, though, so it’s possible I missed some people. If I missed you, just send me an email reminder and I’m happy to give you your due.

    Mar 27
  • I really hope you guys can forgive me

    I’m super behind on grading, and am in danger of falling even further behind. So to try and dig out of my hole, I’m going to just give everybody the full points for assignment #4 as long as they turned it in on time.

    Whatever hard and tenacious work you put into this was still worth it, I promise!

    Mar 27
  • Updated code examples posted

    From yesterday’s class, the git bundles for:

    • 10am.git
    • 2pm.git
    Mar 26
  • Virginia Tech masters: info session

    If you’re interested in pursuing a masters degree at Virginia Tech, consider checking out this information session about the program.

    Mar 24
  • Important: git version on cpsc

    So, it appears that the version of git on the cpsc server is super old, and still defaults to looking for a branch named “master” instead of “main“. Ian told me he’s going to update the OS on cpsc this summer, but it’s too intrusive a change to do mid-semester.

    What this means for you is: if you download one of the git bundles I’ve posted (like, in this post), then after doing:

    $ git clone nameOfBundle.git nameOfDirectoryToUnpackIn
    

    you’ll need to then do:

    $ cd nameOfDirectoryToUnpackIn
    $ git checkout main
    

    That “git checkout main” is the key. Without doing that, the bundle you downloaded is going to seem empty: you won’t see any code in it at all.

    Mar 24
  • Code examples posted

    From today’s class, the git bundles for:

    • 10am.git
    • 2pm.git
    Mar 23
  • House Davies: the next generation

    Click for a close-up!




    What do people think Samuel is doing in the picture? Here are the results:



    Mar 21
  • Please check this immediately

    Before any more time expires, if you have not successfully connected to your MariaDB database on the cpsc server (I’m talking about your database, named the same as your username, not the “galactic” database from previous homeworks) please make sure you can do so NOW. Some students evidently didn’t have their database password set correctly, and I want to eliminate all such cases immediately.

    The command is the same as it was (mariadb -u yourusername -pyourpassword), only you will use your UMW username, and the password I wrote on the board in class this week, as your credentials.

    If you attempt this and get a “login denied” or “password incorrect” or other connection error, please immediately email both myself and Ian (ifinlay _AT_ umw _DOT_ edu) to get your MariaDB password reset.

    Mar 20
  • Code examples from yesterday posted

    From yesterday’s class, the git bundles for:

    • 10am.git
    • 2pm.git
    Mar 19
  • Your MariaDB password

    Your MariaDB password on the cpsc server (not to be confused with your Unix/Linux password to that system) has been set to a secret value which I will reveal in person during class tomorrow. If you’d like it before then (good for you!) drop by office hours and I’ll whisper it in your ear.

    Mar 17
  • Today’s code posted

    From today’s class, git bundles for the following websites:

    1. backfrombreak.git (10am section)
    2. umm.git (2pm section)

    To access these, download them to your machine (or put them on the cpsc server if you’d rather, using scp, PuTTy, or directly with wget) and then executing:

    $ git clone backfrombreak.git backfrombreak
    

    or

    $ git clone umm.git umm
    

    You will now have a new directory on your machine with the cloned contents of the bundle’s repo.

    Mar 16
  • Assignment #6 posted!

    Assignment #6, the first of four stops on your Database World Tour®, has been posted, and is due next Thursday. Give yourself enough unrushed time to complete this assignment well — not only does it require creativity and panache, but it will serve as the basis for all the rest of your homework assignments moving forward!

    Mar 16
  • Class on Zoom tomorrow (Monday)

    Okay, UMW just called it. See everybody on Zoom tomorrow at the usual time! The Canvas announcements have the Zoom link, which is the same as it’s always been for this class.

    Mar 15
  • Class tomorrow (Monday)

    Just a quick note to affirm that we will have class on Monday at the usual time, hopefully in person.

    However, if the university closes due to the coming storms — for either the morning section, or the afternoon section, or both — we will have class on Zoom during the affected sections, using the same Zoom link you’ve always used this semester (and which is in the Canvas course announcements if you don’t have it bookmarked).

    Mar 15
  • Quiz #4 posted!

    Quiz #4 has been posted to Canvas, and is due Thursday at midnight. It is open-book and open-notes, but closed-AI, closed-other-humans, closed-Python, closed-SQLite, closed-MariaDB, and timed at 60 minutes. Good luck!

    Mar 15
  • Assignments 4 & 5 extension

    Assignments #4 and #5 have now been extended to Tuesday, March 17th. Anyone who submits them by the original deadline (tonight, March 12th) will get an extra +5XP!

    Mar 12
  • Class canceled; office hours virtual today

    Sorry guys! I just got back from Richmond. Plan B it is.

    Today’s class (both sections) is canceled, and I will be having Office Hours virtually (over Zoom) at the usual time (12-2pm). See the Canvas page for the Zoom link (which is the same Zoom link as always).

    See everybody in person on Wednesday!

    Mar 9
  • Monday’s class

    Plan A is to have class on time on Monday morning as usual (10am).

    There’s a 30% chance that I’ll be running late, since I have an early morning doctors appointment in Richmond. I think I’ve allowed enough time for it, but just in case traffic or other woes come into play, I might be running a bit late.

    So Plan B is: if I’m not there at the start of class, you should wait for me up to 15 minutes. If I don’t show my lovely face by 10:15, class will be canceled that day. But do please wait until 10:15 if I’m not there at the start.

    Mar 7
  • Accessing the galactic database

    Just to be clear, for assignment #4 you do not have to have MariaDB client running on your laptop. And you certainly do not (and should not) have an instance of the MariaDB DBMS server running on your laptop!

    Instead, you should follow this two-step process to poke around and inspect the galactic database:

    1. Log on to the cpsc.umw.edu server, however you do that (PuTTy, ssh, etc.)
    2. On the cpsc.umw.edu command line, type:

      cpsc$ mariadb -u theSecretUsername -ptheSecretPassword

      and voila, you’re in. (Substitute the actual username and the actual password for those placeholders, of course. And don’t forget: there is no space between the “-p” and the password!)

    The only MariaDB-ish installation required for assignment #4 is the mariadb Python package, which you can install using pip:

    yourLaptop$ pip install mariadb

    This is required not to simply explore the database, but rather for your Python code to access it.

    Send email with any questions!

    Mar 5
  • Spot checking assignment #4

    Here are some checks to confirm that you did assignment #4 correctly:

    1. You should have exactly 42 pilots in your database (this includes the five from assignment #2).

      • Exactly nine of these pilots should be certified to fly the Millenium Falcon.
      • Four pilots should be certified to fly a colonial Viper.
      • Only two pilots should be certified on the U.S.S. Enterprise.
    2. There should be exactly ten regularly scheduled flights servicing planet Vulcan, either departing from, or arriving at, that planet.
    3. The earliest flight (where “earliest” means “the earliest date”) to Centauri Prime in your database should have had exactly 51 passengers, while the latest flight to this planet has only 5 so far.
    4. Exactly one of the scheduled flights should be sold out. The other 600 scheduled flights should have (or did have, at the time) tickets still available for purchase. (Note that this 600 figure includes the five flights scheduled in assignment #2.)


    If all these check out, I think it’s pretty darn likely that your bulk import was successful.

    Mar 4
  • Intergalactic airport abbreviations

    The flightplans table only has names of planets, not airports. You can overcome this mismatch by assigning your own reasonable three-letter airport codes to planets. (For example, using “DGB” for “Dagobah airport” would be acceptable.)

    Mar 4
  • Quiz #3 posted!

    Quiz #3 has been posted to Canvas, and is due Tuesday, March 10th at midnight. It is open book, open notes, closed other humans, closed AI, closed SQL, closed Python, and timed at 60 minutes. Good luck!

    Feb 25
  • Bulk import example code posted

    From today’s (and Monday’s) class, the bulk import example code for:

    • the 10am’ers
    • the 2pm’ers
    Feb 25
  • Assignments 4 and 5 posted!

    Assignments #4 and #5 have been posted! They are both due Thursday March 12th at midnight. You can do them in either order, but be advised that procrastination is doubly important in this case! Start both of them early and often.

    Feb 25
  • XP ca$h out

    If you’d like to cash in your XP cards mid-semester, there will be one opportunity to do so: Wednesday’s class (2/25). To redeem these, your XP cash must be:

    • Stapled together with a staple, using a stapler.
    • Have your name clearly printed on the back of the bottom-most card in the stack.
    • Have the sum total of the XP also written on the back of the bottom-most card (so I don’t have to count).

    You may hand me your stapled (using a stapler) stack of cards on Wednesday, and I will put your points up on the scoreboard over spring break. If you don’t do this on Wednesday, there is no penalty; you can just hold on to your cards until the final exam, and turn them all in then.

    Feb 23
  • Halloween query solutions posted

    Here are my solutions to the Halloween activity.

    Feb 23
  • Tuesday’s (tomorrow’s) office hours

    I’m going to see a specialist tomorrow morning about my back pain, and so might be late to my office hours. I’ll get there as soon as I can!

    Feb 23
  • All systems go!

    Class will be in person, on campus, at the usual time tomorrow. Dress warm!

    Feb 23
  • “the current date”

    To get the current date in Python, the best tool is the datetime package. Here’s a demo:


    from datetime import date
    today = date.today()
    valentines_day = date(2026, 2, 14)
    if valentines_day < today: print("Valentine's Day already happened.") elif valentines_day > today:
    print("Valentine's Day is coming up!")
    else:
    print("Valentine's Day is TODAY!!! (Hope you remembered!)")


    Feb 20
  • B&J console app posted

    From class yesterday, here are:

    • The 10am version of the console app
    • The 2pm version of the console app
    • The SQLite database itself
    Feb 19
  • Not necessarily bullet-proof

    For assignment #3, you don’t have to worry too much about things like “what if they enter an invalid formatted date?” “What if they type ‘bob‘ for the number of tickets to purchase?” Etc. You do need to make sure to properly handle these two errors, though: attempts to (1) an attempt to purchase a ticket when the flight is sold out, and (2) an attempt to purchase a ticket “in the past.”

    Also, just a heads-up to something I would think would be obvious, but which students have messed up on in the past: if there are no tickets yet sold for a particular day’s flight, that should not stop a user from buying (the first) ticket for that day. If you think about it, it would be ridiculous for your program not to allow that — you’d be in an infinite loop, never able to buy tickets for a flight!

    Feb 18
  • Answers to in-class B&J practice queries

    Here are Stephen’s solutions to the practice Ben & Jerry’s queries from this week’s class.

    Feb 18
  • Assignment #3 posted!

    Assignment #3 has been posted, and is due next Wednesday at midnight. Happy Python coding!

    Feb 18
  • B&J query solutions

    The solutions to the B&J example SQL queries we did in class today.

    Feb 16
  • Assignment #2 rubric

    I’ve started grading the assignment #2’s, and if you’re interested in this level of detail, I’m using this rubric to assign points.

    Feb 14
  • Quiz #2 posted!

    Quiz #2 has been posted to Canvas, and is due this Friday by midnight. It is open-book, open-notes, closed-other-humans, closed-AI, and timed at 45 minutes. Good luck!

    Feb 9
  • B&J schema handout

    Here’s today’s handout if you had to miss class.

    Feb 9
  • Runways and reservations

    I got a good question about runways and reservations today, specifically about why I’m saying that a flight can only have one runway reserved at a time. Here’s my justification.

    Admittedly I’m making up stuff about runways here, since I’m not in the airline industry. But my idea was as follows: only one aircraft can reserve a specific runway at a time; otherwise there would be a collision when two airplanes tried to simultaneously land/takeoff. If there’s heavy traffic at the airport, it’s possible for several airborne flights to be “queued up” (not represented in the database) waiting to be given the reservation to land, but only one would have the reservation at any given time. Same thing for departures — there can be lots of airplanes waiting on the tarmac full of passengers and ready to take off, but who have to wait their turn to get a runway reservation so they can do so.

    As for why a flight can’t reserve multiple runways, my assumption is that runway reservations are a pretty quick thing (on the order of minutes for waiting for one, and then using it and getting off the runway so other flights can use it) and therefore a flight wouldn’t “reserve in advance” a runway at its destination airport that it’s not even going to reach for several hours.

    Feb 6
  • .mode table

    If you’d like your SQLite terminal to show tables in the “prettier” format I demo’d in class yesterday, type this command before running your select * from tablename command:

    sqlite> .mode table
    

    If you like the way this displays, and want it to permanently be that way for you, create a file in your home directory called literally .sqliterc and put this line in it:

    .mode table
    
    Feb 5
  • Assignment #2 posted!

    Assignment #2 has been posted, and is due next Thursday. Happy flying!

    Feb 4
  • Stephen’s assignment #1 solution posted

    For your reference, here’s my own solution to assignment #1 (click on the figure to enlarge):





    Feb 3
  • Campus open tomorrow; assignment #1 due tomorrow

    They’ve just announced that UMW campus will be open as usual tomorrow (Monday, Feb. 2nd) and so as promised, assignment #1 will be due tomorrow by 5pm.

    Feb 1
  • Office hours tweak next Tuesday

    I have a short meeting at 10am next Tuesday (2/3), so office hours will be 10:30am-11:30am that day.

    Jan 31
  • Weirdly imbalanced attendance issues

    So, our first week of Zoom is now done. (Hopefully it’s our only week of Zoom, but who knows.) Here’s what I observed:

    • Morning section (10am):
      • Monday ‐ near perfect attendance
      • today ‐ near perfect attendance
    • Afternoon section (2pm):
      • Monday ‐ about half the students showed up
      • today ‐ about half the students (the same half) showed up

    I have no explanation for why this would be, but it is troubling, because as most of you are aware, we covered a loooot of theoretical ground this week. Those in either section who didn’t come to class (and who I haven’t heard from any other way) are in danger of not only bombing the first couple quizzes, but also getting stuck in a can’t-get-caught-up loop.

    So. If you missed class this week, I strongly urge you to (1) get the notes from a classmate, and (2) ask questions about those notes in office hours. Like most Computer/Data Science classes, everything in here builds and builds and builds, so you don’t want an incomplete foundation!

    Just a word to the wise. See you guys one way or the other on Monday!

    Jan 28
  • Campus closed all week (!!)

    Apparently, they just closed campus for the rest of the week. For us, this means:

    • Class will be on Zoom tomorrow, just as it was yesterday (same Zoom link).
    • Office hours will be at the usual times, but on Zoom (same Zoom link).
    • Assignment #1 is now due Monday, Feb. 2nd, at 5pm.

    Stay warm!

    Jan 27
  • Quiz #1 posted!

    Quiz #1 has been posted to Canvas, and must be taken before midnight on Friday, Jan. 30th. It is open book, open notes, closed AI, closed other humans, and timed at 30 minutes.

    Good luck!

    Reminder to those with accommodations: you must remind me before you take each and every quiz that you need your extra time added! Canvas will not do it automatically.

    Jan 26
  • Assignment #1 hint

    Remember that your database must know who the pilot was, and who the co-pilot was, for each individual flight. It is not sufficient for it to know that “these two people were the crew members, but I don’t know which one was the pilot and which one was the co-pilot that day.”

    (Hint: instead of a many-to-many association, where “many” is “exactly 2,” use two different many-to-one associations, one for the pilot, and one for the co-pilot.)

    The same thing is true for departure and arrival airports. It’s not enough for your database to know “Frontier Airlines 77 connects Boston and Detroit, but I’m not sure whether it goes from Boston to Detroit or from Detroit to Boston.” It must know that the origin airport is Detroit, and the destination airport is Boston.

    Jan 26
  • Virtual office hours Tuesday

    I just saw that campus was closed again for tomorrow (Tues), so office hours will be over Zoom tomorrow (at the usual time).

    Jan 26
  • B&J conceptual model

    Here’s the UML diagram for reference during today’s Zoom class.

    Jan 26
  • Virtual office hours Monday

    I’ll be available via Zoom on Monday at the usual office hours time. (See the “Office” tab, above.) My Zoom link is the same one we use for class tomorrow (and the only link I ever use), and is in a Canvas announcement.

    Jan 25
  • *Possible* extension to assignment #1

    If campus is open on Wednesday (Jan 28), assignment #1 will be due 5pm that day, as scheduled.

    If campus remains closed through Wednesday, it will instead be due at 5pm the next day after that that campus is re-opened.

    Jan 24
  • Monday class reminder

    Just a friendly reminder: we WILL have class on Monday, at the usual time, and it will be on Zoom. (The Zoom meeting ID and link are in Canvas, in the Announcements section.)

    Jan 23
  • Assignment #1 posted!

    Assignment #1 has been posted, and is due next Wednesday (Jan 28). Note that this is earlier than assignment #0 is due! That’s because assignment #0 is the Python practice stuff, which isn’t as urgent, since we won’t be actually touching Python for a couple more weeks. Assignment #1, however, is due next week.

    Also, note: unlike most assignments for this class, which are due at midnight, this one is due at 5pm since you’ll be turning in a hardcopy, and the building may close.

    Good luck, start early, and ask questions!  

    Jan 21
  • Lab aide / tutor hours posted

    I’ve added this semester’s lab aide / tutor hours to the “Office” link on this website. Feel free to drop-in and take advantage of these excellent 350 alumni!

    Jan 19
  • Get on the scoreboard!

    To earn any points for anything this semester, you first have to be on the class scoreboard! Click on the “New Student” tab, and provide:

    1. Your real full name (do use any nickname you’re commonly known by — i.e., put “Lizzie Bennet” not “Elizabeth Bennet” if you go by Lizzie)
    2. A super secret screen name that you will never share with anyone.

    You get your first XP for doing this!

    Jan 9
  • Welcome!

    Hey everybody, welcome back from winter break, and welcome to the spring 2026 edition of DATA/CPSC 350: Applications of Databases!

    This site is gonna be hip-hoppin’ with all kinds of great stuff real soon, so stay tuned!

    Jan 7
CPSC 350

CPSC 350

stephendavies.org