WebFund 2024F: Assignment 3: Difference between revisions

From Soma-notes
Line 17: Line 17:
All of these questions are in reference to [https://homeostasis.scs.carleton.ca/~soma/webfund-2024f/code/submitdemo.zip submitdemo] from [[WebFund 2024F: Tutorial 7|Tutorial 7]].
All of these questions are in reference to [https://homeostasis.scs.carleton.ca/~soma/webfund-2024f/code/submitdemo.zip submitdemo] from [[WebFund 2024F: Tutorial 7|Tutorial 7]].


'''For all questions''' be sure to explain 1) how you arrived at the answer and 2) any issues you had in developing your answer. Failure to include this information can result in partial or no marks at all on a question.
'''For all questions''' be sure to explain 1) how you arrived at the answer and 2) any issues you had in developing your answer. '''Failure to include this information can result in partial or no marks at all on a question.'''


# [2] How could you change submitdemo so it accepted submissions named comp2406-assign3-soma.txt? Be sure to specify all the places in the code that must be changed. Assume only valid submissions are uploaded.
# [2] How could you change submitdemo so it accepted submissions named comp2406-assign3-soma.txt? Be sure to specify all the places in the code that must be changed. Assume only valid submissions are uploaded.

Revision as of 22:17, 8 November 2024

Please submit the answers to the following questions via Brightspace by November 20, 2024. There are 20 points in 7 questions.

Submit your answers as a plain text file following this template. Name your answer file "comp2406-assign3-<username>.txt" (where <username> is your MyCarletonOne username). Please make sure to use your correct student ID number otherwise your grades may not be properly recorded.

Your answers will be parsed by a script in order to help with grading so please preserve the format of the template. No other formats will be accepted.

Note that the file should be a text file, preferably a UNIX text file (so LF line endings, not CRLF). (See the Wikipedia page on text files to learn more.)

You may use this validator page to make sure your answer file is properly named and formatted. Submissions that do not validate are likely to receive an automatic grade of zero.

Please solve each question rather than look up their answers. Solutions where the answer was found through an online search or answered by a friend or AI will likely get partial or no marks. The questions can only be fully answered by documenting your journey to find the answer rather than the answer itself. Outside resources and other individuals should be used to help with specific technical problems (e.g., JavaScript syntax and semantics), not to solve the problem itself. Your solution should be your own, and the journey by which you reach it should be your own.

Having said this, for each question, please include what outside resources you used to complete each of your answers, including other students, man pages, and web resources (including AI services). You do not need to list help from the instructor, TA, or information covered in lecture or tutorial.

Questions

All of these questions are in reference to submitdemo from Tutorial 7.

For all questions be sure to explain 1) how you arrived at the answer and 2) any issues you had in developing your answer. Failure to include this information can result in partial or no marks at all on a question.

  1. [2] How could you change submitdemo so it accepted submissions named comp2406-assign3-soma.txt? Be sure to specify all the places in the code that must be changed. Assume only valid submissions are uploaded.
  2. [2] If you create a submission that is valid except for having the wrong number of questions (i.e., not five), such a submission will be allowed to be upload even though it is invalid. Why? And what is a quick but correct way to fix this problem?
  3. [2] How could you change submitdemo so submissions have six questions rather than five? Be sure to specify all the places in the code that must be changed. Assume that only valid submissions are uploaded.
  4. [2] How could you use a command-line web request tool (such as wget or curl) to upload data that is not a properly validated submission?
  5. [4] How could you change submitdemo so that it also validates submissions on the server? The validation should use the same logic as the client-side validator does. When an invalid submission is detected, the server should return the status code 400 and the string "Bad Request".
  6. [4] How could you change submitdemo so it only allows one upload per student ID? When a second upload with the same ID is attempted, the server should reply with a 409 status code with the text "Conflict" and not add the submission to the database. Upon such an error, the client should update its status to say "ERROR Upload forbidden, student has already submitted."
  7. [4] How could you change the analysis page of submitdemo so it reports the number of empty answers for each question? (Thus, it should report a number for each of the five or six questions in each submission.) Note that an empty answer is one that is the empty string or a string consisting of only whitespace characters.