Up: Class 11, Math 696
Next: Homework
Previous: Goals

Activities for Class 11

Classroom discussion

More discussion of techniques for making effective oral mathematical presentations.

Computer activities

Exercise on combining text and graphics

Here is an exercise that combines some of the skills we have learned. The goal is to produce a reasonable facsimile of the preface to Apollonius's Conics, complete with an imbedded illustration, and to hand it in by the end of class.

One of the points is to figure out how to flow text around included graphics in LaTeX, as in this example. There are several packages at the Comprehensive TeX Archive Network (CTAN) that add this functionality to LaTeX: wrapfig.sty, floatflt.sty, and picins.sty. To create the example, I used picins.sty, the package recommended by Piet van Oostrum.

After I grabbed the file picins.sty from the archive, I created the example by putting the line \usepackage{graphics} in the preamble of my LaTeX document and inserting the line \parpic[rf]{\includegraphics{alice02s.ps}} just before the initial paragraph. (Of course, I also had to find the picture of the rabbit somewhere.)

I am deliberately not giving you very detailed instructions. At this point in the course, it is appropriate for you to try to pull together different strands of knowledge and knit them together in a new way. However, here are a few hints.

Dynamic Web pages

Server-side includes

Hello, browser ``'' from host ``'' at IP number on .

The document you are viewing is ``.'' Its Web address is http://, and it was last modified on . The size of the file is bytes.

The information in the previous two paragraphs was dynamically generated. If you reload the page after a minute, you will see the time change. If you load the page on a different day, from a different location, with a different browser, the first paragraph will be modified appropriately. As you can imagine, there are some advantages in having Web pages that interact with the user in this way.

How did I do it? If you use the ``View Source'' feature of your browser, you will be no wiser, because the Web server is actually interpreting the code in the page before it sends the information to your browser.

In the ordinary course of events, when you click on a link to a Web page, the host server simply ships off the contents of the page to your Web browser, which is then responsible for formatting the information and displaying it. However, the technique of ``Server-Side Includes'' makes the host computer of the Web page pre-process the information before sending it off to the client browser.

On the mathematics department computers, server-side includes are enabled in a limited way for files that end in the special extension .shtml (rather than the usual .html). The source code that produced the first dynamic paragraph above looks like this:

Hello, browser ``<!--#echo var="HTTP_USER_AGENT"-->'' from host ``<!--#echo var="REMOTE_HOST"-->'' at IP number <!--#echo var="REMOTE_ADDR"--> on <!--#config timefmt="%A, %B %e, %Y at %l:%M %p"--> <!--#echo var="DATE_LOCAL"-->.

The server recognizes each string of characters between the delimiters <!--# and --> as a special instruction to be interpreted before sending the page off to the browser. For example, the line <!--#echo var="HTTP_USER_AGENT"--> says to insert (``echo'') the value of the environment variable HTTP_USER_AGENT into the file. (This variable holds the name of the Web browser that requested the page, so it has a value like ``Mosaic,'' or ``Mozilla,'' or ``Lynx.'')

The string <!--#echo var="DATE_LOCAL"--> says to insert the current date and time, formatted in a certain way as specified by the instruction <!--#config timefmt="%A, %B %e, %Y at %I:%M %p"-->. For example, %A designates the day of the week, and %Y designates the year. I have not found any official statement of the date and time format specification parameters, but they appear to be the same as those for the UNIX strftime command, which you can read about in the UNIX manual pages by executing the command man strftime in a terminal window.

The code for the second dynamically generated paragraph above looks like this:

The document you are viewing is ``<!--#echo var="DOCUMENT_NAME"-->.'' Its Web address is http://<!--#echo var="SERVER_NAME"--><!--#echo var="DOCUMENT_URI"-->, and it was last modified on <!--#config timefmt="day %w of week %W of year %y of the 20th century at %T"--> <!--#echo var="LAST_MODIFIED"-->. The size of the file is <!--#config sizefmt="bytes"--> <!--#fsize virtual="/~harold.boas/courses/696-96c/class11/activities.shtml"--> bytes.

The variables DOCUMENT_NAME, SERVER_NAME, and DOCUMENT_URI, and LAST_MODIFIED are self-explanatory. The line fsize virtual calls for the size of the file specified by the given virtual path (relative to the server root). The code config sizefmt="bytes" specifies that the size of the file be returned in bytes; the alternative sizefmt="abbrev" gives the file size rounded to the nearest kilobyte.

An example of server-side includes used for a non-frivolous purpose is the on-line faculty newsletter. There are links to five different pages, and a last-modification date is given for each page. These dates are updated automatically, so I do not have to remember to change them every time I revise one of the linked pages.

Exercise

Use server-side includes to put a line on your home page saying ``This page last updated on ...'' with the date automatically generated.

Note: since your home page might be either index.shtml or index.html, it is preferable to cite the URL of your home page as simply /~your.name/. The server will then automatically choose whichever of index.shtml and index.html is appropriate.

You may have noticed that I put a last-modified date on each of my Web pages. It is helpful to people browsing the pages to let them know if the information is current. In principle, I could use server-side includes to generate last-update information for all my pages, but the extra work for the server tends to slow down delivery of pages to browsers. Instead, I use the html-helper-mode package for emacs to time-stamp my pages automatically every time I edit them.

In principle, the technique of server-side includes can be employed to execute any program on the host via the exec feature, but this feature is turned off on the mathematics department server for security reasons.

Client-side redirection

In the above discussion, the host server was doing the work. With certain browsers (Netscape, for instance, but not Mosaic currently), it is possible to make the client browser do some processing. For example, it is possible to make Netscape load several pages in succession, without intervention from the human user. If you are using Netscape, you can look at an example.

By viewing the source, you can see how I created this example (via a feature of the META tag). This feature might be used to refer a browser to a new location of a Web page, for example, but otherwise is not very practical. A better way to introduce animation to Web pages is via Sun's Java programming language. However, at present Mosaic does not support Java. Netscape does, but you may have to enable it: choose ``Options'' on the menu bar, then ``Network Preferences,'' then ``Languages,'' and then check the ``Enable Java'' box. There is a large collection of Java ``applets'' at Gamelan.


Up: Class 11, Math 696
Next: Homework
Previous: Goals

Created Oct 13, 1996. Last modified Nov 13, 1996 by boas@math.tamu.edu.
URL: /~harold.boas/courses/696-96c/class11/activities.shtml
Copyright © 1996 by Harold P. Boas. All rights reserved.