Skip to the Main Content

Note:These pages make extensive use of the latest XHTML and CSS Standards. They ought to look great in any standards-compliant modern browser. Unfortunately, they will probably look horrible in older browsers, like Netscape 4.x and IE 4.x. Moreover, many posts use MathML, which is, currently only supported in Mozilla. My best suggestion (and you will thank me when surfing an ever-increasing number of sites on the web which have been crafted to use the new standards) is to upgrade to the latest version of your browser. If that's not possible, consider moving to the Standards-compliant and open-source Mozilla browser.

January 27, 2005

Can’t Complain About the Weather

As you may have noticed, I now sport the local weather forecast on my sidebar. This is partly a technical “because it’s there,” and partly an artifact of the fact that my former office did not have a window.

The forecast is powered by NOAA’s XML service that I blogged about previously. One of the cool things about the internet is that, in response to my complaints, NOAA’s Director of Internet Services, Bob Bunge, chimed in to say that they were working on my issues. I’d like to thank Bob and especially John Schattel for working with me to iron out the bugs in their service.

Some were quite amusing:

The trouble revolves around our decision to calculate the sunrise and sunset times and base the decision to use “night” when the data time occurs after the sun has set. This logic does not return the correct result in the central time zone at this time of year [mid-winter].

Anyway, it took a while, but it looks like the bugs in their service are mostly squashed. So, despite having moved offices in the interim, I now sport the local forecast on my sidebar.

I’ve gotten a couple of emails asking me how I deal with NOAA’s XML service, so here’s a brief summary.

  1. NOAA updates the current conditions hourly, at 20 past the hour. I use a (completely trivial) script to retrieve the current conditions and cache them locally.
  2. The forecasts are updated hourly, at 50 past the hour. The forecast data is retrieved via SOAP and cached using the script described previously.
  3. To put things together, I run yet another script twice an hour, i.e. after each NOAA update. It parses the aforementioned XML files, using XML::Simple, and spits out a file containing an XHTML fragment which I can include in my sidebar. Up to 7 days of forecasts can be produced. I settled for two.

Note that after haranguing NOAA for not using XML tools to assemble their XML, I copped out and generate my XHTML with a few simple-minded print statements as well. Using XML::Simple to assemble the desired XHTML document from the data would have been kinda painful. And, hey, nothing else in this sprawling expanse of blogging software does it “right” either.

Posted by distler at January 27, 2005 12:29 AM

TrackBack URL for this Entry:   http://golem.ph.utexas.edu/cgi-bin/MT-3.0/dxy-tb.fcgi/500

8 Comments & 1 Trackback

Re: Can’t Complain About the Weather

Could you check the permissions on the Current and Forecast scripts? Thanks.

Posted by: Lou on January 27, 2005 8:37 AM | Permalink | Reply to this

Permissions

Fixed.

Sorry for the inconvenience.

Posted by: Jacques Distler on January 27, 2005 8:43 AM | Permalink | PGP Sig | Reply to this

Re: Can’t Complain About the Weather

Just two silly questions:

(1) Which DateTime.pm are you using, Jacques?

(2) When i try running ‘weather.pl’ i get: ‘Can’t find string terminator “FOO” anywhere before EOF at ./weather.pl line 92.’

Do you have any ideas on what could possibly be happening?

BTW: This is a very neat hack, Jacques; congrats! And thanks for allowing us, mere mortals, to use it…

Posted by: Daniel Doro Ferrante on January 27, 2005 4:35 PM | Permalink | Reply to this

Perl problems

(1) Which DateTime.pm are you using, Jacques?

DateTime 0.25.

(2) When i try running ‘weather.pl’ i get: ‘Can’t find string terminator “FOO” anywhere before EOF at ./weather.pl line 92.’

That’s a bit strange.

Open up the file in a text editor, and make sure it did not get truncated for some reason. The string terminator, “FOO”, is at line 100 of the 110 line file.

Posted by: Jacques Distler on January 27, 2005 7:56 PM | Permalink | PGP Sig | Reply to this

Re: Can’t Complain About the Weather

One small thing: the link you’ve got in weather.pl doesn’t seem to be correct; I got a 404 when I tried copying and visiting it.

Posted by: Aankhen on January 28, 2005 12:04 PM | Permalink | Reply to this

Fixed URL

Whoops! That’s supposed to be a link to this post.

Fixed.

Posted by: Jacques Distler on January 28, 2005 12:11 PM | Permalink | PGP Sig | Reply to this

Re: Can’t Complain About the Weather

Like it and have started using it on my blog main page.

Posted by: Zack on January 31, 2005 9:10 PM | Permalink | PGP Sig | Reply to this

Re: Can’t Complain About the Weather

Hi Jacques,

I fixed the problems i was having with my perl installation? sometimes perl can be quite a nuisance to handle. But, bottom line is that all is working smoothly now.

Posted by: Daniel Doro Ferrante on February 8, 2005 4:17 PM | Permalink | PGP Sig | Reply to this
Read the post Front-end and Back-end Changes
Weblog: Procrastination
Excerpt: There have been a lot of changes here recently, most of them on the back-end. Most of this work was related to having a bilingual (English and Urdu) blog along with MathML equations. This required valid XHTML 1.1 and serving...
Tracked: February 11, 2005 8:23 AM

Post a New Comment