Weather-Watch.com

Weather and the Internet => Creating Weather Web Sites => Custom Templates and Scripts => Topic started by: wvdkuil on April 11, 2019, 12:39:28 PM

Title: HWS-template (WD34 / weather34) April release
Post by: wvdkuil on April 11, 2019, 12:39:28 PM
Please post all remarks and questions about the normal April release in this topic.
For ideas about new functionality, use this "wish-list topic"  (https://www.weather-watch.com/smf/index.php/topic=67497.new)

Title: Re: HWS-template (WD34 / weather34) April release
Post by: bitsostring on April 11, 2019, 07:31:21 PM
Installed the April release, saved easyweathersetup and got the expected message: "Unable to open w34_settings1.php file check file permissions !"

With every version I have had to alter the permission for this file on my server, but this time there is no file called w34_settings1.php?
Title: Re: HWS-template (WD34 / weather34) April release
Post by: wvdkuil on April 11, 2019, 08:08:40 PM
Installed the April release, saved easyweathersetup and got the expected message: "Unable to open w34_settings1.php file check file permissions !"

With every version I have had to alter the permission for this file on my server, but this time there is no file called w34_settings1.php?
You should definitely not copy scripts from one version to another. Never, until the December version.

Only after the basic scripts all work, you can copy your own scripts to the new version.

The fresh install will start index.php => detect there is no settings1 and will start the easyweather setup.
There is no settings1 file as there are new  / rearranged and renamed settings which need their default values.
If that not works, please post the URL so that i can take a look.

Wim


Title: Re: HWS-template (WD34 / weather34) April release
Post by: bitsostring on April 11, 2019, 09:00:25 PM
You should definitely not copy scripts from one version to another. Never, until the December version.

I did not copy anything, I just uploaded the whole new unzipped pwsWD directory and went to /pwsWD/index.php.

Quote
The fresh install will start index.php => detect there is no settings1 and will start the easyweather setup.

It did start easyweather. I filled in a few things and tried to save the configuration, which is when I got the error message shown. That is the only reason I was looking for w34_settings1.php.

Quote
There is no settings1 file as there are new  / rearranged and renamed settings which need their default values.

That's what saving the easyweather settings is supposed to do, but I can't save it until I can change the permissions. Catch 22.

Quote
If that not works, please post the URL so that i can take a look.

I'll try again tomorrow and let you know.

EDIT: OK, couldn't wait so I tried again, same result. For URL, go to my existing web page (left) and change /pws to /pwsWD.

Title: Re: HWS-template (WD34 / weather34) April release
Post by: wvdkuil on April 12, 2019, 07:01:09 AM
I did not copy anything, I just uploaded the whole new unzipped pwsWD directory and went to /pwsWD/index.php.

It did start easyweather. I filled in a few things and tried to save the configuration, which is when I got the error message shown. That is the only reason I was looking for w34_settings1.php.

That's what saving the easyweather settings is supposed to do, but I can't save it until I can change the permissions. Catch 22.

I'll try again tomorrow and let you know.

EDIT: OK, couldn't wait so I tried again, same result. For URL, go to my existing web page (left) and change /pws to /pwsWD.
OK, I tried, same result.

Very strange webserver which does not allow Apache to write new files. I wonder if the caching of forecast files will work?
Code: [Select]
        $fp = fopen($sttngs_fl, "w") or die("Unable to open w34_settings1.php file check file permissions !"); https://www.php.net/manual/en/function.fopen.php
Quote
'w'   Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.
I attach an un-used w34_settings1.php
Can you please test:
1. Unzip => upload to server/pwsWD/
2. check with your ftp program what the permissions are, and make a note of it
3. go to http://swanston.maui.co.uk/pwsWD/_test.php , this will start the main screen => go to settings use default password
4. do not change anything, only go to the green box and save.

If that not work, make a note of the permissions again and reset the permissions of w34_settings1.php  to 755

Wim
Title: Re: HWS-template (WD34 / weather34) April release
Post by: bitsostring on April 12, 2019, 08:45:18 AM
OK, I tried, same result.

I attach an un-used w34_settings1.php

No attachment?
Title: Re: HWS-template (WD34 / weather34) April release
Post by: wvdkuil on April 12, 2019, 08:57:45 AM
No attachment?
:oops:
Title: Re: HWS-template (WD34 / weather34) April release
Post by: bitsostring on April 12, 2019, 09:10:32 AM
:oops:

Thanks. I doubt if the first test will work because the server is not allowed to write to any file that I upload until the permissions are changed. . . but I will follow instructions and report back  :)
Title: Re: HWS-template (WD34 / weather34) April release
Post by: wvdkuil on April 12, 2019, 09:12:50 AM
Thanks. I doubt if the first test will work because the server is not allowed to write to any file that I upload until the permissions are changed. . . but I will follow instructions and report back  :)
Sorry, but what kind of server is that?
Who is your provider?

Wim
Title: Re: HWS-template (WD34 / weather34) April release
Post by: bitsostring on April 12, 2019, 11:12:41 AM
Who is your provider?

He's family, and I have to do what I'm told  :)

Anyway, first test failed as expected so I have changed the permissions for w34_settings1.php and that seems fine. Now I just have to add a curlopt_proxy line to w34_load_files.php and I should be good to go.

Do I need to check anything re forecast caches?

Title: Re: HWS-template (WD34 / weather34) April release
Post by: wvdkuil on April 12, 2019, 11:21:16 AM
He's family, and I have to do what I'm told  :)

Anyway, first test failed as expected so I have changed the permissions for w34_settings1.php and that seems fine. Now I just have to add a curlopt_proxy line to w34_load_files.php and I should be good to go.

Do I need to check anything re forecast caches?
All retrieved data from WU (graphs) Darksky (forecast)  metoalarm (weatheralarms) and so on are stored in the jsondata/ and charswudata/ folder.
It is not known on forehand what the filenames are as sometimes a code or a language is inside the name of the file.
Examples: wufct_en_s.txt   warningNL014 

With normal providers one can give the "folder and its contents" the permission "to be written".

succes, Wim
Title: Re: HWS-template (WD34 / weather34) April release
Post by: bitsostring on April 12, 2019, 06:20:20 PM
Now I just have to add a curlopt_proxy line to w34_load_files.php and I should be good to go.

Well, that didn't work: none of the outside files are being loaded. Guess I'll have to ask my provider again. . .

EDIT: But changing the permissions for /chartswudata and /jsondata did  :D

Files were loaded but couldn't be saved. All seems OK now. Thanks for the advice, Wim.
Title: Re: HWS-template (WD34 / weather34) April release
Post by: SandhurstWX on April 12, 2019, 09:00:21 PM
All working okay for me, https://www.sandhurstweather.org.uk/pwsWD/index.php.

Thanks Win.
Title: Re: HWS-template (WD34 / weather34) April release
Post by: drparker151 on April 13, 2019, 05:48:50 AM
Wow I love this thanks for putting together.

I've got one question and wonder what I'm doing wrong.  I get a 24 hour clock displayed even though I've picked 12 hour in the display and set times to g:i:s a.

In the attached screen shot you can see 24 hour time in the clock box, however the temp box is picking up the correct format.

Title: Re: HWS-template (WD34 / weather34) April release
Post by: bitsostring on April 13, 2019, 09:43:32 AM
I get a 24 hour clock displayed even though I've picked 12 hour in the display and set times to g:i:s a.

See here: https://www.weather-watch.com/smf/index.php/topic,67675.msg544892.html#msg544892
Title: Re: HWS-template (WD34 / weather34) April release
Post by: wvdkuil on April 13, 2019, 12:36:04 PM
Wow I love this thanks for putting together.
I've got one question and wonder what I'm doing wrong.  I get a 24 hour clock displayed even though I've picked 12 hour in the display and set times to g:i:s a.
In the attached screen shot you can see 24 hour time in the clock box, however the temp box is picking up the correct format.
@bitsostring already pointed you to the previous discussion.
Did not find enough time to test the 12 < > 24 hour clock.
Please make a copy of your current clock_small.php script and replace with this test version.
When the setting is for 24 hrs no changes.
When easyweather is set to 12 hr clock it will display the format as in the attached screenshot. 

