>>     < >




In-class notes for 04/14/2014

CS 121B (CS1), Spring 2014

Heartbleed security bug

  • First message: Change your passwords ASAP on Facebook, Google/Gmail, Instagram, Pinterest, Tumblr, Yahoo, Yahoo Mail, GoDaddy, Flickr, Minecraft, Netflix, SoundCloud, YouTube, Box, DropBox, GitHub, OKCupid, Wikipedia (if you have an account), Wunderlist, maybe others.

    Note: Most of these have taken corrective action, but changing your password insures that your account will be safe from then on.
  • But don't change your password yet on Skype, Twitter, Wordpress, and other sites that haven't/may not have taken action yet. (And remove anything you don't want to be seen!)

  • The technology problem: OpenSSH is free security software that is used by most websites that need security (https, green padlock). A bug was discovered by security experts that enables someone to see files on sites that use OpenSSH. The fix requires a software upgrade for OpenSSH, and not all companies have done this yet.

  • Security is an example of a computing ethics issue. Others include:

    • Accessibility - access for differently abled people

    • Intellectual property - who owns the ideas expressed in software and systems?

    • Privacy - controlling who may know what about you

    • Honesty and deception using computing

    • Risk and reliability of computing systems

    • Uses of power related to technology

    • Quality of life, which may be affected for better or worse using computing technology

  • St. Olaf has an innovative course on Ethical Issues in Software Design (ESD, CS 263) that takes a social-science approach to learning about ethical issues. The course includes a term-long team project in which students consult with the ethical issues in real companies/entities about real software. (Spring, prerequisite SD)

Submitted questions on assignments and technology

  • Solution to colorString() problem developed: turtles; solving simpler problem first; looping through string; spacing past drawn characters; then adding turtle color using dictionary

Upcoming

Submitted questions on readings

Defining classes

  • Example class specs: Account.html, and spec for Plant class

  • Memory diagram of an Account object (see end of Account.html)

    Objects in the same class have the same state-variable structure, although each has its own separate memory locations.

  • Syntax of a class definition

WMR exercises

  • Exercise 1:

    Compute the average ratings for all movies

    • Sample data set. For that data set, the results should be:

              1	3.3333
              3	4
              6	4.5
              8	4.5
      

    • mapper() specs

      # IN format
      #    key is a netflix record   value is empty string
      #    NOTE: netflix record format is   movieID,reviewerID,rating,date
      # OUT format
      #    FILL THIS IN
      

    • reducer() specs

      # IN format
      #    FILL THIS IN
      # OUT format
      #    key is a movieID  value is the mean movie rating for that movie
      

    • Hints: (a) COMPLETE THE SPECS FIRST -- what intermediate key-value pairs will you need? (b) Use two accumulators in reducer, one for sum and one for count, in order to compute the mean

    Sample data set:
    1,1596531,5,2004-01-23
    3,2318004,4,2004-02-05
    6,110641,5,2003-12-15
    8,1447639,4,2005-03-27
    8,2557899,5,2005-04-16
    6,52076,4,2004-10-05
    1,13651,3,2004-06-16
    1,1374216,2,2005-09-23
    
  • Exercise 2:

    Compute word frequencies per book and overall frequencies, in a single map-reduce cycle.

    Example input:

            cathat	The cat in the hat
            cathat	wore the hat
            cathat	to the cat hat party.
            OwlCat	The owl and the pussy cat went to sea
    
    Final key-value pairs emitted from reducer:
            The	OwlCat 1
            The	cathat 1
            The	2
            and	OwlCat 1
            and	1
            cat	cathat 2
            cat	OwlCat 1
            cat	3
            ...
    
    • mapper() specs

      # IN format
      #    key is a book ID  value is a line of text from that book
      # OUT format
      #    FILL THIS IN
      

    • reducer() specs

      # IN format
      #    FILL THIS IN
      # OUT formats (there are two)
      #    1. key is a word  value is a book ID, a space, and freq of key in that book
      #    2. key is a word  value is total freq of that word in all books
      

    Hints:

    (1) fill out the specs first -- what should key-value pairs be for example? (2) Use a fake "book id" 'zzzz' to count frequencies for all books, and handle that fake ID specially in reducer to get second output format.




< >