CSE-381: Systems 2 Homework #1: Part B

$30.00

Download Details:

  • Name: Homework1-9pt8nu.zip
  • Type: zip
  • Size: 1.56 MB

Category:

Description

Rate this product

In this homework you will be completing a webserver that can perform simple Natural Language
Processing (NLP) of counting words and
computing average word length. A screenshot of
the program operating via a web-browser is shown
in the adjacent figure. Specifically, your program
must operate as follows:
1. Your program will operate as a web-server based on URLs of the form:
a. http://os1.csi.miamioh.edu:8080/http://www.users.miami
oh.edu/raodm/ones.txt
b. http://os1.csi.miamioh.edu:4432/http://ceclnx01.cec.mi
maioh.edu/~raodm/miami_university.txt
2. Read a HTTP-GET request with URL in the format /http://Host:Port/Path
(e.g., /http://os1.csi.miamioh.edu:8080/~raodm/words.txt).
3. Obtain the specified file from the remote web-server using a suitable HTTP-GET request.
Here, your web-server also acts a web-client. This type of operation is called proxying. It
is commonly used in Tor (https://en.wikipedia.org/wiki/Tor_(anonymity_network)) and
other anonymizing services, which are important concepts & tools in cybersecurity.
4. Process the response from the remote web-server and calculate: word count, total number
of characters, and average word length. These are super-simple operations. So, don’t
overcomplicate them.
5. The output is generated in HTML format and returned as an HTTP response. See sample
output below.

Starter Code
Several aspects of this homework have been covered in the previous lab exercise(s). Hence, ensure
you review previous exercise. The starter code with skeleton methods are supplied. Ensure you
scp all of the starter files to your NetBeans project. Your task is to:
1. Understand operations of the methods in the starter code. There are plenty of comments to
help you understand the starter code. When in doubt, ensure you ask clarifications about
the starter code so that you really understand the work you are doing.
2. The starter code can be run as a web-server, but troubleshooting incorrect output is
cumbersome with a web-browser. Note that web-browsers will not work even if 1-character
is incorrect in your output.
3. Hence the starter code is designed to read input from a file and print output so that it is
easier to troubleshoot. For this you will need to set command-line arguments in NetBeans.
Ensure you review the video on how to set command-line arguments from the Video
Demonstrations Page on Canvas. See Tips below for screenshot specific to this homework.
Testing with web-browsers
The key requirement for this homework is that your program must work correctly with a webbrowser. You may test operation of your program using the following URLs, by suitably
changing the port number below:
• http://os1.csi.miamioh.edu:8080/http://www.users.miamioh.edu/raodm/ones
.txt
• http://os1.csi.miamioh.edu:4432/http://ceclnx01.cec.mimaioh.edu/~raodm/
miami_university.txt
Sample inputs and outputs
Testing your program is best accomplished by supplying exactly the same inputs a web-browser
would generate. The starter code permits inputs to be supplied from a text file specified as a
command-line argument. The sample outputs below illustrate testing using command-line
arguments. This is the same approach that will be used when you submit your solution via
Canvas CODE plug-in.

Tips
1. Review and suitably use parts of code from previous exercise.
2. Review concepts of command-line arguments. Watch the video on setting command-line
arguments in NetBeans on Canvas ®Pages®NetBeans video
Demonstrations. Here is a screenshot of an example of command-line argument
settings for this homework in NetBeans:

3. Rest assured that I/O is trivial. See example in C++ review video Part 1: Introduction to
data types, conditionals, loops, and console I/O (PDF is in: Lecture Materials
®Cpp_Review®Part1_Cpp-Basics.pdf)
4. First write skeleton code with plenty of comments to help you work out the solution.
5. Save and compile often – you should type no more than 3-or-4 lines before saving
and compiling.
6. For troubleshooting use the debugger. There is video demonstrating the use of the
debugger in NetBeans Canvas ®Pages®Video Demonstrations. Ensure you
review the video on how to use the debugger.

Turn-in:
This homework assignment must be turned-in electronically via Canvas CODE plug-in. Ensure
your C++ source code is named MUid_homework1.cpp (where MUid is your Miami Unique
ID). Ensure you have tested operations of your program with a web-browser. Once you have tested
your implementation, upload just your source code to Canvas.