Lecture 10: Exciting Conclusion - CSCI E-1 2010 - Harvard Extension School
Watch on YouTubeVideo summary
In this concluding lecture of CSCI E-1, instructor David Maylen begins by reviewing critical pseudocode errors that students must identify before moving on to broader technology topics. The code analysis highlights three distinct bugs: an infinite loop resulting from a missing increment statement in a while loop, a logical flaw where a condition checks for the value 100 despite a variable initialized to zero, and a guessing game error where numbers below four are incorrectly ignored due to improper conditional logic. Following this technical review, the discussion shifts to consumer technology, distinguishing between persistent hard disk storage and volatile RAM used for active processes while explaining how multiple CPU cores enable true parallel processing rather than simple task switching.
The lecture further explores security implications in the digital landscape, addressing the risks associated with public Wi-Fi sniffing and outlining mitigation strategies such as using Virtual Private Networks (VPNs), firewalls, and encryption methods like HTTPS, WPA2, and full disk encryption to counter threats from weak protocols like WEP. This leads into an overview of cloud computing, defined as the practice of outsourcing data storage and applications to remote servers, which offers significant cost savings but introduces dependencies on internet connectivity and third-party infrastructure. To address the inefficiency of modern multi-core processors where software often fails to utilize all available cores, the session explains how virtualization technology allows companies to rent out portions of physical servers to multiple clients using virtual machine software.
This virtualization concept creates the illusion of running multiple independent computers with different operating systems on a single physical machine, a process that users can replicate for free using tools like VirtualBox to run guest operating systems without dual-booting, though licensing restrictions prevent legal virtualization of macOS. The session culminates in an interactive demonstration where volunteers and the audience collaborate to write a precise algorithm for making a peanut butter and jelly sandwich. This exercise underscores the necessity of explicit, unambiguous instructions in programming, illustrating that computers cannot infer missing steps or make assumptions, and showing how iterative refinement is required to account for specific actions like unscrewing caps, cleaning knives, and spreading ingredients evenly to ensure correct execution.
Read the full video transcript
all right welcome back to computer
science e1 tonight is our final lecture
this here is an ipad
it's not quite as wireless as you would
like when we have to tether it to the
room here but we're actually doing this
as a test um both of us were a little
disappointed to discover
as were many people online that even
though this thing comes with what's
called a vga
adapter or dongle one of these silly
things that you have to connect to many
laptops these days
it actually the ipad does not have
native supports for projecting to
projectors which is to say i tried like
10 of the apps that came with this thing
none of them actually project but we did
find one we found that safari
when you play a youtube video does
actually project up there and as luck
would have it we have a wonderful
youtube video from 2006
from our own dan armendara so we thought
we would begin with this youtube clip
here
wait wait i didn't make this video i'm
just in it
just clarify that
hello my name is david maylen and i'm
the instructor for computer science e1
understanding computers on the internet
at harvard university's extension school
you're watching one of our videos of the
week for more such videos or information
about this course
visit us on the web at
computerscience1.org
enjoy the show
so
foreign
i forgot about that part
anyhow i i actually forgot i was in that
but
i should have paused it take it away
okay so um hello everybody hello
everybody
welcome back um oh so okay
i know what we're going to talk about so
exam two we
graded most of it except for the
distinct distance exams we still have to
um to do those we will do those very
soon
and we noticed that the vast majority of
people got tripped up on some specific
questions and so i just figured that
we'd spend
just a little bit of time to talk about
those and specifically
we're looking at the ones that involve
the the snippets of code so the pieces
of pseudo code
um and unfortunately this seems to have
um
a lot of people seem to have move your
ipad doohickey
all right uh and is this computer on
oh gosh
the monitor's not on yet okay so i just
figured that we would quickly
um go over some of these oh
sticky keys incidentally this is an
example of a bug
when you unplug a cable and then the
computer just freezes with an apple logo
on front this is an
interesting outcome so buggy software
i'm stalling you're not supposed to
focus on me
for what i had this something ready i
was ready to start talking right when i
start
you should have been stalling this whole
time and i'm like oh let's talk about
this
okay anyways um so each there were three
pieces of code and you were supposed to
find the error in each that was
preventing it from doing whatever it
said
you were supposed to do so for example
this first one it said that the
following code should print 10 asterisks
and the code was let i equals zero
the second line is while eyes less than
10 and then
you're supposed to print an asterisk and
so i realized that this is
way too small we will fix that let's see
all right uh bigger
36 sounds good okay everybody can read
that i hope
okay so this was the code that you were
presented so what's wrong with this why
doesn't this work
so keep in mind that what's important
here is that we're not using any
specific language you don't have to know
java c any of those other languages that
we showed examples
but really you're just supposed to read
this and and understand the
concepts that we had that we had talked
about in the programming lecture
specifically the
loops the if statements variables etc
and use those to try to figure out why
this pseudocode might fail
so does this code print 10 asterisks
no what does it print if anything a ton
in fact infinite it's an infinite loop
and why
is that because 0 is always less than 10
right because 0 is always less than 10.
we don't have an incrementer
so i always remains at 0. at the very
first line we set it equal to zero
and we test in this while loop if i if
zero
in other words is less than ten and that
is the case but because we don't have
another line
that says i plus plus or in other words
i equals i
plus one then i never increases so i
never actually reaches the value 10. so
for this reason
uh it's always going to be run and this
is an example of
an infinite loop and so it was that just
this i plus plus
that you were supposed to do to correct
this problem that that was it
uh to fix this specific uh one all right
so this one
uh was let j equal to zero and uh
let's see while j equals 100 if j
is even than print j
j plus plus all right and so this one
says that the following code should
count even numbers
uh from 1 to 100 what what are you
pointing at
okay typo yes this was not in there
let j equals okay so this was the code
and so what happens in this case so it's
supposed to print even numbers but what
actually happens here
what does it print if anything
i'm sorry 100 why 100.
um but well j
equals 100.
okay so good that's one way of
interpreting this is that uh you're
doing
here another assignment and so in other
words you're setting j
equal to another another value 100.
um but we could interpret this another
way in that we're saying that this is
actually a test
so while j is equal to 100 and so this
was
either way is fine because it still
leads to the same end result the same
end fix but if we interpret this as a
test as it can as a test in that
manner then we say okay let j is equal
to zero so that's the first thing
while j is equal to 100 is j equal to
100
no it's not so this the contents in this
loop
this these lines of code are never run
so nothing
is printed whatsoever so what's the fix
in order to have this code operate as we
expect
well i would say it's just
j equals 0 while j equals 100
so j equals zero but then it says while
j equals 100 i'm kind of i'm not really
sure
what that means exactly
about those two lines so okay so the the
first two lines
are doing two different things so the
first one is creating a variable called
j
and it's assigning that variable a value
of zero
so that when we look in memory we have
this the space and memory that we're
calling j when we look at its contents
it represents the number zero
and this second line is a loop and it's
going to perform
the code this code here that's indented
so long as the condition
so long as this boolean statement is
true
and so in this case we have to ask the
question is the
the value j equal to 100
in this case because we had set it equal
to zero it is not
so because this evaluates the false it's
not true
therefore this these lines of code will
not be run the loop will just be ignored
so if this goes back to the first
if we look again at the first example
that we had let i equal to
zero while i is less than 10
uh print asterisk and then we had the
fix
i plus plus what we're saying here is
that this is the same thing
the very first line we are setting uh
we're creating variable called i we're
setting it equal to zero
then we perform a test is i less than
ten
and it is because zero is less than ten
therefore the
the lines of code within the loop will
be run
but only that is only true
if i is equal to 10 for example or if i
is equal to 11
then that condition up here becomes
false
and these lines are no longer run
okay so up here now
we're saying let j equals let j uh be
equal to zero while j is equal to 100
and so we
we figured out that as a result of this
it's never going to be run
so what can we do to fix this how can we
actually cause this loop
to print out the numbers from uh
from 1 to 100 in the even numbers
specifically
yes right so while j is less than
or equal to 100 because in this case now
what we are saying is that okay j
uh if j is equal to zero then we will
allow the the contents of this loop to
be run if j is even then it will print j
then it increments j goes back up to the
top performs the test again now j
is equal to one is j less than or equal
to or is one less than or equal to 100
yes these lines of code are run so on
and so forth
all the way up to 100. is that clear
that change okay now the last one you'll
have to bear with me because it's a
little bit longer to write
so this one you have to loop forever and
let's see i'm just going to indent a
little bit less because it'll be a
little bit easier to read
so now we have another variable uh
called k random number from 1 to 10.
uh let's see if i can make this bigger
all right uh so now
if k is less than four
then we're printing out print
too low else if k is equal to
5 print got it right
and program else if k is greater than 5
print too high all right so what this is
supposed to do is this code will guess
a number from uh by picking a random
number from one to ten if it guesses the
number five
then it is guessed correctly and it will
quit if
it's any other number then it will say
whether the number is too low
or too high and then it will loop so it
will pick another number
and perform the same the same thing it
will then test again to see
if the number is 5 if it's too low if
it's too high
and it will print out appropriately but
there is a problem
with this uh what is the problem with
this code why is this not being printed
out yes
it says end program before the last
elsif so that's that's a
good point but you might recall from
uh else from if and else block the
this code within uh within an ill
and else block or an if block is only
run
if that condition is true so only when
k is equal to five will it print out the
words got it right
and then it will end the program uh in
all other cases
uh it will just ignore that end program
statement and it will continue
along if we were feeling evil and we did
something like this where we removed the
indentation
then you might have a better case
because then you're saying okay well
is that end program statement actually
belonging to that else if block
but in this case uh we didn't want that
ambiguity so we just
remained that statement or we kept that
statement with that else if block
so uh um
right in the case of this pseudocode
we're using indentation to figure out
what blocks of code belong to
various uh structures so this else if
statement for example we're saying that
everything
that's indented uh underneath it belongs
to that
l-sit just like all of this code that is
indented from the loop forever is
belongs to that loop forever so all of
this code belongs to the same block of
code so we're just using indentation to
demark what is a block of code belonging
to which specific
if statement or which specific loop
sometimes and you might recall um
some uh where's my cursor here some uh
programming languages will use some
character to to make it more specific
so sometimes you'll see this in curly
braces for example
to truly make specific okay this the the
blocks the the two lines of code
between the the open and close curly
braces actually belong to
this elsif but in this case we're not
using syntax like that
we're just using indentation
okay so other ideas yeah um
what if the number is four that's a
that's a good question so if the number
is four
let's see what happens so let's say k
picks random number and that random
number is four
is k less than 4
no is k equal to 5 no is k
greater than 5 no so nothing happens it
goes back to
the beginning of the loop picks another
random number and
it continues and so this actually goes
against what we were saying it picked a
random number
and it didn't tell us what that number
was in relation to the number that it
was supposed to pick
so this means that we have some problem
with our if statements with our
conditions
that four is just being ignored so
what's a potential fix that we can do to
uh to get this working
to include four k is less than five very
good so rather than k is less than four
we can just have k is less than five
we have covered all of our bases is
there another way that we could fix this
to do the same thing
less than or equal to four so in either
case you really just have to change or
add one character in order to get this
program
to function properly any questions on
that
what's confusing i was like how can i
have something that's gonna
forever
ends then it
right so what we are saying is that uh
right with this loop forever
we are not necessarily saying that um
well we do need a way of getting out of
this loop because otherwise it's an
infinite loop and that could be bad
there's there's obviously a
point in at least in this specific case
that we want to actually quit
out of this loop and uh we can say
loop forever and have it loop forever
but in this case we did just want to
quit
after some point and the reason that we
say loop forever rather than
some other structure was that well what
if it just doesn't pick
uh k equal you know a k being uh 5
for i don't know 20 times or something
like that then we
then it's it's hard to guess that so
it's hard to have a loop
uh that tries to guess the number of
terms that we would need so in this case
we're just using loop forever
to make sure that this code is run
enough times before we actually find the
k that is
appropriate any other questions
all right so one of the goals tonight is
to tie up some loose ends and also to
make sure that
certain messages consumer oriented
messages in particular
sunk in so that when you exit this place
and no longer for instance have a room
full of classmates to turn to
with technical questions or what-if
questions
you feel nonetheless prepared
to make your way in the world of tech so
what do we mean by that well suppose
that
one of your first stops after a course
like this is to purchase come on
is to purchase your
first computer in let's say a while or
you're at work and you have some input
to the it people when it comes to
getting your new work laptop and you
tell them
uh for the sake of discussion and we'll
do it both ways quickly um that you want
a mac
and they say all right well you go ahead
and pick from any of the desktop models
and in fact this is something i myself
just went through recently with my
sister
since we helped equip my mom um back
home with a new mac and she
was transitioning as an aside from pcs
to mac but we'll do the other direction
in just a moment
so it looks like the model of interest
to us is this thing here if only because
it clearly has a monitor and it has a
stand there are these things called mac
pros but
twenty four hundred dollars as a
starting price is a little beyond my
comfort zone so i'm going to go with the
thing that comes with
a built-in monitor so now you come here
and this is where you the e1 graduates
should hopefully have at least some new
instincts with which to guide your next
click
so it looks like we have a menu of at
least four options here
where to even begin or perhaps put
yourself in
these shoes now you're no longer the
purchaser but now that people know that
you took this computer course at harvard
extension
it's now people who are turning to you
to actually ask you for some counsel
here so where do i begin
i am a hapless uh non-technical person
who knows at least how to check my email
but i need a new computer so where do i
even begin
what should jump out at me in these
listings yeah
okay and let's see right here so good so
if we zoom in on the two left hand
options
it looks like one of the first most
striking differences is that the guy on
the left
has a 500 gigabyte hard drive and on the
right one terabyte and what's the
uh factor difference between these two
just to be clear
so it's twice as much 500 gigabytes plus
500 gigabytes gives you one terabyte
so in fact you get twice as much storage
space on the right hand side but let me
push back
uh it looks like they have the same
amount of memory though
so four gigabytes of memory four
gigabytes of memory so what then is this
difference between hard disk and ram
and memory damn kind of give it away
right because a lot of people maybe even
yourselves up until a course like this
conflated the term memory
with different types of memory which are
clearly in the computer so which is
meant by which of these numbers what do
we have four gigabytes of
okay so ram and in a sentence the
difference between ram
and say hard disk space is what so
storage and what do you mean by that
okay perfect so the hard disk is for
long term
or persistent storage so that when you
shut down pull the plug
move the computer physically your data
unless you've really jostled it or
broken it
is still there intact even though
there's no flow of electricity to the
device
ram by contrast is volatile memory which
is just a fancy way of saying
lose power and that those contents are
gone but ram is useful
yes in the short term why what is ram
used for precisely
someone in the middle section if i may
if everyone can say one thing today
we'll have achieved our goal
if we can set an arbitrary goal what is
ram used for
why bother with it at all yeah i'll take
even the hesitant
hand up
for current processes perfect so for
current processes things you're doing
right at the moment
hard disks as you may recall are pretty
slow anything mechanical in a computer
is relatively slow and there's not even
that many mechanical parts we have the
hard drive
we have the fan but that's about it
these days and they are in fact the
slowest part so it makes sense
intuitively hopefully
that if you actually want to run your
computer quickly and run your programs
and interact with them
you want those programs stored inside
the faster type of memory
which in fact is ram and as we discussed
when we just depicted the pipeline of
sorts on the
on the blackboard long ago there's even
faster types of memory than just ram
called l1 cache l2 cache and those
things
start to get a little lower level you as
the consumer probably don't really have
to care as much about that
but typically more is better but there
are certainly limits but it's usually a
function of which cpu you get
it's not a user configurable drop down
menu yeah
that's probably the only thing they're
gonna notice between these
they're all gonna perform okay
okay
okay so that's a perfect mindset so if
the if especially the end user who's
going to be using this thing is fairly
non-technical but they want a
computer with which to you know check
their mail write documents print things
and that sort of thing
what is in fact the most obvious
difference someone like that is going to
notice
well maybe eventually they would notice
the differences in hard disk space as
their hard drive filled up
but you plant those two things side by
side on a desk or you take them to the
store with you
and yes as you know they're probably
going to notice the disparate screen
sizes the two
ones on the left are 21 inches
diagonally and the two on the right are
27 inches so that's a very reasonable
starting point to sit this person down
and say
well which size do you prefer yeah
okay so there are ways to mitigate even
these decisions that we necessarily have
to make right now in the short term
before we pull the trigger but hey
if we run out of disk space down the
road we've you've all probably seen or
at least heard of external hard drives
you can plug them in with the usb
cable they're relatively cheap and frank
and the funny thing is
when your friend runs out of hard disk
space a year hence they're going to be
even cheaper
most likely and bigger so you can kind
of ride that curve unless you need it
right now
okay so that's an interesting point and
let me just plug out one of the
buzzwords there so
cores so what does it mean if a computer
has multiple
cores
processors yeah and there's a bit of a
difference so a cpu
is not quite the same thing as a core
because the cpu can have multiple cores
but for all intents and purposes if a
cpu on my
on the left has one core and the cpu on
the right has two cores
it's almost as if you have two cpus here
and one cpu here in other words twice as
many cores
means you effectively have twice as many
cpus and in real terms
recall now our discussion of scratch a
couple weeks ago that means if you have
two cpus or two cores
the computer can literally not
figuratively literally do multiple
things at once
and by figuratively i mean if you just
have one cpu or one core
clearly your computer seems to be doing
all sorts of things at once you're
typing a document you're receiving
instant messages
emails being downloaded but recall from
many weeks ago that's really just an
illusion that's because your computer is
so darn fast
it is toggling between all these various
programs really fast really fast really
fast
doing smidgens of work here and there
creating the illusion to us slow
human beings that in fact everything's
happening simultaneously but when you
start to use
more intensive programs like photoshop
or if you're watching trying to watch a
movie while doing work which i've been
guilty of
you actually want to be able to throw
cpu cycles so to speak at those
additional tasks
and having multiple cores can help with
that so which is
perhaps obviously the most souped up
model here
in this menu of four options right so
the quad core and that's where they're
trying to
upsell you or at least entice you in the
top right there there's that little blue
icon that says quad core
so you can just infer from that basic
definition quad core
pretty much means it's as though this
thing has four cpus but then the e1
graduate in you should start to kick in
now wait a minute i am just a relatively
slow moving human being
and yes i might multitask and hit alt
tab or command tab a lot but the reality
is
a normal person is probably checking
their email browsing the web
writing documents printing things maybe
watching a movie
but if you're not using photoshop or
developing movie content and editing
videos like the one we began with
tonight
you might very well be overpaying so you
have to try to find at least intuitively
that fine line if money is no object
then by all means
go with the highest end model possible
but you have to realize too that if you
ride that curve of technology all the
way to the right
getting the latest and greatest the
reality is six months from now apple's
going to release something even better
or whatever the company happens to be so
you're paying that premium here well if
we toggle over for just a moment now to
the first
uh the first thought process you might
have for a pc i picked dell it's a
popular pc company in this case i'm
gonna want a
laptop but i want one of these
newfangled things that i keep hearing so
much about
called netbooks what is a netbook
yeah so it's a smaller pc a laptop form
factor
that's generally used to go on the
internet and the funny thing is in my
own personal opinion this is a stupid
new term it just means small laptop and
we've had laptops for ages
but now you slap a new buzzword on it
you market it at a different price point
and you can call it something new
but the reality is these are still
devices that have maybe one gigahertz of
power maybe 1.3 1.5
gigahertz of cpu power if your needs are
relatively humble
even though you propose using it for
internet and email and the like you can
absolutely write an essay on something
like that and send documents to a
printer and look at photographs
watching movies you might get some
buffering and some
stagnation when you're trying to play
the movie if you're trying to develop
movies probably not the right device but
the beautiful thing
is that if you click through to these
kinds of devices if i go
down here to let's click on shop
now what's really compelling is my god
like the
starting price points of these things
tend to be two hundred dollars three
hundred dollars
and what you get actually this isn't
even the right one these are normal pcs
those are normal laptops uh let me go
to mini notebooks so now we get to the
price points of like 279 dollars 299
dollars so i actually have one of these
little toys
um it's a dell mini nine it's the which
means nine
inch screen um there is one gotcha to
this and the problem with buying
things online whether it's for at least
apple you can go to the store dell
doesn't really have storefronts though
you can sometimes find them in best buy
and the like what's the problem
potentially just intuitively with a
netbook
so yes and no so you propose you can't
multitask you kind of can you can
certainly hit alt tab or equivalent and
run multiple programs at once if your
system
if your taskbar is starting to get 10
and 12 icons you're going to notice a
slowdown
but you can absolutely have say a
browser open word
your instant messaging because frankly
if you think back four or five years we
probably were all doing that four or
five years ago and our cpus probably
were not even as fast as these things
have
now if you want to run the latest and
greatest software like windows 7
and the like then that costs you cycles
for other reasons but that's fair
there's certainly going to be a limit
and i think you are inclined to propose
another limit
it drives me nuts i actually don't use
my little netbook because it's too
annoying to type on for very long
whereas small laptops historically for
me
small but at least i don't feel
constrained i mean this one i literally
am like this and i just can't do it but
maybe other people can
but certainly for using just checking
your mail or tossing something in your
backpack cheaply and quickly
it does perhaps make sense though if you
read the media the um
these things called ipads are a claim to
be taking a bite potentially out of that
market so
we shall see all right so
another scenario so you now walk into
starbucks this one now you already own a
laptop
uh or this is your friend and they are
now a little bit paranoid because of
things you've told them
about all of these threats out there so
you walk into starbucks you own a laptop
and this starbucks is advertising wi-fi
free wi-fi or frankly maybe hubbard
university across the street has free
wi-fi and you're trying to patch into it
so what should be going through your
mind like what are the gotchas
okay security and what do you mean by
that just anything that you're doing on
that laptop you know make sure no one
else can
see what's going on okay good so if you
are on a wireless laptop and by this we
mean you are using that protocol called
802.11
a or b or g or n you need to be
cognizant of the fact that there may
very well be people with too much free
time or malicious intent
watching everything you do not over your
shoulder but just wirelessly by sniffing
the traffic
now there are technologies that mitigate
this what were some of those buzzwords
or technologies that mitigate that
concern
okay so using a vpn a virtual private
network
unfortunately the normal person off the
street doesn't generally have access to
a vpn unless you have a corporate
network or a university affiliation but
if you do have those connections you can
usually ask the it
folks for some free software or software
they've paid for so that you can use it
you have a username and password and
this lets you have an encrypted tunnel
over an otherwise insecure connection
now that's good for keeping away
the annoying people who are trying to
observe what you're doing there
it does not stop who from seeing what
you're doing
well hackers it would i would argue most
hackers it would stop because all they
would see is scrambled nonsense zeros
and ones that look random because
your boss exactly right someone there's
gonna be
uh the buck stop has to stop somewhere
and if you're vpninting into your
corporate network or university
surely the people at the other end of
that tunnel so to speak have the ability
to see what you're in fact
doing what are some other buzzwords so
you don't have a vpn
what at least could you expect in a
public space or certainly in your home
for security's sake
okay so using a firewall and a firewall
is something that comes
built into a lot of operating systems
these days or it can be a physical
device that protects traffic protects
you
from getting hit by any form of inbound
traffic by only allowing outbound
traffic
encrypting your hard drive is a way to
obviate
physical uh to ward off physical threat
or just nosy employees if you hand
something over to like geek squad or the
like
so encryption on your laptop and where
else could there be encryption
https okay so using https
to shop on amazon or some other
otherwise uh
sensitive site where you're giving
private information and what about
wirelessly what are the protocols you're
hopefully using at home if you have any
wireless at all
wpa and okay so that's good wpa you
might see it wpa2 which is a newer
variant the bad one to avoid or at least
if you only have it you should probably
spend 20 30 bucks to get a new router
before long
wep so wep and it's actually interesting
there was just uh one or more articles
published recently about how some
manufacturers in china i think
have been getting clever about
manufacturing dedicated devices
that you allow them to listen to some
wireless traffic and they crack
wep keys for you and then allow you to
connect wirelessly to someone else's
network i mean it is
relatively that easy and they're now
just packaging it up various companies
to save you the dirty work
so you have all of these
means of encrypting your traffic but
what actually happens when you bring
your laptop
to starbucks and you connect it so you
might recall that we have this
this alphabet soup of all these acronyms
of all these various services
that are responsible for bringing a
computer online
uh and and allowing you to connect to
the internet and start browsing the web
so let's say i bring my computer to a
starbucks
and i connect through maybe they
probably don't have wpa protection but
just assume that i'm connected to their
network
what has to happen how does my computer
start to
send data how am i actually able to type
in a url into the web browser
and get a web page back what's the
sequence of steps or what's the first
step arguably that that my computer
has to has to accomplish in order for
this to even begin happening
so bring my computer i sit it set it
down and
what do i need in order to allow my
computer to start communicating on the
internet yes
okay great so i need an ip address and
so typically an ip address is
not something that my computer just has
so how do i get
an ip address from the air
what happens okay so so my computer when
it connects to the router
it actually contacts what's called dhcp
server and so this dhcp servers
most of the time it's built into uh to
the router so what we what we are
calling these home routers that david
was mentioning earlier
they might include their own firewall it
might have wpa protection all of these
things
but actually includes a variety of
services and one of them is dhcp and
dhcp
provides a variety of information to my
computer when it's
requested including the ip address and
including some other servers
known as dns servers so these dns
servers are ip addresses that my
computer
connects to to do what
right so the other way around so it
translates so given a domain name
like cnn.com or computerscience1.net for
example
it will translate that into the ip
address of the server that my computer
needs to connect to in order to
communicate and to be able to send data
to and from to receive a web browser or
to receive a web page
itself okay so now my computer has
received this information and so i'm
able to start typing in a domain into
the web browser when i hit
enter what typically happens to this
this data well recall that
usually this this information is sent
it's broken down into various little
packets and it's sent along
the router along the the wire from
router to router
and recall that what we're calling the
router is is
it has a lot of stuff packed into it
like i mentioned before it has all of
these servers packed into it
but it does also serve as a router and
the purpose of a router is to
retrieve these packets of information
try to figure out where to send it next
so it knows okay well
ip addresses in this range should go
this way i appear addresses in this
range the package should go this way
so it figures out where to send the
packets next and sends the packets to
the next router
until ultimately those packets will be
received by the server
reassembled and then the message will be
received and typically
these messages especially with web
servers or when we're trying to view web
sites
will operate over the http protocol and
so
using http that the computer as you
might recall
asks the the server for uh
let's see what you do with the chalk
here it is so it asks the server
uh to get some information in this case
a slash and so what does this slash
typically mean
when we're talking about http so there's
the computer request get slash
what is it asking for from the server so
i've typed in a web
i've typed in a website like computer
science1.net i've hit enter
and all of my my request has been broken
down in the packet
sent over the wire from router to router
reassembled on the server and it's
this message so it's asking to receive a
web page from the server
and the web page that's asking for is
this slash and what does this slash
represent right the home page or the
default page that's provided by the
server and typically
that translates to that index.html
and recall that html is different from
http so don't get the too confused http
is the protocol
through which the computers and servers
communicate to send
uh web pages and to request web pages
whereas html
is just a markup language it's just a
way of formatting text
that the computer or the server sends to
the client computer to my computer
that we that the web browser reads and
then interprets into
an actual final web page so it's it's
two distinct things and it's important
to keep
the two separate okay so as soon as i my
computer has requested the
slash or the index.html the server sends
that data back
to my computer and then i'm able to
display that web page on
on my computer and so um
recall that we can have a variety of
problems that can exist through this so
let's say for example that i'm no longer
able to connect
to the domain name serv so so i can no
longer connect to dns and i type in
a domain like computer science1.net i
hit enter
and it says that it can't resolve the
information well
sometimes there's ways around this and
troubleshooting problems like this it
really becomes an issue of
uh well where is the problem occurring
is it because i actually cannot connect
to
any web servers on the internet at all
is it that one of these services is down
is it that dh
the dhcp server is down then i'm not
actually receiving an ip address
it said that the dns server is down that
and i can't translate
domain names into ip addresses and it's
typically
very different things that that can that
can happen and
if you are able to figure out which one
it is then sometimes you can get around
it so if a dhcp server is down
it's probably a little bit difficult to
just guess an ip address and have it
operate but if
the domain name service is down then
maybe you can give it a separate domain
name server
uh to to operate on uh and be able to
translate your domain names into
ip addresses
all right so that's a look back at where
we began with hardware
transitioning to networking and security
what are the kinds of trends that are
useful to be cognizant of as you step
out beyond
computer science e1 so there's this
really popular buzzword de jour these
days which is called cloud computing
does anyone know what cloud is meant by
cloud computing
actually step back has anyone heard this
expression before
okay so you've almost all heard it so
what is it
yeah um i'm very vague about this and
i'm kind of guessing but it's kind of
putting your information
on a server okay
okay good so it's it's cloud computing
is all about storing your data and even
running your programs in this
this newfangled thing called the cloud
the reality is this is really just a new
word for outsourcing frankly and that's
a bit of an oversimplification but this
is just yet another one of these
buzzwords that everyone likes to jump on
the bandwagon for
and start touting it as a newfangled
technology when reality all
people are beginning to talk about or
beginning to do is
relabel things like gmat where do you
keep your email well i keep it in the
cloud
well a year or two ago we just called
that the web or
gmail.com now there is a greater
sophistication
tout or there is a greater vision behind
cloud computing and that idea is that
no longer before long will you have to
run programs only on your own cpu on
your own hard drive in your own ram
rather when you want to write a document
you instead pull up the address of some
server
and start typing away those of you who
already use google docs or google
spreadsheets
these kinds of web-based applications
are already using this thing called the
cloud
and now microsoft just this week is
beginning to release what they call
microsoft office online which is
similarly a free suite of tools whereby
you have a word processor
a spreadsheet and even a powerpoint like
or slideshow type software
available to you for free and when you
actually save your data similarly is it
not stored locally on your own laptop or
desktop
but rather where
yeah so on one of their servers so now
the flip side of this
is that if you are seeing an employee at
a company that is no longer paying
three hundred dollars five hundred
dollars per copy of microsoft office
which is ridiculously expensive
albeit quite popular and are instead
using a relatively cheaper service like
google docs or google apps you can
actually
long story short pay someone like google
to host your website
foo davidmailand.com but that actually
lives on google servers and all of my
employees can go to davidmailin.com
and write documents there write letters
they can make their presentations they
can store their spreadsheets
so you have this nice illusion of owning
the software or owning the domain name
even though someone else is actually
hosting the software
but what happens at 2 30 pm if you
really have to bang out this letter to
an important client and
bam something bad happens what could be
that something bad in this scenario
perfect so you're in you could have
internet connectivity problems
maybe it's google servers that are
having issues that's certainly been
known to happen
maybe it's something silly like your
router got unplugged maybe it's
something a little more beyond your
control like verizon is having an issue
with their network or comcast is having
an issue with their network
long story short you are now sol you
cannot use that software
because it's in the so-called cloud so
that's sort of the flip side
of what otherwise is a cost-saving
measure now in fairness
eve there are things that can plague our
computers these days even if we don't
even have this thing called the cloud
there's no hosted applications
we're just using microsoft word on my
own laptop or pc
what can still happen in this day and
age that could go wrong
just think about reality what could go
wrong in a current
it if we scenario on the cloud would be
safe you drop your computer down a
flight of stairs and the hard disk is
broken okay
so that's quite fair too right right now
you are very vulnerable to physical
damage or just circumstantial damage
like your hard drive just gives out it's
defective and bad things happen
well the reality is there might be some
value to paying even if it's only a few
dollars per year per month
people who are more technical than i or
more interested than i in actually
solving the problem of data backup so
right now we have this problem this
might ameliorate it but what about
the electricity going out in the office
well i'd argue that you know frankly you
still can't send that or write that
important letter if
you have these real world constraints
but long story short this is at least a
technology if you will to be cognizant
of because more and more
are we humanity likely to transition
more stuff away from our own client
machines as we'd call them
to the so-called cloud or really just to
a server environment yeah
absolutely so now it becomes a much
juicier target if your stuff and your
confidential information is stored along
with all sorts of
other more interesting information but
now you're in the same bucket as all of
these other folks
frankly and we even talked about it a
bit in this class encryption frankly is
a pretty decent solution to these
problems whereby yes all my email all my
documents may very well be stored on
servers owned by google
and they don't quite offer this feature
across the board yet but the reality is
in a few years once people begin to
expect this level of support
and cpu cycles are such that we can
spend those cycles on
more and more encryption a lot of those
problems can be mitigated by having even
per
company keys encryption keys so that
your data even if it's in the same place
can be encrypted in a different form
than someone else is all together but
there's this other there's this other
feature that's related to this that we
thought we'd introduce
you to just a taste of because it
actually lets you experiment yourself so
when computers first began to get
popularized they were pretty dumb
devices they were dumb
terminals or thin clients is another
expression for this whereby you had a
pretty basic
pretty you know bare bones machine on
your desk
but when you started typing you were
actually doing real work
on some server elsewhere and that's kind
of where the world is trying to get us
back to over the past 10
20 years we've migrated to this world
where you buy shrink wrap software or
download it
install it on your computer you have
antivirus computer all of us are
independent computing entities and any
number of things can go wrong with our
computers and frankly i hate this
reality i think the fact that so many of
us struggle with i.t
issues and technical issues and for
those of us who actually own multiple
computers whether it's a phone
a laptop a desktop just keeping all of
those things in sync is a complete
nightmare and it's not an interesting
problem to solve
so there are some consumer oriented
values to these uh this thing called the
cloud
but the cloud as it's called is
ultimately the result of advances in
what's called virtualization
and this is another sort of buzzword du
jour but it actually describes a real
technology
the upside of our having so many cpu
cycles at our disposal and frankly so
many cores
is that we at the moment don't really
know what to do with all of these cores
especially larger companies that have
big
servers that have 4 or 8 or 16 32
64 cores inside of a one and a half inch
tall computer
what you do with those is increasingly
less clear and so what because
long story short we are not very good at
writing software that takes advantage of
that many cores of that many cpus we
really write software typically that
just needs one cpu maybe two to do
something to get real work done
so what the world has started to do is
chop up these physical servers and all
of their cores
and see the illusion of multiple servers
whereby you can buy one server
have a lot of ram in it and a lot of
cores and then you can rent space
on that server to ten different clients
and to each of those clients you give
two cores and maybe a gigabyte of ram
now how do you do that without you don't
have to give them accounts on that
system
you can instead what's called a virtual
machine software virtualization software
and this is special software that
creates the illusion
that one physical computer is actually
multiple
other computers each of which has its
own administrator account each of which
has its own
choice of operating system you can run
windows
xp you could run windows 2008 you could
run ubuntu linux you could run red hat
linux
all physically on the same server so
long as before you install any of those
operating systems underneath it all
in a sense you put some special software
called a virtual machine
that creates the illusion that one
physical box is multiple
servers and the cool thing is and this
is where we're getting to
you can do this yourself these days for
free
even on your own laptop on your own
desktop
especially if for instance you're a mac
user and you'd actually really like to
have a pc
for just occasional applications to use
or conversely you are running windows
and you'd actually really like to learn
a bit more about this os called linux
but you don't want to delete your whole
hard drive and start fresh you don't
want to do this thing called dual
booting
because if you're like me you're never
going to reboot your whole computer just
to change
operating systems it'd be much nicer if
it's just another operating system
running in a window
in your own comfortable environment so
there's this program which we would
encourage you after this course just to
google
for download for free and poke around
it's pretty good in terms of
documentation and tutorial videos
but the one i have up here is called
virtualbox it's made by a company called
sun microsystems which was just acquired
by a company called oracle
it's still free software and what's
beautiful about it is that it exists for
macs
pcs linux computers other linux
unix-based operating systems
and it looks the same across all of them
so it's nice from a
sort of familiarity standpoint and what
it lets you do is
create the illusion of a machine
computer i just click the new button
i'm going to ignore this boring text
here because the next questions i'm
going to be asked are
what do you want to give the name of
this virtual machine
i then tell it what operating system i
plan on installing i'm going to put
windows
xp on here i click next i then tell
this program how much ram do i want to
allocate for the operating system i want
to install on top
of mac os so right now i'm going to
treat my laptop as though it's one of
these
servers with lots of cores now this
would be kind of ridiculous because this
is not a very fast computer this air
so i'm going to be a little reasonable
click next i can create a new hard disk
this is a software-based card disk so
it's really the illusion of a hard disk
it's not a physical device
and if i click next again i'm going to
skip a couple of these details
how many gigabytes do you want to
allocate to this virtual machine
i mean i'm really creating a computer in
software
and the end result is going to be an
icon much like this one here
whereby if i click windows xp service
pack 3
a windows going to open and i did this
previously so it's waking up
essentially and i was actually amused to
discover that the last time i used this
virtual machine was on a plane
so i could play a game from the 1980s
called king's quest
and i did that because i really wanted
to play this game i only had a mac at
the time on the plane
and i did have a virtual machine running
windows xp
so as stupid as this is this is what
graphics were like in the 1980s
and yeah so this is king's quest
wonderful game but you can't play it on
modern computers
in fact you have to kind of slow them
down so that the guy doesn't tear across
the screen
but i am going to go ahead and just quit
this for a moment so that you see
underneath this is
do thou truly wish to cease our
adventuring
yes quit and what you see here
is windows running on my macintosh and
that's the takeaway and what i also have
in another window here
if you'd like to be even more of a geek
and experiment with another os
altogether this is what
ubuntu linux looks like this is a free
operating system you can download a cd
or an image therefore
and install it into another virtual
machine and voila your mac is now
running windows it's running linux
and slowly if i'm doing all these things
at once but this again
is all takes advantage of the
technologies we've been talking about
thus far
i feel like a hand was about to go up
yeah
with licensing any issue with licensing
yes you have to own that copy of windows
that you install on this computer and we
have a site license for it at harvard
for that purpose ubuntu and other
linux flavors are generally free so it's
not so much an issue
and just fyi apple does not allow
legally people to virtualize mac os so
if you own a pc
you can't quote unquote run mac os in a
window on your computer but people have
figured out
how to do this
all right so i think it's time to come
full circle tonight with a look
at programming i think dan has
volunteered in advance to help us out
with this and we need just one other
volunteer
we can take a moment and uh take a
second in a moment to
change tapes as we set up a little table
but we need
one volunteer who's very comfortable
being on camera
and who's going to help us execute the
very last computer science e1 program
ian come on down all right now before we
reveal what's in the bags
and what ian has to do with you is let's
go ahead and actually we kind of did
this in the wrong order uh
an astute student we'll figure out
preemptively what we're about to do
no that's okay once you've gone up
awkwardly to the front there
and let me go ahead and open up just a
little program
i can do that if you want what do you
want to be the one over here
i got it you sure yeah all right all
right
so before ian and dan do
uh battle wits here we need to get some
little audience participation so the
goal at hand i'm really hungry i didn't
really have lunch today so i would
really like a peanut butter and jelly
sandwich
all right but we're going to ask the
audience here to help teach
us the computer teachers and ian how to
make a peanut butter and jelly sandwich
and then we will execute that program
and hopefully there will be no bugs and
i will get my sandwiches output
all right so with that said you guys
don't get to talk just yet we're going
to ask the audience and i'm going to
document this and then you guys will do
the execution
this is sort of a weird abuse of
microsoft word but i really just need
some place to type
since it's kind of boring to write it
all down on the board
and change my margins all right
so step one in my program
and you may assume the following we
apparently have some bread came prepared
we have some jelly we have some peanut
butter and we have some knives and some
paper towel
so hold that thought for a moment while
we go ahead and change out tapes
and think to yourselves for the next 60
seconds how do i actually make a peanut
butter and jelly
sandwich and that's all we have
information that's all we brought so
that's all you have
like what's on the table yes you may
assume you have this as input
so i guess you're not worrying about
contaminating the jam well
we shall see
all right step one
tell me what to type and then they will
execute
immediately
all right wow you're really taking big
bites out of this problem quickly all
right so open
bread so don't execute yet when we write
down a few steps and then we'll execute
open bread
uh peanut butter and jelly okay someone
else step two
yes
hold night okay
step three okay
oh wait
tear off one square of paper
this will be real good group activity
here okay
yeah lay paper on table
this is gonna be fun all right lay paper
on table step five
someone else get the bread
i look forward to seeing that precision
okay next
it's gonna be quality scoop two slit
remove two slices of bread okay remove
two
slices of bread okay step six
sorry place on the paper towel place on
paper towel
a few more steps
scoop peanut butter peanut butter with
knife okay
spread peanut butter on one slice of
bread
actually you should put on both sides
actually put on both sides
on both sides okay
oh and both slices okay both slices
whoops let me kind of shrink the font
okay
spread jelly on second slice
we'll do two versions
take us home someone put knife down
yep next step put slices together
peanut butter and jelly together
put peanut butter and jelly slices okay
loop three times that'll be good okay
all right so
this is pretty good we seem to have some
form of output here
let's go ahead and execute and then for
version two and final we will see if we
can't
improve yes we're sort of doing this in
parallel
so ivy this and he does that if he does
something i don't consider it done until
i do it
correct so what will i recite the
instructions and i would do your best to
put blinders on not look at what dan's
doing unless he lead you astray or vice
versa
and uh you must only do what we tell you
to do
right you are a computer right when
computers are told what to do they do it
they don't
assume or make guesses or fill in the
blanks for you they're not that smart
so step one open bread
peanut butter and jelly
and don't look at that oh
right
isn't that your silverware yeah
yeah i think one of the computers is
taking some liberties here
it says open jelly all right
all right very good hold
knife oh crap
good that too is imprecise tear off one
square of paper
that's a rectangle paper
yeah what do i do with it well wait
we're waiting for your other computer
okay all right lay paper on table
this paper has hearts on it that's nice
get the bread
all of it the
remove two slices of bread
scoop peanut butter no no place on paper
towel
place what on paper towel place on paper
towel
you know this will be the video we're
showing on youtube three years from now
scooped peanut butter with knife
a scoop peanut butter with knife
we seem to well
all right spread peanut butter on
one slice of bread
i think ian's right we never told you to
put the bread down we said get the bread
what we said get the bread no you said
put put
place on oh we did
but you also didn't specify which bread
i was supposed to put it on so
i just used the ones where you cook the
two slices or the entire
bread that's true all right let's forge
ahead then
oh right actually put on both slices
it already is there's another piece of
the knife over there
all right spread oh let's see
spread jelly on second slice
yeah that jelly was there when we came
in
put knife down
put peanut butter and jelly slices
together
okay not quite edible shall we take one
final stab at this
all right so let's um assume things are
in as pristine a condition
as possible but we'll take some
liberties now let's go back to the
drawing board here and see if we can't
fix where we want to stray
so step one please
on loaf of bread okay
remove cap from peanut peanut butter
and jelly yeah
okay okay so
we'll allow you to go back to the same
step but not further so
unscrew caps from peanut butter and
jelly
yeah move
two
i'm being a lot less reckless this time
it seems yeah step three
it's gonna be boring
tear off one rectangle of paper towel
place rectangle on table
on top surface of table any naysayers
yet
alright next step yep
remove two slices of bread
take off two slices of bread take out
two slices of bread
from good we're we're learning open end
of
bag okay
so this side's being quiet yeah
place the bag back on the table that's
for ian there
put the slices
okay place the
side by side on paper towel
okay think we got that one through
pick up knife
do not break it pick
up unbroken knife
good thank you from handle
next
of knife into
peanut butter i'm going to push back i
claim there's a bug here
yeah so what we do in step one uh step
two
yeah so that's kind of yeah so remove
caps from pb and jelly hubba all right
place caps on top
of table
um how are we holding the knife
where do we pick pick up knight oh yeah
yeah
with hand that's fair
okay bring us home almost there
what's that
thank you all right what else
lift
scoop do you understand scoop i don't
understand scoop
insert blade of knife into peanut butter
what do you want to do
scoop out
all right we're gonna we want to assume
that you know what scoop means
tablespoons with
uh two t two yeah tablespoons of
peanut butter of peanut butter
with knife all right that's pretty good
next
spread oh come on it never works out
well when you say it's so succinctly
okay spread peanut butter on
one side okay good
top side of bread
one slice
spread evenly okay
shrinking the font yet again all right a
couple more steps before this gets
even more awkward
peanut butter side up back on
paper towel
oh okay well you can spread it on the
tape
with the bread on the table right okay
all right so it seems we don't need this
one
what's next
yeah everyone's leaving with a peanut
butter and jelly sandwich tonight so we
better start being hygienic
clean the knife better hope you get
bread from that one only 20 more
sandwiches to go
all right clean the knife and
all right a little copy paste job blade
of knife into
sure jelly
jelly okay
on this okay so on one on top side
of of the slice with no peanut butter
okay and finally
match up
jelly touch in
the center evenly even
so that the edges match
loop twice all right
anything else is that it all right here
we go
your exciting conclusion untwist tie on
loaf of bread
fix the knife
untwist untwist tie on loaf of bread
oh no well
all right we'll improvise
all right all right unscrew cap from
peanut butter and jelly
you guys are boring no fun
didn't say remove what didn't say remove
tear off oh and jelly and jelly
tear off one rectangle of paper towel
go ahead
well i they just wanted one they didn't
say one
there that's one rectangle
all right place rectangle wait a minute
you're gonna jump in the gun
what well now place rectangle on top of
surface of table on top of surface of
table there
on top surface of table yeah done take
that sentence is not grammatically
correct according to microsoft word
okay take out two slices of bread from
open end of bag
oh out
place the two slices no place the bag
back on the table
place the two slices side by side on
paper towel
gently
pick up unbroken knife from a handle
with hand you guys are that's not fair
well i fixed mine so see not broken do
not break it
not broken remove caps from peanut
butter and jelly
you guys didn't leave me a free hand you
were supposed to unscrew it though i did
unscrew it it was unscrewed it's just
there
wait it didn't say okay
place caps on table
insert blade of knife into peanut butter
here we go oh no
oh no
well that was up there you didn't tell
me
i hope you're getting this
i can't do it
scoop out two tablespoons of peanut
butter with knife
that actually makes a pretty good spoon
now
spread evenly peanut butter on top side
of one of the two slices
they were well i i placed them side by
side but
due to physics they moved elsewhere
oh man
is
okay okay clean the knife
almost done clean the knife
four steps till we put you out of your
misery no god no
it's e coli clean the knife
insert blade of knife into jelly
scoop out two tablespoons of jelly with
knife
spread evenly jelly on top side of the
slice
with no peanut butter
peanut butter see it's nice like this
where distance ed is really looking
better isn't it
all right and finally match
up slices so that peanut butter and
jelly touch in the center
evenly so that the edges match
all right well a big round of relieved
applause
all right do your thing where you say
hello everybody and we wrap up
goodnight everybody we will be in touch
by email with the courses conclusion
grades and all of that but certainly do
feel free to linger if you have any
questions tonight or want to chat and
many thanks to our volunteer
tonight
you