Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Introduction to Computers CS1100.01 Dr. Zhizhang Shen Chapter 7: What Went.

Slides:



Advertisements
Similar presentations
Debugging ACL Scripts.
Advertisements

JQuery MessageBoard. Lets use jQuery and AJAX in combination with a database to update and retrieve information without refreshing the page. Here we will.
A complete citation, notecard, and outlining tool
CS0007: Introduction to Computer Programming Console Output, Variables, Literals, and Introduction to Type.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley An Introduction to Debugging To Err is Human lawrence snyder c h a p t e.
Chapter 7: Introduction to Debugging TECH Prof. Jeff Cheng.
Announcements Wednesday's test will be postponed until Thursday – July 7 th, See me if this won’t work for you. Project 1 will be due Monday – July.
Created by Liat Rothfeld December 5, 2010 Begin Lily spent a whole class period creating an illustration in MS Paint. She went to File-Save, gave it.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Introduction to Computers CS Dr. Zhizhang Shen Chapter 10: How to.
Debugging Introduction to Computing Science and Programming I.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Fluency with Information Technology Third Edition by Lawrence Snyder Chapter.
Chapter 7 To Err Is Human: An Introduction to Debugging.
Modules, Hierarchy Charts, and Documentation
Introduction to Unix – CS 21 Lecture 5. Lecture Overview Lab Review Useful commands that will illustrate today’s lecture Streams of input and output File.
Conversational Computers
What to do when you are done. PRINTING WITH PHOTOSHOP.
Microsoft ® Office Word 2007 Training Mail Merge II: Use the Ribbon and perform a complex mail merge [Your company name] presents:
Binary Arithmetic Math For Computers.
Lesson 6 Part 1. 2 When would the use of a template save time and be more productive? In other literature a “template” may also be referred to as a “boiler.
Computer Skills /1436 Department of Computer Science Foundation Year Program Umm Alqura University, Makkah Place photo here 1.
Chapter 7 To Err Is Human: An Introduction to Debugging.
Information guide.
DAT602 Database Application Development Lecture 14 HTML.
Learning Objectives Explain how ordinary precision differs from computing precision Describe the six-step strategy for debugging Explain the purpose of.
Encoding, Validation and Verification Chapter 1. Introduction This presentation covers the following: – Data encoding – Data validation – Data verification.
The Bean Counter: A JavaScript Program
ICAPRG301A Week 4Buggy Programming ICAPRG301A Apply introductory programming techniques Program Bugs US Navy Admiral Grace Hopper is often credited with.
General Programming Introduction to Computing Science and Programming I.
XP Mohammad Moizuddin Creating Web Pages with HTML Tutorial 1 1 New Perspectives on Creating Web Pages With HTML Tutorial 1: Developing a Basic Web Page.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Mail merge I: Use mail merge for mass mailings Perform a complete mail merge Now you’ll walk through the process of performing a mail merge by using the.
JMD2144 – Lesson 4 Web Design & New Media.
PHP meets MySQL.
Debugging & Troubleshooting “To err is human, but it takes a computer to really foul things up” © 2004 Lawrence Snyder.
Program Development Life Cycle (PDLC)
Unit 2, cont. September 12 More HTML. Attributes Some tags are modifiable with attributes This changes the way a tag behaves Modifying a tag requires.
Unit 3 Day 6 FOCS – Web Design. Journal Unit #3 Entry #4 Write the source code that would make the following display on a rendered page: Shopping List.
Chapter 8 Collecting Data with Forms. Chapter 8 Lessons Introduction 1.Plan and create a form 2.Edit and format a form 3.Work with form objects 4.Test.
Forms and Server Side Includes. What are Forms? Forms are used to get user input We’ve all used them before. For example, ever had to sign up for courses.
DEBUGGING. BUG A software bug is an error, flaw, failure, or fault in a computer program or system that causes it to produce an incorrect or unexpected.
Lesson Understand templates 2 Create a new document from a template 3 Work with template elements 4 Create a custom template 5 Use a custom template.
Systems Life Cycle. Know the elements of the system that are created Understand the need for thorough testing Be able to describe the different tests.
Downloading and Installing Autodesk Inventor Professional 2015 This is a 4 step process 1.Register with the Autodesk Student Community 2.Downloading the.
Copyright 2006 by Timothy J. McGuire, Ph.D. 1 MIPS Assembly Language CS 333 Sam Houston State University Dr. Tim McGuire.
Optimizing Your Computer To Run Faster Using Msconfig Technical Demonstration by: Chris Kilkenny.
Created by, Tom Rebold, MPC FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
Introduction to JavaScript CS101 Introduction to Computing.
BMTRY 789 Lecture 11: Debugging Readings – Chapter 10 (3 rd Ed) from “The Little SAS Book” Lab Problems – None Homework Due – None Final Project Presentations.
The Information School of the University of Washington 13-Oct-2004cse debug1 Debugging and Troubleshooting INFO/CSE 100, Spring 2005 Fluency in Information.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 From Randomness to Probability.
Chapter 5 Files and Exceptions I. "The Practice of Computing Using Python", Punch & Enbody, Copyright © 2013 Pearson Education, Inc. What is a file? A.
Verification & Validation. Batch processing In a batch processing system, documents such as sales orders are collected into batches of typically 50 documents.
4 HTML Basics Section 4.1 Format HTML tags Identify HTML guidelines Section 4.2 Organize Web site files and folder Use a text editor Use HTML tags and.
Conditional Statements.  Quiz  Hand in your jQuery exercises from last lecture  They don't have to be 100% perfect to get full credit  They do have.
Testing External Survey Automatic Credit Granting Shepherd University Department of Psychology.
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley What did we learn so far? 1.Computer hardware and software 2.Computer experience.
Copyright 2006 by Timothy J. McGuire, Ph.D. 1 MIPS Assembly Language CS 333 Sam Houston State University Dr. Tim McGuire.
JavaScript Introduction and Background. 2 Web languages Three formal languages HTML JavaScript CSS Three different tasks Document description Client-side.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
By the end of this lesson you will be able to explain: 1. Identify the support categories for reported computer problems 2. Use Remote Assistance to connect.
1 PROJECT 3 WEB/HTML PROJECT USING NOTEPAD Management Information Systems, 9 th edition, By Raymond McLeod, Jr. and George P. Schell © 2004, Prentice Hall,
Functions Wouldn’t it be nice to be able to bring up a new animal and paragraph without having to reload the page each time? We can! We can place the.
Lesson 6 Word Lesson 6 presentation prepared by Michele Smith – North Buncombe High School, Weaverville, NC. Content from Microsoft Office Word 2010 Lesson.
BIT116: Scripting Lecture 05
FOP: Multi-Screen Apps
CSC 110 – Fluency in Information Technology Chapter 7: An Introduction to Debugging Dr. Curry Guinn.
Fluency with Information Technology
Intro to PHP & Variables
To Err Is Human: An Introduction to Debugging
Presentation transcript:

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Introduction to Computers CS Dr. Zhizhang Shen Chapter 7: What Went Wrong, How to fix it?

