all right we're back this is week twelve
so this is the end, so nice to see so many of
you again
we will adjourn ultimately to cake in the
pub downstairs but what I thought I'd do is
begin us today with a little something some
of your teaching fellows made
first a little reminder as to what inspired
this particular clip so as you'll recall
this painful experience from a few weeks prior
so we'll just do a minute or so of this
I'm sorry
hey, welcome to the party. The four of us, along with host world wide and
you
are launching windows 7 ultimate software
so you know lets take a minute or so to tell you how great it is to host a launch party
you can use house party tools to build your guest list, upload your pictures
which is his favorite, and you can even get a party pack. though you're in your own home,you'll be able to participate with others in this exciting event around the world.
In a lot of ways your just throwing a party with windows 7 as an honored guest.
that sort of says it all. so
as you know the CS50 fair is coming
up and so to get folks excited about this
a few of our staff
decided to put the following together for you,
it's about
six minutes long here we go.
Oh hi, welcome to the party.
CS 50 and you are hosting the new CS 50 fair 2009 edition.
let's take a minute or so to tell you 
how big it is to be apart of the fair
you can use the CS 50 website to check the guest list
and CS 50 servers
to host your websites
which is his favorite.
yeah, it is my favorite.
and you can even get
an address for that so you can participate
in this exciting event with students all across this campus
you know in a lot of ways it's just like throwing an ordinary party with CS 50 as an honored guest
sounds easy,
and it is. we thought that you'd probably like to know what to do to get
ready and how some students would want their presentations to flow.
Now the four of us did our presentations in past years.
yeah. You know, tried everything out. So we thought
we'd give you some pointers on how to make your final project
presentation really really fun.
now the first thing you have going to want to do
is finish your final project
haha duuh.
make sure you do this
at least a day before coming to the fair, preferably by
december 7th at 11 am
talk to your TF's, us,
or consult the bulletin board if you have any questions.
and you've got to play with your final project
before actually coming to the fair
second, look at the list of projects that you and your friends can try at your CS 50 fair
and visit the ones that seem most interesting to you.
there is a handy list of all final projects at the fair and there is a handy set of specs to read online
that sort of tells you ahead of time what you'll be needing
for your presentation
hey- again,
you don't need to do all the things that are specified in the project specs
just choose your favorites, and try them out
we just have a sample agenda that we more or less followed.
for the first part of the fair we let the guests come in, and they just came in and had a drink 
and a snack and just mingled around for a bit.
just like they would
at any good party
right? yeah, all those parties we go to al the time.
and then as we gathered around
I was able to show my project to whoever came by
exactly.
I just gave an overview of how my project worked, and it only took a minute or two. and you know what was great?
It was totally informal.
and everyone was just crowded
around the table
and after my overview I went
straight to an activity.
Oooh, you went to an activity?
well, I just let everyone
fool around with my project for a while.
Haha, I did the same!
Good, I then started an activity a minute or too later.
well either case works
I guess you just
have to figure out what your guests want
and play it by ear.
We each did a demo or two.
Uumm, I did three.
the demos go for a brief time every once and a while
when other people come by, so for the rest of the party you can just let your guests play around for a while
and your guests may have some questions for you or you may
want to show them some things
but it's completely informal.
yeah.
Again, there are several ways to fill your time at the CS 50 fair
but in the end, it's all up to you.
it's all up to you.
you know, the four of us learned a lot of things
to make our part of the fair a lot of fun.
yes, here's mine:
make the thing you're demonstrating personal to the person you're showing
like the way I helped someone register for a username and make an order on my online dining hall ordering site webpage program application.
or how I let students arrange their own custom made schedules
on my project and gave them LOLcat
user names.
Okay on a more serious note..
hahah JK.
pick out your tables,
and prepare a little bit of information you want to talk about,
and make sure that you have all the equipment you need.
I mean sure, you have to have your computer to show off your project.
In any case none of the setup is too hard. Just need to make sure that you're ready to go when your guests arrive.
and hey, help me remember I'm not a salesman at this party,
I'm not supposed to be a total expert either, I mean this is
a brand-new implementation, and part of the fun of the CS 50 fair is
seeing what you already know
and what you can figure out.
It's so simple anyone can do it.
that's one of the great things about being
a part of this fair that's amongst your peers.
I think the biggest thing is being totally creative and open to your project
and how you present it at the fair.
after all it is
your fair.
can you guys believe that David J. Malan put the launch of the CS 50 fair in our hands? What is he crazy?
ROFL haha 'will you be involved?'
I mean it does make a lot of sense,
CS 50 is about the students
and the community
and it's all about like,
thinking about everyday problems in new ways
and making new things possible;
this really is our fair.
yeah. you're right
so its about to be a party
have fun out there!
oh, I'm hungry. Let's eat!
This was CS 50
no TFs were harmed
during the production of this movie
except me who just starved to death
{laughter} except you're eating an apple!
hahaha, we also have like eight shots of you eating.
okay
so actually just noticed that Matt did like three
wardrobe changes during that film
but umm
so the CS 50 fair is indeed coming
up. Oh and just as funny as that
was the photo shoot that went on
afterwards
so we have a lot of clips like this and
perhaps something will end up floating around
on youtube at some point before long.
But as for this thing, what to expect. so the week of the fair you guys will all get
an email with some additional instructions so if
you're wondering
what do I do on that day, just check your email on Monday, December 7th,
the fair again is on Tuesday December 8th
essentially
it'll go as follows, you will enter the northwest
science which is that relatively new science
building down the street
roughly nine hundred people attended the
fair last year including last year's students,
you will be pummeled with CS 50 stress balls
as the TFs greet you as you come in, little
things like this.
and up next
you'll be handed a program and with these things
you will be handed instructions and
essentially out of the three hundred plus students in
the class
about half of the will be directed to show
up at the beginning of fair which is going
to be one o'clock
and then half of you will be instructed show
roughly halfway during the fair
so there will be intentionally a bit of overlap and
the will be essentially a scene change for all
of you guys show up with your lap-tops
and projects on it for exhibition
and then roughly halfway through other people
will take your place
and it was actually really quite fun as you ma have seen
from the facebook photos online
and hopefully this little teaser today of
will get you all the more excited coming at
the end of lecture are two cakes this time
both chocolate and vanilla
so do stick around; underneath we have
decorated happycat
in the CS50 garb of this year
that's stored at CS50.net
at CS50.net
and let me go ahead and do the sentimental
part rather than leaving that for the end.
A huge thanks
to the staff of this course, over the past
several months
who have really made
this all of the magic in this course happen.
So I maybe the talking face
at the front of lecture
a couple of times per week, but it's the sixty
plus
undergraduates and graduates and alumni who
have really made this course
run so smoothly behind the scenes so even
though just a few of them don't have conflicts
with class and the rest of them are cutting cake
downstairs at the moment
could we please at least on camera given them
huge round of applause.
if interested in joining precisely that team
go to CS50.net/ apply
and the roles were looking for again are teaching
fellows who lead sections and grade, hold office
hours and really get to know a group
of students over the course of the semester
CA's who are alumni who will hold two
hours of office hours per week
pretty much self scheduled by a google calendar
and that's a way of sort of keeping one
foot in CS-50 while still focusing if
you so choose on other extracurriculars
and then graders as well.
I wanted to read a little excerpt of a couple of E-MAILS I got
one in February of 2008 and
one in November of 2007
and this student wrote me, just a
couple of excerpts here,
Hello David, thank you very much for your
your email,
it really made my long computer science- less
boring
CS- less boring day
I was in a model united nations conference
at McGill when I found out about my grade
I couldn't help but shreek
right in the middle of my committee
it was a very embarrassing moment and all
the other 99 delegates looked at
me
and I simply pretended that nothing had happened.
everything about CS50 in my life involves
some kind of drama
now a few months prior that same student had
written me this note here and incidentally
they
approved my reading excerpts from these
so don't
worry about ever sending me an email again.
Hello David
let's see
after our dinner yesterday, faculty student dinner,
I asked myself
why I was about to drop the course, this was
in the fall 2007, considering
how much i adore the course. The main reason
why I was about to drop the course
was rather personal
but here is the entire story
it's pretty long
so excerpts thereof
even though I was always interested in
the material around the third week right before
the mid-term I felt overwhelmed and exhausted
by the load of work I had to do
I tried finishing my PS-2 on Wednesday
because I was leaving on Thursday for Columbia
for model united nations conference
I spent an entire day in the terminal room
trying to get help
I hadn't developed the office hours technique
yet back then
maybe I was just unlucky but I
only got helped once and the poor TF overwhelmed by the number of students in office hours
could only talk to me for a few minutes. I
tired the virtual terminal room that night
and for some reason 20 people were online
and around one AM- in the morning I realized
that it was a lost cause so I tried doing
it on my own
but somehow I couldn't figure out a way to
make visionare work exclamation point exclamation
point exclamation points
in Columbia I literally locked myself in
the hotel room to come up with a logical solution
to my problems
but it's the more I tried the more I failed
miserably. I tried virtual office hours again
and while the poor TF's again tried and
helped two Students at a time
weren't really able to help me. Honestly I
really frustrated that I needed so much time
to get a relatively easy key set done so I
said to myself
if I can't do the problems that the beginning
of the year
I won't be able to
handle the course
so dot dot dots and this recalls the same student that
had wrote us at the semester's end
with a much on were gratified
note
but I want to excerpt one last quote here since I've asked this student if she
could give me your perspectives on the course
two years ago which was the first year I
taught this course
what suggestions she might have and she wrote
if the sections could be designed in such
a way to put all of the less comfortable students
together in a small section
it might work better. I feel that sections
are important because there you can ask more questions
without filling intimated by
200 other comp sci experts looking
at you
and once you
and also once you feel like you're not the
only one
you feel better about yourself
smiley face
so it was largely the result of this student having
written and other students having echoed these
same sentiments that we did introduce this last
year these three tracks for those less and
those more
comfortable and those somewhere in between
and I want to take take a moment
to read these excerpts really just to show
you the before the after because in the course's
syllabus we do make that promise
that what matters in the course is not
so much where you end up relative to that
CS- expert you're right in the CS- expert
your left
but rather where you end up relative to yourself
and in week 12,
Vis-ˆ-vis week zero.
so the student who wrote me this note is
named Jan-Su
who has been the course's head teaching fellow
for the past couple of years and so I just
wanted to thank her very
wholeheartedly and very sentimentally
for having written this note
and for having done such a wonderfully
and apparently awkward job the past couple
of years so Jan-Su
and finally
Though I do love all of the TFs and CAs equally, I did want to
take a  moment to just recognize the
boy who has wardrobed happycat
and all of us this year CS50 honestly
would not be as beautiful or as branded
as it has become over the past two years
and you've seen perhaps the limited extent
of my web skills
and it's really thanks to this fellow
that the course looks the way it does so
huge round of applause would be good for him as well
and lastly there are many many people
on the sheet of paper who are never in front
of a camera but behind it but
Chris and John and Barry the team downstairs
a many many thanks for having me this semester
so
flawless and I apologize myself for
any technical gauche they've been
they've been mine and never the crew that supports
us, so thank you.
so now
now it's all about you guys
so we look back at several problems sets
and there were various fun competitive aspects
and various interesting submissions over
time and we wanted to take a moment
to recognize a few of the submissions that
came in over the course of this semester
this is not to say that these were necessarily
the best this is not to say these were the
worst but they certainly stood out
in the staff's mind for better or for worse
and today
certainly for the better. So we wanted to take a moment
to recognize this scratch project from many
weeks ago almost none of these students were
among those more comfortable but what we went
ahead and did was dig up
a few
this one here was one of our favorites
actually let me go ahead and put the client side
version and as some of you may recall
things seem to run better on the local
client and is Tom Rice here
Tom
so this is Tom Rice's space invaders and
if we can invite him up here for a second and then would
someone like to play space invaders
up here
albeit on camera for just a moment
it's your last chance to volunteer
Tom pick someone who you think would love
to come up on stage with you.
Alright come on down here, now Tom
if you would like to come up here and explain
if need be exactly how this is played
we thought we would
feature for just a moment your version
of space invaders
umm so
the controls are right here
right
shoot to start
click the green light first
yes
shoot at the aliens
and don't let them hit you
you've got to hold down the space bar
if you hit lots of them you level up.
two shield left
ah!
so thank you Tom and to Art, we have a little
parting gift for them today so thank you for
such a job well done
ah thank you Art
all right so we have two other scratch projects
we wanted to recognize and again even though
it might not be your project up here
do you think back to what week zero of this
course was like
you may recall specially poignantly in week
one to how damn hard it was to get a simple
little relatively simple little period of
stars
just to appear on the screen and if you now
think back to p-set 7 p-set 8
do appreciate those of you who feel
this way just how far
you've come in these 12 or so weeks so
this next one
is actually a bit musical in fact
both of these
are musical along these lines so this here
is Anastasia Rhoda, is Anastasia here?
Do you mind coming up
for a second? come on up Anastasia.
so this is called music composer
I'm having some technical difficulties
let me fix.  There we go. A little heavy
on my computer here.
so this I was particularly struck by I
don't play piano very well but it allows you
to program essentially a piano by
by way of some music. I'm guessing you do know
some piano
so if this this might be a little bit of pressure
here but would you like to program us
a little
few chords
Anastasia
music composer
various letters represent the various
musical notes per the legend on the side
that's got to be hard under pressure so big
round of applause for Anastasia
in retrospect I probably should have told
Anastasia that I would need her to write
a song on stage
so I hope that wasn't too much pressure and
then finally this one actually played with
myself another one that's musical in nature
that caught our eye but again then we love them
all equally
this one
is by Ivan Bokov
apologies if I've mispronounced let's let this
one load too
and this one too can be programmed I thought
I would go ahead and do what I did last night
while tinkering go ahead and hit the green
flag here
and I wanted  to so this is the program
that one run moves this little bar from left to
right and any time it encounters a
note it plays that note and each of these
boxes represents a different note
that's pretty. so what I thought I would see
is it what CS 50 the musical sounds
like so
I got to playing like this
and then I did this
and then i did this
oops I left some space last night so let's do this
again
rights
and that looks like and 'S' kind of
right now I did this
it's a decent five
zero
and zero
now is iIvan here
do you mind joining us up on stage and I'll let you hit play?
so this too was actually very addictive and
I'm frankly amazed when I look at that the
source code the puzzle pieces the sprites
that you guys implemented there are many that
are
far more sophisticated certainly than
what I once did so  do you want to explain
in just a couple words what motivated this
or how it works and then go to town?
well I'd like to take full credit for this, but unfortunately I found it on the internet.
There is something called the tone matrix
hence tone scratch trix
and it's essentially what you see here except
that it's even bigger, it's a grid of 16x16
of these little dots
it's based on a pentatonic scale so
essentially anything any combination of squares
that you press
are almost guaranteed to make a good sound
although I'm not sure if you have this many
and to be clear you found the tool or the game
online not this particular scratch project
right
oh
right
I thought I'd implement a few other functions to it
to make it not just like a clone of the actual thing
so I have these other buttons which invert mirror reset
you can change tempo which is just changing the speed of the bar
as it moves along
and if you click on sound it gives you
a different instrument to play.
well show us
that is what CS50 sounds like
do you want to play with tempo and sound perhaps. so changed the tempo, invert, mirror which makes it go the opposite direction.
let's end on a good note
thank you for that so congrats to Ivan, I mean it was really
quite fun to play with so these are all linked to todays lectures page
congrats. so.
that was p-set zero that then brought
us to problem set 5
which recall
involves this guy
in many different places on campus so
frankly the fact that,
never mind the fact that we own our own happy
cat from Icanhazcheezburger.com
but in years past we simply took photographs
of fairly inanimate the not people but
the places and things
this year we decided to spice it up by putting
happy cat all around campus and at the
very last minute so we gave everyone
four weeks to find these photos
and literally at like eleven twenty three PM-
eleven forty nine PM- all of the submissions
from sections
started coming in and so the four sections who
really took this the heart
were these four here Lee's, John's Drew's
and Rose's section what I thought I
would do is pull up each of these links Lee's
section
was in fact the first to submit
and almost everyone got most all of them I
thought I'd bring up their album here
ya Lee's Section!
just us, alright.
here you go
so you may recognize this is actually fairly
common almost all of the groups submitted a
photo that looked like this
so this was of course the statue outside of
Boylston and Science Center B actually looks
kind of cool when looked at from this angle
here
what else do we have this of course is a
favorite
and what else do we have here
and you did find of the bike rakes what else did we have here.
oh and of course those of you've never seen
winnie the pooh, pooh seems to disappear
every couple of years but is door has
been there for many many years this is a
little gem outside of the science center
by the law school so it's a little dark on this
screen but that's pooh's corner there so
congrats to Lee's section but also congrats
to the other couple of sections let me pull
up
just a few of their photos this is John section who
rolled around campus
similarly found most of the locations most
of these were taken by
or featuring Shia who actually did find
the apple tree in radcliffe yard, I had never
known that there was an apple tree on the
harvard's campus and
that there is is not necessarily all that
interesting
but she did find it and this is over near
the admissions office these days takien
at dark apparently
but there are or were apples there.
And this was not quite the intention when you
go intocambridge common when we decided
we were getting bored at this point
in the day and so we started throwing
happycat
and taking pictures
but she
had decided to take this
to heart
so congrats to her section there
So just a couple of others, the next submission came from our Drew Robs
by Mark
so pretty much in Mark seems
to have shouldered the entire project himself
here is Mark in Maxwell Dworkin
here's Mark outside Maxwell Dworkin
here is Mark
in northwest science
alone there
here is Mark
in northwest science
sliding down the poll
here is Mark hiding
and again there's just a theme, here is Mark checking his voicemail
and lastly here is mark with his head in
the statue
so congrats to Mark and Drew's section and
lastly Rose's section they used this new
future of google maps where you actually pinpoint
where you found things so if you're curious
as to
where all the photos did it go find were
do take a look at this particular
link and what you'll see in just a
moment hopefully as a bunch of blue markers
still loading
yes it's slow
and what still see on the map come on
google maps
what this section may have or at least one section did or
may have done
because I may have mentioned
this at one point
is that when it was getting hard to find some
of the photos especially ones at the tops the
buildings which frankly I actually forgot too
where so we were hoping you would
find them
what you can do is actually look at what's called the exiph data inside of a JPEG, s
o in addition to recovering the data of the JPEGs, the JPEGs actually have
some meta data which is things like
the name of the file, the type of camera that took it
and the date and time at which the photo was
taken so in fact
if you assumed reasonably that we followed
a path
through campus and didn't randomly run around
campus taking photos and then revisiting those
places
you can actually kind of trace or infer our
steps
based on these time stamps in the photos now
two years ago
this didn't even occur to us and there's a little
emblem on the back of the John Harvard statue
that even no tourist would have ever
seen
we found this we photographed it and we were
amazed that one of the factions actually found
it
and it was because of that trick. Well last
year we decided to mess with students
so we altered all of the time stamps just to kind
of send them every which way
that kind of hurt participation
so we didn't do that this year and unfortunately
google maps doesn't seem to be cooperating
here but you will eventually see from Rose's
section
a sprinkling of markers all over Harvard's
campus and inside of those little cartoon bubbles
our the directions to them.
so we'll defer to that one online so with, oh,
there were four sections, I used my computer to make
four certificates of distinction
this morning
could if the TF's are here
or one student from each section from Lee's,
John's, Drew's, and Rose's section, would you
like to come on up
and we'll be taking these sections to a meal
in the square right after thanksgiving break
as their prize for their straw.
I see Drew, I see Rose
I don't see Lee or John which means
someone from oh Mark!
Mark is here
come on up, congrats to these guys,
very nicely done.
we'll be in touch.
this is Mark,
ok, congrats.
Do you mind? oh, the TF's
here we go
here Rose
oh you're together
Drew is right there though
what are you going to make me come down? here we go.
congrats to you guys, we'll have those nice meals before long.
all right so if that weren't enough fun,
problem set 6 challenged you to minimize ram and CPU time
and it's probably just as well
'cause now will get a bit awkward because not only
did Drew Robb, now teaching follow, win all
of these contests last year as a student
he seems to have done so again.
but this is not a bad thing because
frankly we definitely noticed that it seemed
to have incentivized  a number of  your classmates
namely Kevin, and then Alan up here at the
top of the list
to really try to best that time and even though
they didn't, this is damn remarkable and so are
Kevin and Alan here who would like to come
up to recognize for this accomplishment
come on down.
so the catchis
if you don't mind just giving us a couple
of sentences on
how would you minimized your CPU times
if you're up for it.Kevin?
so I actually coded my program in assembly
I used
this X-86 instruction that shifts bits to
make a fast task function
you didn't think of that did you?
yeah, no, I didn't think of that either,
Yeah, I don't know, I talked to my TF who is actually Drew, he gave me some good tips. Well congrats,
and here, these are perhaps even more fitting than before, so here you are.
so congrats. So realize that
winning the big board was not what that was
all about it purely opt in and just making it
to the big board even if you were at the very bottom
props to you nonetheless
so congrats though to these
guys who really went above
and beyond putting in the time so
Drew again
walks away this year with one hundred
thirteen quintillion dollars
having grown that from ten thousand, Alan
don't go too 'cause I think we'll put you
on the spot
and I answer the question everyone might have
wondered at the time which was
how did you earn only eleven quintillionin dollars
if you wouldn't mind returning to the stage for a moment
 so what I did is, I stole
