Home
>>     < >




In-class notes for 01/09/2018

CS 284 (MCA), Interim 2018

Submitted questions on assignments and technology

JavaScript (Elijah Verdoorn)

Promises

  • ES6 Promise exercises

    let timeoutMsg = (dur = 0, msg = "done") => { 
      return new Promise((resolve, reject) => { 
        setTimeout(() => { console.log(msg); resolve }, dur);
     })}
    

    Mozilla documentation: search MDN

Shared projects and stogit Merge Requests

  • Clone the shared demo repository.

    cd ~
    git clone git@stogit.cs.stolaf.edu:mca-i18-shared-ex/demo.git MCA-demo
    cd MCA-demo
    

  • Create a branch named with your username, and switch to it.

    git checkout -b username
    

  • Add some capability to Inner.java in your branch. This could be a new drawing color, a clear button, a background change button, a button that does something else, etc.

    • Use your initials to label the change you make for the user. For example, if you add a color choice, add your initials to the color name; if you add a button, label it with your initials.

    • Avoid adding long elements to the GUI. For example, if you add a button, label it only with your initials.

  • Test your changes to make sure your version of Inner.java works correctly.

  • Commit and push to record your branch (not master)

    git add Inner.java
    git commit -m "Modified Inner to ..."       # fill in what you did
    git push origin username
    
    Note: We omitted git pull above because you've never pushed your branch before -- it doesn't exist on stogit. In the future, pull before pushing your branch once it already exists on stogit.

  • Perform a merge request on stogit. Find the shared project demo in the git group MCA-I18 shared exercises on the Stogit website stogit.cs.stolaf.edu, and make the request to merge your branch into master.

  • Give feedback on someone else's merge request. We will not accept merge requests that haven't been checked by another student.

    • You can retrieve someone else's branch from stogit as follows:

      # make sure all of your changes are committed
      git checkout master
      git fetch            # retrieves all branches
      git checkout otheruser     
      # or  git checkout origin/otheruser  for older versions of git
      

      You can see a list of all branches in your working directory with

      git branch -a
      

  • Instructors will accept or reject your merge request later.

Fetching data from a server

  • Google developers introduction to ES6's fetch()

  • Button server: IP address 162.210.90.19, port 3000

  • Getting fetch() to work:

    npm install node-fetch --save
    
    If you have an old version of node, you may need this line at the start of your javascript code:
    let fetch = require('node-fetch')    # probably unneeded for
        your setup
    

To study for quiz

Java programming in Lab 3 - 4
  • Concepts of event-driven programming in Java -- describe and use

  • Modify and identify elements of an applet like Scribble.java




< >