Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 108 Computing Fundamentals

Similar presentations


Presentation on theme: "CS 108 Computing Fundamentals"— Presentation transcript:

1 CS 108 Computing Fundamentals
August 31, 2017 1

2 Quiz and Homework Review
Quiz review Discuss the homework assignments File boxes Available starting on Tuesday, Sept 5th Outside of the classroom door at 9:45 AM (15 min before class) Please take the contents of your file... please do not take the file folder itself Please do not remove your file folder from the box (let's keep the files in alphabetical order 2

3 Class Videos Should be ready for "prime time" next week 3

4 Operating Systems (1) Software that manages the hardware and software resources of a computer Performs basic tasks controls and allocates memory prioritizes the processing of instructions controls input and output devices facilitates networking manages files and more 4

5 Operating Systems (2) Main advantages of an OS:
Multiple programs can run concurrently Multiple people can use hardware/software concurrently Simplifies the programming of application software Programs do not have to manage hardware directly Programs work through the OS to interact with hardware Programs interact with other programs through the OS 5

6 Operating Systems (3) Lowest level of any operating system is its kernel First layer of software loaded into memory when a system boots Provides access to various common core services Scott Spetka offers a LINUX kernel programming course Most computer users: Use Microsoft Windows as their OS of "choice" Windows uses a GUI to "interact" with the OS The interface and the OS are different animals We are going to use the UNIX every time we login to Fang on DogNet... Putty is not an interface... Putty is a connectivity tool UNIX uses "shells" as interfaces 6

7 UNIX Shells There are a number of shells available
DogNet uses the tcsh shell We can prove that by having DogNet tell us the shell that we're using At the fang prompt enter this command: echo $SHELL Note: You do not have the authority to change shells on Fang 7

8 What Can We Do With UNIX (1)
The sky is the limit!! UNIX is the backbone of the Internet Here’s one of many great tutorials on the Web 8

9 What Can We Do With UNIX (2)
Let's start small... let's make sure you are who you think you are: At the Fang prompt enter: whoami Let's find out who is logged onto the system right now who Let's compare the results of who with the results of w w 9

10 What Can We Do With UNIX (3)
What about things that you normally "point and click" to accomplish in Windows? You don't need Windows to get things done even when you're using Windows Windows has a DOS prompt available DOS and UNIX commands are pretty similar Check the next slide 10

11 What Can We Do With UNIX (4)
Command UNIX DOS/Windows List directory content ls dir Copy a file cp copy Delete a file rm del Rename a file mv rename Display contents cat type Print a file lpr print Change directory cd cd 11

12 What Can We Do With UNIX (5)
Command UNIX DOS/Windows List directory content ls dir List directories with a / ls –F or ls –p How can we learn more about the ls command from within the UNIX shell? man pages Manual pages man ls Hit the spacebar to move forward and q to quit 12

13 UNIX Help is Everywhere
Tiny sample of help available 13

14 Let's Talk About Directories (1)
What is a directory? a place to store files (a virtual container for files… think of something similar to Windows “folders” ) ls alone shows you files in your current working directory, but there are other directories directories can contain files and/or other directories 14

15 Let's Talk About Directories (2)
Directories in a UNIX file system are organized into a hierarchy, starting at the root directory When you refer to a file in a command, that file is assumed to be in the current directory You can refer to a file in some other directory by using or including its pathname You can use the pwd command to find out where you are located in the directory structure… pwd tells me, right at this moment, my present working directory is: /home/f/csci/urbanc 15

16 Let's Talk About Directories (3)
You can use the pwd command to find out where you are located in the directory structure… pwd tells me, right at this moment, my present working directory is: /home/f/csci/urbanc The left-most / represents the root directory… the other / are separators between directories in the directory hierarchy… we can use /home/f/csci/urbanc to determine the information on the next slide 16

17 / (root) (1) | /home /f /csci /urbanc /home/f/csci/urbanc Tells me that my (urbanc’s) home directory is 4 levels down from the root At this point I have no idea what other directories and files are in the hierarchy Let’s explore 17

18 cd / (change directory to the root) ls ls -p
| | | | | | | /bin /dev /boot /home /usr /lib pwd cd / (change directory to the root) ls ls -p We now see directories other than home that are directly under root 18

19 cd home (change to home sub- directory of root ) ls ls -p
| | | | | | | /bin /dev /etc /home /usr /lib | | | | /staff /f /u /s pwd cd home (change to home sub- directory of root ) ls ls -p We now see directories other than f that are directly under or subdirectories of home 19

20 cd f (change to f sub-directory of home) ls ls -p
/ (root) (4) | | | | | | | /bin /dev /etc /home /usr /lib | | /f /s | | | /csci /mgmt /tele pwd cd f (change to f sub-directory of home) ls ls -p We now see directories other than csci that are directly under or subdirectories of f 20

21 cd csci (change to csci sub-directory of f ) ls ls -p
/ (root) (5) | | | | | | | /bin /dev /etc /home /usr /lib | | /f /s /csci | | /urbanc /ron pwd cd csci (change to csci sub-directory of f ) ls ls -p We now see directories other than urbanc that are directly under or subdirectories of csci 21

22 cd urbanc (change to urbanc sub- directory of csci ) ls ls -p
/ (root) (6) | | | | | | | /bin /dev /etc /home /usr /lib | | /f /s /csci /urbanc pwd cd urbanc (change to urbanc sub- directory of csci ) ls ls -p Now you see all the files and directories in my home directory 22

23 pwd My entire path is: /home/f/csci/urbanc / (root) (7) |
| | | | | | /bin /dev /etc /home /usr /lib | | /f /s /csci /urbanc pwd My entire path is: /home/f/csci/urbanc 23

24 fortune is a program in the games directory under the usr directory
/ (root) (8) | | | | | | | /bin /dev /etc /home /lib /usr | | | | | /f /s /games /csci /urbanc fortune is a program in the games directory under the usr directory From my directory (or any directory that is lateral or below the directory where your the intended file resides) one needs to use the entire path to "run" fortune /usr/games/fortune 24

25 fortune is a program in the games directory under the usr directory
/ (root) (9) | | | | | | | /bin /dev /etc /home /lib /usr | | | | | /f /s /games /csci /urbanc fortune is a program in the games directory under the usr directory From the usr directory (or any directory that is in the path and above the directory where your the intended file resides) I may use the relative path to "run" fortune games/fortune 25

26 Student directories reside in the path /home/undergrad
/ (root) (10) | | | | | | | /bin /dev /etc /home /lib /usr | | | | | /undergrad /s /f / (username) Student directories reside in the path /home/undergrad cd /home/undergrad ls - p The OS protects users against intruders 26

27 If You Get Lost in The UNIX File System
No matter where you are, at the command prompt type cd then hit the enter key: this takes you back to your home directory

28 How Do We Create Text Files
As you might guess, we need to use a text editor Windows/DOS provides Notepad as a very simple text editor UNIX provides nano (pronounced nan-o) and pico (pronounced peek-oh) and vi ( pronounced vee-eye) We'll start editing with pico 28

29 How Do We Create Text Files
We'll start editing with pico From your Fang prompt enter pico file-identifier note: file identifiers usually have two parts file name . file type such as stuff.txt or ghp1.c Additional slides/material on pico: 29

30 New Topic: Let's Talk About Algorithms
An algorithm is an ordered set of unambiguous and atomic executable steps which define/specify/describe a terminating process. an ordered set? unambiguous? atomic? executable steps? define/specify/describe a terminating process? 30

31 Why Are Algorithms Important?
Easier to understand what is to be accomplished Easier to find errors and fix them Algorithms are independent of H/W and S/W Algorithms are about WHAT NEEDS TO BE DONE We use a completed algorithm as the starting point to employ H/W and S/W H/W and S/W are “HOW” we accomplish the “WHAT” 31

32 Why Are Algorithms Important?
Algorithms guide our "program development" because they act as a detailed guide or blueprint or GPS guided roadmap Without an algorithm we don’t know what we are doing/where we are going We will always complete and verify our algorithm before we write a single line of code hms.htm 32

33 Let's Develop Some Algorithms
Algorithms are about WHAT needs to be done (ordered set of unambiguous and atomic executable steps which define/specify/describe a terminating process. Every “WHAT” needs to be specified in detail (think “unambiguous”) Take 5 minutes and write down an algorithm for making a peanut butter and jelly sandwich 33

34 Pseudocode Pseudocode:
code.htm /chap05/slides/pseudo.htm orithms.htm 34

35 Let’s Start Talking About Programming
1. What can a computer do? 2. What is programming? 3. What are the steps to develop a program? 4. What are the elements of a C program?

36 What Can a Computer Do? A computer can receive or accept data (input)
A computer can store data in a memory device A computer can perform arithmetic operations/instruction and data manipulation operations/instructions A computer can select one of some number of alternatives based upon some decision criteria A computer can repeat a group of operations/instructions A computer can output information

37 What is Programming? A program is a very specific set of instructions that making a computer do what you want it to do Programming is the process of creating a program Developing a solution Setting up of a related series of instructions which will produce the desired results/outcomes/outputs

38 Steps Are The Steps In Developing a Program?
Determine the desired output(s) Determine the necessary input(s) Develop an algorithm Select the ordered, atomic steps necessary to transform the necessary input(s) into the desired outputs Check the algorithm by hand for correctness Use the algorithm to guide development of source-code using a programming language (we will use C) Test and troubleshoot every algorithmic step Document (comment) as source-code is being developed Test and troubleshoot the entire program

39 Elements of a C Program (1 of 5) (notice there are many different Web sites)
Character Set Tokens (not an all inclusive list… but pretty inclusive) Keywords Identifiers

40 Elements of a C Program (2 of 5)
Constants Integer Constants Real Constants Character Constants String Constants

41 Elements of a C Program (3 of 5)
Operators (not all inclusive) Arithmetic Relational Logical

42 Elements of a C Program (4 of 5)
Increment Decrement Assignment Comma

43 Elements of a C Program (5 of 5)
3. Data Types Variables Expressions and 6. Statements

44 Homework: GHP #4 Note 1 - due no later than 10:00 AM on Tuesday, September 5, 2017 Using your DogNet account and the pico editor, create a file that contains three algorithms that could be used as the "blueprint" to accomplish three different tasks.  I suggest you use "structured English" or "pseudocode" or "bulletized English phrases" as a means to communicate your algorithms. When you have successfully completed your three algorithms, send me the single file that contains the three algorithms as an attachment (see next slide) to an alpine mail message.  44

45 Homework: GHP #4 continued
To attach a file, just type the name of the file in the "Attchmnt:" field.  Another way to attach a file:  position your cursor (use the arrow keys and not the mouse) in the "ATTCHMNT" field an then hit type CTRL-T (^T).   You can use the spacebar to move down and then hit "ENTER" when the correct file is highlighted, or you can hit L to enter the "LIST MODE" and then the letter "X" to mark each the files you want to attach, followed by the letter S to select those marked files as attachments. 45

46 Homework: GHP #4 continued
The subject line of any/all GHP-related shall contain three pieces of info: The course number (CS 108) The letters "GHP" and the appropriate number The word "Complete" or the phrase "Need Help" Examples: Subject: CS 108 / GHP #4 / Complete or Subject: CS 108 / GHP #4 / Need Help 46

47 Homework: GHP #5 (1 of 2) Note 1 - due no later than 10:00 AM on Tuesday, September 12, 2017 Task #1: Complete all the "Lessons" and all the "Exercises" at the following Web site (accessible on-campus only): Be Aware #1: help is available via "man pages"... at the FANG prompt type "man " (without the double quotation marks) followed by a space followed by the UNIX command of interest... an example would be: man pwd Be Aware #2: A search engine and the Internet can be your very useful 47

48 Homework: GHP #5 (2 of 2) Task #2: Send me an Alpine message using FANG and tell me what you think of the UNIX tutorial (a few sentences will be appropriate).  The "Subject" line of your message to me shall be in EXACTLY the following format: Subject:  CS 108 / GHP #5 / Complete or Need Help (pick the appropriate one) GHP #2 Assessment Rubric      48

49 Let’s Stop Here Complete GHP #5 by Tuesday, Sept 12th at 10:00 AM
Complete GHP #3 by Friday, Sept 8th at noon GHP #6 will be assigned on Tuesday Sept 5th and it will be due on Thursday Sept 7th Play with UNIX!! See you on Tuesday


Download ppt "CS 108 Computing Fundamentals"

Similar presentations


Ads by Google