diff --git a/.gitignore b/.gitignore index 13c659c19..fd0a96515 100755 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ *Thumbs.db* .project .tm_properties -.gitmodules \ No newline at end of file +.gitmodules +www/* diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..d505919a4 --- /dev/null +++ b/Makefile @@ -0,0 +1,15 @@ +.PHONY: site copy + +PANDOC=pandoc --from markdown --to html --fail-if-warnings course.md --metadata title="title" --metadata-file=config.json +SOURCES=index.html course/ cur/ glossary/ topic/ +EXTRAS=img llab.js llab/css/ llab/fonts/ llab/html llab/img/ llab/lib llab/script llab/loader.js + +# Copies the existing content into the www/ folder subdirectories. +copy: + cp -r --parents ${SOURCES} ${EXTRAS} www/bjc-r/ + +# Processes each HTML file as a template. If any template markers are present +# in the file, they will be replaced with data from config.json. Otherwise they +# will be unchanged. +site: copy + find ${SOURCES} -name "*.html" | xargs -I {} -n 1 ${PANDOC} --template {} -o www/bjc-r/{} diff --git a/config.json b/config.json new file mode 100644 index 000000000..1114d3105 --- /dev/null +++ b/config.json @@ -0,0 +1,8 @@ +{ + "css": [ + "/bjc-r/llab/lib/bootstrap/dist/css/bootstrap.min.css", + "/bjc-r/llab/lib/bootstrap/dist/css/bootstrap-theme.min.css", + "/bjc-r/llab/css/default.css" + ], + "js": ["/bjc-r/llab/loader.js"] +} diff --git a/course.md b/course.md new file mode 100644 index 000000000..e69de29bb diff --git a/course/cs10_sp21.html b/course/cs10_sp21.html index 66c159929..71efb7357 100644 --- a/course/cs10_sp21.html +++ b/course/cs10_sp21.html @@ -2,9 +2,14 @@ CS10 Labs | Spring 2021 | UC Berkeley + $for(css)$ + + $endfor$ + $for(js)$ + diff --git a/cur/programming/libraries/Moviepy/MoviePy-intro.html b/cur/programming/libraries/Moviepy/MoviePy-intro.html index 5aa7bbc36..70d583c35 100644 --- a/cur/programming/libraries/Moviepy/MoviePy-intro.html +++ b/cur/programming/libraries/Moviepy/MoviePy-intro.html @@ -27,10 +27,10 @@

Downloading MoviePy


 (For Mac - in the code below you can also replace 'python3' with 'python' if you have an older version)
-Alonzos-Laptop:~ alonzo$ python3 -m pip install moviepy
+Alonzos-Laptop:~ alonzo$$ python3 -m pip install moviepy
 
 (For Windows)
-Alonzos-Laptop:~ alonzo$ py -m pip install moviepy
+Alonzos-Laptop:~ alonzo$$ py -m pip install moviepy
     

That is all that is necessary to get the MoviePy Library onto your device! Next you will need to download diff --git a/cur/programming/python/csed_python/open_python.html b/cur/programming/python/csed_python/open_python.html index e58c3033c..ca2b349f1 100755 --- a/cur/programming/python/csed_python/open_python.html +++ b/cur/programming/python/csed_python/open_python.html @@ -48,7 +48,7 @@

Running Python

If the text cursor is on a line beginning with >>>, the command line window has an active python interpreter open. That means we can't do commands like cd, or ls, because the program is expecting Python code. To leave the python interpreter, type the exit command exit() and press enter.


 >>> exit()
-Alonzos-MacBook:~ alonzo$
+Alonzos-MacBook:~ alonzo$$
         

Any functions or variables created in the python interpreter are erased when the exit() command is run. diff --git a/cur/programming/python/finding_a_bar.html b/cur/programming/python/finding_a_bar.html index f3bb9614e..8e835990b 100755 --- a/cur/programming/python/finding_a_bar.html +++ b/cur/programming/python/finding_a_bar.html @@ -18,7 +18,7 @@ Now it's time to seriously write some code. Start by right clicking on this link and select save as. Make sure to save this file to the PythonLab1 directory that we made earlier. Head back to the shell and enter the ls command to make sure that the file made it into our PythonLab1 directory.


-Alonzos-MacBook:PythonLab1 alonzo$ ls
+Alonzos-MacBook:PythonLab1 alonzo$$ ls
 virus.py
         

@@ -31,13 +31,13 @@ Head back to the shell and you can try running this file by entering python3 virus.py as shown below:


-Alonzos-MacBook:PythonLab1 alonzo$ python3 virus.py
+Alonzos-MacBook:PythonLab1 alonzo$$ python3 virus.py
         

Next try running the first exercise by entering python3 virus.py first_even_nums 5 (if it's working this should print the first 5 even numbers, starting with the number 2):


-Alonzos-MacBook:PythonLab1 alonzo$ python3 virus.py first_even_nums 5
+Alonzos-MacBook:PythonLab1 alonzo$$ python3 virus.py first_even_nums 5
 2
 4
 6
@@ -47,7 +47,7 @@
             Uh oh...it looks like we've only printed the first 4 even numbers. Head back to Sublime and edit the function called first_even_nums so that we get the correct behavior:
         


-Alonzos-MacBook:PythonLab1 alonzo$ python3 virus.py first_even_nums 5
+Alonzos-MacBook:PythonLab1 alonzo$$ python3 virus.py first_even_nums 5
 2
 4
 6
diff --git a/cur/programming/python/hug_text_processing/python_basic_files.html b/cur/programming/python/hug_text_processing/python_basic_files.html
index 0175987bf..09abf7dd9 100644
--- a/cur/programming/python/hug_text_processing/python_basic_files.html
+++ b/cur/programming/python/hug_text_processing/python_basic_files.html
@@ -30,7 +30,7 @@
         Run this file and you should see something mysterious that looks something like:
       

-
$ python word_analyzer.py
+    
$$ python word_analyzer.py
 <_io.TextIOWrapper name='horse_ebooks.txt' mode='r' encoding='UTF-8'>

@@ -47,7 +47,7 @@ Try running word_analyzer.py, and you should get a print out of the contents of the file "horse_ebooks.txt".

-
$ python word_analyzer.py
+    
$$ python word_analyzer.py
 Fruits and Vegetables and Vegetables on a Budget and Vegetables at a Store and Vegetables to Clean Fruit and Vegetables

If we look to the Python code, f.read() is the important part. read is a function that is built into every file object (just like .append is built into any list and .join is built into any string). Here, we're telling the file object to give us the information in the file for which it is responsible (horse_ebooks.txt). Note that this was not possible in Snap!, given the restrictions that our web browser places on the Snap! interpreter. diff --git a/cur/programming/python/hug_text_processing/python_language_games.html b/cur/programming/python/hug_text_processing/python_language_games.html index 2a5f32f52..ba4ac92ce 100644 --- a/cur/programming/python/hug_text_processing/python_language_games.html +++ b/cur/programming/python/hug_text_processing/python_language_games.html @@ -41,7 +41,7 @@

Pig Latin

Try running word_analyzer.py, and you should get:

-
$ python word_analyzer.py
+		 
$$ python word_analyzer.py
 Ellohay

-izzle Speak

@@ -117,7 +117,7 @@

Higher Order Manipulation

text = read_file("text_processing/gettysburg.txt")
 print(apply_language_game(text, izzle))
 	 
-
$ python word_analyzer.py
+     
$$ python word_analyzer.py
 Foizzle scorizzle izzle sevizzle yeizzle agizzle oizzle fathizzle broizzle ...
\ No newline at end of file diff --git a/cur/programming/python/hug_text_processing/python_text_processing_intro.html b/cur/programming/python/hug_text_processing/python_text_processing_intro.html index be8c4e74c..1ffeb2286 100644 --- a/cur/programming/python/hug_text_processing/python_text_processing_intro.html +++ b/cur/programming/python/hug_text_processing/python_text_processing_intro.html @@ -35,11 +35,11 @@
  • Download the data for this lab from this link.
  • Unzip this file into the datalab folder. You can unzip this file through the command line by using the unzip command. -
    $ unzip text_processing.zip
    -$ ls
    +            
    $$ unzip text_processing.zip
    +$$ ls
     text_processing.zip  text_processing
    -$ cd text_processing
    -$ ls
    +$$ cd text_processing
    +$$ ls
     beatles.txt     nietzsche.txt
     democratic_debate_2015.txt  presedential_debate_2016.txt
     ee_cummings.txt     republican_debate_2015.txt
    diff --git a/cur/programming/python/hug_text_processing/python_top_words.html b/cur/programming/python/hug_text_processing/python_top_words.html
    index 62907888d..e0f1cea4f 100644
    --- a/cur/programming/python/hug_text_processing/python_top_words.html
    +++ b/cur/programming/python/hug_text_processing/python_top_words.html
    @@ -52,7 +52,7 @@
     
         
           
    -$ python word_analyzer.py
    +$$ python word_analyzer.py
     ['on', 'Budget', 'to', 'Fruit', 'Clean', 'Fruits', 'Store', 'at', 'a', 'and', 'Vegetables']
     
         
    diff --git a/cur/programming/python/introduction-to-the-terminal.html b/cur/programming/python/introduction-to-the-terminal.html index 9bfe2b92f..034552add 100644 --- a/cur/programming/python/introduction-to-the-terminal.html +++ b/cur/programming/python/introduction-to-the-terminal.html @@ -23,7 +23,7 @@

    Opening a Terminal

    If you're on one of the lab computers or on your own Mac, search for the application Terminal and open it. If you're using Windows, search for cmd.exe instead. After you open the program, you should have a window that has something like this in it:

    
    -Alonzos-MacBook:~ alonzo$
    +Alonzos-MacBook:~ alonzo$$
           

    The little bit of text that's already in the window is called the prompt. It gives you a bit of information about the computer that you're on. When you type commands, they appear to the right of the prompt. @@ -36,7 +36,7 @@

    ls: listing contents of a directory

    To see what's in the current directory, we can use the command ls (use dir instead if on Windows). The ls command lists the contents of our current directory. To use a command, type it in the terminal, then press 'enter'. Try it out. You should see something like this:

    
    -Alonzos-MacBook:~ alonzo$ ls
    +Alonzos-MacBook:~ alonzo$$ ls
     Applications		Downloads	Pictures
     Library			Public		Music
     Desktop			Movies		Documents
    @@ -46,8 +46,8 @@ 

    cd: navigating to another directory

    We can see that the home directory has some other directories in it, such as Documents and Desktop. If we want to go into one of those directories, we can use the command cd, followed by that directory's name. Try it out by using the command cd Documents.

    
    -Alonzos-MacBook:~ alonzo$ cd Documents
    -Alonzos-MacBook:Documents alonzo$
    +Alonzos-MacBook:~ alonzo$$ cd Documents
    +Alonzos-MacBook:Documents alonzo$$
             

    Now you're in the Documents directory. We can use ls again to see the contents of Documents. @@ -56,23 +56,23 @@

    cd: navigating to another directory

    How can we get back to the home directory from here? cd .. moves us upward one directory, which puts us back in home. The "dot dot" always means "parent directory". This means we can use cd .. to go to upward one directory. Try it out!

    
    -Alonzos-MacBook:Documents alonzo$ cd ..
    -Alonzos-MacBook:~ alonzo$
    +Alonzos-MacBook:Documents alonzo$$ cd ..
    +Alonzos-MacBook:~ alonzo$$
             

    mkdir: making a new directory

    Okay, now that we've tried that, let's go back to Documents. (If you're in home, use the command cd Documents). You're probably used to making new folders on your computer by using a menu action like "File > New Folder", or a keyboard shortcut like "shift-cmd-N". To make a new directory (folder) using the terminal, we can use the command mkdir followed by the name we want for the new directory. Try the command mkdir PythonLab1.

    
    -Alonzos-MacBook:~ alonzo$ cd Documents
    -Alonzos-MacBook:Documents alonzo$ mkdir PythonLab1
    +Alonzos-MacBook:~ alonzo$$ cd Documents
    +Alonzos-MacBook:Documents alonzo$$ mkdir PythonLab1
     				

    Nice! now use ls to confirm that your directory has been created! We can use cd PythonLab1 to go into our new directory.

    
    -Alonzos-MacBook:Documents alonzo$ cd PythonLab1
    -Alonzos-MacBook:PythonLab1 alonzo$
    +Alonzos-MacBook:Documents alonzo$$ cd PythonLab1
    +Alonzos-MacBook:PythonLab1 alonzo$$
     				

    diff --git a/cur/programming/python/open_python.html b/cur/programming/python/open_python.html index 286adf0b7..33e4eb361 100755 --- a/cur/programming/python/open_python.html +++ b/cur/programming/python/open_python.html @@ -30,7 +30,7 @@

    Running Python

    The first step is to open the Python interpreter. On the command line in your terminal, use the command python3. If you see something like "command not found", then use the command python instead. You should see something similar to the following:

    
    -Alonzos-MacBook:~ alonzo$ python3
    +Alonzos-MacBook:~ alonzo$$ python3
     Python 3.4.0 (v3.4.0:04f714765c13, Month DD YYYY, HH:MM:SS)
     [GCC X.X.X] on darwin
     Type "help", "copyright", "credits" or "license" for more information.
    @@ -50,7 +50,7 @@ 

    Running Python

    If the text cursor is on a line beginning with >>>, the command line window has an active python interpreter open. That means we can't do commands like cd, or ls, because the program is expecting Python code. To leave the python interpreter, type the exit command exit() and press enter.

    
     >>> exit()
    -Alonzos-MacBook:~ alonzo$
    +Alonzos-MacBook:~ alonzo$$
             

    Any functions or variables created in the python interpreter are erased when the exit() command is run. @@ -68,4 +68,4 @@

    Running Python

    - + \ No newline at end of file diff --git a/cur/programming/python/parsons/exponent.html b/cur/programming/python/parsons/exponent.html index 94ae47d59..34f955717 100644 --- a/cur/programming/python/parsons/exponent.html +++ b/cur/programming/python/parsons/exponent.html @@ -64,7 +64,7 @@

    Exercise 2: Exponents

    } } - $(document).ready(function(){ + $$(document).ready(function(){ var parson = new ParsonsWidget({ 'sortableId': 'sortable', 'trashId': 'sortableTrash', @@ -73,15 +73,15 @@

    Exercise 2: Exponents

    }); parson.init(initial); parson.shuffleLines(); - $("#newInstanceLink").click(function(event){ + $$("#newInstanceLink").click(function(event){ event.preventDefault(); parson.shuffleLines(); }); - $("#feedbackLink").click(function(event){ + $$("#feedbackLink").click(function(event){ event.preventDefault(); parson.getFeedback("exponent"); }); - $("#exportLink").click(function(event){ + $$("#exportLink").click(function(event){ event.preventDefault(); parson.export("exponent.py"); }); diff --git a/cur/programming/python/parsons/hello_world.html b/cur/programming/python/parsons/hello_world.html index fe662133e..cee4f2a15 100644 --- a/cur/programming/python/parsons/hello_world.html +++ b/cur/programming/python/parsons/hello_world.html @@ -48,7 +48,7 @@

    Exercise 0: Hello World

    } } - $(document).ready(function(){ + $$(document).ready(function(){ var parson = new ParsonsWidget({ 'sortableId': 'sortable', 'trashId': 'sortableTrash', @@ -57,15 +57,15 @@

    Exercise 0: Hello World

    }); parson.init(initial); parson.shuffleLines(); - $("#newInstanceLink").click(function(event){ + $$("#newInstanceLink").click(function(event){ event.preventDefault(); parson.shuffleLines(); }); - $("#feedbackLink").click(function(event){ + $$("#feedbackLink").click(function(event){ event.preventDefault(); parson.getFeedback("hello_world"); }); - $("#exportLink").click(function(event){ + $$("#exportLink").click(function(event){ event.preventDefault(); parson.export("hello_world.py"); }); diff --git a/cur/programming/python/parsons/palindrome.html b/cur/programming/python/parsons/palindrome.html index 8ff53d911..4b119df49 100644 --- a/cur/programming/python/parsons/palindrome.html +++ b/cur/programming/python/parsons/palindrome.html @@ -57,7 +57,7 @@

    Exercise 3: Palindrome

    } } - $(document).ready(function(){ + $$(document).ready(function(){ var parson = new ParsonsWidget({ 'sortableId': 'sortable', 'trashId': 'sortableTrash', @@ -66,15 +66,15 @@

    Exercise 3: Palindrome

    }); parson.init(initial); parson.shuffleLines(); - $("#newInstanceLink").click(function(event){ + $$("#newInstanceLink").click(function(event){ event.preventDefault(); parson.shuffleLines(); }); - $("#feedbackLink").click(function(event){ + $$("#feedbackLink").click(function(event){ event.preventDefault(); parson.getFeedback("palindrome"); }); - $("#exportLink").click(function(event){ + $$("#exportLink").click(function(event){ event.preventDefault(); parson.export("palindrome.py"); }); diff --git a/cur/programming/python/parsons/sum_all_numbers.html b/cur/programming/python/parsons/sum_all_numbers.html index 99f986cd7..a6fb51c85 100644 --- a/cur/programming/python/parsons/sum_all_numbers.html +++ b/cur/programming/python/parsons/sum_all_numbers.html @@ -64,7 +64,7 @@

    Exercise 1: Sum All Numbers

    } } - $(document).ready(function(){ + $$(document).ready(function(){ var parson = new ParsonsWidget({ 'sortableId': 'sortable', 'trashId': 'sortableTrash', @@ -73,15 +73,15 @@

    Exercise 1: Sum All Numbers

    }); parson.init(initial); parson.shuffleLines(); - $("#newInstanceLink").click(function(event){ + $$("#newInstanceLink").click(function(event){ event.preventDefault(); parson.shuffleLines(); }); - $("#feedbackLink").click(function(event){ + $$("#feedbackLink").click(function(event){ event.preventDefault(); parson.getFeedback("sum_all_numbers"); }); - $("#exportLink").click(function(event){ + $$("#exportLink").click(function(event){ event.preventDefault(); parson.export("sum_all_numbers.py"); }); diff --git a/cur/programming/python/run_a_python_script.html b/cur/programming/python/run_a_python_script.html index 579281573..7b805070d 100644 --- a/cur/programming/python/run_a_python_script.html +++ b/cur/programming/python/run_a_python_script.html @@ -40,7 +40,7 @@

    Running a Python File

    Now, let's run the file with Python. Head back to your terminal, and use the commands you learned earlier to navigate to the PythonLab1 directory we made earlier. Once you are there, use the ls command to verify that lab1.py is there!

    
    -Alonzos-MacBook:PythonLab1 alonzo$ ls
    +Alonzos-MacBook:PythonLab1 alonzo$$ ls
     lab1.py
             

    @@ -53,7 +53,7 @@

    Interactive Mode

    Did you notice that after the command python3 lab1.py, the prompt was back to something like:

    -

    Alonzos-MacBook:PythonLab1 alonzo$?

    +

    Alonzos-MacBook:PythonLab1 alonzo$$?

    This means that even though we opened Python to run our program, Python exited when it was done. Sometimes, we'd like to stay in Python after we run a file!

    diff --git a/cur/programming/python/running_script_from_command_line.html b/cur/programming/python/running_script_from_command_line.html index 058bff420..f31dfde67 100755 --- a/cur/programming/python/running_script_from_command_line.html +++ b/cur/programming/python/running_script_from_command_line.html @@ -35,7 +35,7 @@

    How files are organized on a computer:

    First, enter the command ls to view a list of all of the files and directories that are located in your current directory (if you're using windows the command is dir not ls). If you see a ~ next to your user name (alonzo is the username below) then we are in our home directory. To go directly to your home directory enter the command cd. When your enter ls in your home directory you should see something similar to the following:

    
    -Alonzos-MacBook:~ alonzo$ ls
    +Alonzos-MacBook:~ alonzo$$ ls
     Applications		Downloads	Pictures
     Library			Public		Music
     Desktop			Movies		Documents
    @@ -46,17 +46,17 @@ 

    How files are organized on a computer:

    Next, move into the Documents directory by entering the command cd Documents. This stands for change directory to the given directory name. The following should appear (notice that the ~ has now been replaced by the directory name Documents):

    
    -Alonzos-MacBook:~ alonzo$ cd Documents
    -Alonzos-MacBook:Documents alonzo$
    +Alonzos-MacBook:~ alonzo$$ cd Documents
    +Alonzos-MacBook:Documents alonzo$$
     				


    If we need to move back out of our directory we can enter the command cd .. Shown below is how to move out of our documents directory and then back into it:

    
    -Alonzos-MacBook:Documents alonzo$ cd ..
    -Alonzos-MacBook:~ alonzo$ cd Documents
    -Alonzos-MacBook:Documents alonzo$
    +Alonzos-MacBook:Documents alonzo$$ cd ..
    +Alonzos-MacBook:~ alonzo$$ cd Documents
    +Alonzos-MacBook:Documents alonzo$$
     				

  • @@ -64,10 +64,10 @@

    How files are organized on a computer:

    Finally, let's make a directory that will hold our python files.We can enter the command mkdir PythonLab1 to create a directory called PythonLab1 as shown below. Now that we have made this new directory enter the command cd PythonLab1 to go to the directory.

    
    -Alonzos-MacBook:Documents alonzo$ 
    -Alonzos-MacBook:Documents alonzo$ mkdir PythonLab1
    -Alonzos-MacBook:Documents alonzo$ cd PythonLab1
    -Alonzos-MacBook:PythonLab1 alonzo$ 
    +Alonzos-MacBook:Documents alonzo$$ 
    +Alonzos-MacBook:Documents alonzo$$ mkdir PythonLab1
    +Alonzos-MacBook:Documents alonzo$$ cd PythonLab1
    +Alonzos-MacBook:PythonLab1 alonzo$$ 
     				

    Now we have a place to put all of our python files! Continue to the next page to download the starter file for this lab. diff --git a/cur/programming/variables/reviewing-variables.html b/cur/programming/variables/reviewing-variables.html index f972c52fd..b2dea5b19 100755 --- a/cur/programming/variables/reviewing-variables.html +++ b/cur/programming/variables/reviewing-variables.html @@ -8,4 +8,4 @@ gtag('config', 'UA-176402054-1'); - The previous lab was aimed at getting you comfortable with using variables to store values and thus to do things you couldn't do before. Variables are one of the central concepts in computer science and one of the most powerful tools in a programmer's toolbox. They will pop up steadily throughout the rest of the semester.

    These are two blocks that we will be seeing a lot in the coming months. Make sure that you are clear with the differences are between them.

    Set and change

    As we mentioned in the last lab, you can use these two blocks to accomplish the same thing, but it probably makes more sense to use one over the other depending on what you are trying to do. If you are trying to set the value relative to what it already is (such as adding $5 to a variable storing a bank balance), you will probably be better off using a change block. If you are trying to set it to a totally new, unrelated value (such as resetting someone's score in a video game), then you will probably want to use a set block. + The previous lab was aimed at getting you comfortable with using variables to store values and thus to do things you couldn't do before. Variables are one of the central concepts in computer science and one of the most powerful tools in a programmer's toolbox. They will pop up steadily throughout the rest of the semester.

    These are two blocks that we will be seeing a lot in the coming months. Make sure that you are clear with the differences are between them.

    Set and change

    As we mentioned in the last lab, you can use these two blocks to accomplish the same thing, but it probably makes more sense to use one over the other depending on what you are trying to do. If you are trying to set the value relative to what it already is (such as adding $$5 to a variable storing a bank balance), you will probably be better off using a change block. If you are trying to set it to a totally new, unrelated value (such as resetting someone's score in a video game), then you will probably want to use a set block. diff --git a/docs/templates/curriculum_template.html b/docs/templates/curriculum_template.html index c708db56b..027aa7fac 100755 --- a/docs/templates/curriculum_template.html +++ b/docs/templates/curriculum_template.html @@ -1,7 +1,12 @@ - + $for(css)$ + + $endfor$ + $for(js)$ +