Документация
HTML CSS PHP PERL другое

Workshop

 
Previous Table of Contents Next

Workshop

Quiz

1:

XML documents can be parsed with regular expressions

  1. True

  2. False

2:

PDF document coordinates are specified in

  1. Millimeters

  2. Points

  3. Inches

  4. Pixels

3:

The top-level "component" in an Excel file .xls is

  1. Workbook

  2. Worksheet

  3. Grid

  4. None of the above

4:

To compute the Great Circle distance in Listing 20.2 you needed what module?

  1. LWP::Simple

  2. XML::Simple

  3. Math::Trig

  4. None. The acos, sin, and cos functions are built into Perl.

Answers

A1:

a. But not really. As explained in Hour 19, "Data Processing," it's possible to extract specific pieces of information from an XML document with regular expressions. However, as a general-purpose parsing tool it doesn't work well.

A2:

a. Points (72 points per inch).

A3:

a. The hierarchy goes: a workbook has worksheets; worksheets have rows, columns, and cells.

A4:

c. Math::Trig. If you answered (d), you were close. Perl has sin and cos as built-in functions, but not acos (arc cosine).

Activities

  • Surf the net and find some icons (gifs, jpegs) for various weather phenomenon (rain, clouds, sun, and so on). Place these on the PDF weather report in an appropriate location.

  • Almanac information for your area can be obtained by consulting the U.S. Naval Observatory web site. If you submit the following URL (all on one line):


http://aa.usno.navy.mil/cgi-bin/aa_rstablew.pl?

yy0=1&yy1=45&yy2=0&xx0=-1&xx1=83&xx2=0&zz0=-1&zz1=0

&Compute%20Table=1


a table of sunrise and sunset for your location will be generated. The fields are:


yy0 1 = Latitude North, -1 = Latitude South

yy1 = Degrees Latitude

yy2 = Minutes Latitude

xx0 1 = Longitude East, -1 = Longitude West

xx1 = Degrees Longitude

xx2 = Minutes Longitude

zz0 1 = East of Greenwich, -1 = West of Greenwich

zz1 = Number of hours east or west of Greenwich


Because you've computed latitude and longitude, you're using ZIP codes so it's reasonable to assume the addresses are all in the United States (west and north); the only real problem is computing how many hours west of Greenwich the ZIP code is. This is left as an exercise for the reader.

    Previous Table of Contents Next
    © 2000- NIV