|
home—lects—hws
D2L—breeze (snow day)
Review: show the result of requesting hello-world_php.txt (result: hello-world.php).
The server, seeing the suffix “.php”, is configured (presumably) to
run that file as a php program, and whatever that program prints is what the server
sends back to the client.
SO: when our browser visits on hello-world.php, and we do a show-source, do we see the php program? NO! (Why not? Let's reread the above paragraph!)
Wait: So how am I displaying the source, if the server doesn't send you the program? For this one example, I happened to make a copy of the php file, and re-named it ending in “txt”. When requesting that file, the server did not consider it a php program and didn't run it; instead it just returned that filed. It looks funky; do a show-source and then tell me why the client is displaying the source-code in a very odd way.
Task:
the function
For any programming task (from 120 on up, including web programming), we start with test cases, which are runnable code:
echo "actual: ", blend("motor", "hotel"), "\n"; echo "expect: ", "motel", "\n"; echo "actual: ", blend("smoke", "fog"), "\n"; echo "expect: ", "smog", "\n"; |
So, let's make some further test cases.
What should
What should
We'll continue next time: What other inputs should we test?
1Or if the requested resource was (say) in image-file, the http packet's payload would be the bits of the image-file. The payload is actually reponsible for includeing a “mime-type” statement to help the receiver understand how the payload's bits should be interpreted, but it's forgivable to think of the payload as just being the bits all the other meta-information as part of some-header-or-another, w/o worrying to distinguish http header info from other headers. ↩
2 For example, see www.montgomerycollege.edu/~steuben/blendwords.htm. ↩
3Okay, okay, here's the third component right now: A way to automatically compare the actual and expected outputs, so that we don't rely on having to manually scour output with a human eye. ↩
home—lects—hws
D2L—breeze (snow day)
©2016, Ian Barland, Radford University Last modified 2016.Sep.02 (Fri) |
Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |