Lecture Notes and Homeworks:

2015-06-12 Final Post

posted Jun 11, 2015, 8:38 PM by Samuel Konstantinovich   [ updated Jun 12, 2015, 5:37 AM ]

Please fill out the Exit Survey: (the end of the first part links to the second part)
(After it loads it should only take about 15-20 minutes to complete)

Place a text file directions.txt in your final project directory. Use this to explain all the features I can test on your final project.

Remember your project must be completed by Monday 8am unless you have spoken to me prior to today. 
DO test your code completely after making any changes. 
Do NOT have an index.html, or
Do NOT wait till Sunday to put any new features on the website... =)
**Do NOT edit/change your files after Monday 8am, or I will grade the previous version that you have posted. **

2015-06-08 Homework

posted Jun 8, 2015, 4:58 AM by Samuel Konstantinovich   [ updated Jun 9, 2015, 6:35 AM ]

-Each group will make one post with a link to their "Monday Version" in class. (This way you cannot forget to do so)
-Each group member will claim 5 other groups websites to test by posting a reply to their piazza post. 
(*do not claim a site with 10 or more claims, if you are the 11th or higher claim, it does not count)
-Test those 5 sites basic features, post, make comments. 
   *use your real name as the username when you sign up
   *keep your posts/comments 
   *do not post garbage data
   *do not post HTML or things that could break the site. 

*-If all sites have 10 or more claims, and you still need to go, then you may claim one with 10 or more claims.


posted Jun 5, 2015, 6:19 PM by Samuel Konstantinovich   [ updated Jun 5, 2015, 6:19 PM ]


As per project specifications you should have had a file:
You must now rename the file to:

changelog1.txt  (period 1)
changelog2.txt  (period 2)
changelog3.txt  (period 3)

2015-05-29 Final Project Guidelines

posted May 29, 2015, 6:08 AM by Samuel Konstantinovich   [ updated May 29, 2015, 6:10 AM ]

Final Project specifications
June 8th - Minimum Working Site. It has to work, have your most important features. 
June 15th - Improved Site with more features.

On your accounts you need directories each day:
0615/ <- final version

Each day, copy your project into a new directory, DO NOT touch the old directories. 

Each of you should keep a log of your changes every day!
You should each write your OWN changelog, and include what you perceive your partner to be doing. Yours should be more detailed when writing about what you do, and you can write what features they completed.

sample: (yours should be MUCH more specific)
   We both planned and researched.
   Bob: Set up login from Mr. K's base code.
   Amy: Added function to view list of users, created css.
   Bob: Created feature to add/view posts. 
   Amy: Created function to add/remove friend
   Bob:  Finished adding posts, started with adding comments
   Amy: Added function to view friend's posts, 

You are allowed to use my login base code
(use these 3 commands to copy them over)
mkdir sample
cd sampler
cp /home/support/konstans/public_html/pubLogin/*  .

2015-05-28 Final projects start!

posted May 28, 2015, 5:22 AM by Samuel Konstantinovich   [ updated May 28, 2015, 5:22 AM ]

Fill out this with your partner:


posted May 26, 2015, 4:59 AM by Samuel Konstantinovich   [ updated May 26, 2015, 4:59 AM ]

Do Now:

Make a text file login2.txt that contains all of your updated login files.
this should include your updated:
and any other py files that are part of the lab that you worked on over the weekend.

The text file should be in the following location:

Finish working on the lab so that you stay logged in. If you complete that, work on learning some css.

2015-05-21 Important

posted May 22, 2015, 5:17 AM by Samuel Konstantinovich   [ updated May 22, 2015, 5:17 AM ]

1. Rename the directory with your login lab to:  Login
(case sensitive)

2. Copy/Paste your login python file into a text file named login.txt. DO NOT copy any HTML files, just the py file. This can be done with a single terminal command:
cp login.txt
   If you have multiple py files for this assignment paste them all into the same text file.

2015-05-22 New assignment

posted May 22, 2015, 4:56 AM by Samuel Konstantinovich   [ updated May 22, 2015, 6:10 AM ]

Goal: Staying Logged in

When a python program is running as a website, it knows the address of the user connected to it:
after you :
import os
you can get a remote user (person connected to marge) address:
ip = os.environ["REMOTE_ADDR"]

if you run the py file locally, the key 'REMOTE_ADDR' will not be found! Check for this so it doesn't crash.

1. Make a file to store logged in users. CSV format and chmod it to allow writing. 

The format of loggedin.txt is:

2. When You log in successfully (you already did the log in) it should add that user to the loggedin.txt file. Provide a link to the main page:
""  #if bob logged in this would show up.

3. Make a main page python file which looks to see if you are logged in. (compares your user + id to AND the IP address logged in file)
a) When you connect to it without being logged in, it will link you back to the login page. 
b) When you are logged in, it tells you "good job", and shows a link to logout.
c) If you give your neighbor the same link, it should not work because they have a different IP address.

4. Make a function  remove(user,magicNumber) that will remove a user if the username and magic number match someone in the logged in file.

5. Make a logout page, that uses the remove method to log someone out, then links to the login page. (this is where redirects are useful)

Optional awesomeness:
Now the main page (and all other pages, should be able to link to eachother the same way your login linked to the main page.)


posted May 19, 2015, 7:06 AM by Samuel Konstantinovich   [ updated May 19, 2015, 7:07 AM ]

Goal: Login system

Step by step
0. create a text file with write permissions to use as a data file.
1. make a create form, that appends a username to a text file
2. make sure duplicate names are not appended to the file.
3. add the password field to your form, and append username,password to the file. Password should be plain text.
4. Modify your duplicate name code, you have to check if the part before the comma matches the user
5. Make a login form, that has user/password fields. If the entered name+password match one in the data file, the page should print "Success!" otherwise "Login Failed!"
6. Once you can create accounts, and log in you should try to hash the password using MD5.

By Thursday morning you should have a very nice login system.

import md5
m =
hashedPassword = m.hexdigest()
#now hashedPassword has the data you want
#you can test it by printing things out if you want to understand how it really works.
#if you don't test it by printing it out, things wont work and you wont know why!


posted May 15, 2015, 5:22 AM by Samuel Konstantinovich   [ updated May 15, 2015, 5:25 AM ]


You must submit the 5 assignments that are listed below.  You posted them on marge so the files are on these computers, and you can submit them easily.
1-Submit one file per slot.
2-Just submit the python file.
---Do not submit data files
---Do not submit HTML files with forms. 
3-When you are done, verify that your submissions are on the homework server!

05 - Madlibs
07 - SAT Lab 1 (not 2)
08 - Pokemon Lab
10 - Math Form (two numbers and a drop down menu)
11 - Dictionary Word Tally (Words words words, You just did it before the current lab)

This must be done Right away. 

-Work on your PPPLab
-Plan how you will break up the work for the weekend!
-Must be done by Monday morning.

1-10 of 64