Charle's idea
of  just trading volume indices
but Drew
did it better than me, because he figured out that you need
to wait for them to improve because if you put like
a bunch of
random characters in there it like only remembered
it some of the time so Drew basically
made a bunch of trades
where he basically immediately made
I don't know, like a quintillion dollars every time
and then just made a ton of them and crushed me.
Well congrats nonetheless.
all right so so admittedly there some bugs
in our big board we'll perhaps take
care of that next year but this is by far
the first time that someone so completely
vanquished all previous records
so we wanted to recognize one other student,
we took a look at the
statistics for the bulletin board which is
if you never tuned in,
and now we know that you did or didn't
because we looked at the statistics
is this anonymous bulletin board by which you can
ask questions, answer questions,
and there were three folks in particular
and I'm happy now to pat myself on the back that
I blew you all away when it came to posting
to the bulletin board
 followed by Glenn Holloway and who you
never see but who has also been invaluable is
sort of my behind the scenes consuliary in
the course
but Jeremy Cushman, if he's here
with one hundred sixty two
answers really, there was an occasional
question but we're quite grateful that he
would often pluck off questions before
we even had a chance. So Jeremy we made you
a certificate too.
very nicely done
have another
we always get them afterwards
so with that said hopefully at this point
you have filled out a few questions on this
piece of paper 'cause you only have a couple
more minutes to do so. So you have in your
hands when you walked in probably
a piece of paper in the bottom quarter of
which is either the number one
or the number two on the back
this was an accident this is what happens
when I send an email to have something
photocopied and don't think we only wanted
you get side two
or side one
so we thought we'd leverage some probability
here and we're just saying go ahead and fill
out with questions and answered either side
one
or side two and we're hoping purely by
chance that roughly fifty percent of you
will choose one
and fifty percent of you will choose two.
so if you haven't done that, please take the last couple of minutes
here to do so
and come up with a couple of quiz show like
questions
and what I thought I would do then as you
finish that up
is this here.
So we looked at the surveys from problem set 5, and you'll be hit by one more towards the
end of the semester because it's invaluable data
for us as we improve the semester
and I wanted to give this student his or
her fifteen seconds of fame too, so this is
respondent number twenty nine who wanted their
survey put up just like the birthday
boy from a couple of weeks ago
this was interesting and whenever we see
nonsense we tend to assume that it's something
like rot13
so if we pull this up here rot13 converter
we'll just go over the top the link here, no
not working, we'll go to the second link here
we could do this by hand of course, we know how,
but I'm just going to go ahead and fill in that
blank, click rot 13, and this student
had this to say
so you're fifteen seconds are now up but
thank you for your
your feedback
and this was also a theme here too in the
survey. So I only took one of one of these quotes
but throughout the surveys for p-set 5 were comments along these lines
so you'll recall that the course web site
for some time featured a whole bunch of LOLcats
which, no,
the course website featured for a whole bunch of time some staff, so teaching fellows,
course assistants and e
occasionally me, we decided to swap ourselves
out recently with a LOLcat of the
day
so this is from a very popular funny web
site called Icanhazcheeseburger.com
and they provide what's called an
RSS feed. RSS is an XML based language,
a tag based language
well we had a bit of free time so we went
to their web site
we found the link to the RSS feed,
we then were a little PHP program that
every few minutes queries their web site, grabs
that RSS feed
and much like our proxy for p-set 8
traverse the RSS that came back
from google news,
so do we traverse the RSS that comes
back from Icanhazcheeseburger, we look for
the most a recent JPEG
that they've embedded in their RSS feed,
and then we save in our local database a
copy of that URL,
and then we proceed to embed it in our own web
site and so this thing
doesn't change every minute or so but anytime
they update their feed, within a few minutes
we've actually captured these changes as well
and we also dove in
and played around with some other things which
we thought we'd draw your attention to because
as you exit this course
there will come a point
where you're certainly not going to be handed a PDF that
tells you exactly how to proceed
to tackle some problem
so we've been having great fun this year building
up these various API's, application programming
interfaces
and this is really just to lower the bar to
getting data that's interesting on campus
but as this wiki page that is linked to the
course's website reveals,
there are so many fun data sets
and tools that you can patch into, whether
it's for the iphone or  facebook or calendars
or finance
or maps or any number of things
and so just to inspire your forthcoming final
projects
I thought I'd draw your attention to the solving
of two problems for instance so we have a
number of students who wanted to implement
some food based projects for their final project
and by that we mean doing something to the
dining hall, and you may recall that
crimsondining.org was made by a former CS 50
student and TF,
that does something along these lines
but we decided that you know it's not going
to be the best use of time
if a whole bunch of students go to the www.dining.harvard.edu,
they pull up the menu and then you have to
figure out somehow
how to get this data
into web site.
so number you at this point in the term
are probably a. not thinking about final
projects at all,
or two, are but really have no idea how you're
going to implement what you proposed implementing
in your proposal
so just to help you realize that you now have
underneath your belt, a whole bunch
of tools
and building blocks with which you can figure
these things out on your own
I thought I'd, in just sixty or so seconds, explain
how we went
about grabbing all of the data from Harvard dining's web site
so that we now re-expose it to any student who wants
is in CSV formats or in Jason
format
via that wiki page before so I went to
this web site and I said wow
I'd really like to start screen scraping, as
it's called, grabbing data from this web site
so I can get into my own database some turkey
sausage, some egg beaters, some egg whites,
so I took a look at the source code for this
page and in the source code of this page
is alright some HTML or XTML
and then I noticed alright, let me search
for sausage so I knew that that's in the web
page
so here's my turkey sausage
and I realize that there seems to be a
structure to this page of it's a bit messy
it's kind of indented all over the place
but notice that turkey sausage is inside of
an anchor tag, a link
that's inside of a span
and that's inside of a div, but even more
interesting is that that div
has sort of a special moniker its of class
item wrap
and sure enough it by continued scrolling
down through the file
pretty much any piece of food, here's egg beaters,
was similarly inside of a div whose class is
item_wrap. So I noticed this pattern and I figured
oh,
if I can
now somehow
go after this XHTML looking for
this pattern
I can do what's called screen scrape
so I went to my command line and I pulled
up
a little PHP
I pulled up my text editor
and I ended up writing something that looks
a little something like this. And how all this
code works doesn't matter so much now, and I'm happy to
send
 this to folks  via email, if you'd like to take a closer look,
