380 likes | 482 Views
Building Your Web Site. ATS 315. Your Project. Make a web site that shows plots that YOU generated! Plots should regenerate every hour!. Step 1: Decide what plots you want to show. Pick out a couple of charts that can be made with the programs we have written this semester.
E N D
Building Your Web Site ATS 315
Your Project • Make a web site that shows plots that YOU generated! • Plots should regenerate every hour!
Step 1: Decide what plots you want to show • Pick out a couple of charts that can be made with the programs we have written this semester. • Don’t go nuts—maybe 4 or 5 plots at most!
Step 2: Make special versions of your programs with NO interaction! • Your programs shouldn’t require anyone to choose a variable, domain, contour interval or anything like that. • Each program should produce ONE chart!
Step 3: Modify these programs so that they produce an XWD file • XWD = “XWindow Dump” • a file format for images, similar to GIF • We’ll learn how to do this later.
Step 4: Create a “script” that runs these programs. • “scripts” – little programs that perform unix commands. • We’ll learn more about this later.
Step 5: Set up a “crontab” that runs your script each hour • crontabs are scripts that execute on a schedule. • We’ll learn more about this later.
Step 6: Make an HTML page to display your output • You already know how to do this!
The Steps: • Decide what you’ll show • Versions w/o interaction • Produce XWD files • Set up scripts • Set up crontabs • Write HTML code
Step 3: Produce XWD files of your maps • /export/home/schragej/X/xwdjms • a special version of a standard unix program “xwd” • captures a graphics window and saves it as a .xwd file • no beeping! • xwdjms –name myplot
Step 3: Produce XWD files of your maps • /export/home/schragej/X/xwdjms • a special version of a standard unix program “xwd” • captures a graphics window and saves it as a .xwd file • no beeping! • xwdjms –name myplot The name of the graphics window that you opened! Don’t use any spaces!
Step 3: Produce XWD files of your maps • xwdjms uses “printf” to dump everything it does to the screen. • You need to “capture” this to a file! • xwdjms –name myplot > image.xwd
Step 3: Produce XWD files of your maps • xwdjms is a UNIX command, not a C command! • system(“ ”);
Step 3: Produce XWD files of your maps • xwdjms is a UNIX command, not a C command! • system(“ ”); • Example: • system(“rm *.dat”);
Step 3: Produce XWD files of your maps • system(“/export/home/schragej/X/xwdjms –name myplot > image.xwd”);
Step 3: Produce XWD files of your maps • system(“/export/home/schragej/X/xwdjms –name myplot > image.xwd”); • Also, turn off the ghold!!!!!!!!
Step 3: Produce XWD files of your maps • system(“/export/home/schragej/X/xwdjms –name myplot > image.xwd”); • Also, turn off the ghold!!!!!!!! • Still more problems…
Step 3: Produce XWD files of your maps • Draw the map • Draw the data • system(“xwdjms…”); • Even though you’ve given the orders to draw all the lines and all the data, the graphics might not “keep up”…
Step 3: Produce XWD files of your maps • Draw the map • Draw the data • system(“xwdjms…”); • …when you call xwdjms, it’s possible/likely that the picture isn’t done yet! • You’ll capture a partial image!
Step 3: Produce XWD files of your maps • Draw the map • Draw the data • XFlush(display); • system(“xwdjms…”); • You need to XFlush the display.
Step 3: Produce XWD files of your maps • Draw the map • Draw the data • XFlush(display); • system(“xwdjms…”); • You need to XFlush the display.
Step 3: Produce XWD files of your maps • Draw the map • Draw the data • XFlush(display); • system(“xwdjms…”); • Display *display; • display = gget_xdisplay();
Step 3: Produce XWD files of your maps • Display *display; • display = gget_xdisplay(); • Draw the map • Draw the data • XFlush(display); • system(“xwdjms…”);
The Steps: • Decide what you’ll show • Versions w/o interaction • Produce XWD files • Set up scripts • Set up crontabs • Write HTML code
Step 4: Create a “script” that runs these programs. • “scripts” – little programs that perform unix commands. • An example of a script:
Step 4: Create a “script” that runs these programs. • An example of a script: #! /bin/csh –f rm *.gif mv sample.data my.data
Step 4: Create a “script” that runs these programs. • All scripts start with “pound bang space slash bin slash sea ess aich space minus eff” #! /bin/csh –f rm *.gif mv sample.data my.data
Step 4: Create a “script” that runs these programs. • Everything after that just runs as if you typed it at the keyboard in Unix. #! /bin/csh –f rm *.gif mv sample.data my.data
Step 4: Create a “script” that runs these programs. • Everything after that just runs as if you typed it at the keyboard in Unix. #! /bin/csh –f setenv DISPLAY wx-sun1:0. rm *.xwd MakeTempContours /opt/sfw/bin/convert image.xwd temperature.gif mv temperature.gif public_html
Step 4: Create a “script” that runs these programs. • Change the execution privileges on your script: • chmod a+x MyScript • Test it.
The Steps: • Decide what you’ll show • Versions w/o interaction • Produce XWD files • Set up scripts • Set up crontabs • Write HTML code
Step 5: Set up a “crontab” that runs your script each hour • crontabs are scripts that execute on a schedule. • To edit a crontab, you need to have set the EDITOR variable to your favorite editor: • setenv EDITOR vi • setenv EDITOR pico
Step 5: Set up a “crontab” that runs your script each hour • start editing: crontab –e • Every line of the crontab schedules one task to be run repeatedly. • There are 6 entries on every line:
Step 5: Set up a “crontab” that runs your script each hour • The first entry is the MINUTE of each hour during which to run your job. 15 * * * * /export/home/schragej/MyScript
Step 5: Set up a “crontab” that runs your script each hour • Entries 2, 3, 4, and 5 are the hour, day, day of week and day of month on which to run the job. • A star means “every”. 15 * * * * /export/home/schragej/MyScript
Step 5: Set up a “crontab” that runs your script each hour • The sixth entry is the name of your script, with the full path name! • If your script prints ANYTHING to the screen, you’ll need to include: • > /dev/null • or the output will be emailed to you! 15 * * * * /export/home/schragej/MyScript
The Steps: • Decide what you’ll show • Versions w/o interaction • Produce XWD files • Set up scripts • Set up crontabs • Write HTML code
Your (Last!) Assignment • Impress me with a web site with weather charts that refresh hourly!