1-2 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-2 Computers are usually reliable, but… We use computers to do everything today. They usually work, but exceptions do exist. Anything recently? Why exceptions? We only hear such news of “A person bit a bog.” but not “A dog bit a person.” It is really not computer’s error, but…

1-3 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Whose fault is this? All the computer related stuff, hardware, software, user manual, …, are created by human beings. It is quite likely that something is wrong. The question is how to find the errors? and once found, how to fix them? 7-3

1-4 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-4 Precision: The bloodline of IT We can be imprecise, but a computer can’t –Many people say "oh" rather than zero when giving a phone number. The automatic system may not get it. –The listener makes the mental conversion because he knows phone numbers are numeric –Computer does not know that unless it has been programmed to know it.

1-5 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-5 How precise is “precise”? We can program software to automatically convert “oh” to zero because all digits in these cases will always be numbers In other cases such as , we have to allow both letters and numbers, so the computer can't be programmed to auto-correct. Users have to be careful, i.e., they have to provide whatever as required by the machine. This is where the manual kicks in.

1-6 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-6 What should they look like? The information entered into boxes/forms on screen is governed by lexical structures (rules about the legal form for input fields) May limit symbols that can appear in specific positions, length of entry, etc.: at least 6 characters long, and has to be a combination of letters and digits. This is particularly true for password, since a combination of letters and digits makes it much more difficult to break.

1-7 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-7 About debugging… Debugging: Figure out why a process or system doesn't work properly –Usually learned from experience Debugging in everyday Life: Why the car doesn't start? –Running out of gas, spark plug needs replacement,… –Call “car talk” Debugging in Information Technology: –A user might enter wrong data or wrong configuration information into a working system, ‘F-’ for a grade; or –There might be a logical design error in a system, a buggy program: you can answer both “yes” and “no” in a survey form. –You learn the basics in a series of programming courses.

1-8 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-8

1-9 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-9 Whose fault is it? When we debug an information system, we might be part of the problem –We give an incorrect command and/or input Operator or pilot error. Instead of stepping on the brake pedal, you step on the oil pedal.  –Another possible cause is a broken system: The break fluid pipe is leaking, costing $$$.  People don't knowingly make errors, except… –We may think we did everything right, but we actually misunderstand the system: Where is the windshield wipe button in this car?

1-10 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-10 Using the computer to debug? A computer can't debug itself, we have to do it: We can’t pull ourselves out of the pool, a lifeguard has to. Errors are internal to the computer To get information about the error, we have to ask the computer what data it stored, what it does to them, what is the value of which data at what point, etc.. Thus, a “dump” usually helps. The trouble is where to look at.

1-11 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-11 A Dialog About Debugging Debugging is solving a mystery –What happened? How could it happen? A printer is not printing? Ask purposeful questions like: –Do I need more clues? Is it falling out? –Are my clues reliable? Is it really not printing? –What is a theory to explain the problem? Are you nuts?

1-12 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-12 A debugging process: 1.Check that the error is reproducible, rather than random. The printer has not been working for a while, instead of just this page. 2.Check all the "obvious" sources of error: Is the power off? Is the cable off the hook? Out of paper? 3.Isolate the problem Divide operation into those parts that are working and those that are not working: Trying to isolate the problem. I do have power for the machine. Think objectively—ask yourself if you've made a wrong assumption, etc. Have I put in paper in the paper tray this morning? Think about the big picture, since….

1-13 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley It is a process… If no mailing labels come out of printer, problem may be  with the printer itself, or  the program that generates those labels from a file, or  the file containing addresses, or  the cable that sends the stuff to the printer? 7-13

1-14 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-14

1-15 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-15 Butterflies and bugs: A Case Study Errors can arise for both software and hardware. Particular, they come up in programming. As an example, assume that we've developed a simple HTML page, with the following display in mind.

1-16 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-16 Our Goal Page:

1-17 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-17 Huston, we have a problem….

1-18 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-18

1-19 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-19

