[ Updated April 10, 2017 ]
This is the week-by-week outline for spring 2017. Weekly topics are subject to change. Please check this page once a week for the latest updates. All assigned work is listed here and linked when linking is relevant.
This schedule is subject to change throughout the semester.
DEADLINES for all quizzes and assignments are in Canvas.
Week 1 – Jan. 10
Introduction to the course. Tools, technologies and outcomes.
Week 2 – Jan. 17
- Watch and complete exercises: SQL basics (9 parts)
- Download XAMPP before class — follow these instructions to install it
Introduction to SQL and databases.
Introduction to XAMPP, an Apache Web server that runs on your computer (Mac/Windows).
- Quiz 1
Week 3 – Jan. 24
- Watch and complete exercises: More advanced SQL queries (10 parts)
- Watch: Hacking Websites with SQL Injection (8 min. 58 sec.)
- Optional: SQL Tutorial and/or SQL Teaching
- Optional: Prepared statements and preventing SQL injection attacks
Note: This article uses the object-oriented commands, such as
$stmt->execute();We will use the procedural commands, such as
Other than this difference, the article is excellent for this topic.
- [ADDED Jan. 24] Optional resource: Explanation of the difference between the SQL object-oriented commands and SQL procedural commands (when you see
->that is NOT the way we are doing it); I added this in case you Google SQL commands and get confused
- Optional: Prepared statements and stored procedures (from the PHP documentation)
SQL and databases, part 2. Security concerns and SQL.
How to create and use prepared statements in PHP.
- Assignment 1: Complete the shoutbox exercise
- Quiz 2
Week 4 – Jan. 31
- Watch and complete exercises: Modifying databases with SQL (7 parts)
NOTE: This is the fourth section of the Khan Academy course. We are skipping the third section (Relational queries in SQL). Feel free to complete the third section on your own, but I will be discussing the fourth section in class and not the third section.
- Resource (optional): PHP with MySQL Essential Training (Lynda.com) — login here. Like many Lynda.com courses, this is very long (14+ hours) and thorough. You can skip around among these videos to supplement or reinforce what we’ve covered in class. Section 14, “Using PHP to Access MySQL,” is especially good. You can also download the complete exercise files for the course. The only drawback: The instructor is using old XHTML tags that end with /> … do not copy his outdated HTML tags! (His DOCTYPE is also outdated.) On the plus side, he is using PHP’s newer mysqli_ functions and procedural style (not object-oriented style) — so his PHP matches what we have used in class.
Using phpMyAdmin to export, import, delete tables, and to test SQL queries.
Using UPDATE and DELETE to modify rows in your database.
More HTML forms + Ajax + PHP.
Database passwords. Database transactions.
MySQL database project explained (Assignment 2).
- Assignment 2: Web form and database
- Quiz 3
Week 5 – Feb. 7
- Read: Command line tips
- Read Preface; “Introduction: The Hard Way Is Easier”; “Exercise 0: The Setup” in Learn Python the Hard Way (Note: On the Mac, your Python should be already set up and ready to run. Test it! On Windows, follow the instructions in “Exercise 0: The Setup,” and install Python if necessary)
- Do exercises 1–12 in Learn Python the Hard Way — read them, type them, save them, run them
- Optional: Python practice exercises
Install Python (in class) if necessary; test-drive Terminal (Mac) or PowerShell (Windows).
Introduction to the command line.
Introduction to Python.
Help session for Assignment 2 — bring your questions
- Assignment 3: Python review 1 (see Canvas for deadline)
- Make sure you have the required book by Mitchell
Week 6 – Feb. 14
- Read: Web Scraping: A Journalist’s Guide (Nael Shiab, August 2015) — very short: What is scraping? Why do it?
- Read: On the Ethics of Web Scraping and Data Journalism (Nael Shiab, August 2015) — Is scraping legal? Is it unethical?
- Read: Mitchell, Preface (pp. vii–xi) and chapters 1 and 2 — do not DO the things described in the book; we will do them (or at least start them) in class
- Do exercises 13–17 in Learn Python the Hard Way — read them, type them, save them, run them — you must practice these and explore how this code works
- Watch video for exercise 16 (2 min. 35 sec.)
- Read: Intro to PIP and virtualenv
Introduction to Web scraping with Python and BeautifulSoup.
Using PIP and virtualenv.
In class, we will install virtualenv and then install Python 3 using a virtual environment. Mitchell discusses virtual environments on pp. 7–8.
- Assignment 4: Exercises from Mitchell (see Canvas for deadline)
- Assignment 5: Python review 2 (see Canvas for deadline)
- Quiz 4
- Install Python 3 (in a virtualenv) — guide/document for use in class
- Web Scraping Tools – virtualenv — slides shown in class
Week 7 – Feb. 21
- Read: Mitchell, chapters 3 and 4
- Read: Python Regular Expressions
- Do exercises 18–26 in Learn Python the Hard Way — read them, type them, save them, run them
- Read: “Smart” Quotes (also known as “curly quotes”) and code
- Reference (optional): Python’s re library for deciphering regex
- Resource (optional): Pythex, a visual editor tool for building regex for Python
Web scraping, part 2. Introduction to regex. More Python.
- Assignment 6 has been moved to next week
- Assignment 7: Python review 3 (see Canvas for deadline)
- Quiz 5
Resources used in class, Week 7:
- Slides: Web Scraping (Mitchell, chapter 2) — the basic scraping code, line by line
- Slides: Web Scraping: Intro to regex — Kevin Bacon files
- Gist: Code for how to open, read, write and close files in Python (use this as a cheatsheet)
- Gist: Code for example of using argv to pass in variables at runtime (to clarify how argv can be used)
- In-class exercise: Introduction to regex
Week 8 – Feb. 28
- Read: Mitchell, chapters 5 and 6 — these are still “on” for this week
- Read (or review) Mitchell, chapter 4 and this post
- Read: How to Break News While You Sleep (about email and bots)
- Do exercises 27–37 in Learn Python the Hard Way — read them, type them, save them, run them
Web scraping, part 3. Introduction to APIs. Storing scraped data. Web scraping project.
- Assignment 6: Exercises from Mitchell (see Canvas for deadline)
- Assignment 8 has been moved to Week 10
- Web scraping proposal (see Canvas for deadline)
- Quiz 6
- Slides: Web Scraping (Mitchell, chapters 4 and 5) — APIs and storing data from scrapes
Week 9 – March 7
Spring Break – no classes
Week 10 – March 14
Starting the next book next week! Make sure you have it: Head First Python, 2nd edition (Barry)
- Read: Why is Flask a good web framework choice?
- Read: Django vs Flask vs Pyramid: Choosing a Python Web Framework — read but skim the code parts, paying attention to the parts that are specifically about Flask (note how the two other frameworks differ)
- Read (for your Web scraping project): My first homemade Web scraper
Wrap-up for Web scraping: How to write data to a CSV or MySQL database
Web frameworks: Why use a framework?
Installing Flask (hands on): http://bit.ly/install-flask (plus slides)
Next round of student presentations: Assign dates
- Quiz 7
- Assignment 8: Python review 4 (see Canvas for deadline)
- Slides from class: Flask, Part 1
Week 11 – March 21
- Read: Barry, chapter 5
- Refer to this while you’re reading chapter 5: http://bit.ly/install-flask
Web apps with Python: Flask
Flask templates: Introduction
- Quiz 8
- Assignment 9: Web scraping project
- Slides from class: Flask Templates
Week 12 – March 28
- Read: Intro to Flask: Adding a Contact Page (Note: Do NOT run the code, because several specifics in this tutorial are outdated now and likely will not work. Also, we will use Bootstrap for our form in class, so you can completely skip the CSS parts.)
- Read: Creating or using requirements.txt
- Read: Summary: Using virtualenv
- No chapter in Barry is assigned this week
- Optional: Docs for Flask-Bootstrap
- Optional: Docs for Flask-WTF
- Optional: Flask Extensions (list)
Flask and Bootstrap (more about templates)
Flask for Web forms with Flask-WTF and Bootstrap
- Quiz 9
- Assignment 10: Small Flask app
- Slides from class: Flask and Web Forms
Week 13 – April 4
- Read: Frozen-Flask
- Read: Python Web Server Gateway Interface (WSGI) — naturally, you won’t read all of this, but read enough so that you understand what WSGI is (“Rationale and Goals” and the first part of “Specification Overview” are good)
- Assignment: Final project proposal
- Here the GitHub repo for Frozen-Flask: flask-app-for-freezing
- Here is the walk-through for using Frozen-Flask with your Assignment 10 project
Week 14 – April 11
- Read: Barry pp. 363–373 (about sessions)
- To better understand the Barry pages, run the three files in this gist
- Read: Type hints in Python (maybe read it before reading the Barry pages)
- Read: Working with SQL databases in Flask
- Optional: Docs for the Flask-SQLAlchemy extension
- Optional: Docs for SQLAlchemy
- Optional: NoSQL Databases Explained — some databases do not use SQL
Student’s individual Web project — workshop hours during class period
- Quiz 10
- GitHub repo: A Flask app using a MySQL database (there’s no slide deck, but there is a “how-to” Google doc linked in the README)
- Put that Flask database app online at Reclaim Hosting (how to do this after it works on your own computer)
Week 15 – April 18
Student’s individual Web project — workshop hours during class period
- Extra workshop hours Friday, April 21, noon–4 p.m. (room TBA)
Project Due Date
All projects are due on Monday, April 24, at 11:59 p.m. That is the Monday of finals week. You will post your project on your own website.
- Post your project’s URL in Canvas by the deadline. This URL is on your own website.