[Firebug-cvs] firebug/web/demo index.html,1.1,1.2 results.php,1.1,1.2 test.gnu,1.1,1.2
Brought to you by:
doolin
From: <do...@us...> - 2004-03-13 05:17:46
|
Update of /cvsroot/firebug/firebug/web/demo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5755/demo Modified Files: index.html results.php test.gnu Log Message: plotting now more or less works. Index: index.html =================================================================== RCS file: /cvsroot/firebug/firebug/web/demo/index.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** index.html 16 Feb 2004 02:03:16 -0000 1.1 --- index.html 13 Mar 2004 05:09:02 -0000 1.2 *************** *** 21,25 **** be unix compatible.</li> <li>Make sure that all the file permissions allow ! writing the image file.</li> <li>Check to make sure that the database permissions --- 21,29 ---- be unix compatible.</li> <li>Make sure that all the file permissions allow ! writing the image file. On camshaft, this was ! accomplished by chgrp -R SYSTEM demo; chmod -R 775 demo. ! This is probably more access than is wise, but ! suffices for demo purposes. ! </li> <li>Check to make sure that the database permissions *************** *** 34,38 **** <!-- Created: Sun Feb 15 08:22:46 Pacific Standard Time 2004 --> <!-- hhmts start --> ! Last modified: Sun Feb 15 08:28:18 Pacific Standard Time 2004 <!-- hhmts end --> </body> --- 38,42 ---- <!-- Created: Sun Feb 15 08:22:46 Pacific Standard Time 2004 --> <!-- hhmts start --> ! Last modified: Fri Mar 12 09:47:59 Pacific Standard Time 2004 <!-- hhmts end --> </body> Index: results.php =================================================================== RCS file: /cvsroot/firebug/firebug/web/demo/results.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** results.php 15 Feb 2004 15:16:14 -0000 1.1 --- results.php 13 Mar 2004 05:09:02 -0000 1.2 *************** *** 11,38 **** <body> <h1>Demonstration monitoring</h1> <?php ! /* ! if (!file_exists("/tmp/tempdata")) { ! echo "Creating /tmp/tempdata...<p>"; ! mkdir ("/tmp/tempdata",0755); } ! */ // This stuff doesn't work yet, but would be ! // be a better way to do this. ! $command = "echo -e 'set term png\n"; $command .= "set size 0.4\n"; ! $command .= "plot \"test2.dat\"\n'"; $command .= "| C:/gp373w32/pgnuplot.exe > test.png"; //echo $command; // System call ! `"C:/gp373w32/pgnuplot.exe < ./test.gnu"`; // This would be preferable, but doesn't seem to work. ! //passthru($command); --- 11,124 ---- <body> + + <h1>Demonstration monitoring</h1> <?php ! /** ! * Lots of broken code in here, mostly related to the ! * system() function. The workaround is not pretty, ! * the strings will need to be handled using lots of ! * small functions. ! */ ! ! mysql_connect("localhost","root","") or die("Error: ".mysql_error()." in mysql_connect."); ! ! $statement = "use gpsradio"; ! mysql_query($statement) or die("Error: ".mysql_error()." changing databases"); ! ! $statement = "select lat_dec_min from location where lat_deg = 37"; ! $result = mysql_query($statement) or die("Error: ".mysql_error()." in select statement"); ! ! ! if (!$ofp=fopen("test.dat","w")) { ! echo "Unable to open data output file for writing.\n"; } ! ! if(!chmod ("test.dat", 0775)) { ! echo "chmod failed\n"; ! } ! ! function print_row($item2,$key) { ! fwrite($ofp,$item2); ! } ! ! if ($row = mysql_fetch_row($result)) { ! ! // for each row ! do { ! // For each column... ! $row = array_values($row); ! // This is no good for multiple columns. ! fwrite($ofp,$row[0]."\n"); ! } while ($row = mysql_fetch_row($result)); ! } ! fclose($ofp); ! ! // This stuff doesn't work yet, but would be ! // be a better way to do this. Move all this ! // kind of stuff into dedicated functions. ! //$command = "echo -e 'set term png\n"; ! $command = "'set term png\n"; $command .= "set size 0.4\n"; ! //$command .= "plot \"test2.dat\"\n'"; ! $command .= "plot \"test.dat\"\n'"; ! //$command .= "| C:/gp373w32/pgnuplot.exe > test.png"; $command .= "| C:/gp373w32/pgnuplot.exe > test.png"; + //$plotcommand = "echo -e 'set term png\n"; + $plotcommand = "'set term png\n"; + $plotcommand .= "set size 0.4\n"; + $plotcommand .= "set output \"test.png\"\n"; + $plotcommand .= "plot \"test.dat\" with lines 2'"; + + $plotstring = "set term png\n"; + $plotstring .= "set size 0.4\n"; + $plotstring .= "set output \"test.png\"\n"; + $plotstring .= "plot \"test.dat\" with lines 2"; + + + $gnuplot = " | C:\\gp373w32\\pgnuplot.exe"; + //echo $command; // System call ! $systemcall = $plotcommand; ! $systemcall .= $gnuplot; ! ! $gnufile = "test2.gnu"; ! //$ofp = fopen("test1.gnu","w"); ! $ofp = fopen($gnufile,"w"); ! fwrite($ofp,$plotstring); ! fclose($ofp); + //system("C:\\gp373w32\\pgnuplot.exe < ./test1.gnu"); + //Try the redirect going the other way with an output file name. + system("C:\\gp373w32\\pgnuplot.exe < ./$gnufile"); // > $outfile.png + + /* + print("<pre>"); + print($plotcommand.$gnuplot); + print("</pre>"); + */ + //This doesn't work either. + //`$plotcommand.$gnuplot`; + + /* + $systemcall = $plotcommand; + $systemcall .= $gnuplot; + $e = escapeshellcmd($systemcall); // This would be preferable, but doesn't seem to work. ! if(system("echo -e $systemcall",$error)) { ! echo "System call succeeded\n"; ! } else { ! echo "System call failed with error $error\n"; ! } ! print("<pre>"); ! print($e); ! print("</pre>"); ! */ Index: test.gnu =================================================================== RCS file: /cvsroot/firebug/firebug/web/demo/test.gnu,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test.gnu 15 Feb 2004 15:16:14 -0000 1.1 --- test.gnu 13 Mar 2004 05:09:02 -0000 1.2 *************** *** 3,5 **** set size 0.4 set output "test.png" ! plot "testdata.dat" using 2 with line 1 \ No newline at end of file --- 3,5 ---- set size 0.4 set output "test.png" ! plot "test.dat" using 1 with line 1 \ No newline at end of file |