1-20 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-20 Butterflies and bugs (cont'd) Displaying the page in Safari and Mozilla also produces errors –To reproduce the problem, test it in multiple browsers! If it doesn’t work in all of them, it is very likely related to the code. We now have to study the HTML code very closely and find out the bug –Where is the “hay”?

1-21 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-21 Where is the beef? Look at the displayed page and determine where the errors occur What are the issues: missing links, no pictures, and the wrong color of blue. What to do? –We always try to fix the very first error, which can mess up with everything afterwards. –Once the first one is fixed, the others might be fixed, as well. –This is particularly true in programming.

1-22 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley What is the very first error? 7-22 The blue caption seems to be the first. What happens? The word Blues appears in red on the page, instead of blue. as intended. Where is the blue specified? Right ahead of the table. Blues What is wrong here? Missing opening quotation mark around the attribute value “blue” How to fix it? Add that missing half back.

1-23 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-23 The HTML for Our Page

1-24 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-24 Another common error… In HTML, a quite common error is forgetting to close a tag –For example: with no closing tag –Thus, we have to make sure that all quotes match (open and close). – The best way to do it is to come up with a pair first, then fill in the content.

1-25 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Why is the More here link stil missing? The next issue is that the link “More here” is not there. Where is this link specified? Right above the table: More here. What went wrong? There should be a space between “a” and “href”. It now looks better. 7-25

1-26 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-26

1-27 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-27 Why is the first row blue? An important thing is always cut a complicated task into a bunch of smaller and simpler ones: Where? First row of the table What do we want? Silver. Where is it specified? In the background color. What went wrong? A fancy quote around “silver” that the browser cannot interpret

1-28 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-28

1-29 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-29

1-30 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-30 Why no pictures? The pictures are not displaying. The image tags are well structured and the browser is interpreting them correctly To check that the images are ok, display in another document, or use paint to verify that they are really images. To check that the JPEG specification is ok, put another image file in the document Check the exact file name, and path, for the image, including capitalization What went wrong? The filename extension is.jpeg, not.jpg as we have been using. Make sure that both parts of the names do match.

1-31 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-31

1-32 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-32 Have we done too much? –During the debugging process, we often make some unnecessary changes due to wrong conjectures about the error. Who knows what’s wrong. –Sometimes we even make the situation worse by introducing new errors. Unnecessarily change parts –Remember what you did and change back later using comments. <!-- 

1-33 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-33 Got more than what we bargging for Hiding other errors: –At first we thought we had three errors—bad caption, missing link, busted table –Because there were two things wrong with the table (messed up heading line and wrong file names specified) there were actually four errors –Because it is common for one error to hide another, always suspect there are more than one errors.

1-34 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-34 Debugging tools are useful Viewing the source: –Most effective technique in our debugging was the View Source feature. You can compare what you want it to show and what it actually shows, i.e., the intended output and the actual one. –In general, one of the most powerful debugging techniques is to find ways for the computer to tell us the meaning of the information it stores or the commands it executes. Not what we think it should do, but what it does. Little errors, big problems: –The errors in the HTML code were tiny, but they had serious effects. Also true in general programming –We must be extremely precise and careful.

1-35 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-35 Where is the print out? The software is very complicated. How do we troubleshoot a system we don't understand? Generally, software has been extensively tested before we come in contact with it (QC team) –Standard operations are likely to be bug-free –To illustrate debugging a system without understanding it, consider a common problem: You try to print a document and nothing comes out of the printer

1-36 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-36 Applying the Debugging Strategy –Reproduce the error, understand the problem, check the obvious causes. Is this the only document that I can’t print? –Check the printer's control panel, the paper, the cartridges (ink), cable connection, file to be printed, installation of printer driver, whether others can print (if it's a shared printer) and whether you can print a different document (maybe the file is corrupted) Simple, quick checks for obvious reasons. –If this does not solve the problem, …

1-37 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-37 Pressing On Try to isolate the problem: –Configuration is correct because you've printed before –Try printing a simple document –Think through the probable process If the computer couldn't send the data to the printer, wouldn't it give a message to plug in the printer? Check out the files that you want to print. Check out the printer queue. –In the printing monitor's files, you find a list of files you've tried to print recently –Start > Control Panel> Printers and Faxes

1-38 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-38 The print queue You've found the print queue Computer's settings may tell it to "queue" converted files rather than printing them immediately –Pause Printing You may never know how this occurred, but you can still fix it by re-configuring the driver –Unclick Pause Printing or click Resume Printing

1-39 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-39

1-40 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7-40 Homework Multiple choices: odd numbered Short answers: 1-7 Complete Exercises 1, 3, 7, and 8