=================================================================
Assignment #11 - O/S review, HTML, HTTP, Web pages
=================================================================
- Ian! D. Allen - idallen@idallen.ca - www.idallen.com
Sources for these answers (thank you!):
- Ian Allen
- Alex Thomson
0. What is the date and room location of your CST8281 Final Exam?
11:30am-2pm Thursday, April 29, 2010, rooms T102A/B/C
1. Write the simplest IF statement (simplify the Boolean logic) for the
following programming problem specification:
"Call the add routine unless: the cost is less than zero or the
colour is 'blue'."
if ( cost >= 0 && colour != "blue" ) add();
2. Write the simplest IF statement (simplify the Boolean logic) for the
following programming problem specification:
"In Elbonia, you lose (cannot renew) your driving license if your
age is over 50 or you have more than 23 demerit points. Call the
renew() function if this is not true. (Write a simplified IF
statement that calls renew() if you are allowed to renew.)"
if ( age <= 50 && demerit_points <= 23 ) renew();
*** Operating Systems Review (CST8202) ***
CLS = "Course Linux Server"
3. What is the absolute pathname of your CLS home directory?
$ cd
$ pwd
/home/abcd0001 [replace abcd0001 by your account name]
4. Use "ls -lid" to display the permissions on the above directory and paste
the full output here:
$ ls -lid /home/abcd0001
000000 drwx--x--- 4 abcd0001 www-data 4096 2010-04-07 17:11 /home/abcd0001
5. What is the absolute pathname of the CLS directory containing your
Assignment 10 "mypage.html" file?
$ cd public_html/a10
$ pwd
/home/abcd0001/public_html/a10
6. On the CLS, what is the absolute pathname of the directory containing
a copy of all the CST8281 course Notes files?
$ echo ~idallen/public_html/teaching/cst8281/10w/notes
/home/idallen/public_html/teaching/cst8281/10w/notes
7. On the CLS, what is the absolute pathname of the 210_file_transfer.txt
file in the preceding CST8281 course Notes directory?
/home/idallen/public_html/teaching/cst8281/10w/notes/210_file_transfer.txt
8. How would you use file patterns and "grep" on the CLS to find out
which Week Notes files contain the string "PuTTY"?
$ grep PuTTY /home/idallen/public_html/teaching/cst8281/10w/notes/week*.txt
-OR-
$ cd /home/idallen/public_html/teaching/cst8281/10w/notes/
$ grep PuTTY week*.txt
-OR-
$ cd
$ ln -s /home/idallen/public_html/teaching/cst8281/10w/notes n
$ grep PuTTY n/week*.txt
9. Give the absolute pathname on the CLS of the file referenced by the
following URL:
http://cst8281.idallen.ca:8080/~abcd0001/one/two.jpg
/home/abcd0001/public_html/one/two.jpg
10. Give two URLs, one private (Algonquin-only) and one public (works on
the Internet) for the following pathname on the CLS:
~alleni99/public_html/test/image.png
(Algonquin-only) http://idallen-linux/~alleni99/test/image.png
(Internet-wide) http://cst8281.idallen.ca:8080/~alleni99/test/image.png
11. You are using FTP or SFTP on a Windows computer. Your current
Windows directory is C:\Temp and you connect using userid abcd0001 to
the CLS. Give the "put" command that will copy a local file "foo.txt"
from the "Vmware" directory on your Windows "D:" drive to the CLS
so that the following URL will display the contents of that file.
Note the new file name:
http://cst8281.idallen.ca:8080/~abcd0001/tmp/bar.txt
put d:\Vmware\foo.txt public_html/tmp/bar.txt
(I assume the FTP connection connects to the abcd0001 home directory)
12. You are in the directory ~abcd0001/public_html/a10 on the CLS.
You want to move a file named "foo.txt" from the abcd0001 home
directory into the directory ~abcd0001/public_html/tmp using the
shortest possible relative path names. What command do you use?
mv ../../foo.txt ../tmp
13. Create the directory "public_html/a11" under your CLS home directory.
(Do not include the quote marks.) Use "ls -lid" with the above
pathname to show the permissions of the directory and paste the full
output here:
$ cd public_html
$ ls -lid a11
000000 drwxr-xr-x 2 abcd0001 abcd0001 4096 2010-04-07 18:36 a11
14. Redirect the output of the Unix "who" command into the file "who.txt"
in the above "a11" directory. (Do not include the quote marks.)
Verify that you can see the contents of the who.txt file using a
web browser (e.g. Firefox) using the appropriate URL.
$ cd public_html/a11
$ who >who.txt
Web: http://cst8281.idallen.ca:8080/~abcd0001/a11/who.txt
15. Use "ls -liac" on the "a11" directory to show the permissions of the
directory and all the files inside it. Paste the output here:
$ cd public_html
$ ls -liac a11
000000 drwxr-xr-x 2 abcd0001 abcd0001 4096 2010-04-07 18:38 .
000000 drwxr-xr-x 5 abcd0001 abcd0001 4096 2010-04-07 18:36 ..
000000 -rw-r--r-- 1 abcd0001 abcd0001 192 2010-04-07 18:38 who.txt
16. Turn off execute permission for "others" on the "a11" directory.
a) What command turns off execute permission for "others"?
$ cd public_html
$ chmod o-x a11
b) Use "ls -liac" to generate a listing showing the new permissions of
the "a11" directory and all its contents and paste the output here:
$ cd public_html
$ ls -liac a11
000000 drwxr-xr-- 2 abcd0001 abcd0001 4096 2010-04-07 18:40 .
000000 drwxr-xr-x 5 abcd0001 abcd0001 4096 2010-04-07 18:36 ..
000000 -rw-r--r-- 1 abcd0001 abcd0001 192 2010-04-07 18:38 who.txt
b) Can you still use "cat" or "less" to view the who.txt file?
yes
c) Can you still view the who.txt file via URL in the web browser?
no
d) Turn on execute permissions on the "a11" directory. What command
did you use to do this?
$ cd public_html
$ chmod o+x a11
e) Use "ls -liac" to generate a listing showing the restored
permissions of the "a11" directory and its contents and paste it here:
$ cd public_html
$ ls -liac a11
000000 drwxr-xr-x 2 abcd0001 abcd0001 4096 2010-04-07 18:41 .
000000 drwxr-xr-x 5 abcd0001 abcd0001 4096 2010-04-07 18:36 ..
000000 -rw-r--r-- 1 abcd0001 abcd0001 192 2010-04-07 18:38 who.txt
f) Can you still view the who.txt file in the web browser?
yes
*** The Web ***
17. What is the World Wide Web?
A world-wide network of computers that provide HTML pages and other
resources using the HTTP protocol over the Internet.
18. What is the difference between HTTP and HTML?
HTTP "Hyper-Text Transfer Protocol" is the Internet standard
communication protocol used for transferring HTML and web-related data.
HTML "Hyper-Text Mark-up Language" is a mark-up language used to
mark-up text files so that they render nicely in a web browser.
19. What gets stored in the disk files that are served up by a Web server?
Mostly plain-text, marked-up with HTML tags. HTML files may refer to
other things such as images and style sheets.
20. What protocol is used to send Web pages across the Internet?
HTTP "Hyper-Text Transfer Protocol" (over the underlying TCP/IP)
21. Describe how your Web browser acts to fetch and display a Web page.
The browser looks up the IP address of the host name contained in the
URL and connects to the HTTP port on that server (usually port 80).
To that serer, your browser sends an HTTP request for a resource,
usually an HTML file. The server returns the requested resource.
If the resource is an HTML page containing links to other resources
(such as images or CSS style sheets), your browser will make
additional requests to the server to fetch those resources.
22. True/False: Line breaks in HTML appear as line breaks in your Web page.
False, under most circumstances. There are HTML tags which can be
used to preserve line breaks.
23. What is the URL of the W3C web page validator service?
http://validator.w3c.org/
24. To what does the name "Apache" refer in the Web? (What is "Apache"?)
Apache is the name of a popular open-source web server package.
25. True/False: Every opening HTML tag has a corresponding closing tag.
False, e.g. ,
43. Write here, from memory, the smallest valid Web page that displays
"Hello World!", including all the mandatory tags. You can omit the
details on the DOCTYPE header line (don't memorize it).
This is the smallest valid web page. All tags are required.
-- | Ian! D. Allen - idallen@idallen.ca - Ottawa, Ontario, Canada | Home Page: http://idallen.com/ Contact Improv: http://contactimprov.ca/ | College professor (Free/Libre GNU+Linux) at: http://teaching.idallen.com/ | Defend digital freedom: http://eff.org/ and have fun: http://fools.ca/