WebFund 2016W: Assignment 6: Difference between revisions

From Soma-notes
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''This assignment is not yet finalized.'''
In this assignment you will create <tt>ajaxLogs</tt>, a version of [[WebFund 2016W: Assignment 5|analyzeLogs]] written to work as a single-page application, in the style of [[WebFund 2016W: Tutorial 9|interactive-graphs]].
In this assignment you will create <tt>ajaxLogs</tt>, a version of [[WebFund 2016W: Assignment 5|analyzeLogs]] written to work as a single-page application, in the style of [[WebFund 2016W: Tutorial 9|interactive-graphs]].


You may base your version either on your solutions to Assignment 5 or on the supplied solutions.
You may base your version either on your solutions to Assignment 5 or on the supplied solutions.
Submit your program as a zip file via cuLearn.  The assignment is officially due on April 7th; however, you may submit it until April 9th without penalty.


==Tasks==
==Tasks==


<tt>ajaxLogs</tt> should behave just as analyzeLogs, except that the button presses should not cause a new page to be loaded; instead, the page should be updated with the new output.  Specifically:
<tt>ajaxLogs</tt> should behave just as analyzeLogs, except that the button presses should not cause a new page to be loaded; instead, the page should be updated with the new output.  Specifically:
* Uploading a file should indicate success or failure without causing a new page to be loaded.  For example, text could appear beside the upload button saying "upload succeeded" or "upload failed".  You may want to use something like this [https://github.com/hayageek/jquery-upload-file jQuery upload file plugin] (not tested).
* Uploading a file should indicate success or failure without causing a new page to be loaded.  For example, text could appear beside the upload button saying "upload succeeded" or "upload failed".  You may want to use something like this [https://github.com/hayageek/jquery-upload-file jQuery upload file plugin].
* Downloading the log file should cause the file to be saved to disk through a save dialog box without causing a new page to be loaded.  See [https://github.com/eligrey/FileSaver.js FileSaver.js].
* Downloading the log file should cause the file to be saved to disk through a save dialog box without causing a new page to be loaded.  See [https://github.com/eligrey/FileSaver.js FileSaver.js].
* The Show logs functionality should cause a scrollable widget to be displayed at the bottom of the page with the retrieved logs.
* The Show logs functionality should cause a scrollable widget to be displayed at the bottom of the page with the retrieved logs.
Line 29: Line 29:


Good luck!
Good luck!
==Hints==
===Saving files===
With [https://github.com/eligrey/FileSaver.js FileSaver.js], saving data stored in a string to a file can be as simple as:
<source lang="javascript">
    saveAs(new Blob([selectedlogdata],
                    {type: "text/plain;charset=utf-8"}),
                      "selected.log");
</source>
==Solutions==
[http://homeostasis.scs.carleton.ca/~soma/webfund-2016w/code/ajaxLogs.zip ajaxLogs]

Latest revision as of 20:17, 10 April 2016

In this assignment you will create ajaxLogs, a version of analyzeLogs written to work as a single-page application, in the style of interactive-graphs.

You may base your version either on your solutions to Assignment 5 or on the supplied solutions.

Submit your program as a zip file via cuLearn. The assignment is officially due on April 7th; however, you may submit it until April 9th without penalty.

Tasks

ajaxLogs should behave just as analyzeLogs, except that the button presses should not cause a new page to be loaded; instead, the page should be updated with the new output. Specifically:

  • Uploading a file should indicate success or failure without causing a new page to be loaded. For example, text could appear beside the upload button saying "upload succeeded" or "upload failed". You may want to use something like this jQuery upload file plugin.
  • Downloading the log file should cause the file to be saved to disk through a save dialog box without causing a new page to be loaded. See FileSaver.js.
  • The Show logs functionality should cause a scrollable widget to be displayed at the bottom of the page with the retrieved logs.
  • The Visualize logs functionality should cause the frequency graph to be displayed at the bottom of the page.

Note that you may change the interface to make the new functionality more clear, e.g., change the "Submit Query" button to be "Retrieve Logs". You are also allowed to make other improvements, so long as your application runs entirely from a single page. In other words, while it will make GET and POST requests in the background, the contents of the address bar won't change and the page should never do a full reload because of user actions (other than hitting the reload button in the browser).

Scoring

This assignment is worth a total of 10 points. Points will be awarded as follows:

  • 2 for uploading logs without loading a new page
  • 2 for downloading logs without loading a new page
  • 2 for displaying logs in a widget without loading a new page
  • 2 for graphing logs without loading a new page
  • 2 for the overall aesthetics and functionality of the application

You may implement extra functionality. Extra functionality may be awarded up to 2 extra points.

Points may be deducted for disorganized, hard to read/understand, or otherwise problematic code EVEN IF THE CODE FUNCTIONS PROPERLY.

Good luck!

Hints

Saving files

With FileSaver.js, saving data stored in a string to a file can be as simple as:

     saveAs(new Blob([selectedlogdata],
                     {type: "text/plain;charset=utf-8"}),
                       "selected.log");

Solutions

ajaxLogs