Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 108 Computing Fundamentals January 22, 2015. GHP #1 Looks like I’m missing just a couple submissions  If you need help, please see me ASAP I have.

Similar presentations


Presentation on theme: "CS 108 Computing Fundamentals January 22, 2015. GHP #1 Looks like I’m missing just a couple submissions  If you need help, please see me ASAP I have."— Presentation transcript:

1 CS 108 Computing Fundamentals January 22, 2015

2 GHP #1 Looks like I’m missing just a couple submissions  If you need help, please see me ASAP I have not yet graded your submissions  You will receive/have received a reply message from me with a grade… probably today sometime  The reply message will go to Fang… you’ll need to use Alpine to read it

3 GHP #1b and #2 Due on Tuesday We will discuss as part of class today The rubrics that I will use for grading are posted  Please don’t submit anything for GHP #1b or #2 until you review the rubrics

4 Class Videos https://classx.cs.sunyit.edu/ Login Click on "Semesters" Click on "SPRING 2015 Semester" Click on "CS 108 01: Computing Fundamentals (Spring 2015)

5 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

6 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  program do not have to manage hardware directly  programs work through the OS to interact with hardware  Programs interact with other programs through the OS

7 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

8 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

9 What Can We Do With UNIX (1) What can we do with UNIX? –The sky is the limit!! –UNIX is the backbone of the Internet –Here’s another great tutorial http://people.ischool.berkeley.edu/~kevin/unix-tutorial/toc.html

10 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 –At the Fang prompt enter: who Let's compare the results of who with the results of w –At the Fang prompt enter: w

11 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

12 What Can We Do With UNIX (4) Command UNIXDOS/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 http://yolinux.com/TUTORIALS/unix_for_dos_users.html

13 What Can We Do With UNIX (5) Command UNIXDOS/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 spacebar to move forward and q to quit

14 UNIX Help is Everywhere Tiny sample of help available – http://www.rain.org/~mkummel/unix.htmlhttp://www.rain.org/~mkummel/unix.html – http://www.computerhope.com/unix.htmhttp://www.computerhope.com/unix.htm – http://unixhelp.ed.ac.uk/http://unixhelp.ed.ac.uk/ – http://bignosebird.com/unix.shtmlhttp://bignosebird.com/unix.shtml – http://www.ee.surrey.ac.uk/Teaching/Unix/http://www.ee.surrey.ac.uk/Teaching/Unix/

15 Let's Talk About Directories (1) What is a directory? –a place to store files (a virtual of a 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

16 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

17 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

