logo

Crowdly

Browser

Add to Chrome

Internetworking and Web-programming (IWP) (DAT2, AAL-SW2, BaIT6T)

Looking for Internetworking and Web-programming (IWP) (DAT2, AAL-SW2, BaIT6T) test answers and solutions? Browse our comprehensive collection of verified answers for Internetworking and Web-programming (IWP) (DAT2, AAL-SW2, BaIT6T) at www.moodle.aau.dk.

Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!

Write a JavaScript function at the client that

can extract the input values of the registration form and return them in a JavaScript

object. 

View this question

Implement the client-side functionality for

submitting

the registration form and presenting the result

  • When the submit button (“Register”) is clicked, a JavaScript function should extract the content of the form and send it as JSON object to the server at the specified resource name. 
  • Once the result response arrives at the client, show the output box containing the encouragement texts. 
  • Remember to distinguish the two cases: when fewer than three things have been registered, and when 3 or more things have been registered. 

It suffices to show the encouragement as plain text output in the designated HTML placeholder. 

Using .innerHTML is forbidden!

View this question

<!--

function msoCommentShow(anchor_id, com_id)

{

if(msoBrowserCheck())

{

c = document.all(com_id);

a = document.all(anchor_id);

if (null != c && null == c.length && null != a && null == a.length)

{

var cw = c.offsetWidth;

var ch = c.offsetHeight;

var aw = a.offsetWidth;

var ah = a.offsetHeight;

var x = a.offsetLeft;

var y = a.offsetTop;

var el = a;

while (el.tagName != "BODY")

{

el = el.offsetParent;

x = x + el.offsetLeft;

y = y + el.offsetTop;

}

var bw = document.body.clientWidth;

var bh = document.body.clientHeight;

var bsl = document.body.scrollLeft;

var bst = document.body.scrollTop;

if (x + cw + ah / 2 > bw + bsl && x + aw - ah / 2 - cw >= bsl )

{ c.style.left = x + aw - ah / 2 - cw; }

else

{ c.style.left = x + ah / 2; }

if (y + ch + ah / 2 > bh + bst && y + ah / 2 - ch >= bst )

{ c.style.top = y + ah / 2 - ch; }

else

{ c.style.top = y + ah / 2; }

c.style.visibility = "visible";

} } }

function msoCommentHide(com_id)

{

if(msoBrowserCheck())

{

c = document.all(com_id);

if (null != c && null == c.length)

{

c.style.visibility = "hidden";

c.style.left = -1000;

c.style.top = -1000;

} }

}

function msoBrowserCheck()

{

ms = navigator.appVersion.indexOf("MSIE");

vers = navigator.appVersion.substring(ms + 5, ms + 6);

ie4 = (ms > 0) && (parseInt(vers) >= 4);

return ie4;

}

if (msoBrowserCheck())

{

document.styleSheets.dynCom.addRule(".msocomanchor","background: infobackground");

document.styleSheets.dynCom.addRule(".msocomoff","display: none");

document.styleSheets.dynCom.addRule(".msocomtxt","visibility: hidden");

document.styleSheets.dynCom.addRule(".msocomtxt","position: absolute");

document.styleSheets.dynCom.addRule(".msocomtxt","top: -1000");

document.styleSheets.dynCom.addRule(".msocomtxt","left: -1000");

document.styleSheets.dynCom.addRule(".msocomtxt","width: 33%");

document.styleSheets.dynCom.addRule(".msocomtxt","background: infobackground");

document.styleSheets.dynCom.addRule(".msocomtxt","color: infotext");

document.styleSheets.dynCom.addRule(".msocomtxt","border-top: 1pt solid threedlightshadow");

document.styleSheets.dynCom.addRule(".msocomtxt","border-right: 2pt solid threedshadow");

document.styleSheets.dynCom.addRule(".msocomtxt","border-bottom: 2pt solid threedshadow");

document.styleSheets.dynCom.addRule(".msocomtxt","border-left: 1pt solid threedlightshadow");

document.styleSheets.dynCom.addRule(".msocomtxt","padding: 3pt 3pt 3pt 3pt");

document.styleSheets.dynCom.addRule(".msocomtxt","z-index: 100");

}

// -->

Extend

the HTML of the front page using semantic

markup to show as the extended front page. 

  • Add a complete form

    with action and method as

    specified

  • Add three suitably labelled inputs

    to

    the registration form:

     
    • Username:

      a

      string of 5 to 30 characters

    • Good Thing

      : a

      string of 10

       to 100 characters
    • Score

      : a

      number between 1 and

      10
  • Add HTML validation

    such that all inputs must be

    entered and satisfies the above constraints.

  • Add a placeholder output element

    (initially hidden)

    to contain the registration result.

List only the added HTML code. Do not spend time on layout, but you may optionally use the supplied css file.

View this question

Add the specified function that

executes the

registration.

It must  

  • add a registrationDate

    to the good

    thing registration object

  • register the good thing object in

    the database,

  • compute and return the response

    object, that in addition to the registered object, includes a field storing the

    goodthingsCount of good things now registered at the registration date.

Hint:

There is a helper function to check whether

two dates are the same date.  You need to filter the database for matching username and date pairs.

Hint:

A new date can be created

using the constructor function

Date (see[DF 11.4] )

Remark: For this exercise, use the Date object as per your text book, but remark that Javascript has since been updated with a new ”Temporal” object that should replace Date in future real applications.

View this question

At the server app.js, expand the server’s API

(routing)

to handle the registration request.

The request

processing must extract the enclosed JSON object and

then call the specified

functions to 1) validate the client inputs,

then

2) based on the

validated data, register the “good thing” in the database and send the JSON

response (or report an error).

Show

only

changed/added

code, including where the change is made.  

Hint: The supplied helper functions extractJSON (promise based), jsonResponse, reportError may be useful.  

View this question

On

the server side, implement the JavaScript functions for

validating the JSON object with registration

form data

.   This requires that the userName

,

goodthing, and score

fields are present, sanitized, and satisfy

the same constraints as in the HTML form. Return an object that contains only validated fields. 

View this question

Let's talk about Tampering attacks (the T

in STRIDE). Select all correct sentences.

0%
0%
100%
0%
View this question

SSL/TLS

has

different mechanisms to protect against different attacks.

Select all correct

sentences.

0%
0%
100%
100%
View this question

A client is downloading a large file from a web server. During the transfer, some packets are lost. Despite this, the client eventually receives the complete file in the correct order.

Which TCP services are responsible for ensuring this outcome? 

0%
100%
0%
0%
0%
0%
0%
View this question

Which of the following functions accepts a number, and returns a

Promise that will fulfill, either immediately or after a delay, into

the input number + 1?

0%
0%
0%
100%
View this question

Want instant access to all verified answers on www.moodle.aau.dk?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome