1 / 38

Building Your Web Site

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.

annona
Download Presentation

Building Your Web Site

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Building Your Web Site ATS 315

  2. Your Project • Make a web site that shows plots that YOU generated! • Plots should regenerate every hour!

  3. 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!

  4. 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!

  5. 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.

  6. Step 4: Create a “script” that runs these programs. • “scripts” – little programs that perform unix commands. • We’ll learn more about this later.

  7. 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.

  8. Step 6: Make an HTML page to display your output • You already know how to do this!

  9. The Steps: • Decide what you’ll show • Versions w/o interaction • Produce XWD files • Set up scripts • Set up crontabs • Write HTML code

  10. 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

  11. 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!

  12. 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

  13. Step 3: Produce XWD files of your maps • xwdjms is a UNIX command, not a C command! • system(“ ”);

  14. Step 3: Produce XWD files of your maps • xwdjms is a UNIX command, not a C command! • system(“ ”); • Example: • system(“rm *.dat”);

  15. Step 3: Produce XWD files of your maps • system(“/export/home/schragej/X/xwdjms –name myplot > image.xwd”);

  16. Step 3: Produce XWD files of your maps • system(“/export/home/schragej/X/xwdjms –name myplot > image.xwd”); • Also, turn off the ghold!!!!!!!!

  17. 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…

  18. 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”…

  19. 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!

  20. Step 3: Produce XWD files of your maps • Draw the map • Draw the data • XFlush(display); • system(“xwdjms…”); • You need to XFlush the display.

  21. Step 3: Produce XWD files of your maps • Draw the map • Draw the data • XFlush(display); • system(“xwdjms…”); • You need to XFlush the display.

  22. Step 3: Produce XWD files of your maps • Draw the map • Draw the data • XFlush(display); • system(“xwdjms…”); • Display *display; • display = gget_xdisplay();

  23. Step 3: Produce XWD files of your maps • Display *display; • display = gget_xdisplay(); • Draw the map • Draw the data • XFlush(display); • system(“xwdjms…”);

  24. The Steps: • Decide what you’ll show • Versions w/o interaction • Produce XWD files • Set up scripts • Set up crontabs • Write HTML code

  25. Step 4: Create a “script” that runs these programs. • “scripts” – little programs that perform unix commands. • An example of a script:

  26. Step 4: Create a “script” that runs these programs. • An example of a script: #! /bin/csh –f rm *.gif mv sample.data my.data

  27. 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

  28. 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

  29. 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

  30. Step 4: Create a “script” that runs these programs. • Change the execution privileges on your script: • chmod a+x MyScript • Test it.

  31. The Steps: • Decide what you’ll show • Versions w/o interaction • Produce XWD files • Set up scripts • Set up crontabs • Write HTML code

  32. 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

  33. 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:

  34. 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

  35. 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

  36. 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

  37. The Steps: • Decide what you’ll show • Versions w/o interaction • Produce XWD files • Set up scripts • Set up crontabs • Write HTML code

  38. Your (Last!) Assignment • Impress me with a web site with weather charts that refresh hourly!

More Related