About the CS 205 Workbook

Throughout CS 205, the workbook will be used as a platform to run your code and will serve as a portfolio of all your work. As a general rule, you will synchronize the workbook with the "master" workbook to get the latest demo, lab, and assignment. The master workbook contains only the descriptions of each demo, lab, and assignment and you will complete them in your own version of the workbook.

Installing the prerequisites

In order to get started with the CS 205 workbook, your computer must have the software that the workbook relies on already installed. To install everything that is needed, complete the following steps:

Open a Command Line Interface: The next step requires you to type a command into a command line interface. You must open a new command line interface after you installed Anaconda, so you should not do this step before the previous steps.

Downloading the CS 205 Workbook the first time

Before downloading the CS 205 Workbook, you will need to decide where you want it to "live" on your computer. For most people, a folder on the desktop makes the most sense. You will be working within it a lot, so it should be somewhere easy to access.

Mac

Go to your project on Gitlab

​​Go on Gitlab and go to your copy of the workbook, should be NETID/workbook.

Get your project's address

​​On the top, select HTTPS instead of SSH if you did not setup SSH key.

Copy the address

should look like https://gitlab-beta.engr.illinois.edu/NETID/FA15workbook.git (HTTPS) or git@gitlab-beta.engr.illinois.edu:hanchen2/workbook_dev.git (SSH)

Open a Command Line Interface: If you forgot how, instructions here. If you just installed git, you will need to close your old Command Line Interface and re-open it for it to know about git.

Navigate to your CS 205 folder on the Command Line Interface

If your folder is on your desktop and called cs205, you can do that by typing cd Desktop, pressing enter, typing cd cs205, and pressing enter again.

cd stands for change directory, use it to navigate through folders. cd "FOLDER NAME" to enter a folder or cd .. to back out a folder.

​One set of entries is labeled 'origin' which is your forked repository

One set of entries is labeled 'release' which is what you just added.

Updating the CS 205 Workbook to the latest version

When a new assignment is made, it will be done via the course adding content to the CS 205 Workbook. Therefore, for each assignment, you will need to update your workbook to the latest version each time.

To update it:

Mac​

Open a Command Line Interface: If you forgot how, instructions here. If you just installed git, you will need to close your old Command Line Interface and re-open it for it to know about git.

Navigate to your CS 205 folder on the Command Line Interface

If your folder is on your desktop and called cs205, you can do that by typing cd Desktop, pressing enter, typing cd cs205, and pressing enter again.

Fetch the latest updates

​​Type the following command git fetch release

​​Type the following command git checkout master

​​Continue if you see "Already on 'master'"

​​Type the following command git merge release/master

Windows

Navigate to your CS 205 folder on your computer

Open Git Bash

​​Right click any blank area within the folder and select 'Git Bash'

Fetch the latest updates

​​Type the following command git fetch release

​​Type the following command git checkout master

​​​Continue if you see "Already on 'master'"

​​Type the following command git merge release/master

Running the CS 205 Workbook

In order to run both your code, as well as the CS 205 Workbook as a whole, you need to start the CS 205 Workbook. To do this:

Open a command line interface and navigate to your CS 205 workbook folder

Run the app.py code in python

Run the following command: python app.py

View workbook in browser

Open a web browser and type 127.0.0.1:5000 into your address bar

Text Processing in the CS 205 Workbook

In order to run any text processing code (starting February 17), you need to install the nltk Natural Language Toolkit for python. To do this:

Open a command line interface

Run the following command: conda install nltk

Run the following command: python -m nltk.downloader punkt

Web Scraping

In order to run the web scraping code (starting April 2), you need to install the Scrapy package for python. To do this:

Open a command line interface

Run the following command: conda install scrapy

When prompted to proceed, choose: y

Creating a Scraper

To create each scraper, you should:

Rename your scraping folder olympics_original

Open a command line interface

Change directory to the py folder for your lab or demo

Run the following command: scrapy startproject projectname where you fill in the desired project name. For example, for the Olympics lab, you would type scrapy startproject olympics

Either in terminal or in your file manager, copy the following files from the olympics_original directory into the same folder in the olympics directory you just created:

items.py, pipelines.py, settings.py, olympics_scraper.py (or lyrics_scraper.py or whatever the scraper in the spiders folder is named)

Committing your work to Git, Gitlab, or update Heroku webpage

To turn in assignments in this class, you need to upload aka 'push' the changes you made onto Gitlab. You will first commit your changes, then push them onto Gitlab. Think of commit as a collection of changes, so you can commit multiple times before you do a push.

Mac OS X

Open a Command Line Interface: If you forgot how, instructions here. If you just installed git, you will need to close your old Command Line Interface and re-open it for it to know about git.

Navigate to your CS 205 workbook on the Command Line Interface

If your folder is on your desktop and called cs205, you can do that by typing cd Desktop, pressing enter, typing cd cs205, and pressing enter again.

(Optional) List of new or changed files

Run the following command: git status

Add changes to the next commit

Run the following command: git add FILENAME (replace FILENAME with the name of the new or modified file that you want to commit)

Repeat for all the files you want to commit.

This adds all the changes within the file to the next commit.

Do this for all new or modified files.

Commit changes to repository

Run the following command: git commit -m "USEFUL MESSAGE" (replace USEFUL MESSAGE with what you changes you made to the files)

If you ever need to rollback to an earlier revision. The message will help you determine which revision it is you are looking for.

(Optional) Update Heroku Website

​Run the following command: git push heroku master​

​'heroku' is the repository name.

'master' is the branch, every repository starts with the master branch.

(Optional) Push to Gitlab

​Run the following command: git push origin master​

​'origin' is the repository name.

'master' is the branch, every repository starts with the master branch.

Windows

Navigate to your CS 205 workbook on your computer

Open Git Bash

​​Right click any blank area within the folder and select 'Git Bash'

(Optional) List of new or changed files

Run the following command: git status

Add changes to the next commit

Run the following command: git add FILENAME (replace FILENAME with the name of the new or modified file that you want to commit)

Repeat for all the files you want to commit.

This adds all the changes within the file to the next commit.

Do this for all new or modified files.

Commit to repository

Run the following command: git commit -m "USEFUL MESSAGE" (replace USEFUL MESSAGE with what you changes you made to the files)

If you ever need to rollback to an earlier revision. The message will help you determine which revision it is you are looking for.

(Optional) Push to Gitlab

​Run the following command: git push origin master​

​'origin' is the repository name.

'master' is the branch, every repository starts with the master branch.

Deploying Workbook on Heroku

To deploy the app online, you should:

Mac OS X

Open a Command Line Interface: If you forgot how, instructions here. If you just installed git, you will need to close your old Command Line Interface and re-open it for it to know about git.

Navigate to your CS 205 workbook on the Command Line Interface

If your folder is on your desktop and called cs205, you can do that by typing cd Desktop, pressing enter, typing cd cs205, and pressing enter again.