Sandaysoft

Support forum for Cumulus weather station software
It is currently Mon Nov 24, 2014 5:04 am
Please click here before posting. Help me to help you!
Useful Links: Cumulus FAQ • Enhancement requests • Wiki (documentation) • Downloads
Please put your approximate location into your profile • Add your personal web site to the Cumulus user map
Read the Announcements and News section regularly!
Do not allow your PC to go into standby mode while Cumulus is running - read the readme.txt!
If you find Cumulus useful, please make a donation -

All times are UTC




Post new topic Reply to topic  [ 208 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8 ... 14  Next
Author Message
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Thu Nov 03, 2011 9:34 am 
Offline
User avatar

Joined: Thu Jan 07, 2010 9:44 pm
Posts: 3388
Location: Wilmslow, Cheshire, UK
Weather Station: Davis VP2
Operating System: XP SP3, Win 7
Changing line 302 to:
Code:
if (array_key_exists($testfile, $filesfound)) {

fixes that problem, trying to figure out which index is going out of bounds at line 326...

Edit: Got it, in the month for loop $m is incremented before the range check, so when the loop exits $m=13
change line 326 to:
Code:
if($y != $first_year) { $nav_build[$y]['months'][$m-1] .= "<br />\n";}
and that fixes it.

And finally changed 367-371 to:
Code:
         if (array_key_exists($testfile, $filesfound)) {
            $advisory = "<br /><b>Report for $yr ";
            if ($mo) {$advisory .= $months[$mo];}
            $advisory .= "</b>\n";
            $rpt = implode("",file("$NOAAdir/$testfile"));

_________________
Mark
Wilmslow Astro Weather


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Thu Nov 03, 2011 10:07 am 
Offline
User avatar

Joined: Thu Jan 07, 2010 9:44 pm
Posts: 3388
Location: Wilmslow, Cheshire, UK
Weather Station: Davis VP2
Operating System: XP SP3, Win 7
Oh, and the putenv error? I run in Safe Mode, so
Quote:
In Safe Mode, the user may only alter environment variables whose names begin with the prefixes supplied by this directive. By default, users will only be able to set environment variables that begin with PHP_
http://php.net/manual/en/function.putenv.php

_________________
Mark
Wilmslow Astro Weather


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Thu Nov 03, 2011 1:07 pm 
Offline
User avatar

Joined: Tue Dec 09, 2008 1:37 pm
Posts: 2240
Location: Dudley, West Midlands, UK
Weather Station: None !
Operating System: XP SP3
Cheers Mark, I'll check that out and update later.

Never used array_key_exists, I'll have to look it up :?

_________________
Image
......................Imagine, what you will KNOW tomorrow !


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Thu Nov 03, 2011 2:03 pm 
Offline
User avatar

Joined: Thu Jan 07, 2010 9:44 pm
Posts: 3388
Location: Wilmslow, Cheshire, UK
Weather Station: Davis VP2
Operating System: XP SP3, Win 7
I hadn't either, but looking up on how to trap 'does not exist' errors found it, you cannot pass the missing array member to any of the normal error checking routines because it doesn't exist so the act of passing it causes an error - doh!

_________________
Mark
Wilmslow Astro Weather


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Thu Nov 03, 2011 2:33 pm 
Offline
User avatar

Joined: Tue Dec 09, 2008 1:37 pm
Posts: 2240
Location: Dudley, West Midlands, UK
Weather Station: None !
Operating System: XP SP3
mcrossley wrote:
...
And finally changed 367-371 to:
Code:
         if (array_key_exists($testfile, $filesfound)) {
            $advisory = "<br /><b>Report for $yr ";
            if ($mo) {$advisory .= $months[$mo];}
            $advisory .= "</b>\n";
            $rpt = implode("",file("$NOAAdir/$testfile"));

I elected to go 'terse' - same but different ;)
Code:
         if (array_key_exists($testfile, $filesfound)) {
            $advisory = "<br /><b>Report for $yr " .($mo ? $months[$mo] : ''). "</b>\n";
            $rpt = implode("",file("$NOAAdir/$testfile"));

         } else {

_________________
Image
......................Imagine, what you will KNOW tomorrow !


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Thu Nov 03, 2011 2:39 pm 
Offline
User avatar

Joined: Tue Dec 09, 2008 1:37 pm
Posts: 2240
Location: Dudley, West Midlands, UK
Weather Station: None !
Operating System: XP SP3
Update V3.1 - bug fix for 'twitch level' error reporting

viewtopic.php?f=14&t=5754&p=49194#p49194


NB: If you have an earlier version running without problems ..........

_________________
Image
......................Imagine, what you will KNOW tomorrow !


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Mon Dec 12, 2011 8:28 pm 
Offline

Joined: Wed May 06, 2009 6:29 pm
Posts: 2043
Location: Cheadle Hulme, Cheshire, England
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
I've been working my way through the instructions kindly provided by beteljuice to get NOAA reports available on my website.

I've hit a brick wall and I'm sure it's path related but for the life of me I cannot see where the problem lies.

This is the error being reported on my server:-

[12-Dec-2011 20:01:36] PHP Warning: opendir(./NOAA-reports) [<a href='function.opendir'>function.opendir</a>]: failed to open dir: No such file or directory in /home/admin4/public_html/NOAA-reports/NOAA-reports.php on line 195

And here is the page I've created:- http://www.cheadlehulmeweather.co.uk/NOAA.php

Neither of the two reports (Dec or 2011) will display even though they exist in the NOAA-reports subfolder under my root public_html.

In public_html/NOAA-reports I have:-
NOAA-reports.php
noaarep.css
NOAAMO1211.txt
NOAAYR2011.txt

In public_html I have:-
NOAAT.php
NOAA.php
weatherstyle.css

Any help gratefully appreciated.

_________________
Cheers,
Ray, Cheshire.

Image


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Mon Dec 12, 2011 9:01 pm 
Offline
User avatar

Joined: Wed May 06, 2009 5:02 am
Posts: 628
Location: Saratoga, CA, USA
Weather Station: Davis Vantage Pro Plus
Operating System: Windows XP SP3
RayProudfoot wrote:
I've been working my way through the instructions kindly provided by beteljuice to get NOAA reports available on my website.

I've hit a brick wall and I'm sure it's path related but for the life of me I cannot see where the problem lies.

This is the error being reported on my server:-

[12-Dec-2011 20:01:36] PHP Warning: opendir(./NOAA-reports) [<a href='function.opendir'>function.opendir</a>]: failed to open dir: No such file or directory in /home/admin4/public_html/NOAA-reports/NOAA-reports.php on line 195

And here is the page I've created:- http://www.cheadlehulmeweather.co.uk/NOAA.php

Neither of the two reports (Dec or 2011) will display even though they exist in the NOAA-reports subfolder under my root public_html.

In public_html/NOAA-reports I have:-
NOAA-reports.php
noaarep.css
NOAAMO1211.txt
NOAAYR2011.txt

In public_html I have:-
NOAAT.php
NOAA.php
weatherstyle.css

Any help gratefully appreciated.


I'd suggest you change the directory specification from

./NOAA-reports

to

./NOAA-reports/

and see if that fixes the issue.

Best regards,
Ken


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Mon Dec 12, 2011 9:22 pm 
Offline

Joined: Wed May 06, 2009 6:29 pm
Posts: 2043
Location: Cheadle Hulme, Cheshire, England
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Thanks Ken. I think that has fixed one problem but I appear to have another related to my location adapted for England.

The error log is now complaining about line 433:-

[12-Dec-2011 21:19:07] PHP Warning: preg_replace() [<a href='function.preg-replace'>function.preg-replace</a>]: Delimiter must not be alphanumeric or backslash in /home/admin4/public_html/NOAA-reports.php on line 433

That line is as follows:-
$rpt = preg_replace('State: Cheshire', 'County: Cheshire Country: UK', $rpt, 1);

_________________
Cheers,
Ray, Cheshire.

Image


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Mon Dec 12, 2011 10:05 pm 
Offline

Joined: Wed May 06, 2009 6:29 pm
Posts: 2043
Location: Cheadle Hulme, Cheshire, England
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
I reverted to the standard piece of code for the location and it seems to have fixed the problem.

http://www.cheadlehulmeweather.co.uk/NOAA.php

One last question. How do I generate files for all the months I have data for? Had a look in the Help but nothing jumped out at me.

_________________
Cheers,
Ray, Cheshire.

Image


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Mon Dec 12, 2011 10:18 pm 
Offline
User avatar

Joined: Wed May 06, 2009 5:02 am
Posts: 628
Location: Saratoga, CA, USA
Weather Station: Davis Vantage Pro Plus
Operating System: Windows XP SP3
RayProudfoot wrote:
Thanks Ken. I think that has fixed one problem but I appear to have another related to my location adapted for England.

The error log is now complaining about line 433:-

[12-Dec-2011 21:19:07] PHP Warning: preg_replace() [<a href='function.preg-replace'>function.preg-replace</a>]: Delimiter must not be alphanumeric or backslash in /home/admin4/public_html/NOAA-reports.php on line 433

That line is as follows:-
$rpt = preg_replace('State: Cheshire', 'County: Cheshire Country: UK', $rpt, 1);


Hi Ray,

The preg_replace would need to have a delimiter in the regex on the first argument like:

$rpt = preg_replace('/State: Cheshire/i', 'County: Cheshire Country: UK', $rpt, 1);

then it would execute correctly.

Best regards,
Ken


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Mon Dec 12, 2011 10:24 pm 
Offline
User avatar

Joined: Wed May 06, 2009 5:02 am
Posts: 628
Location: Saratoga, CA, USA
Weather Station: Davis Vantage Pro Plus
Operating System: Windows XP SP3
RayProudfoot wrote:
I reverted to the standard piece of code for the location and it seems to have fixed the problem.

http://www.cheadlehulmeweather.co.uk/NOAA.php

One last question. How do I generate files for all the months I have data for? Had a look in the Help but nothing jumped out at me.

Glad the spec on the directory fixed the issue.

In the Cumulus, View, NOAA Monthly Report (and NOAA Yearly Report) there's an option at the bottom of the window to specify the Month/Year (or just Year) for the report. Select 'Update Report' then you can do a "Save" selecting ANSI file type.

Repeat for your missing reports, then manually upload the historical file(s) to your NOAA-reports/ directory.

Best regards,
Ken


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Mon Dec 12, 2011 11:34 pm 
Offline

Joined: Wed May 06, 2009 6:29 pm
Posts: 2043
Location: Cheadle Hulme, Cheshire, England
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Hi Ken,

Thanks for your help with both questions. Given the location code works I'll leave that alone for now.

Regarding choosing another month/year for NOAA data I don't see an option at the bottom of that window. I'm running Cumulus on a netbook with a 1024*600 resolution. Might that be the reason?

Steve, should I be able to see the option at the bottom of that window to generate data for another period?

_________________
Cheers,
Ray, Cheshire.

Image


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Tue Dec 13, 2011 1:39 am 
Offline
User avatar

Joined: Tue Dec 09, 2008 1:37 pm
Posts: 2240
Location: Dudley, West Midlands, UK
Weather Station: None !
Operating System: XP SP3
Ken wrote:
The preg_replace would need to have a delimiter in the regex on the first argument like:

$rpt = preg_replace('/State: Cheshire/i', 'County: Cheshire Country: UK', $rpt, 1);

then it would execute correctly.
:oops: - caught between regex and str replace :? - example corrected, cheers

_________________
Image
......................Imagine, what you will KNOW tomorrow !


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Tue Dec 13, 2011 12:44 pm 
Offline
User avatar

Joined: Thu Jan 07, 2010 9:44 pm
Posts: 3388
Location: Wilmslow, Cheshire, UK
Weather Station: Davis VP2
Operating System: XP SP3, Win 7
RayProudfoot wrote:
Regarding choosing another month/year for NOAA data I don't see an option at the bottom of that window. I'm running Cumulus on a netbook with a 1024*600 resolution. Might that be the reason?
Probably, can you remote desktop into your netbook and specify a larger desktop size?

_________________
Mark
Wilmslow Astro Weather


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 208 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8 ... 14  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group