midterm review next monday in class midterm cannot make it
play

MIDTERM REVIEW NEXT MONDAY: IN-CLASS MIDTERM CANNOT MAKE IT? If - PowerPoint PPT Presentation

CS 498RK FALL 2016 MIDTERM REVIEW NEXT MONDAY: IN-CLASS MIDTERM CANNOT MAKE IT? If for some special circumstance, you CANNOT make the in-class midterm, please email me ASAP. If we don't know about your special circumstance by 11.59pm


  1. CS 498RK FALL 2016 MIDTERM REVIEW

  2. NEXT MONDAY: IN-CLASS MIDTERM

  3. CANNOT MAKE IT? If for some special circumstance, you CANNOT make the in-class midterm, please email me ASAP. If we don't know about your special circumstance by 11.59pm Monday, Oct 24th, we won't be able to accommodate you.

  4. THINGS YOU SHOULD KNOW ABOUT THE MIDTERM Anything from lecture and MPs is fair game One-sheet of handwritten notes (front and back) Expect to write code: Javascript , HTML, CSS, SASS, JQuery, AngularJS, Mongo Query Language Will test your ability to apply what you've learned in new situations -- NOT regurgitate memorized facts (i.e., history of HTML)

  5. HOW TO STUDY FOR MIDTERM Go through all the questions on slides Go through all code examples on slides/CODE PEN Review the challenging aspects of the MPs

  6. Be sure to review the following topics…

  7. STRUCTURAL SEMANTIC TAGS < body > < header > < h1 >How to Get a PhD</ h1 > < nav >...</ nav > </ header > < article > < section > < figure >< img src="benfranklin.jpg"></ figure > < h3 >Bribing your Committee</ h3 > < p >When blackmail fails...</ p > </ section > < aside > < h4 >Useful Links></ h4 > < a href="www.bevmo.com">Research Supplies</ a > </ aside > </ article > </ body >

  8. STRUCTURAL SEMANTIC APPLICATIONS?

  9. STRUCTURAL SEMANTIC APPLICATIONS < header > Reuse stylesheets < nav > Remix pages and applications < article > < article > Retarget between form factors < article >

  10. CSS SELECTORS <!DOCTYPE html> . photo { < html > width:300px; ... } < body > . photo h3 { < div class="photo"> font-weight:bold; < h3 >My first photo</ h3 > } < img src="picture1.jpg"/> img { </ div > border:1px solid black; ... } </ body > ... </ html > map HTML elements to CSS rules

  11. Which selectors promote the most reuse ?

  12. WHY CASCADING? more than one rule can apply to an HTML element priority rules for resolving conflicts more specific = higher priority (class trumps element) some properties ( font-size ) are inherited, while others aren’t ( border , background )

  13. LINKING TO HTML (1) <link rel=“stylesheet" href=“gallery.css" type="text/css"/> (2) <html> <head> < style > h1 {color:red;} p {color:blue;} </ style > (3) <div style ="color:blue;text-align:center"> higher priority

  14. Box Model MARGIN BORDER PADDING CONTENT control over white space

  15. position VALUE DESCRIPTION default. positioned by the flow model; static una ff ected by top, bottom, le " , right positioned relative to browser window; fixed use with will not move when window is scrolled top bottom positioned relative to its normal position relative left right positioned relative to the first ancestor absolute where position!=static

  16. Design Challenge: vertically center a <div> of unknown height CODEPEN

  17. SOLUTION .table-outer { width: 100%; display: table; } css tables! .outer { <div class=“table-outer"> height: 200px; <div class="outer"> background-color: #144057; <div class="inner"> </div> display: table-cell; </div> vertical-align: middle; </div> } .inner { width: 100px; height: 50%; background-color: #B6C4C9; }

  18. Separation of CONTENT from PRESENTATION? purely presentational html! <div class=“table-outer"> < div class="outer"> < div class="inner"></ div > </ div > </div> a lot of HTML su ff ers from presentational div bloat

  19. CSS PREPROCESSORS languages that extend CSS in meaningful ways features: variables, nesting, mixins, inheritance shrinks developer’s codebase and compiles into CSS popular CSS preprocessors: LESS and SASS

  20. JAVA : JAVASCRIPT :: :

  21. Functions are first-class objects

  22. FUNCTIONS ARE OBJECTS that are callable! reference by variables, properties of objects pass as arguments to functions return as values from functions can have properties and other functions

  23. ANONYMOUS FUNCTIONS create a function for later use store it in a variable or method of an object use it as a callback see more examples next class

  24. this the other implicit parameter a.k.a. function context object that is implicitly associated with a function’s invocation defined by how the function is invoked (not like Java)

  25. apply() and call() two methods that exist for every function explicitly define function context apply(functionContext,arrayOfArgs) call(functionContext,arg1,arg2,…)

  26. implemented in Javascript 1.6 function forEach(list, callback){ for (var n = 0; n < list.length; n++){ callback.call(list[n],n); } } var numbers = [5,3,2,6]; forEach(numbers, function(index){ numbers[index]= this*2;}); console.log(numbers);

  27. Classes are defined through functions

  28. OBJECT-ORIENTED PROGRAMMING new operator applied to a constructor function creates a new object no traditional class definition newly created object is passed to the constructor as this parameter, becoming the constructor’s function context constructor returns the new object

  29. CONSTRUCTOR INVOCATION constructors are given the class name function Llama() { this.spitted = false; this.spit = function() { this.spitted = true; } } var llama1 = new Llama(); llama1.spit(); console.log(llama1.spitted); true var llama2 = new Llama(); false console.log(llama2.spitted);

  30. scopes are declared through functions and not blocks {}

  31. closure scope created when a function is declared that allows the function to access and manipulate variables that are external to that function

  32. PRIVATE VARIABLES var add = (function () { self-invoking var counter = 0; return function () {return counter += 1;} })(); add();

  33. PRIVATE VARIABLES private data member now! function Llama() { var spitted = false; this.spit = function() { spitted = true; } this.hasSpitted = function() { return spitted; } }

  34. DOCUMENT OBJECT MODEL one-to-one correspondence between HTML elements and DOM nodes BODY < body > < div class="photo"> < h3 >My first photo</ h3 > DIV < img src="picture1.jpg"/> </ div > ... H3 IMG </ body > “My first photo”

  35. TRAVERSING THE DOM BODY var body = document.body; var div = body.children[0]; DIV var h3 = div.children[0]; var textNode = h3.childNodes[0]; H3 IMG var textString = textNode.nodeValue; “My first photo” www.w3schools.com/jsref/dom_obj_all.asp

  36. DOM ELEMENT OBJECT relative to offsetParent MARGIN BORDER position: element.offsetTop , PADDING element.scrollTop , … CONTENT dimensions: element.clientWidth , clientWidth element.offsetWidth , … style: element.style offsetWidth (includes scrollbar) www.w3schools.com/jsref/dom_obj_all.asp

  37. DOM MANIPULATION programmatically change the structure and modify element properties element.style.backgroundColor = “red”; element.innerHTML = “<div><h3>Llama!</h3>…</div>” augment DOM structure: element.appendChild() , element.removeChild() , … www.w3schools.com/jsref/dom_obj_all.asp

  38. THE BROWSER EVENT LOOP Parse HTML and create DOM USER BROWSER Check for events Event Queue NETWORK TIMER NO Event? single-threaded: events YES processed one at a time Process event

  39. EVENT PROCESSING events propagate in two phases capture phase : root to innermost element bubble phase : innermost element to root DOM standard: capture then bubble

  40. EVENT PROCESSING element.addEventListener(event, function, useCapture) set capture or bubble phase event.stopPropogation() CODEPEN

  41. JQUERY cross-browser use for all DOM manipulation: ( e.g., positioning relative to document and not o ff setParent ) jquery.com

  42. ANGULAR CONCEPTS 1.3 Controllers $scope object Directives MVC Client-side Templating Data Binding

  43. WAYS OF DATA BINDING OneWay Dependency Object Object TwoWay Dependency Property Property OneWayToSrc

  44. MADLIBS TEMPLATE <div ng-app> <div ng-controller='MadlibsController'> <div>Hola <span class="madlib">{{madlibs.animal}}</span>, </div> <div>Se llama <span class="madlib" ng-bind="madlibs.name"></span>! </div> <form> <input ng-model="madlibs.name"> </form> </div> </div> CODEPEN

  45. MONGO SCHEMA DESIGN For “one-to-few”, you can use an array of embedded documents For “one-to-many”, or on occasions when the “N” side must stand alone, you should use an array of references. You can also use a “parent-reference” on the “N” side if it optimizes your data access pattern For “one-to-squillions”, you should use a “parent- reference” in the document storing the “N” side blog.mongodb.org/post/88473035333/6-rules-of-thumb-for-mongodb-schema-design-part-3

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend