sa saving ng da data o on t n the he se server
play

Sa Saving ng Da Data o on t n the he Se Server No screens - PowerPoint PPT Presentation

Sa Saving ng Da Data o on t n the he Se Server No screens Say your name Prof. Lydia Chilton COMS 4170 19 February 2020 My goal is to use your time well. I want you to understand how design is a useful skill in your life. I want


  1. Sa Saving ng Da Data o on t n the he Se Server No screens Say your name Prof. Lydia Chilton COMS 4170 19 February 2020

  2. My goal is to use your time well. • I want you to understand how design is a useful skill in your life. • I want to interact with you on an individual basis • I do not want anyone to be bored, lost, zoned-out, or stalking their ex on Facebook. No screens. If you are lost, interact. 2

  3. This is when the class starts to get hard.

  4. Please don’t underestimate this class Simple, functional design is deceptively difficult 4

  5. Reason #1: Although websites look easy, there is so much going on beneath the surface that you don’t see.

  6. Reason #2: Systems programming is hard. Events HTML Interaction CSS JavaScript Model / View JQuery Data Storage Visual Information hierarchy Bootstrap Individually, they are not hard. But together, they are complex.

  7. • I do not want anyone to be confused, bored, or zoned-out. • Using screens distracts your neighbors, and makes it harder for them to pay attention. No screens. If you are lost, interact. 7

  8. Sa Saving ng Da Data o on t n the he Se Server No screens Say your name Prof. Lydia Chilton COMS 4170 19 February 2020

  9. Homework 4

  10. In HW4, you dynamically create widgets Buttons Autocomplete Drag and Drop Added minor customization (hovering and drop target feedback)

  11. And users interacting data Create / Delete data Update data

  12. But there’s a big problem:

  13. Problem: Th The data doesn sn’t t sa save

  14. If you refresh the page, your new data is gone. Why? Add data Data appears The data is only stored on the browser. REFRESH PAGE Data is gone!

  15. To keep data around, we need to store it somewhere else – another computer that will never get turned off. Server: Client: keeps the data gets data from server (and displays it to all users)

  16. What data does the server keep? emails = [ { “from”: “bollinger”, “to”: “chilton”, “subject”: “4170 is awesome!” }, { “from”: “obama”, “to”: “chilton”, “subject”: “belated medal of freedom” }, ] Client: Server: gets data from server keeps the data (and displays it to all users)

  17. What data does the server keep? products = [ { “title”: “Ivy League Web Design”, “author”: “chilton”, “stars”: “5” }, { “title”: “JavaScript and You”, “author”: “chilton”, “stars”: “6” }, ] Client: Server: gets data from server keeps the data (and displays it to all users)

  18. What data does the server keep? cars = [ { “location”: “116 and broadway”, “driver”: “kenny”, “car type”: “uber XL” }, { “location”: “times square”, “driver”: “jen”, “car type”: “normal” }, ] Client: Server: gets data from server keeps the data (and displays it to all users)

  19. What data does the server keep? profiles = [ { “name”: “maddy”, “image”: “./maddy.png”, “likes”: “1000”, ”dislikes”: 0, }, { “name”: “julia”, “image”: “./julia.png”, “likes”: “1000”, “dislikes”: 0, }, ] Client: Server: gets data from server keeps the data (and displays it to all users)

  20. We need to have another computer st store and serve the data . That server is running a Python application called Fl sk . Flask Server: Client: keeps the data gets data from server (and displays it to all users)

  21. Example application: Storing and Serving data in Flask

  22. You must first install Flask

  23. Example project for storing a list of names. (code is on the webpage)

  24. You have written the world’s smallest Flask app. Now what?

  25. How to render an HTML page with data

  26. How to send an array of data to JavaScript?

  27. How to send an array of data to JavaScript?

  28. Iterate over the data

  29. Display all the names

  30. How do we allow people to add names?

  31. What does the click handler do?

  32. Now what does the click handler do?

  33. This is MVC updating. It will add names to the list. Wi Will it sa save? NO. The changes are only on the client

  34. Save the data to the server ?????

  35. Save the data to the server saveName(name)

  36. What happens on the server?

  37. How do we test if the data saves to the server? Refresh the page to see if the new data stays

  38. Next Homework

  39. Problem 1. Get the Flask sample code to run

  40. Problem 2. Put a backend behind Log Sales

  41. Problem 3. Put a backend behind PPC

  42. HW5: Due Wednesday Feb 26th: Problem 3. Problem 1. Problem 2. Put a backend behind PPC Get the Flask sample code to run Put a backend behind Log Sales Please get this done today .

  43. Fill out participation now! HW 5 is out.

  44. Participation

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