Weeks 13 - 15
PHP, SVG and other
The magic command used to make the file useable by scripts is
chcon -t httpd_sys_content_t threefull
We have to figure out a way so that everyone can present their
final project orally, either on the last two days of class (Friday, Dec. 9th and Monday, Dec. 12) or during
the time reserved for the final (Friday December 16th, 1 - 3 pm).
Presentations will be (M-k)/n minutes where n is the number of people in the class, M is the number of minutes in the class, k is some constant to allow for transitions.
Describe your project, what you hoped to accomplish, what you did accomplish, demonstrate the working project (on the screen). Describe problems encountered, and or what you would have hope to add to it, and whether or not you wish to continue working on it after the class has ended.
Be sure to speak up so that everyone can hear you!
Turning in the final project: make sure that you email me all source code as well as a working link to the working project.
Projects are due at the moment the period for the final exam would begin!SVG:
Something sort of self-contained
W3C/EU course :
2nd Quiz -- Monday Dec. 5th (PHP and SVG)
USMap in SVG with AJAX, PHP and JavaScript (works everywhere now, including IE/ASV !)
Take a look at this in Opera, Firefox or IE/7/8. See if you can get it working in Chrome and Safari as well.
What we have done so far with SVG in class.....
A simple data file with states can be seen at ~ddailey/public_html/data/simplestate -- (copyright issue)
Mediating two person interaction
PHP exercise. Make a PHP web page which "hypertextualizes" the "database" of US place names. Specifically, using the data available on granite at /homes/ddailey/public_html/data/places2k.txt , make a page which displays eight place names (names of eight incorporated places chosen at random) and the state of each as links in a table (2 columns x 8 rows). Whenever someone clicks on a state, 8 new places are randomly selected from that state and likewise displayed in 2 by 8 format. Whenever someone clicks on a place name, all place names sharing that name are likewise displayed, unless there are more than 8 of them, in which case, 8 are chosen at random. Congratulate people for finding places that belong to more than two states, and display a list of places that users have found that share the current record for most states with a given place name -- for example "Eureka" is found in 8 states: IL, KS, MO, MT, NC, SD, TX, and UT
Happy Valley Alaska Happy Valley Texas
You may prefer the simplified file at /homes/ddailey/public_html/data/stateplacenames2000.
The original file is from http://www.census.gov/geo/www/gazetteer/places2k.html where it is discussed.
There is also a file at ST_Place created from stateplacenames2000 from the command:
sed 's/\ [^ ]*$//;s/^../& /' $s>ST_Place (where s=stateplacenames2000)
Notes: other examples of the hypertextualization of data may be seen with these examples:
http://granite.sru.edu/~ddailey/cgi/readwebster3?wildhttp://granite.sru.edu/~ddailey/cgi/hyphens?wild
Some town studies may be seen at townstudies.htm
And...take a look at this script: http://granite.sru.edu/~ddailey/data/randplace.php
Here is some code that might help:
| PHP | explanation |
if (isset($_GET["S"])){ | determine whether or not the variable S has been sent (in this case, as a part of the query string) |
$B=preg_grep('/FL/', $P); | search the file $P for lines matching a regular expression. $B will be an array, but indexed by the lines numbers of $P. |
$vals = array(); | Make an array, $vals, which will be indexed from 0 to count($vals) -1 instead of by the lines numbers of $P |
$parts=explode(" ",$P[$vals[$r]]); | Removing state name from record, and then recombining the rest into a string. |
}
Or this one (to get you started)
Here's the PHP part:
<?
$f[0]="bootstarts";
$f[1]="bestmiddles";
$f[2]="bestendings";
if (!isset($c)) $c=10;
for ($j=0;$j<$c;$j++){
for ($i=0;$i<3;$i++){
$F=file($f[$i]);
$l[$i]=$F[rand(0,count($F)-1)];
$W=preg_split ("/\s+/",$l[$i]);
echo $W[2];
}
echo "<br>";
}
?>
| ==> bootstarts <== 6 allen 5 6 bent 1 6 chest 18 6 clif 14 6 coal 0 |
==> bestmiddles <== 2 al 1420 2 ampton 18 2 an 2091 2 arborn 2 2 ark 355 |
==> bestendings <== 2 born 11 2 bury 41 2 by 64 2 castle 4 2 chester 18 |
| 25 new 10 25 oak 4 31 lake 24 31 wood 211 37 west 18 |
22 er 2297 22 th 887 26 land 322 26 wood 211 28 s 5840 |
9 view 72 10 field 147 12 land 322 12 wood 211 14 ville 1007 |