|
home—lects—hws
D2L—breeze (snow day)
We will look at:
You'll want to be familiar with the main options for the following:
Before we even revisit the code, let's talk about the machine rucs.radford.edu (“radford university computer science”): it's a machine for use by ITEC department students, and is a compute-server which you can access from anywhere.
How to log on to rucs, so that you can run php on it:
First, start the VPN, if you are off campus.
Then, either
use ssh yourUserName@rucs.radford.edu
or
run putty.
Note that if rucs is down, then ruacad.radford.edu can also be used.
Be aware: rucs is not the
campus web server, nor the php server!
You don't have accounts on those machines
(although your H: drive is shared by those machines).
In particular: the version of
Once logged on to rucs, it is straightforward to run a php program:
However, this raises the question of how to get your php program-files onto your H: drive in the first place.
Either
Note that if you have your own computer and have installed XAMP, it includes
a PHP interpreter (that's the ‘P’ in “XAMP”).
So you may find it easy to
However, you'll still need to know how to connect to rucs and run php there:
the reason is that the rather-quite-old version of PHP installed on rucs is
much closer to the old version of PHP used by php.radford.edu.
So when debugging, you'll want to be able to run PHP using
the exact H: files
and
the similar php version
as the web server uses.
We can take
blend.php (src),
and separate the code from the test-cases:
utils.php (src), and separately
utils-test.php (src).
The directive
This also lets us separate a program that uses
xhtml: Even though original HTML doesn't require the following, they are best practices, and they are required for this class:
The most common (non-X)HTML example using improperly nested tags is <p>, which (in HTML) doesn't need to be closed; the browser auto-closes the tag when it reaches the next <p> (or more precisely: when it reaches the next block-level open-tag, or a close-tag which is terminating the enclosing block, e.g. if the paragraph was already inside an itemized list).
Browsers tend to go to great lengths to try to make sense of tag soup; just because a page looks fine in your browser doesn't mean it's legal. The result is that many people learned their HTML by doing a show-source on bad, illegal examples, and then propagating that bad HTML, and never realizing it because most browsers still did something reasonable (although the details of how a browser handled bad HTML are of course entirely non-standard).
<br />— Used for backwards compatability.
The original HTML required a space before the
We will not worry about such archaic cruft for this class, but your future employers might well care about customers who use old browsers.
Important: In HTML (and actually enforced! by most modern browsers), you can only use the self-closing tag for those tags which never are allowed a body. For tags that may or may not have a body (notably:script ), you cannot use the self-closing version even when you want an empty body.There is no good reason for HTML to be defined like this!
- <hr />— fine;
hr never has a body.- <img src="foo.jpg" />— fine;
img never has a body.- <script type="text/javascript" src="foo.js"></script>— fine.
- <script type="text/javascript" >callSomeFunction();</script>— fine.
- <script type="text/javascript" src="foo.js" />— BAD; a browser may ignore the tag entirely!, which is an annoyingly difficult bug to track down.
See also:
home—lects—hws
D2L—breeze (snow day)
©2017, Ian Barland, Radford University Last modified 2017.Sep.20 (Wed) |
Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |