04/04/2020 Assignment 2 (CourseWork 2): IY1: Multimedia Computing (MUCO) https://canvas.sussex.ac.uk/courses/14704/pages/assignment-2-coursework-2 1/15 Assignment 2 (CourseWork 2) (https://canvas.sussex.ac.uk/courses/14704/files/1276857/download?wrap=1) CourseWork 2 MUCO Assignment 2 This assessment provides a programming exercise in JavaScript with opportunities to answer questions on multimedia on the web. It is worth 20% more than the first assignment and incorporates the final test. It is designed to do online and you should expect to spend many hours carrying out its tasks and learning as you do so. Scenario Your employer wants to see which intern to appoint to a post as a web developer. She has set you 4 tasks testing your ability to understand programming in JavaScript and multimedia. She is not assessing CSS. Instead of an interview where you do the tasks under supervision complying with UK Government guidelines on social distancing, she has set a series of problems and questions for you to solve and submit via a Solution Document (SD). The SD will become your report. NB: For all code sections copied to your SD, please use http://www.planetb.ca/syntax-highlight-word to make sure the formatting of your code is maintained (select HTML or JavaScript in the options) Tasks Your four tasks are: 1 The Wikipedia Simulation website (20 marks) 2 The programming exercise on text compression (42 marks) 3 The programming task on image loading from base64 (8 marks) 4 The answers to questions that form a Report. (30 marks) 04/04/2020 Assignment 2 (CourseWork 2): IY1: Multimedia Computing (MUCO) https://canvas.sussex.ac.uk/courses/14704/pages/assignment-2-coursework-2 2/15 Total marks 100. This will be weighted to 60% of the overall grade. Task 1: The Wikipedia Simulation (15 marks for coding the program + 5 marks for entry) You are asked to carefully consider W3Schools’ reference for local storage at https://www.w3schools.com/html/html5_webstorage.asp (https://www.w3schools.com/html/html5_webstorage.asp) because the company wishes to be sure you can do research to solve problems. In particular, you are expected to do research and asks you to look at am incomplete web page. Download, load into a browser and run the file below: (https://canvas.sussex.ac.uk/courses/14704/files/1276857/download?wrap=1) wiki_sim_starter.html (https://canvas.sussex.ac.uk/courses/14704/files/1276858/download?wrap=1) It should look like this: 04/04/2020 Assignment 2 (CourseWork 2): IY1: Multimedia Computing (MUCO) https://canvas.sussex.ac.uk/courses/14704/pages/assignment-2-coursework-2 3/15 It will not work. It needs your corrections and completion. (Note that the style sheet is not present nor part of the assessment but you can use one so the link is left in for you.) When corrected and the Load example text button is clicked and then the create your wiki entry button is clicked, the local storage looks like this (in Chrome when F12 is pressed; other browsers have similar development tools): 04/04/2020 Assignment 2 (CourseWork 2): IY1: Multimedia Computing (MUCO) https://canvas.sussex.ac.uk/courses/14704/pages/assignment-2-coursework-2 4/15 The local storage item has been given a name for its key, myEntry, and its value is a string copied from the textarea in the form with an id of entryBox. You will be creating and deleting this key using local storage methods. You can look these up in W3Schools or other sites, but don't worry because the code is deliberately transparent, so you should just need to work it out. Local storage is an associative array, like a map in Java; a key->value arrangement. It is not expected to be used on smartphones but is widely used commercially on larger devices It stores data on the client's machine. The data can be megabytes in size, controlled by the user of the device and may be permanent or temporary (session storage). Photographs can be stored in the base64 code string (see task 3). There is currently no edit facility, just removal, and restoration of a modified string value. Total storage is about 10 MB you are told. The key must be unique or named; here it is named. In a database system, keys (primary keys) uniquely identify a table row (tuple or record) with many columns (or fields), which may be of many types, not just string. A database has a CRUD (create, read, update and delete) front end for database administration. Databases are usually stored on a server, not the client, whereas local storage as its name suggests is stored on the client. Local storage is much simpler and although several keys could have unique identifiers describing records, it cannot be a named group like a table and each key has a single value; no collections are possible. They are quite different and your employer will ask you to advise her on both for her Wiki in the final task. You will observe on loading the form runs a function, myLoadItem(), that fills the entryBox with an example text or a text value retrieved from local storage by its key, myEntry. You need to complete this function. You will note that the form never submits to an action page because it is intercepted by JavaScript, the function createItem().