but in a nutshell
I went ahead and I grabbed the, I
pasted the URL from the browser into this
script somewhere in a constant and then I
proced to fetch that
using file get contents or something similar
which actually then goes and grabs the data,
and then I did this trick, and in this is your
little hint: if you ever have to do this in
life,
when you have XML data, there are ways
of querying that XML  data using a language
called X path
and X path essentially lets you say something
like this
if you want to get out all the divs in the
page,
you use a query like /HTML
/body
and then you can do something like //div and this expression it's sort of like
a file system path , c:/ or whatever
that path there will return to me an array of
all of the divs inside of the body and
so the slash notationis is very similar in
spirit to any file system. So a long story short
I wrote a script that searches through
this source code grabs all of those divs,
and then i check, are you of type class
item_wrap? Are you are you?
and then using very similar syntax that I
pluck out
turkey sausage and egg beaters and egg whites
and then finally I did an insert
into
a miescual table and the end result
is that if you ever want to find out what's
coming up for
breakfast,
you can execute a query of CS50's own
server, get back a CSV file
that looks much more
machine friendly, a CSV file with rows and
columns and dates and food types
and all of that so again
you now have the ability to at least identify
potential problems and hopefully now have
heard enough details that even if you have
no idea
how to go about using X path
it's really just a google search or wikipedia article
away at this point. Finally we also had
some fun this weekend
given that
so many of you have been diving into your
own final projects, we decided to take our
own map site to search for Mather house
and now we integrate wikipedia articles
automatically into the thing why
just because
and also official photographs of all of
the buildings and so you get little pop ups
like this for Mather house
and if you really like to engage dynamically
in something like this
and don't like the fact that wikipedia
is telling the world that Mather is the box
that Dunster came in quote unquote.
we don't censor in 50. Well hey, if you don't like it Matherites, go change it
will notice that change within an hour or
so of it getting edited on wikipedia
so perhaps we can do some changes to all
the houses begin now
let's see what's Lowell house has to say on
wikipedia
one of the twelve
it's actually a very nice flattering article
that
so,
Lowell house is a is a little nicer and then
finally did we do anything else? nope,
that's enough for now
so hopefully at this point in the story you filled
out this form yea or nay
so we had a few volunteers from staff so
could our staff contestants come on up
a few faces may look quite familiar
and really any of the staff who are seated here
are welcome to come up on stage the more the
merrier
and now we need at least two maybe three of
those less comfortable more comfortable
or somewhere in between to take the remaining
chairs up here for our finale
quiz show of sorts
for which you, hopefully, just wrote the questions.
any volunteers would like to match wits
match with the staff?
ok, you two and three,
and is there someone down here
four, come on down
all right I think we have enough chairs for
everyone
we have five, fifth
contestant?
ok five and six, come on up
all right so it's now six versus four
let me go ahead and ask Jan-Su and
the remaining Tf's who are a little too shy apparently
to come on up
could you guys just collect the forms that
people have filled out and bring them on up
front
ideally flipping them to the right side based
on what's been filled out.
come on up
alright so
in just a moment
you'll see another web site we've been working
on
which looks a little like this
very high-tech
this is all HTML based
and it's just this is the biggest
Jeopardy competition we've ever had
so in just a moment
we will have
the following
"and now here is your host of Jeopardy, and now here is.." ipod is on loop,
awkward, all right
normally that sounds better. Alright here we go.
anyone else?
so okay you don't have to stand there awkwardly, you can take your seats
so we have just a few minutes before we adjourn
to some cake downstairs, what you have in front
of you
are two huge teams
oh we can get another chair
ok so
why don't we very quickly go down the row
here and say who you are and say one interesting
thing interpret as you will
and be sure to speak very deliberately
into the speakers
my name is Mathew
and I'm a CS50 TF
I'm Rose
and I'm also a CS50 TF
excellent
Hi Mike, and I'm also a CS50 TF
ok this is no longer interesting
hi I'm Greg and I enjoy making juice
Hi I'm Kevin, and I am Greg's roommate
I'm Robert and I thought it was really interesting
how today in EC 10
Professor Mankiw allused to a set with measures zero
I'm John,
I'm from Leverett House
Hi  I'm Michael
I'm an econ concentrator who hates econ
I'm Josh, I have conducted an orchestra while wearing
a guerrilla suit
I'm Panit,
I'm from New Mexico and some people don't
realize it's part of the United States
I'm Anna, I'm from Utah, which used to not wanna be part of the United States.
and we have Jan-Su who is going to run our scoreboard here we'll have
the staff score on the left the students score
on the right
well we did a little coin toss before class
and the students won the toss which means
you students have control of the board, we're
kind of going to butcher the logistics of
jeopardy here and kind of just go with what works
with that said go ahead and pick a category
if you need a little cheat sheet
you've probably will get you some blank
sheets of paper so you'll know what week was what
go ahead and pick a  week and the dollar amount
anyone on the students team
week two for one thousand
week two for one thousand going in strong
so your question for week
two
should've said write legibly, your
question
for week two
ok
we'll start off with this
rot13 plus rot13 equals? first hand up gets it
ok students
rot0, actually the answer is awesomeness
we'll give it to them
so Jan-Sue will be our judge, a thousand dollars
for the students okay and you're still in
control
of the board
we came prepared with this
very nice
ok you're in control what would you
like next
well ipod is on automatic play  now
not very good the technology okay
students what would you like
week 3 eight hundred
oh wait I'm not doing this right am I.
what week
sorry?
week 3, one thousand
okay week three for one thousand, your question is
what is the
 lower bound on the running time of bubble
sort?
Matt. Omega of n. Omega of n, audience what you think?
who's going to answer
yes no
okay yes
do we want this to devolve into one of these things, where we
all right
Sanders has never been so proud
Tf's you are in control, what category
would you like
 week four for one thousand
week four for one thousand...
what happens if you don't allocate memory
before signing...
Robert? segfault.
bad things
Very good for one thousand. Students are in
control
what's left?
what's left, everything except those two
I heard
what was it week four
all right well there's no week three for one
thousand anymore
user error.
week zero for one thousand all right so
oh my goodness
this is really not week zero material but
what is the askey value of the open curly
brace?
no funnier is, who knows this?
yes, students.
cast open curly brace
audience?
0:52:00.839,0:52:03.729
one ninety eight
no,
I don't think so
minus a thousand
anyone
who wrote the question? come on, fess up.
well
what's the answer
one hundred twenty three is in fact I'm not
going to throw correctly but here you go.
wow
thanks
I think we should take off the points
yeah they were wrong
so it's tied at one thousand and there's time
for a couple more questions in single jeopardy
what would you like your next category to be?
week one for one thousand eight, your
question here is ...
what does GCC stand for
Greg's hand went up first, and then went down very quickly
Gnu compilation...uh Gnu C Compiler
yes, did you know that though
yes it's true so for one thousand.
Gnu C Compiler so extra credit if you go figure
out what Gnu stands for some day
Gnu's not Unix
ok you're all very smart now
The staff are in the lead now with two thousand
we've got time for one more single jeopardy question
so what's it going to be staff
oh sorry
 week four for eight hundred so week
