Please read the posts in the Announcements section about the current status of Cumulus development now that I have retired

Please read this post before posting

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3043 Jan 20 2017. See this post for download

Yet Another Dayfile Reader (PHP)

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderators: daj, TNETWeather

nowind
Posts: 7
Joined: Thu Feb 02, 2017 8:22 pm
Weather Station: Davis Vantage Vue
Operating System: Win 10

Re: Yet Another Dayfile Reader (PHP)

Postby nowind » Sun Aug 05, 2018 8:53 pm

jlmr731 wrote:

Ugg yes I see that now, also tried with php 5.6 and looked that same :groan:

If there is anything that can be done like debugging let me know Ill try and help out

Even without average of averages I still love your work thanks so much !!!


I don't know if this is solved, but I just found out that if you delete line 749ish (or preferably comment the line with //, just in case):
$alltime = array(1 => '', 2 => '', 3 => '', 4 => '', 5 => ", 6 => '', 7 => '', 8 => '', 9 => '', 10 => '', 11 => '', 12 => '');

then you got average of average.

I've tried to find any misreadings/problems, but haven't found any yet. Maybe beteljuice can confirm.

User avatar
beteljuice
Posts: 2472
Joined: Tue Dec 09, 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: Yet Another Dayfile Reader (PHP)

Postby beteljuice » Sun Aug 05, 2018 11:44 pm

Odd ... you have effectively deleted the declaration and population of of multi-dimensional array - which the latest versions of PHP seem to demand :o - perhaps I shouldn't have 'nulled' it, but then there should be problems elsewhere ..

Do you know what version you are running ?
Image
......................Imagine, what you will KNOW tomorrow !

User avatar
mcrossley
Posts: 5188
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Yet Another Dayfile Reader (PHP)

Postby mcrossley » Mon Aug 06, 2018 9:02 am

In my version of the script I have...

Code: Select all

        $alltime = array(1 => [], 2 => [], 3 => [], 4 => [], 6 => [], 7 => [], 8 => [], 9 => [], 10 => [], 11 => [], 12 => []);

Since each month will be an array of values, but note that syntax will not work pre PHP 5.4.

And it is a rather wonderful combination of both old and new syntax!

nowind
Posts: 7
Joined: Thu Feb 02, 2017 8:22 pm
Weather Station: Davis Vantage Vue
Operating System: Win 10

Re: Yet Another Dayfile Reader (PHP)

Postby nowind » Mon Aug 06, 2018 3:27 pm

@beteljuice: I have version: 5.0 - 18 April 2016 - beteljuice - changes for php 7 compatibility.

My PHP-version: 5.6.30.

This is what I have done:

I was just curious and downloaded version 3.1 and compared it with version 5.0. I used WinMerge to compare the two files. I found only 3 differences, really.

line 751: version 3.1: $alltime = array(1 => '', 2 => '', 3 => '', 4 => '', 6 => '', 7 => '', 8 => '', 9 => '', 10 => '', 11 => '', 12 => ''); (Same as mcrossley's version)
line 751: version 5: $alltime = array(1 => '', 2 => '', 3 => '', 4 => '', 5 => '', 6 => '', 7 => '', 8 => '', 9 => '', 10 => '', 11 => '', 12 => '');

line 804 version 3.1: if($dataSet != 'winddir') $alltime[$m][] = $thisValue;
line 804 version 5: if($dataSet != 'winddir') $alltime[$m][$d] = $thisValue;

line 951 version 3.1: $seasonTot[$sT][] = $thisValue;
line 951 version 5: $seasonTot[$sT][$d] = $thisValue;

I spotted the difference in line 751, and then I removed 5 =>'' so my version was the same as 3.1. To my surprise the average of average for May was shown.

@beteljuice FYI:
I copied this small script into the file to check any errors:

error_reporting(E_ALL);
ini_set('display_errors', 1);

Warning: Illegal string offset 'short' in .../betel_readDayfile.php on line 1126

This warning comes repeatedly, but I don't think it has anything to do with the average of average problem.

User avatar
beteljuice
Posts: 2472
Joined: Tue Dec 09, 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: Yet Another Dayfile Reader (PHP)

Postby beteljuice » Mon Aug 06, 2018 11:58 pm

PHP 5.xx is much more forgiving than the later version(s) !

That is why it is working 'properly' for you :D

You will see MANY posts of older scripts which either hang or just don't give the results they used to - all because of a rash of PHP updates which are not backwardly compatible !!!
Image
......................Imagine, what you will KNOW tomorrow !

nowind
Posts: 7
Joined: Thu Feb 02, 2017 8:22 pm
Weather Station: Davis Vantage Vue
Operating System: Win 10

Re: Yet Another Dayfile Reader (PHP)

Postby nowind » Wed Aug 08, 2018 10:49 am

beteljuice wrote:
PHP 5.xx is much more forgiving than the later version(s) !

That is why it is working 'properly' for you :D


Yes, and I really appreciate your work! :clap:


Return to “Web site - General”

Who is online

Users browsing this forum: No registered users and 1 guest