csc 110 - intro. to computing lecture 26: xml & course review

27
CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

Upload: ursula-norman

Post on 06-Jan-2018

218 views

Category:

Documents


2 download

DESCRIPTION

XML DTD XML documents include Document Type Definition (DTD) which specify document’s organization

TRANSCRIPT

Page 1: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

CSC 110 -Intro. to Computing

Lecture 26:XML & Course Review

Page 2: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

Announcements

Essay due todayPlease e-mail essay & your service learning

logs Service Learning due 5PM Friday Quiz #6 available on class web page

Due at start of final If you hand it in earlier, I will give you the quiz

solutions to help you study

Page 3: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

XML DTD XML documents include Document Type

Definition (DTD) which specify document’s organization

Page 4: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

XML Example XML uses tags

from the DTD to label data in a document

File can now be “mined” like a database!

Page 5: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

In-Class Exercise

Define the DTD and write an XML document for:Election ballotCollection of CDs

Page 6: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

Final’s Format

Final will be similar to midtermA few fill-in-the-blanks or multiple choice, but

mostly problem solving and short answer Final will be closed-book and closed-note

Page 7: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

Material for Final

Focus will be on material not covered on midtermStarting with Palgo and RobotranOlder material included only when it relates to

most recent material Try testing understanding of material rather

than rote memorization Important to understand hows and whys

Page 8: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

Program Trace

1 x = 4 + 22 y = 8 * 13 z = y – 34 x = x + 15 z = y - x6 y = y / 27 z = “x”8 y = z + “b”

Line# x y z1 6

Line# x y z

2

Line# x y z

2 83

Line# x y z

2 83 54

Line# x y z

75

Line# x y z

16

Line# x y z

6 47

Line# x y z

x8

Line# x y z

xb

Page 9: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

Tracing a Loop

1 x = 52 y = 33 total = 04 repeat y times5 total = total + x6 end7 print total

Line

Cond-ition x y tota

l output

1 52 33 04 1 of 35 54 2 of 35 104 3 of 35 157 15

Line

Cond-ition x y tota

l outputLine

Cond-ition x y tota

l output

1 5

Line

Cond-ition x y tota

l output

2 3

Line

Cond-ition x y tota

l output

3 0

Line

Cond-ition x y tota

l output

4 1 of 3

Line

Cond-ition x y tota

l output

5 5

Line

Cond-ition x y tota

l output

4 2 of 3

Line

Cond-ition x y tota

l output

5 10

Line

Cond-ition x y tota

l output

4 3 of 3

Line

Cond-ition x y tota

l outputCond-ition

5 15

Page 10: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

Tracing n! 1 num = input_num(“What number?”)

2 fact = 13 for i = 1 to num4 fact = fact * i5 end6 print fact

Line Cond-ition

num fact i OutputCond-

ition1 4

Cond-ition

2 1

Cond-ition

3 1 < 4 1

Cond-ition

4 1

Cond-ition

3 2 < 4 2

Cond-ition

4 2

Cond-ition

3 3 < 4 3

Cond-ition

4 6

Cond-ition

3 4 < 4 4

Cond-ition

34 24

Line Cond-ition

num fact i Output

2 13 1 < 4 14 13 2 < 4 24 23 3 < 4 34 63 4 < 4 44 243 5 < 4 5

Line Cond-ition

num fact i Output

3 1 < 4 14 13 2 < 4 24 23 3 < 4 34 63 4 < 4 44 243 5 < 4 56 24

Page 11: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

Palgo Loop Selection Each of Palgo’s loops serves different purpose

repeat Executing the commands a specific number of times

for Remembering the number of times that we are

executing the instructions in a loop Very useful for lists!

while Executing a loop for as long as needed to meet a specific

condition

Page 12: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

Robotran Exampleprogram walkervar distancevar anglewhile true do let distance = getRand(3) go forward distance inches let angle = getRand(360) turn right angle degreesend

define getRand (parm max) returns float var number = random/100.0 * max return numberend

Page 13: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

Simulations

Different types of simulatorsContinuous Simulations evaluates and

computes results at every instance in timeDiscrete Event Simulations emulate world by

examining when 2+ entities interact What are limitations of using simulations?

Page 14: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

Ethics

Common understanding of ethics: Golden Rule – Do unto others as you would have

them do unto you Sniff Test – Does it seem like it is ethical?

Major systems of ethics: Divine dicta -- The divine states what is right Natural law -- Human intuition and conscience guides

what is right Relativism -- Prevailing standards set what is right;

must consider each situation in its environment

Page 15: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

Ethics - Dentology

One must fulfill duties defined by law, religion, and societyCannot refuse to perform these duties for any

reason Based upon principle of universality

If an action would be wrong in any situation, then it is wrong in every situation

Page 16: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

Ethics – Utilitarianism

Calculates whether actions are moral or immoralEvaluate benefits that arise from an actionCalculate the bad caused by an actionDetermine if good outweighs the bad

“The greatest good for the greatest number of people”

Page 17: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

Ethics - Analogies

When deciding if an action is acceptable, people often relate it to a similar situationUse analogous decisions from the past to help

make the moral choice in the present Computers can make this more difficult

Not always clear if situations are comparableSomething that is good normally may not be once

the power and speed of computers are included

Page 18: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

Ethics for the Final

Important consideration: Always clearly state and justify your arguments If needed, pick a side and argue itCorollary: Even the best opinion must be

backed up by a strong argument

Page 19: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

Semantic Networks

Method of representing knowledge Focuses on relationship between items Typically shown as directed multi-graph

Data items are the vertices (points)Relationships are the edges (lines)

Relationships are one-way Know how to create & read these

Page 20: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

Artificial Neuron Operation

Effective weight of an input is the input value multiplied by input’s weight

If sum of effective weights is equal to or above threshold neuron outputs 1When sum of effective weights is less than the

threshold, neuron outputs 0

Page 21: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

Artificial Neuron Example

Consider the following neuron:

Output would be a 1 when threshold is 0.3 + (-3) + 0 + 4 = 1.3 or lower

Value Weight Effective Weight1 0.3 0.31 -3 -30 2 01 4 4

Page 22: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

Ring Topology

Each machine connected to 2 others All data flows in one fixed direction

Source0

Target0

1

1

Source1

Target1

1

1

Page 23: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

0

Star Topology

All data flows through central node Need to be careful to handle collisions

Source1

Target1

1

1

1

Source0

Target0

0

0

Page 24: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

Bus Topology

Machines connected via shared bus But needs sophisticated collision handler

Source1

Target1

11

1

1

11

Target0

Source0

Page 25: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

HTML & XML

What HTML tags are and how they workLimitations of HTML to describe the contents

of the page How to define a DTD and how to use this

in an XML document

Page 26: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

Essay on Final Grading rubric used to grade your final:

Stating clear thesis 20%in opening paragraph

(Correctly) citing at least 1 20%ethical system

Making convincing arguments 25%to support your argument

Length 5% Spelling 5% Grammar 10% Organization 10% Clarity 5%

Page 27: CSC 110 - Intro. to Computing Lecture 26: XML & Course Review

For the Final

I will be in my office most of Monday through Wednesday Can answer questions, discuss any issues

you may have, anything students would like