Wim
Title: Re: HWS-template (WD34 / weather34) April release
Post by: drparker151 on April 13, 2019, 12:55:33 PM
Excellent, that works great. :D

thanks,
Drew
Title: Re: HWS-template (WD34 / weather34) April release
Post by: bitsostring on April 13, 2019, 01:22:49 PM
I see Celcius is still spelled wrongly in the small balloon on Temp block. . .
Title: Re: HWS-template (WD34 / weather34) April release
Post by: johnmac78 on April 13, 2019, 01:49:27 PM
I believe this was discussed previously, but I cannot find any info - Is there any way to speed the refresh rate on the forecast block and current conditions block? They are showing old data and both blocks are useless if you are just opening weather34 for a short time, otherwise great program.

Thanks,

John
Title: Re: HWS-template (WD34 / weather34) April release
Post by: wvdkuil on April 13, 2019, 02:53:09 PM
I believe this was discussed previously, but I cannot find any info - Is there any way to speed the refresh rate on the forecast block and current conditions block? They are showing old data and both blocks are useless if you are just opening weather34 for a short time, otherwise great program.
Thanks,
John

When using the 5 minute cron-job  => all data is always recent. If not, there is a problem.
So I assume, based on your question,  that you are NOT running a 5 or 10 minute cron-job?

Please always type the URL to the template so i can check if there is a problem.

The weather34/ based template works as follows:
1. A person (you) visits the site.
2. The index.php draws the blocks on the screen without any data inside the blocks
3. The index.php loads updater.php which sends a bunch of small javascript-functions to the browser
3.1 First javascript-function starts a server-side "load_files" php-script which re-loads all external data files if they are to old
3.2 The other javascript-functions will each start (and refresh) a server-side php-script to fill one block with data.

All blocks, including the forecast block, when started by their javascript-function, process the available data, recent or old does not matter to a block script
The forecast blocks are refreshed every 5-6 minutes and will process the then available data.

===
Reloading external data:
The darkSky and WU api have a maximum number of allowed free accesses / day.
The forecast and CCN (=current conditions)-data is fetched by the "load_files" script based on the age of the data
DarkSky and WU-forecast max-age 1800 seconds = 0.5 hour
METAR default max-age 900 seconds

Without the cron-job,  if the data is old,  one has to wait 1 or 2 seconds and do a page-refresh. The recent data will be shown

===

A 5 minute  cron-job will also load the same "load_files" script but the allowed age  reduced with 20%.
This makes sure that all visitors will always get the recent data.

Wim

Title: Re: HWS-template (WD34 / weather34) April release
Post by: drparker151 on April 13, 2019, 10:08:23 PM
Just spotted something else.  When you pick short time = "g:i:s a" in easysetup it only saves "g:i:s" in w34_settings1.php.  I have manually edited w34_settings to add the a and that works. However if I go back into easysetup it reverts to just "g:i:a" and I have to do another manual edit.
Title: Re: HWS-template (WD34 / weather34) April release
Post by: johnmac78 on April 13, 2019, 11:39:06 PM
When using the 5 minute cron-job  => all data is always recent. If not, there is a problem.
So I assume, based on your question,  that you are NOT running a 5 or 10 minute cron-job?

Please always type the URL to the template so i can check if there is a problem.

The weather34/ based template works as follows:
1. A person (you) visits the site.
2. The index.php draws the blocks on the screen without any data inside the blocks
3. The index.php loads updater.php which sends a bunch of small javascript-functions to the browser
3.1 First javascript-function starts a server-side "load_files" php-script which re-loads all external data files if they are to old
3.2 The other javascript-functions will each start (and refresh) a server-side php-script to fill one block with data.

All blocks, including the forecast block, when started by their javascript-function, process the available data, recent or old does not matter to a block script
The forecast blocks are refreshed every 5-6 minutes and will process the then available data.

===
Reloading external data:
The darkSky and WU api have a maximum number of allowed free accesses / day.
The forecast and CCN (=current conditions)-data is fetched by the "load_files" script based on the age of the data
DarkSky and WU-forecast max-age 1800 seconds = 0.5 hour
METAR default max-age 900 seconds