18 / (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

19 / (root) (2) | -------------------------------------------------------------------------------------- | | | || | /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

20 / (root) (3) | -------------------------------------------------------------------------------------- | | | || | /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

21 / (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

22 / (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

23 / (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

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

25 / (root) (8) | -------------------------------------------------------------------------------------- | | | || | /bin /dev/etc /home /lib /usr | | ------------------------------------ --------- | | | /f /s /games | --------------------------- | /csci | --------------------------- | /urbanc fortune is a program in the games 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

26 / (root) (9) | -------------------------------------------------------------------------------------- | | | || | /bin /dev/etc /home /lib /usr | | ------------------------------------ --------- | | | /f /s /games | --------------------------- | /csci | --------------------------- | /urbanc fortune is a program in the games 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

27 / (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

28 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

29 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

30 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: https://www.cs.sunyit.edu/~urbanc/cs_108_jan_22a.html

31 New Topic: Let's Talk About Algorithms An algorithm is an ordered set of unambiguous, atomic, executable steps, defining a terminating process. –[1] an ordered set? –[2] unambiguous? –[3] atomic? –[4] executable steps? –[5] defining a terminating process?

32 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 guide our "program development" because they act as a detailed guide or blueprint or GPS guided roadmap http://userpages.wittenberg.edu/bshelburne/Comp150/Algorit hms.htm

33 Problem Solving Acording to George Polya 1.Understand the problem (and the audience) Are you building a chair? Need directions to a location? Making popcorn? Trying to solve a puzzle? 2.Devise a plan Is this similar to something else? Who is the audience for the solution? What are the required steps?  Need gruesome detail!!

34 Problem Solving According to George Polya 3.Carry out the plan (implement) Does it work? Is each step correct? Necessary? 4.Is the solution accurate? (Correct?) Will it always lead to a solution?

35 Let's Develop Some Algorithms Take 5 minutes and write down an algorithm for "sharpening a pencil"

36 Pseudocode Pseudocode: http://www.minich.com/education/wyo/stylesheets/pseudo code.htm http://www.wiley.com/college/busin/icmis/oakman/outline /chap05/slides/pseudo.htm http://www.unf.edu/~broggio/cop2221/2221pseu.htm http://userpages.wittenberg.edu/bshelburne/Comp150/Alg orithms.htm

37 Homework: GHP #1b (1 of 2) Note 1 - due no later than 8 AM on Tuesday, January 27, 2015 Task #1: Complete all the "Lessons" and all the "Execises" at the following Web site: http://unix-tutorial.cs.sunyit.edu 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

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

39 Homework: GHP #2 Note 1 - due no later than 8 AM on Tuesday, January 27, 2015 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.

40 Homework: GHP #2 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.

41 Homework: GHP #2 Continued The subject line of any/all GHP-related e-mail shall contain three pieces of info: 1.The course number (CS 108) 2.The letters "GHP" and the appropriate number 3.The word "Complete" or the phrase "Need Help" Examples: Subject: CS 108 / GHP #2 / Complete or Subject: CS 108 / GHP #2 / Need Help

42 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?

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

44 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

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

46 Elements of a C Program (1 of 5) (notice there are many different Web sites) 1.Character Set http://aboutc.weebly.com/c-character-set.html 2.Tokens (not an all inclusive list… but pretty inclusive) Keywords http://aboutc.weebly.com/keywords.html Identifiers http://aboutc.weebly.com/identifiers.html

47 Elements of a C Program (2 of 5) Constants http://aboutc.weebly.com/definition-and-its-types.html  Integer Constants http://aboutc.weebly.com/integer-constants.html  Real Constants http://aboutc.weebly.com/real-constants.html  Character Constants http://aboutc.weebly.com/character-constants.html  String Constants http://aboutc.weebly.com/string-constants.html

48 Elements of a C Program (3 of 5) Operators (not all inclusive) http://aboutc.weebly.com/definition-and-its-types1.html  Arithmetic http://aboutc.weebly.com/arithmetic.html  Relational http://www.tutorialspoint.com/cprogramming/c_relational_ operators.htm  Logical http://www.tutorialspoint.com/cprogramming/c_logical_op erators.htm

49 Elements of a C Program (4 of 5)  Increment http://www.c4learn.com/c-programming/c-increment- operator/  Decrement http://www.c4learn.com/c-programming/c-increment- operator/  Assignment http://www.c4learn.com/c-programming/c-assignment- operator/  Comma http://www.c4learn.com/c-programming/c-comma- operator/

50 Elements of a C Program (5 of 5) 3. Data Types http://www.lix.polytechnique.fr/~liberti/public/computing/p rog/c/C/CONCEPT/data_types.html#intDecrement 4.Variables http://www.zentut.com/c-tutorial/c-variables/ 5.Expressions and 6. Statements http://farside.ph.utexas.edu/teaching/329/lectures/node11.html

51 Let’s Stop Here Study the links of the previous 5 slides… know them well!!  The Web is full of helpful sites!!!  Go to "CS 108 Links" page for more!! http://web.cs.sunyit.edu/~urbanc/cs_108_links.html Do GHP #1b and GHP #2 Read/study Chapter 2 Play with UNIX!! See you on Tuesday


Download ppt "CS 108 Computing Fundamentals January 22, 2015. GHP #1 Looks like I’m missing just a couple submissions  If you need help, please see me ASAP I have."

Similar presentations


Ads by Google