Author Topic: Problems with Month and Year using Cumulus MX on Raspberry PI  (Read 16275 times)

Offline Andy9164

  • Full Member
  • ***
  • Posts: 87
    • Midlifedad
Hi everyone,

So firstly, I apologise for the length of the email but I tried to explain and give examples.

I recently moved from PC / Cumulus 1.9.4 to Raspberry PI / Cumulus MX and everything is working fine except the Month and Year pages do not display the recorded date / time correctly.

If you take a look here (website running Cumulus MX)  http://midlifedad.me.uk/weather/thismonth.php and then compare to my friends website here (running Cumulus 1.9.4) http://dal-y-gwynt.me.uk/weather/thismonth.php you will see the difference in the right hand column. Both sites are based on the original WB2 templates just wth a lot of modification but the php usage is taken directly from there.

I looked in to this and can see that the way the data is interpreted in the wt_dat_inc files and the results produced are different.

In 1.9.4 the line below in the monthly section

if (!is_numeric("<#MonthTempHD format='m'>")) $MonthTempHF = "<#MonthTempHD>"; else
$MonthTempHF = $pre_time.$MonthTempHT.$pre_date."<#MonthTempHD format='d'> ".$Tr_monthnames["<#MonthTempHD format='m'>"];

returns the following data

if (!is_numeric("7")) $MonthTempHF = "01 July"; else
$MonthTempHF = $pre_time.$MonthTempHT.$pre_date."1 ".$Tr_monthnames["7"];

In MX, the same line returns

if (!is_numeric("m")) $MonthTempHF = "01 July"; else
$MonthTempHF = $pre_time.$MonthTempHT.$pre_date."d ".$Tr_monthnames["m"];

So it does not appear to be receiving or translating the "7" correctly.

I know there are some format changes for date and time in MX and I have tried using "M", "MM", "MMMM" instead of "m" but cannot get any to work.

My undertsnading of the above process (given my very limited PHP knowledge) is that if #MonthTempHD is not a single number for the month then the MonthTempHF variable should be set to #MonthTempHD and if it is a single month number then the MonthTempHF variable should be a combination of $pre_time.$MonthTempHT.$pre_date."<#MonthTempHD format='d'> ".$Tr_monthnames["<#MonthTempHD format='m'>"]; to give something like at 00:07 on 06 July.

Because it never seems to receive a single numerical month, for example "7" it always sets it to MonthTempHD variable, in this case 01 July.

There is a different problem for Lowest Winchill Temperature where it shows "time" d, but it is probably related.

I dont know if this an MX issue or if it is to do with the way the PHP template is handling the formatting. I read on the Cumulus website about standard strings and custom strings when looking at date / time format but unfortunately that went way beyond my knowledge.

I also noticed in this post http://weatherbyyou.com/forum/index.php?topic=1254.0 that it is using MX and WB2 and has the same issue.

Any help or suggestions would be appreciated

Kind Regards
Andy

« Last Edit: July 06, 2015, 06:28:09 AM by Andy9164 »

Offline Andy9164

  • Full Member
  • ***
  • Posts: 87
    • Midlifedad
Re: Problems with Month and Year using Cumulus MX on Raspberry PI
« Reply #1 on: July 07, 2015, 05:11:11 PM »
Just a quick update. I am not sure why the if / else is used here. There may be a good reason and hopefully Jacques knows why and can let me know.

I am in the process of changing the thismonth_txt.php files to pull the required data from the wt_in_data standard variables and so far seems to be working ok.

Will attach files to the post when completed so that others can use if wanted.

Andy

Offline Mr.Meteo

  • Administrator
  • Hero Member
  • *****
  • Posts: 1120
    • http://www.meteostours.ca
Re: Problems with Month and Year using Cumulus MX on Raspberry PI
« Reply #2 on: July 08, 2015, 08:33:17 PM »
Hi Andy,

Sorry, I'm about to move my (4) sites to better provider,
so, I'm "far a bit". I've bought a Pi recently, but had no time
to play with it!

As I see there is problem with date, maybe something
special with "locale" (in Linux).

Thanks to share your work!

Regards,
Jacques

Please, consider supporting this site 

Offline Andy9164

  • Full Member
  • ***
  • Posts: 87
    • Midlifedad
Re: Problems with Month and Year using Cumulus MX on Raspberry PI
« Reply #3 on: July 09, 2015, 03:05:19 AM »
Thanks Jacques,

Good suggestion about the locale on the Raspberry. I dont have MX running on a PC so.....

To the community,

Do any of you have Cumulus MX running on a PC with Windows, if so, please paste a link to your site in this post so I can see if it has the same issue.

Thanks
Andy

Offline Andy9164

  • Full Member
  • ***
  • Posts: 87
    • Midlifedad
Re: Problems with Month and Year using Cumulus MX on Raspberry PI
« Reply #4 on: July 12, 2015, 04:48:35 PM »
So just a quick update.

I managed to run MX on a PC and got the same results, so its not a locale problem.

