Homework 6 Answer Key

waisttherapeuticSoftware and s/w Development

Nov 4, 2013 (3 years and 10 months ago)

80 views

CIT 436
Homework
6

answer key


1.


a.

<!
--
#config timefmt=“%a, %b %d, %Y, %H:%M:%S”
--
>

<!
--
#echo var=“DATE_LOCAL”
--
>

b.

<!
--
#echo var=“DOCUMENT_NAME”
--
><br />

<!
--
#echo var=“CONTENT_TYPE”
--
><br />

<!
--
#echo var=“SERVER_NAME”
--
><br />

<!
--
#echo var=“SERVER_ADDR”
--
>

c.

<!
--
#config timefmt=“%j, %m, %y, %I:%M %p %Z”
--
>

<!
--
#echo var=“LAST_MODIFICATION_DATE”
--
>


2.

<html><body>

<!
--
#include file=“banner.html”
--
><br />

<!
--
#exec cgi=“getImage.pl”
--
>

<!
--
#exec cgi=“getStory.pl”
--
>

<!
--
#exec cmd=“who”
--
><br />

<!
--
#if expr=“${DAT
E_LOCAL = AM
$
}”
--
>

<!
--
#exec cgi=“quote.pl”
--
>

<!
--
#else
--
>

<!
--
#include file=“forecast.html”
--
>

<!
--
#endif
--
>


3.

A type map is used for content negotiation between the browser and the apache server.
The file stores information about each variation of the f
ile, for instance, each language,
each content type, each character set. You include the URI of the file itself (typically just
the file’s name without any extension), the URI of each variant of the file, and for each
variant, the language, type, characte
r set and/or encoding that makes it unique, and
possibly qs values to dictate the
quality of the files that the server can choose between
(this is not a
preference

but a statement of value)
. In the directory space, you will include
each file named name.ht
ml.extension where the extension demonstrates what makes this
file different (e.g., en for English and de for German). Finally, to make the type map
work, you have to add Options MultiViews in the directory container for the directory
that has the negotia
ble content, AddLanguage, AddType, AddEncoding and
AddCharacterSet directives for each type, and AddHandler type
-
map .extension for the
type map.


4.

Answers can vary tremendously. Below are just a few comments.

a.

Perl



an older language which has very strong

regular expression operations built
into it, but because it is an older language, it lags behind the newer languages in
features. It is also very complicated

and has a very hard to read syntax
.

b.

Php



since it was the original language developed for serve
r side scripting, it
ha
s

been popular/well known. It is also easy to apply PHP in apache with a module
so that php code can be embedded in html. It also runs more efficiently on apache
than other scripting languages, which usually require that the interp
retor be loaded
on demand
. It also, now, is object
-
oriented, so it is as flexible as Ruby, Python,
Java and Javascript. One downside of php is that it has many security holes.

It is
also far less powerful than some of the newer languages (Ruby, Java).

c.

R
uby



a new language which is both (relatively) easy to use and has most of the
useful features needed of a programming language. One downside is that
it is a
slower language than Perl and Php, partially because it is a larger, more flexible
language that

carries with it a great deal of overhead (for instance, garbage
collection routines). Since
server side scripting do
esn’t really need all these
features that Ruby offers, the language may not be the best choice for server side
scripting.

d.

Python



same as

Ruby

although Python syntax may be a little easier to
understand

and Python is not as wide
-
ranging (powerful) as Ruby
.

e.

Java


Java is an even more powerful language than Ruby or Python including
better objects, multithreading, security, etc
.
Another advan
tage is that it is better
known than Ruby and Python. Because Java can be compiled, there are more
uses for it, so finding a Java programmer is easier. Additionally, Java can run
very efficiently because it is compiled. On the other hand, Java is not in
terpreted
so it makes for a poor scripting language.

f.

Javascript



the objects in Javascript are not true objects. On the other hand,
Javascript has many features built in that promote client side browser capabilities
that are not available in other langua
ges. But since we are interested in server
side scripting, this advantage is not very relevant.


Graduate Student Question


5.


a.

Nothing appea
rs at all


if the SSI comes first in the page, there might be an error
such that a server error is causing the page’
s contents to be ignored. It is also
possible that the page is not executable.

b.

The text appears, but not the outcome of the php program



the php program has
no output statements or the php code is causing an error.

c.

You get an Internal Server Error (500)



the CGI program is causing an error or
apache is not configured properly to handle CGI, SSI and/or PHP.

d.

The text appears and you get some nonsense in place of the php program



the
php program has an error in it.