four
for eight hundred
and your question's going to be
week four for eight hundred
blank
the week what
I do need help
what is the name
we're taking today very seriously. What
is the name of the pointer video we watched
from Stanford?
I saw Rose's hand,
yes?
Blinky's Pointer Fun?
judges? Rejected for minus eight hundred
students? Fun with Pointers?
No! The answer was Pointer Fun with Blinky
who knows that? Alright so now was transition
to double jeopardy where the scores on the
board double
why don't we take a moment to ask students
How is the game going for you thus far
who would like to step up
and field this type of question?
what's your strategy moving forward?
we're trying to write some pseudo code
and staff what's your strategy for taking these
guys down
we're just going to continue David,  we think this is working for us
pretty well and we're
stick with it
yes your two hundred dollar lead is
massive here
all right so
i'd let's see I think the staffers still in
control so staff what's your choice
of weeks here
new weeks on the board
yes
no
yeah
yes Matt, and two thousand it is
so week ten for two thousand, oh soft ball,
what does CPU stand for?
a chance to pick the students, ok students? yes?
central processing unit? audience?
yes! very nicely done so now it's
three thousand to twelve hundred Matt,
so students what's it gonna be? There's time for couple
more questions
what's it gunna be?
the one with the..?
oh, you want to know what this is,  I came
prepared
that's going to be an audio daily double and
that period is my clue to myself to remember
that
okay one moment
gotta find
for twelve hundred dollars
who let's see, this is the students
name this tune
yes
I think it's the hamster dance
this is the hamster dance that's correct
twelve hundred dollars
all right we have time for one more question
the before,
oh that's twelve hundred
all right Matt it's time to dominate
Students you're in control
week nine for two thousand dollars in week
nine your question
is going to be let's see if we can pick a
winner here, your question is
going to
this is just
this is just an opinion question, that is the music
played during lecture breaks pseudo random,
justify.
ok, alright
no, that's not the question
the question will be
all right this person drew pictures
very well including a toilet, a hammer, a tree,
and star, a rainbow,
a lollipop
that was
glad you enjoyed the first part of lecture.
right finally week, what week are we in, nine?
so your question is going to be, your
question for week nine
okay perfect, quality, week nine
first hand up gets it
how awesome is Ajax?
Matt. Really really awesome David!
it's very.
that's okay
why don't we go ahead and
why don't we go ahead and officially
adjourn here after double jeopardy
'cause yeah, just
yeah
I think it's time for cake, congratulation on
a wonderful semester
we will see you downstairs in the pub if you would like a snack
