From 38f17179b2275708e0efe7cf02bb9bd73ca9cb67 Mon Sep 17 00:00:00 2001 From: Chris Harrelson Date: Thu, 15 Apr 2021 19:01:54 -0700 Subject: [PATCH 01/12] none --- llab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llab b/llab index df13c5d33..9dffce4dc 160000 --- a/llab +++ b/llab @@ -1 +1 @@ -Subproject commit df13c5d33237ad090b3a3a0b634f2cc99a2716a4 +Subproject commit 9dffce4dccf7d630e80ad3cc85695f9c348ce722 From ced146b1313611768e72bdae56bb3a155f8725c8 Mon Sep 17 00:00:00 2001 From: Chris Harrelson Date: Sat, 14 Aug 2021 20:54:17 -0700 Subject: [PATCH 02/12] none --- course/cs10_sp21.html | 2 +- llab | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/course/cs10_sp21.html b/course/cs10_sp21.html index 66c159929..35e4b7014 100644 --- a/course/cs10_sp21.html +++ b/course/cs10_sp21.html @@ -4,10 +4,10 @@ CS10 Labs | Spring 2021 | UC Berkeley - +

This is the CS10 version of The Beauty and Joy of Computing course during Spring 2021. diff --git a/llab b/llab index 9dffce4dc..df13c5d33 160000 --- a/llab +++ b/llab @@ -1 +1 @@ -Subproject commit 9dffce4dccf7d630e80ad3cc85695f9c348ce722 +Subproject commit df13c5d33237ad090b3a3a0b634f2cc99a2716a4 From ba80e1a0532c8f8b334ce02d306393b50a2da69b Mon Sep 17 00:00:00 2001 From: Chris Harrelson Date: Sat, 14 Aug 2021 21:38:18 -0700 Subject: [PATCH 03/12] Example pandoc template --- config.json | 3 +++ course/cs10_sp21.html | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 config.json diff --git a/config.json b/config.json new file mode 100644 index 000000000..8be71ddd3 --- /dev/null +++ b/config.json @@ -0,0 +1,3 @@ +{ + "css": ["abcd", "defg"] +} \ No newline at end of file diff --git a/course/cs10_sp21.html b/course/cs10_sp21.html index 35e4b7014..ae13bddae 100644 --- a/course/cs10_sp21.html +++ b/course/cs10_sp21.html @@ -2,6 +2,9 @@ CS10 Labs | Spring 2021 | UC Berkeley + $for(css)$ + + $endfor$ From 9751b3293a930bb7aa75ab16907ab36ca8112fc2 Mon Sep 17 00:00:00 2001 From: Chris Harrelson Date: Sat, 14 Aug 2021 23:04:48 -0700 Subject: [PATCH 04/12] Fix template errors --- .gitignore | 3 +- Makefile | 14 +++++ config.json | 7 ++- course.md | 0 course/cs10_sp21.html | 5 +- .../libraries/Moviepy/MoviePy-intro.html | 4 +- .../python/csed_python/open_python.html | 2 +- cur/programming/python/finding_a_bar.html | 8 +-- .../python_basic_files.html | 4 +- .../python_language_games.html | 4 +- .../python_text_processing_intro.html | 8 +-- .../hug_text_processing/python_top_words.html | 2 +- .../python/introduction-to-the-terminal.html | 20 +++---- cur/programming/python/open_python.html | 57 ------------------- cur/programming/python/parsons/exponent.html | 8 +-- .../python/parsons/hello_world.html | 8 +-- .../python/parsons/palindrome.html | 8 +-- .../python/parsons/sum_all_numbers.html | 8 +-- .../python/run_a_python_script.html | 4 +- .../running_script_from_command_line.html | 20 +++---- .../variables/reviewing-variables.html | 2 +- docs/templates/curriculum_template.html | 7 ++- 22 files changed, 87 insertions(+), 116 deletions(-) create mode 100644 Makefile create mode 100644 course.md diff --git a/.gitignore b/.gitignore index 13c659c19..ad1f130bf 100755 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ *Thumbs.db* .project .tm_properties -.gitmodules \ No newline at end of file +.gitmodules +www/* \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..adff78302 --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ +.PHONY: site copy + +PANDOC=pandoc --from markdown --to html --fail-if-warnings course.md --metadata title="mytitle" --metadata-file=config.json + +# Copies the existing source files into the www/ folder subdirectories. +# The purpuse is merely to create the directory structure; all of the files +# will be overwritten by the "site" target. +copy: + find course/ -name "*.html" | xargs -I {} cp --parents {} www + find cur/ -name "*.html" | xargs -I {} cp --parents {} www + +site: copy + find course/ -name "*.html" | xargs -I {} -n 1 ${PANDOC} --template {} -o www/{} + find cur/ -name "*.html" | xargs -I {} -n 1 ${PANDOC} --template {} -o www/{} diff --git a/config.json b/config.json index 8be71ddd3..be76b4150 100644 --- a/config.json +++ b/config.json @@ -1,3 +1,8 @@ { - "css": ["abcd", "defg"] + "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"] } \ No newline at end of file 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 ae13bddae..2eb2b37b9 100644 --- a/course/cs10_sp21.html +++ b/course/cs10_sp21.html @@ -3,7 +3,10 @@ CS10 Labs | Spring 2021 | UC Berkeley $for(css)$ - + + $endfor$ + $for(js)$ + - - -

- Python can be tricky to run at first on some computers. Always ask if you're having trouble. -

-

On Mac OS X: (including in-lab computers)

-

- You'll be running python from the Terminal application that we learned about on the last page. -

-

On Windows

-

- Python may not be set up properly on windows. If you are unable to get python to work from the command line (as explained below) here is a link that will help you get things set up if you'd like to work on your Windows machine. -

-

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
-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.
->>>
-        

-
-

python and python3, what's the difference? When you open Python with one of these commands, check out the text that appears like above. You'll see something like Python 3.4.0 or Python 2.7.10. These are just different versions of Python. The folks who develop Python release updates as new versions, just like apps on the App Store. Don't worry, both versions will work for this lab.

-
-

- We're now using Python! Notice that we still have a prompt, but it looks like this now: >>>. The >>> indicates that we're using Python right now, and is where we can type Python code. After typing a line of code, hitting enter will tell the python interpreter to run the instruction. Try typing the following into the interpreter: -

-


->>> 3 + 5
-8
-        

-

- 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$
-        

-

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

- -

- Here are some basic concepts about the Python intepreter you should understand before you move on: -

-

- - - 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)$ +

    This is the CS10 version of The Beauty and Joy of Computing course during Spring 2021. From a948290323fe84f24cb79aacf2ebf0d7bcf1649b Mon Sep 17 00:00:00 2001 From: Chris Harrelson Date: Sun, 15 Aug 2021 14:09:30 -0700 Subject: [PATCH 11/12] add newline --- config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.json b/config.json index be76b4150..1114d3105 100644 --- a/config.json +++ b/config.json @@ -5,4 +5,4 @@ "/bjc-r/llab/css/default.css" ], "js": ["/bjc-r/llab/loader.js"] -} \ No newline at end of file +} From 28482e4fd32bd8c5c9d40015d8d600c28e0630be Mon Sep 17 00:00:00 2001 From: Chris Harrelson Date: Sun, 15 Aug 2021 14:11:19 -0700 Subject: [PATCH 12/12] Fix error --- cur/programming/python/open_python.html | 57 +++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/cur/programming/python/open_python.html b/cur/programming/python/open_python.html index 919e7ed03..33e4eb361 100755 --- a/cur/programming/python/open_python.html +++ b/cur/programming/python/open_python.html @@ -12,3 +12,60 @@ gtag('config', 'UA-176402054-1'); + + +

    + Python can be tricky to run at first on some computers. Always ask if you're having trouble. +

    +

    On Mac OS X: (including in-lab computers)

    +

    + You'll be running python from the Terminal application that we learned about on the last page. +

    +

    On Windows

    +

    + Python may not be set up properly on windows. If you are unable to get python to work from the command line (as explained below) here is a link that will help you get things set up if you'd like to work on your Windows machine. +

    +

    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
    +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.
    +>>>
    +        

    +
    +

    python and python3, what's the difference? When you open Python with one of these commands, check out the text that appears like above. You'll see something like Python 3.4.0 or Python 2.7.10. These are just different versions of Python. The folks who develop Python release updates as new versions, just like apps on the App Store. Don't worry, both versions will work for this lab.

    +
    +

    + We're now using Python! Notice that we still have a prompt, but it looks like this now: >>>. The >>> indicates that we're using Python right now, and is where we can type Python code. After typing a line of code, hitting enter will tell the python interpreter to run the instruction. Try typing the following into the interpreter: +

    +

    
    +>>> 3 + 5
    +8
    +        

    +

    + 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$$
    +        

    +

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

    + +

    + Here are some basic concepts about the Python intepreter you should understand before you move on: +

      +
    • Open the interpreter with the command python or python3.
    • +
    • The interpreter will run the code you typed every time you press enter.
    • +
    • + Exit the interpreter with the command exit(). Now you can use commands like cd and ls again, and whatever you did in Python is lost. +
    • +
    +

    + + + \ No newline at end of file