Re: noaa dead, so our sites all hang :)

2001-04-23 Thread Martin Geisler

Brenno J.S.A.A.F. de Winter [EMAIL PROTECTED] writes:

  Yes, it would be nice to have a cron-script that would update the
  database every 40 minutes or so. But unfortunately that's not
  available to everybody... (I don't have access to it at
  gimpster.com)
 
 For those cases you then can put it the load of the data in a
 different routine and describe in you README how to call the
 script.--

Well, I think it should work like this:

1) You call print-pretty (or some other function that produces some
   output)

2) The function checks whether or not there's a decoded metar. If so,
   it will use that, otherwise it calls decode_metar()

3) decode_metar gets its METAR from get_metar()

4) get_metar uses the current METAR, if any, or else it tries to get
   one by calling get_metar_from_db().

5) get_metar_from_db() uses the database, or calls
   get_metar_from_web() if the METAR wasn't in the database or if it
   was too old.

The idea with this is, that you should only call one function
(print_pretty()) - the rest is handled by lower-level functions. PHP
Weather is my first shot at object-oriented programming, so it might
not be the best solution, but on the other hand, I think it works
quite well.

It's get_metar_from_web() that uses a lot of time to figure out,
whether or not the file is available. If anybody know how to quickly
check if a host is alive, then please tell me.

If you set 'always_use_db' to true, then get_metar_from_db() will use
the METAR is finds in the db, even if it's too old. If it can't find
the METAR, then it has to contact NOAA anyway.

 make dep  make install  make modules  make modules_install,

Was that  line part of your signature? :-)
 
 Brenno J.S.A.A.F. de Winter
 De Winter Information Solutions.
 
 
 
 
 

-- 
Best regards,
Martin Geisler

Checkout http://www.gimpster.com for:
PHP Weather = Shows the current weather on your webpages.
PHP Shell   = A telnet-connection (almost :-) in a PHP page.



RE: noaa dead, so our sites all hang :)

2001-04-22 Thread Michael Willems

Agreed. Right now, even http://www.gimpster.com/php/phpweather/ itself
is 'dead'.

Any workaround for now, anyone?

Michael

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: April 22, 2001 10:26
 To: Michael Willems
 Cc: [EMAIL PROTECTED]
 Subject: Re: noaa dead, so our sites all hang :)


 We ought to seperate the process. One cron-daemon that fills a local
 database on a regular basis. The script than only should read our own
 database so if the information isn't updated on time you still get a
 response ...

 Michael Willems wrote:

  http://weather.noaa.gov/ is dead right now.
 
  But this means my web page, and many other phpweather
 powered sites I
  have tried, hang forever. The @file("http://... etc line
 does not seem
  to prevent a non-response from that IP to hang your pages.
 
  Any ideas?
 
  ---
  Michael Willems
  Chief Technology Officer
  Digital View Corporation

 --
 make dep  make install  make modules  make modules_install,

 Brenno J.S.A.A.F. de Winter
 De Winter Information Solutions.