However, I did find the answer and it is to do with the way the date and time are formatted in Cumulus MX as some changes had to be made as it now uses .NET as its code. For example, 'm' is now minutes and not month and 'M' is now month. Also ' now needs to be " for the format string.

I did stumble on one small issue where "M" does not return the month as single number i.e. "7" so have asked in the MX forum at Sandaysoft. The return of a single digit for "month" is needed for some of the arrays in selecting the month name amongst other things. (I have learnt a lot in 2 years)

Once I get this last little problem solved I will post again and advise what needs to be changed.

Jacques,
I know you are busy moving to a new host, but I think I also found some small errors in the download of Weather Blues V2.2b (date of 2014-02-14), I hope you do not mind me telling you.

1) In monthlyrecords.php you "include (wt_months_inc.php) should this be wt_month_inc.php
2) There is no multirecords.txt I dont know if this is meant to be this way or if that is old and it is me that is behind.

Keep you posted.

Andy


Offline Andy9164

  • Full Member
  • ***
  • Posts: 87
    • Midlifedad
Re: Problems with Month and Year using Cumulus MX on Raspberry PI
« Reply #5 on: July 14, 2015, 11:48:43 AM »
So now finally I have this solved. I would like to thank Steve and Mark at the Sandaysoft forum for helping me with the last piece of the jigsaw.

This applies to users of Cumulus MX only. It does not affect those using Cumulus 1.x.x (e.g.  Version 1.9.4)

There were some changes made in Cumulus MX to the date and time formatting due to .NET being used as opposed to Delphi. From the Sandaysoft Wiki:
 â€œThe differences come about because Delphi is case-insensitive, and .Net is case sensitive, so .Net can use upper and lower case for different items, where Delphi has to use different letters.”

Details of the changes can be found here
http://wiki.sandaysoft.com/a/Webtag#Differences_for_Webtags_in_MX_builds

As you will see by reading the above link a lot of changes have had to be made and this affects the WB2 Monthly, Yearly, Records and All Time records pages.

I have attached the modified wt_inc_data.php, wt_month_inc_data, wt_inc_intl.php and wt_month_intl.php files with the new formats.  I have tested these on my own website and also a website I set up using the standard Weather Blues template that I downloaded from the downloads section here at the weekend. I suspect that the changes will also affect other WeatheByYou templates that use date and time formatting in them but as I don’t use those templates I will leave it up to you to check but the same rules will apply.

These files need to be placed in the correct place in you Cumulus installation.

PLEASE ENSURE YOU MAKE A COPY OF YOUR EXISTING FILES BEFORE CHANGING

I have also attached a document which tries to explain the changes and what changes need to be made in each section of the files in case your templates are slightly different from the originals.

The attached files produce the time and date format as hh:mm dd mmmm yyyy  (at 16:01 on 01 July 2015)  which is slightly different to the original WB2 files. If you want to change them there is an explanation of what you can change and how to do this using the new format selectors in the attached document.

To see how the unmodified files look please go to:
http://midlifedad.me.uk/WB2_unmodified

and  to see how the modified files look please go to:
http://midlifedad.me.uk/WB2_modified

You should be able to see the difference between the Month, Year, Monthly Records and All Time Records pages. (Under the History drop down menu.)

Any questions or problems please post and I will try and help, although I am not an expert.

Andy

Edit: Have further modified the files due to the Webcam tag being encapsulated in double quotation marks " when it should be in single ones ' .Caused a potential php issue - see post on Cumulus forum.

http://sandaysoft.com/forum/viewtopic.php?f=27&t=13975
« Last Edit: July 18, 2015, 04:18:59 PM by Andy9164 »

Offline Mr.Meteo

  • Administrator
  • Hero Member
  • *****
  • Posts: 1120
    • http://www.meteostours.ca
Re: Problems with Month and Year using Cumulus MX on Raspberry PI
« Reply #6 on: July 14, 2015, 05:34:37 PM »
Hi Andy,

1) wt_months_inc.php was a try to avoid replacing original file with
processed one, but seems to confuse. (I was thinking of using "T" as Cumulus
filenames eg. indexT.htm, but major change for a small benefit)

2)multirecords_txt is used only with "1 line menu" templates. Weather Blues v2
use pull-down menu, then it doesn't merge monthly and all time records.
If you found any error do not hesitate to share it, templates are always to be enhanced!  8)

Regards,
Jacques
Please, consider supporting this site 

Offline Andy9164

  • Full Member
  • ***
  • Posts: 87
    • Midlifedad
Re: Problems with Month and Year using Cumulus MX on Raspberry PI
« Reply #7 on: July 15, 2015, 04:00:16 AM »
Thanks for the explanation Jacques. I dont use drop down menu's so this explains to me why I use multirecord.

Andy

Offline Geoff Morris

  • Jr. Member
  • **
  • Posts: 14
    • Shotton Weather
