Get Instant Help From 5000+ Experts For
question

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing:Proofread your work by experts and improve grade at Lowest cost

And Improve Your Grades
myassignmenthelp.com
loader
Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Attach file

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Guaranteed Higher Grade!
Free Quote
wave
Linux Command Line and Flask Application Tutorial
Answered

Task 1

The goal of this exercise is to get you familiarized with the Linux command line. Perform the steps listed below and take screenshots whenever indicated and copy them into a single pdf document. 

Perform the following steps

1. Go to the GCP console and connect to your VM instance using a terminal window.

2. Create a directory named stuff and change into it

3. In stuff, create a plain text named f1.txt using nano as the text editor. Type some text in the file and save it. Exit nano.

4. Make 2 copies of f1.txt named f2.txt and f3.txt

5. List the contents of the current directory

6. Rename f3.txt to f3_new.txt

7. List the contents of the current directory. Take a screenshot showing the output of the commands of steps 5-7.

8. Using nano, create a python program named hwk1_1.py that contains one print statement: print(‘hello CSC330’)

9. Run the python program from the command line

10. Run the python program again, this time redirecting the output to a file named output.txt. If you’re unfamiliar with the concept, look up output redirection in Linux.

11. List the contents of the current directory. Take a screenshot of the output of steps 9-11.

12. Go to your home directory, create a directory called text and change into it. Using a single command, copy all .txt files from stuff into text. (look up wildcards). Do a directory listing and take a screenshot of the output.

13. Go to your home directory, and using a single command, delete stuff and its contents. While still in your home directory, type ls -lR and take a screenshot of the output.

14. Type history and take a screenshot showing the sequence of commands starting with step 2.

What to submit

Copy the 5 screenshots into a single document and export to a file named hw1_1.pdf.  

Follow the steps in the flask hello world tutorial (FlaskHelloWorld.pdf) posted on the course site. In addition to the top level route (/), create two dynamic routes as follows:

1) A route with the relative URL /vowels/<some_string> where <some_string> is the argument that the user specifies in the address bar of the browser on the client side. The flask application should count the number of vowels in the some_string and return a message that includes the vowel count as an h1 heading in html. For instance, if some_string is abracadabra, the string “abracadabra contains 5 vowels” should be displayed in the browser. 

Task 2

2) A route with relative URL /sum_digits/<some_integer> where <some_integer> is the argument that the user specifies. The flask application should add the digits and return the sum as an h1 heading in html. For instance, if some_integer is 234, the string “The sum of the digits in 234 is 9”. You may assume that the user will provide valid input. 

What to submit

Create a pdf document named hw1_2.pdf with the following screenshots:

• VM instance details on GCP showing the public IP address.

• Browser window with the top level route.

• Browser window with the dynamic route to count vowels.

• Browser window with the dynamic route to sum the digits of an integer.

• Terminal window where you ran the flask application. Take this screenshot after you access the application from the browser (the screenshot should include the three GET requests that the flask application outputs)

The objective of this exercise is to create a Flask application to keep track of guests attending an event. On your existing SQL instance in GCP, create a table named guests, which has three fields: name, no_guests, and attending. The field attending is a Boolean value indicating whether or not the guest is attending the event. no_guests represents the number of guests attending. If attending is False, no_guests should be 0. If it is True, no_guests must be >= 1. Using the MySQL client, add a few entries to the table.

Create a Flask application with the following routes. Model your code after the example provided to you for the in-class exercise.

1. The root URL (‘/’) will display a welcome message. [1 pt]

2. http://<your VM IP address>:8080/guests will retrieve and output to the browser the list of all guests stored in the table. Each guest record should be on a separate line. Remove extraneous characters such as parentheses and brackets from the output.

3. http://<your VM IP address>:/attending will retrieve and output the list of all guests who will be attending. This should output in the browser the names and number of guests, one record per line. Remove extraneous characters such as parentheses and brackets from the output. [3 pts]

4. http://<your VM IP address>:/guest/<name> will output whether a guest with the name provided between < > will be attending. If the invitee is attending, the guest’s name and number of guests should be output. Otherwise, an appropriate message should be displayed based on whether the guest is in the database or they will not be attending.

5. http://<your VM IP address>:/total_guests will output the total number of guests who will be attending the event.

6. http://<your VM IP address>:/RSVP/<response> enables the user to RSVP. The format of <response> should be as follows: [Guest Name]:[y or n]:[number of guests (0 by default if not attending]. For instance, if Jill has 2 guests, the URL would be /RSVP/Jill:y:2. If Tim is not attending, the URL would be /RSVP/Tim:n  Each of these 6 routes should be implemented as a view function. The Flask application should accept requests on port 8080. Be sure that your database contains at least 10 guest entries. 

What to submit

Create a pdf document named hw1_3.pdf with the following screenshots [3 pts]:

• VM instance details on GCP showing the public IP address.

• SQL instance details showing the public IP address.

• Screenshot of the output of a select * query of the guest table which you run using the MySQL client. The table should have a few entries in it.

• Six screenshots of the browser window showing the output of each of the six routes above.

• Terminal window where you ran the flask application. Take this screenshot after you access the application from the browser (the screenshot should include the six GET requests that the flask application outputs). In addition, submit your Flask application source file. Name the source file hw1_3.py. 

support
close