Courses‎ > ‎Software Development 1‎ > ‎Dyrland-Weaver‎ > ‎

Work

All smaller assignments (those posted here) should be uploaded as submodules to the workshop repository in the appropriate assignment directory.

Make sure to put your submodule in the folder of your period and include your name and the name of your partner(s) (if applicable) in the repo name.



Last Class Today!

At the end of each class, 1 student will be chosen at random to post the day's notes online.
Notes will be posted in the README.md document for each class in the notes-and-code repository on github (https://github.com/stuy-softdev/notes-and-code.git).
Title the note [DAY] [DATE] [TOPIC/AIM] by [AUTHOR]
For example:   Wednesday, 9/14 Variable Types by JonAlf Dyrland-Weaver
Also include at the end of the note a link to an interesting piece of tech/science news.

Work 11: Are you Devo?

posted Oct 18, 2017, 10:03 AM by JonAlf Dyrland-Weaver

Imagine:
Your team of four has been contracted to design and implement a wiki. Your team advertises proficiency with Flask, Python, and SQLite.

Your “software solution,” to use the parlance of our times, will incorporate a few distinct components, so it is imperative that your team develop a design before taking any further steps.
Deliverables:
  • A list of program components with role of each specified.
  • Explanation of how each component relates to the others.
    • Component map visualizing relationships between components.
  • Database Schema
  • Site map for front end
    • Represent each page you envision for your site.
    • Show linkages conveying user pathways for traversing site.
  • A breakdown of the different tasks required to complete this project
    • Include assignments of each task to each group member
  • Amalgamate these components into a single PDF

Work 10: Selecting Success

posted Oct 17, 2017, 10:05 AM by JonAlf Dyrland-Weaver

With your duo, write a Python script named stu_mean.py that will access the database built in your last assignment to
  • Look up each student’s grades
  • Compute each student’s average
  • Display each student’s name, id, and average
  • Create a table of IDs and associated averages, named "peeps_avg" (thank team Sparkly Spectacular Sushi)
  • Facilitate updating a student's average
  • Facilitate adding rows to the courses table
To test the last 2 features, you should add lines to the end of courses.csv to reflect a new term's worth of course enrollment for your peeps (students).
File under 10_db in the workshop, with your local submodule name in this format: lastaF-lastbF

Work 09: SQLite, same great SQL taste, half the calories

posted Oct 13, 2017, 12:57 PM by JonAlf Dyrland-Weaver

Grab the freshest sample code gift from the notes-n-code repo (right here: https://github.com/stuy-softdev/notes-and-code/tree/master/smpl/03_sqlite), and set about the mission below:

  • Read data from two CSV files --- one containing students and their IDs, another linking said IDs to the students' current grades in some courses --- and create a database whose table structure mimics that of the CSV files.
    • TASK the Foist: Familiarize yourself with Python's CSV module, specifically its DictReader() method, as it will greatly expedite your work going forward. (If you are already familiar, do your team a solid and lead a tutorial.)
      • For some sample code to get you going, see csv_tester.py
  • TASK the Second: Familiarize yourself with the contents of the two provided CSV files.
  • TASK the Toid: Write db_builder.py, which will
    • create a new SQLite database
    • utilize csv.DictReader() to read each provided CSV file
    • create a table for each
    • populate each table
  • Save your work in a new repo, linked under the db1 folder as TeamName_LastF-MastF-NastF
  • PROTIPs:
    • It may be helpful during development to delete your db file between runs.
    • Read through the db_builder skeleton and talk it over BEFORE you begin making it your own...
    • Use the sqlite shell to test out SQL commands before baking them into your Python script.
Put this under 09_sqlite in the workshop.

Work 08: login 2.0

posted Oct 6, 2017, 10:57 AM by JonAlf Dyrland-Weaver

Revise your login program form assignment 7 so that it uses redirect and url_for.

Submit this in the workshop under 08_login

Work 07: It's login, login, it's better than bad, it's good!

posted Oct 3, 2017, 8:23 PM by JonAlf Dyrland-Weaver   [ updated Oct 3, 2017, 8:26 PM ]

Yes, I know you have no idea what the title is about, so go here, you're welcome.

Work in pairs for this. You may self select pairs.

Continue working on the login flask app we have been building in class. For now, hardcode in your flask app a username and password combination. Include the following features:
  • The root route goes to the login form
  • The form send
    ​s​
     data to the flask app
  • The form target should check the credentials, and render a welcome page or an error page
    • If login failed, then a message should display what went wrong (bad password? bad username?)
  • Implement sessions
  • When a user logs in, a session should be established with the username stored
  • Root route should have 2 behaviors now
    ​:​
    • If the user is logged in, it should take them to a welcome page
    • If the user is not logged in, it should take them to the login page
  • Welcome page (successful login) should have a logout button that goes to a separate route that will log the user out of the session

Submit this as 07_login in the workshop.

Work 06: Echo echo echo...

posted Oct 2, 2017, 10:15 AM by JonAlf Dyrland-Weaver

Write a Flask app to echo to a user their input via an HTML form (use the form developed in class as a basis).

Your app's response should be rendered via a template, and should include
  • username entered
  • request method used 
  • your greeting to this person
Submit this as 06_echo in the workshop.

Work 05: Occupational Jinja Training

posted Sep 26, 2017, 10:13 AM by JonAlf Dyrland-Weaver   [ updated Sep 26, 2017, 10:29 AM ]

For this you will refer to your prior occupation assignment. You are encourage to re-use and refactor code as necessary.

With your table buddy, write a flask app with an "/occupations" route, which will generate an HTML page with an appropriate title, a descriptive heading, and a tablified version of the occupations data, followed by a randomly selected occupation.

If you're feeling flasky, and you've completed the requirements above, try this on for size:
  • For each occupation, find a link that would be helpful to get started in that filed.
  • Add that link to the occupations.csv file.
  • Include the link in the python dictionary you create (Note: you'll have to store the percentage and the link as values attached to each name)
  • When Your flask app renders the page, include the link to help your users on their way to their new job.


Submit this as 05_occupy_flask_st in the workshop.
New Naming Scheme: lastF-lastF

Work 04: Can I flask you a question?

posted Sep 20, 2017, 11:06 AM by JonAlf Dyrland-Weaver

Write a flask app that has 3 separate routes.

When working in github, DO NOT COMMIT YOUR VIRTUAL ENVIRONMENT folder (that means do not just git add * or .).

Submit this as 04_lemme_flask_u_sumpn in the workshop.

Work 03: Files occupy space

posted Sep 14, 2017, 10:20 AM by JonAlf Dyrland-Weaver

In the workshop you will find a .csv file that contains information about occupations in the United States (Courtesy of Mr. Brooks). Each line looks something like this:
    Legal,0.8
    "Education, training and library",6.1
The first item is the name of the occupation and the second is the percentage that occupation makes up of the U.S. workforce. Note that when the occupation has a comma in it, it is surrounded by quotation marks.

Your job (in pairs):
  • Read in the file and build an appropriate dictionary from it. Make sure the percentages are stored as numbers.
  • Create a function that returns a randomly selected occupation where the results are weighted by the percentage given. For example, there should be a 6.1% chance that "Education, training an library" is returned.
File this under 03_occupation

Work 02: Get your pyth-on

posted Sep 12, 2017, 9:51 AM by JonAlf Dyrland-Weaver

Here is a python dictionary where the keys are class periods and the values are lists containing the names of students:

CLASSES = {
    7: [ 'Helen', 'Shakil', 'Eric', 'Jennifer Y', 'Jennifer Z', 'Arif', 'Queenie', 'Jawadul', 'Shaina', 'Vivien', 'Brian', 'Naotaka', 'Bayan', 'Adam', 'Caleb', 'Terry', 'Jason', 'Alessandro', 'Samantha', 'Carol', 'Joyce', 'Shannon', 'Charles', 'Taylor', 'Kelly', 'Leo', 'Khyber', 'Ibnul', 'Eugene', 'Yuyang', 'Karina', 'Tiffany', 'Holden', 'Michael'],
    8: ['Masha', 'Adrian', 'David', 'Eric', 'Josh', 'Jerome', 'Henry', 'Jackie', 'Giorgio', 'Karen', 'Sonal', 'Xavier', 'Bermet', 'Alex', 'Iris', 'Manahal', 'Donia', 'Md', 'Connie', 'Lisa', 'Xing', 'Angelica', 'Angel', 'Augie', 'Dimitriy', 'Yiduo', 'Gordon', 'Tiffany', 'Clive', 'Jonathan', 'Sasha', 'Daniel'],
    9: [ 'Yu Qi', 'Michela', 'Kristin', 'Fabiha', 'Maxim', 'Marcus', 'Ish', 'James', 'Ryan', 'Edward', 'Adeeb', 'Jake', 'Cynthia', 'Kevin', 'Levi', 'Edmond', 'Kyle', 'Andrew', 'Max', 'Jenny', 'Philip', 'Shan', 'Mansour', 'Ray', 'Jake', 'Ida', 'Kerry', 'Stanley', 'Jackie', 'William', 'Tina', 'Michael']
}

With your partner, use your python knowledge to write a program that will print the name of a random selected student from a given period.

1-10 of 12