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

Realtime and mysql download available.

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

Moderators: daj, TNETWeather

mproper23
Posts: 14
Joined: Fri Aug 31, 2012 6:52 am
Weather Station: WH1080
Operating System: 7
Location: Germany

Re: Realtime and mysql download available.

Postby mproper23 » Wed Sep 05, 2012 9:38 am

hi.

i use the actual version of cumulus.


here's a link to my realtime.txt
http://www.volksfrontderhorde.de/wetter/realtime.txt

Thank you for your time!

richardmhowell
Posts: 16
Joined: Thu Aug 30, 2012 12:35 pm
Weather Station: WH1090
Operating System: Windows XP SP3
Location: United Kingdom

Re: Realtime and mysql download available.

Postby richardmhowell » Thu Sep 06, 2012 9:30 am

mproper23 wrote:hi.

i use the actual version of cumulus.


here's a link to my realtime.txt
http://www.volksfrontderhorde.de/wetter/realtime.txt

Thank you for your time!


the problem you have is becuase your date is formatted like this 3.12.2012 the script is written to replace the date formatted like this 3/12/2012 see below;

Code: Select all

// This line should convert any date in the form dd/mm/yy to yy/mm/dd
   $linemysql = preg_replace('/(\d{2})\/(\d{2})\/(\d{2})/' , "\\3/\\2/\\1" , $linemysql)


I am not 100% sure how to change this without making the sky fall in, it might be easier to change your cumulus settings.

Not much use i know i will see if i can get it working for you

Rich

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

Re: Realtime and mysql download available.

Postby mcrossley » Thu Sep 06, 2012 1:27 pm

richardmhowell wrote:the problem you have is becuase your date is formatted like this 3.12.2012 the script is written to replace the date formatted like this 3/12/2012 see below;

Code: Select all

// This line should convert any date in the form dd/mm/yy to yy/mm/dd
   $linemysql = preg_replace('/(\d{2})\/(\d{2})\/(\d{2})/' , "\\3/\\2/\\1" , $linemysql)


I am not 100% sure how to change this without making the sky fall in, it might be easier to change your cumulus settings.

I think it would be...

Code: Select all

// This line should convert any date in the form dd/mm/yy to yy/mm/dd
   $linemysql = preg_replace('/(\d{2})\.(\d{2})\.(\d{2})/' , "\\3/\\2/\\1" , $linemysql)

But what do know about PHP! I'm assuming 'dot' is a special char that needs escaping.

User avatar
steve
Cumulus Author
Posts: 26495
Joined: Mon Jun 02, 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Realtime and mysql download available.

Postby steve » Thu Sep 06, 2012 1:41 pm

mcrossley wrote:I think it would be...
I thought the same, and posted it but then deleted it as I wasn't sure :oops:
Steve
-----
Hosting available for Cumulus web sites. See http://sandaysoft.com/forum/viewtopic.php?f=2&t=11876

Please read the posts in the Announcements section about the current status of Cumulus development since I have retired from my day job

gemini06720
Posts: 1700
Joined: Mon Aug 10, 2009 10:16 pm
Weather Station: No weather station
Operating System: No operating system
Location: World...

Re: Realtime and mysql download available.

Postby gemini06720 » Thu Sep 06, 2012 2:01 pm

The code seems to produce the same results with and without the '\' escaping character.

'mproper23' 'realtime.txt' file contains the date in the following format:

Code: Select all

06.09.12
with the escape character:

Code: Select all

$linemysql = preg_replace('/(\d{2})\.(\d{2})\.(\d{2})/' , "\\3/\\2/\\1" , $linemysql);
without the escape character:

Code: Select all

$linemysql = preg_replace('/(\d{2}).(\d{2}).(\d{2})/' , "\\3/\\2/\\1" , $linemysql);
produce:

Code: Select all

12/09/06

User avatar
steve
Cumulus Author
Posts: 26495
Joined: Mon Jun 02, 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Realtime and mysql download available.

Postby steve » Thu Sep 06, 2012 3:26 pm

Could it be that in the 'unescaped' case, the dot represents 'any character' and hence that form would be a good general case replacement for the original (as some people might have other date separators, e.g. "-")?
Steve
-----
Hosting available for Cumulus web sites. See http://sandaysoft.com/forum/viewtopic.php?f=2&t=11876

Please read the posts in the Announcements section about the current status of Cumulus development since I have retired from my day job

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

Re: Realtime and mysql download available.

Postby mcrossley » Thu Sep 06, 2012 3:47 pm

It does and it would Steve.

gemini06720
Posts: 1700
Joined: Mon Aug 10, 2009 10:16 pm
Weather Station: No weather station
Operating System: No operating system
Location: World...

Re: Realtime and mysql download available.

Postby gemini06720 » Fri Sep 07, 2012 9:38 am

I concur with Mark - I tried different separators and different combinations of separators and I always end up with the date in the 'yy/mm/dd' format.

Boym
Posts: 1
Joined: Fri Nov 06, 2009 5:39 pm
Weather Station: W-8681

Re: Realtime and mysql download available.

Postby Boym » Thu Oct 11, 2012 9:41 am

I made a little change in script.
Now he take a date in european format; 11.10.12 and I added new column in table.
Now script works.
You do not have the required permissions to view the files attached to this post.

SpeedyGJ
Posts: 13
Joined: Thu Mar 19, 2009 8:26 am
Weather Station: Davis Vantage Pro 2
Location: Holwerd / Netherlands
Contact:

Re: Realtime and mysql download available.

