W5020 CS Ed Week 2020
CS ED Week[edit]
If you would like to participate in the event, please sign up by Clicking Here
Future updates will be provided through the Remind class @ahs-csed.
We thank you for your interest in participating!
Promotional Material[edit]
An Hour of Code and Beyond
"There's more to it than meets the eye"
Wednesday, December 9th, 2020 5PM-7PM
What is CS ED Week about: “Computer Science Education Week (CSEdWeek) is an annual call to action to inspire K-12 students to learn computer science, advocate for equity in computer science education, and celebrate the contributions of students, teachers, and partners to the field. As part of the #CSforGood movement this year we’re proud to elevate”
Topics we will go over:
* Computer Science Intro * Linux Basics * Shell basics * Igis and graphics * CSS/HTML Basics
Merlin Shell Access Application:
If you do not have access to the Merlin Shell, use this Link to sign up. You will need this access to the shell in order to participate in the events today!
https://www.codermerlin.com/wiki/index.php/Merlin_Shell_Access_Application
CS ED Survey If you already completed the application above, fill this survey so we can see what interests you!
https://docs.google.com/forms/d/e/1FAIpQLScyx0dsKmb53X6WCXeMNaISDzvVfIpH6u-pvJluvF_ZEke9Ew/viewform?embedded=true
Computer Science[edit]
Why Computer Science?[edit]
Computer science is one of the fastest growing pathways in terms of not only economic viability, but also accessibility and significance. With the onset of the digital age, many industries have turned towards technology as their ticket to the future, and now, more than ever, need computer scientists in their fields: restaurants and grocery chains rely on mobile applications for deliveries and purchases, while distributors like Amazon continue to thrive in online shopping. Yet without the programmers behind the scenes, none of this would be possible.
Programming exists virtually everywhere, encompassing a large share of the job market, and can be done in any environment.
Fundamental Concepts of Computer Science[edit]
Computer Science, at its core, is the bridge between computers and humans, allowing us to “talk” to machines and tell them what to do. Coding languages are used to translate normal words into computer language. For example, 2 is a number and is represented through a variable which can store numbers and has a label to clarify exactly what information it stores. Coding languages have a few basic data types used to store common real world values:
- Booleans represent whether something is true or false
- Integers represent positive and negative whole numbers
- Doubles represent positive and negative decimals
- Characters represent ‘letters’, except they also include numbers, symbols, and other written characters, so long as they are only 1 unit long.
This means ‘a’ is a single character while ‘an’ is made up of two characters. - Strings represent words, or several characters put together
These are the 5 basic variable types used in coding. However, if you wanted to store the information of something more complicated than just a number or a word, like a car, you would use classes. A class is a way to group together lots of smaller variables as parts of a larger object. For example, every car must have engine specs, a color, some number of seats, and other information which can be stored using any of the 5 basic data types. A class allows you to put everything together under one name. Classes also have the ability to do things, called functions. Functions are the actions a class can do, such as a car class having the ability to change its color through a paintjob or increase its speed.
Linux Basics[edit]
Getting Ready[edit]
Installing the secure shell extension[edit]
To access Merlin, you'll need a secure shell client.
If you're using a Windows-based device (usable on any device with Chrome): install Google Chrome, open up Chrome and search "Secure Shell Extension", install the extension.
If you're using a Mac or Linux based device, it probably has a built-in client which can be accessed from the terminal.
You will need a connection string to access the server.
Obtaining an account[edit]
Fill out this form (if you haven't already) and wait for your credentials to be provided (via email).
Once your account is obtained, open up the "Connection Dialogue", and input the connection string. It will prompt you for your password, input it and continue.
It will prompt you to reset your password, which you can do by typing "passwd" into the terminal:
(here for further information)
Change your default password to a strong password:
john-williams@codermerlin:~$ passwd
Changing password for john-williams.
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
[edit]
View the working directory[edit]
In order to see what our working directory is inside the shell, we are going to use pwd which stands for "print the working directory". You can use the command by typing it in and hitting <RETURN>.
first-last@codermerlin:~$ pwd
/home/first-last
After using the command you should see something like the above console line. As long as you haven't moved in the directory you should start off in the home directory.
Listing directories and files[edit]
Next, let's try the ls command which will list the directories and files in the working directory. However no files or directories have been created yet, so there won't be anything to display.
first-last@codermerlin:~$ ls
Making a directory[edit]
We can make a directory by using the command mkdir
first-last@codermerlin:~$ mkdir firstDirectory
Then to enter the directory simply use the command "cd <SPACE> directoryName".
first-last@codermerlin:~$ cd firstDirectory
And if we use the pwd command now, we should see that we are in the created directory.
first-last@codermerlin:~$ pwd
/home/first-last/firstDirectory
Changing directories[edit]
Now let's navigate out of the current directory. Using the previous cd command we can use "../" to go back one directory (which can be chained together, e.g. "../../../"), leave it blank to return to the home directory or use "~" to also get to the home directory.
first-last@codermerlin:~$ cd ../
Now that we have returned to the home directory, let's try listing again:
first-last@codermerlin:~$ ls
You should now see the directory previously added.
firstDirectory
Creating a file[edit]
We can create a file using the emacs command followed by the file name and extension. In this case, we are using the Swift coding language so the extension is ".swift". This will create and open the file, which will initially be blank, but if the file already exists this command can be used to open and edit it.
first-last@codermerlin:~$ emacs main.swift
Once we have a file open we can begin using emacs short-cuts in order to navigate and edit the file. However for now let's suspend the file using CONTROL-z (press your control key, followed by the 'z' key).
View running files[edit]
Now we are back in the shell, however, we still have a file that is open, but suspended. Using the command jobs we can see all of our open files.
first-last@codermerlin:~$ jobs
Upon using the command you should see something similar to this:
first-last@codermerlin:~$ [1]+ Stopped /usr/local/bin/emacs main.swift
Opening suspended files[edit]
Let's reopen the file using the fg command.
first-last@codermerlin:~$ fg
And finally, let's first save the file using CONTROL-x-s and then close the file using CONTROL-x-c. For further reference, about the Emacs commands, continue to the next section.
For more detailed information on this and relating topics: W1002 The Client, the Server, and the Shell
Emacs[edit]
Emacs is the text editor we will be using to edit our files today. Many of the important key sequences for navigating, suspending/exiting, and saving files will be displayed in the following charts. Keep in mind this list is not comprehensive, but mostly accounts for basic emacs usage. A comprehensive list of Emacs Keys can be found here. Additionally typing "emacs" into the shell brings up further documentation.
[edit]
Key Sequence | Purpose |
---|---|
CONTROL-v | Scroll down (forwards) one page |
ALT-v | Scroll up (backwards) one page |
CONTROL-l (second character is lowercase 'L') | Clear screen and redisplay the text, moving the cursor to the vertical center |
ALT-SHIFT-< | Move the cursor to the beginning of the file |
ALT-SHIFT-> | Move the cursor to the end of the file |
The arrow keys can be used to traverse across characters. Keep in mind that using emacs keys for moving across characters is an option as well.
Suspend/Exit and Save[edit]
Key Sequence | Purpose |
---|---|
CONTROL-x CONTROL-c | Exit emacs |
CONTROL-z | Suspend emacs temporarily |
CONTROL-x CONTROL-s | Save the current file |
CONTROL-x s | Save changed files (prompts for all confirmation) |