Re: Problems with Month and Year using Cumulus MX on Raspberry PI
« Reply #8 on: July 20, 2015, 07:28:55 AM »
Hello Andy...........I have just got MX going on a Pi, and read your message with interest. I assume that as Cumulus MX runs under Mono on linux, it has the same functionality/facilitys as .NET under windows. That said, the only wrong date/time I have on my site, is the "All time records" under History. This month and This year appear fine to me, both before and after using you modified wt_data_inc file. (The only one cumulus processes)

I will spend some more time to try and get my head round what is going on, and what needs to change. My brain cells are very old, and are slow on the uptake..!!!

Many thanks for you work on this..............Geoff

http://gw3atz.co.uk/shotton_weather/index.php



Offline Geoff Morris

  • Jr. Member
  • **
  • Posts: 14
    • Shotton Weather
Re: Problems with Month and Year using Cumulus MX on Raspberry PI
« Reply #9 on: July 20, 2015, 08:07:24 AM »
Update...........It may well be that when I thought I was using Andy's modified file, in fact I wasn't..!! When I got my act together, and finally was using it, the result was that it didn't work, just created a server error. No web site shown......

It may be that its a php version issue (for me) on the server at my ISP, but can't see any reason why the changes made by Andy would cause that.  Will go and check....Good job I am retired, and nothing else to do........

Cheers................Geoff

Offline Andy9164

  • Full Member
  • ***
  • Posts: 87
    • Midlifedad
Re: Problems with Month and Year using Cumulus MX on Raspberry PI
« Reply #10 on: July 20, 2015, 09:12:30 AM »
Hi Geoff,
Sorry to hear the files didn't work. However, I updated them yesterday as I had seen a similar problem a while ago and made a slight change based on some advice I was given in the Cumulus forum. Please see here.

http://sandaysoft.com/forum/viewtopic.php?f=27&t=13975

The files I re-posted (about 5 messages above) should be the corrected ones. If you open the wt_data_inc file and / or wt_data_intl files and scroll to the "Others" section and look for this variable:

$webcam = '<#webcam>';

if it is as above then this is the correct file

if it is as this $webcam = "<#webcam>"; then this can cause a problem.

The difference is single quotes (') and double quotes (") plus a minor issue with Cumulus. It needs to be single quotes.

Once changed and uploaded back to your MX installation you will need to wait for the next "upload" for it to change on your website and then you will need to refresh your screen, so if you update your website every 10 minutes you need to wait for that period before refreshing your browser to see if it has worked.

Let me know how you get on and if you still have a problem.

Andy

« Last Edit: July 20, 2015, 09:44:05 AM by Andy9164 »

Offline Geoff Morris

  • Jr. Member
  • **
  • Posts: 14
    • Shotton Weather
Re: Problems with Month and Year using Cumulus MX on Raspberry PI
« Reply #11 on: July 21, 2015, 04:28:42 AM »
To give an update to a small problem. It transpires that I am running version 2.0 of weather blues (php). The wt_data_inc file that Andy has been sorting is from version 2.2b. Putting that into my system crashes the remote web server. The latest file is 71 lines longer, so I assume other changes have taken place with other files/templates in the latest version.

As it took me a long time to get my site to how I wanted it, for now I will leave the incorrect display of "all time records" as it is, and get back to it when I have more time.

Thanks to Andy for his help with this.

Cheers............Geoff

http://gw3atz.co.uk/shotton_weather/index.php

Offline bennymeteo

  • New member
  • *
  • Posts: 3
Re: Problems with Month and Year using Cumulus MX on Raspberry PI
« Reply #12 on: October 10, 2016, 01:25:04 AM »
Good morning,
I also have problems gives me this error
I do not understand English very well I'm using google translator to understand this topic
I also use CumulusMX of raspberry PI3 B

Buon Giorno,

Anhce io ho problemi mi da questo errore
Non capisco molto bene inglese sto usando google traduttore per capire questo topic
Uso anche io CumulusMX su RaspBerry PI3 B


Parse error: syntax error, unexpected 'www' (T_STRING) in /web/htdocs/www.miosito.com/home/meteo/stazione1/wt_data_inc.php on line 595

How do I resolve I have to download wt_data inc.php changed if you where?

Thank you

Come risolvo devo scaricare wt_data_inc.php modificato se si dove ?

Grazie

Offline Mr.Meteo

  • Administrator
  • Hero Member
  • *****
  • Posts: 1120
    • http://www.meteostours.ca
Re: Problems with Month and Year using Cumulus MX on Raspberry PI
« Reply #13 on: October 13, 2016, 11:56:07 AM »
Hi Benny,

There is no "www" on line #595!

Could you look at that line and copy it here?

Regards,
Jacques
« Last Edit: October 14, 2016, 11:52:56 AM by Mr.Meteo »
Please, consider supporting this site 

Offline bennymeteo

  • New member
  • *
  • Posts: 3
Re: Problems with Month and Year using Cumulus MX on Raspberry PI
« Reply #14 on: October 19, 2016, 04:57:55 AM »
There is no "www" on line #595!
Could you look at that line and copy it here?
Nella Linea 595 del mio wt_data_inc.php ho:
$MonthDewPointHD = "07 October";