Postby SpeedyGJ » Fri Nov 16, 2012 5:46 pm

Hellow!

Setup OK
Real.php: File not found. Make sure you specified the correct path.
Database.php: Empty!

The pad to the realtime.txt is: /httpdocs/weer/realtime.txt but thats not OK!
Even as: http://www.weerstationdokkum.nl/weer/realtime.txt
I have everything try to make this working but nothing work!
What do i wrong?

Even the database.php is empty! Its this correct?

gemini06720
Posts: 1700
Joined: Mon Aug 10, 2009 10:16 pm
Weather Station: No weather station
Operating System: No operating system
Location: World...

Re: Realtime and mysql download available.

Postby gemini06720 » Fri Nov 16, 2012 10:19 pm

Are you using the scripts found in the 'realtime.zip' (attached to a message released on October 11, 2012?

If so, you need to make modification to (at least) the 'real.php' script.

Unfortunately, the script designer improperly 'assumed' that everyone was using the same date format as was used on his/her computer (poor programming)!

The date format produced by your Cumulus is in this format '16-11-12' - the script is expecting the date format to be in this format '16.11.12' - thus the script is producing an error message that, on most servers, will not be displayed.

To be able to process the 'realtime.txt' produced by your Cumulus, you need to change line 37 of 'real.php' from:

Code: Select all

$tmp_date = explode( ".", $linearray[0] );
to

Code: Select all

$tmp_date = explode( "-", $linearray[0] );
(the period has to be replaced with a dash)

I have just done some tests with the 3 scripts...
    - the 'sqlsetup.php' scripts did not create the database - it only created the 'realtime' table - you have to manually create the database using something such as phpMyAdmin on an Apache server;
    - the relative path to the 'realtime.txt' data files has to be well specified in the 'real.php' script - otherwise the error message "File not found. Make sure you specified the correct path." will be displayed;
    - the 'database.php' script, as specified, reads the last 288 entries of the database (according to the description in the script, the last 24 hours - that would mean one entry every 12 minutes) and produces 43 arrays, each array containing 288 values;
    - the 'database.php' script has not been designed to display anything - the arrays produced by the 'database.php' script have to be used within a web page template.

I do hope the information provided will help you resolve your situation... If not, just post again explaining as clearly as possible the actions you have taken and the results you are (or are not) obtaining.

inaciovieira
Posts: 54
Joined: Sun May 01, 2011 7:13 pm
Weather Station: Watson
Operating System: Windows 7
Location: Funchal

Re: Realtime and mysql download available.

Postby inaciovieira » Fri Nov 30, 2012 11:13 am

Can some one help me how to put the values in to a graphic. I have been around this and can´t do it.

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

Re: Realtime and mysql download available.

Postby mcrossley » Fri Nov 30, 2012 11:32 am

Ray, would it not be better to replace the explode() with a preg_split(), then t will work with any delimiters?

Code: Select all

$tmp_date = preg_split("/[^0-9]/", $linearray[0] );


Another observation about these scripts, would it not be better to keep the SQL table column names the same as the corresponding webtag names? This is what David did with the ImportCumulusFiles scripts in the Wiki (and I have extended), and I have also done with my realtime.txt log parser. Keeping consistency is usually a good thing.

In fact it may be useful to add this functionality to the already exisiting ImportCumulusFiles scripts? The script already handles the monthly and dayfile logs in a very similar manner.

To be honest I'd forgotten about this script when I wrote my realtimeLogParser :roll:

kc2kzz
Posts: 26
Joined: Tue Jul 31, 2012 2:08 pm
Weather Station: Davis Vantage Vue
Operating System: Windows 2012 Server
Location: United States
Contact:

Re: Realtime and mysql download available.

Postby kc2kzz » Tue Dec 04, 2012 2:38 pm

I just set this up and getting strange results.

The log shows that data is being inserted into the table:

121204 9:32:59 72 Connect cumulus@localhost on
72 Init DB weather
72 Query insert into realtime values('','12/12/04','09:32:44','50.4','96','49.3','0.0','0.0','46','0.00','0.15','30.270','NE','0','mph','F','in','in','1.6','+0.002','0.21','15.75','0.01','64.2','47','50.4','+0.8','50.4','09:32','42.7','00:12','2.0','08:55','5.0','08:13','30.280','00:10','30.256','05:33','1.9.3','1054','1.0','50.4','52.3','0','0.000','0','114','0.00','1','1','0','ESE','250','ft','50.3','0.0','238','0','')
72 Query insert into realtime values('','')
72 Quit

but I don't see any data in the database:
MySQL returned an empty result set (i.e. zero rows). ( Query took 0.0009 sec )
SELECT *
FROM `realtime`
LIMIT 0 , 30
Image

kc2kzz
Posts: 26
Joined: Tue Jul 31, 2012 2:08 pm
Weather Station: Davis Vantage Vue
Operating System: Windows 2012 Server
Location: United States
Contact:

Re: Realtime and mysql download available.

Postby kc2kzz » Tue Dec 04, 2012 3:20 pm

Debugging shows this:

$ php real.php
PHP Deprecated: Function split() is deprecated in /home/www/tmp/real.php on line 37

Deprecated: Function split() is deprecated in /home/www/tmp/real.php on line 37
PHP Notice: Undefined offset: 2 in /home/www/tmp/real.php on line 53

Notice: Undefined offset: 2 in /home/www/tmp/real.php on line 53
Image


Return to “Web site - General”

Who is online

Users browsing this forum: No registered users and 2 guests