Without the cron-job,  if the data is old,  one has to wait 1 or 2 seconds and do a page-refresh. The recent data will be shown

===

A 5 minute  cron-job will also load the same "load_files" script but the allowed age  reduced with 20%.
This makes sure that all visitors will always get the recent data.

Wim

Wim,

Thanks for the detailed explanations. Where do I find info on these cron-jobs, are they part of WD or Weather34? I have not seen any discussion about these cron-jobs, but I do see a tab in WD for Weather34 with no explanation.

Thanks,

John
Title: Re: HWS-template (WD34 / weather34) April release
Post by: Weather Display on April 13, 2019, 11:45:50 PM
you can set the cron jobs up in WD under control panel, webfiles/web page setup, custom web page setup
Title: Re: HWS-template (WD34 / weather34) April release
Post by: johnmac78 on April 14, 2019, 02:27:41 AM
you can set the cron jobs up in WD under control panel, webfiles/web page setup, custom web page setup

I am using the Darksky forecast, can I update that from WD?
Title: Re: HWS-template (WD34 / weather34) April release
Post by: wvdkuil on April 14, 2019, 07:07:36 AM
I am using the Darksky forecast, can I update that from WD?
Who to use to run the cron-job
As the cron-job runs on your website, the website itself can not start the cron-job.
Your website provider probably has a cron-job facility and there are other free or paid-for cron-job-providers
But WD is already running 24/7 and has al cron-job services built in.  No need to use another way.

How does it work:
WD will start the cron-job with a http call to your website => that is the only thing WD has to do
The "cron-job" will be run on your webserver as it is a normal PHP script
The "cron-job" will load the  server-side "load_files" php-script which re-loads all external data files if they are to old, but this time with 80% of the allowed age

Some documentation
http://wd34.weather-template.com/ => Documentation => http://wd34.weather-template.com/documentation/WDapi-stationcron-2019-01.pdf

PLEASE ALWAYS SUPPLY THE URL TO YOUR WEBSITE
Sometimes a small problem or a provider-setting inhibits loading the external data.
Only with the link  the poeple who try to help you, can check if there is another problem

Wim
Title: Re: HWS-template (WD34 / weather34) April release
Post by: Torjan on April 14, 2019, 11:38:17 AM
Hi!
For you who use the new language section xx, just a tip.

Should you use WXsim do not forget and create plaintext-parser-lang-xx.txt to get the right language in the weather forecast.

Torjan.
Title: Re: HWS-template (WD34 / weather34) April release
Post by: bitsostring on April 15, 2019, 05:25:38 PM
Personal opinion: I have to say I do not like the new style of pop-up, with a really black background. (For comparison, the "Meteors" pop-up still has the original format.)

I have one (Moon info) in my original version setup, too. Tried to change the background colour today but the moonphase "myMoonlight" object has a black background as well. . .

Didn't really notice this at all in beta: I think I've only just realised what my "problem" is.
Title: Re: HWS-template (WD34 / weather34) April release
Post by: wvdkuil on April 16, 2019, 04:23:44 PM
Personal opinion: I have to say I do not like the new style of pop-up, with a really black background. (For comparison, the "Meteors" pop-up still has the original format.)

I have one (Moon info) in my original version setup, too. Tried to change the background colour today but the moonphase "myMoonlight" object has a black background as well. . .

Didn't really notice this at all in beta: I think I've only just realised what my "problem" is.
This will all be solved in the new css.
This version has a slight "off-black" #1A1C20 back-ground which is used for the fill of the moon back-ground also.
You can adapt it at line 221
Wim
Title: Re: HWS-template (WD34 / weather34) April release
Post by: bitsostring on April 16, 2019, 06:33:24 PM
This version has a slight "off-black" #1A1C20 back-ground which is used for the fill of the moon back-ground also.

Thanks, Wim. Looks much better alongside the other pop-ups in the original release  :)
Title: Re: HWS-template (WD34 / weather34) April release
Post by: NorCal Dan on April 16, 2019, 11:51:49 PM
Very nice, I like it!