Page 4 of 4

Re: Default Cumulus web page working in PHP using realtime.t

Posted: Wed 09 Feb 2011 8:16 pm
by daj
Synewave wrote:...David, I am wondering the reason why you coded this line?
It was a basic attempt at catching the error.

What I am saying is if the file name for realtime.txt is returned in the data it reads from the server then assume an error, if not (i.e. -1) then we have some good data.

For me, when it failed to read realtime.txt my server returned an error saying it "could not find the file realtime.txt" so I was checking to see if that is what it returned.

Does that make sense? :?

Re: Default Cumulus web page working in PHP using realtime.t

Posted: Wed 09 Feb 2011 9:51 pm
by Synewave
daj wrote:
Synewave wrote:...David, I am wondering the reason why you coded this line?
It was a basic attempt at catching the error.

What I am saying is if the file name for realtime.txt is returned in the data it reads from the server then assume an error, if not (i.e. -1) then we have some good data.

For me, when it failed to read realtime.txt my server returned an error saying it "could not find the file realtime.txt" so I was checking to see if that is what it returned.

Does that make sense? :?
Yes thanks, it all makes sense, but that line of code doesn't seem to rectify the problem for me. I'll give it a few days and let you know how it goes without that line.

Re: Default Cumulus web page working in PHP using realtime.t

Posted: Wed 09 Feb 2011 10:26 pm
by daj
I guess it depends what your own server returns as the error, which I think is caused when Cumulus is uploading the file AND the Ajax call is trying to read it

Re: Default Cumulus web page working in PHP using realtime.t

Posted: Wed 09 Feb 2011 10:44 pm
by mcrossley
After you do your .split() on the returned text, check the array length? Too short or too long, then retry the fetch?

Re: Default Cumulus web page working in PHP using realtime.t

Posted: Thu 10 Feb 2011 12:44 am
by beteljuice
That's the beteljuice way - although the length of the array keeps growing (and will different between 190 stable and 191 beta)

Code: Select all

    var currdat = x.responseText.replace(/\r\n/g, "");	// this gets rid of any line ending
   	var currdat = currdat.split(' ');	// populate the array

	// now make sure we got a realtime.txt with minimum content 
	// If we have a valid currdat file AND updates is < maxupdates
	if(currdat[47] && ( updates <= maxupdates || maxupdates > 0  ) ) {
Simply bombs out to my 'normal' 10s cycle which I deemed acceptable, especially as using ftp rename seemed to fix any conflict problems I may have had, which were mostly with the 'banner'

Re: Default Cumulus web page working in PHP using realtime.t

Posted: Thu 10 Feb 2011 10:03 am
by tjaliwalpa
While all of this has been going on I have set up my main data page (Current Conditions) to use the realtime data at a refesh of 15sec (also my realtime upload). The script (based on Davids wconsole) seems to work OK. I've added a few bits for trends (pressure, temp)and beaufort decriptions. I also use the script to feed my title summary (used to be a scrolling marquee but I got sick of it).

I shall work on expanding the current conditions a little to take full advantage of the new fields in realtime.txt as it currently exists (1.9.1).

Re: Default Cumulus web page working in PHP using realtime.t

Posted: Thu 10 Feb 2011 10:36 am
by daj
Bob,

On a side note, I see from your site that you have a FineOffset type station -- why update every 15 seconds? The FO stations only refresh every 48 seconds so there is a lot of wasted processing going on.

(I have my 'hosting' hat on at the moment -- sending an update every 15 second to the web is 5760 updates per day, tow thirds of which is duplicate data. Granted it is small amounts of data, but....)

Just an observation.

Re: Default Cumulus web page working in PHP using realtime.t

Posted: Thu 10 Feb 2011 11:00 am
by tjaliwalpa
daj wrote:Bob,

On a side note, I see from your site that you have a FineOffset type station -- why update every 15 seconds? The FO stations only refresh every 48 seconds so there is a lot of wasted processing going on.

(I have my 'hosting' hat on at the moment -- sending an update every 15 second to the web is 5760 updates per day, tow thirds of which is duplicate data. Granted it is small amounts of data, but....)

Just an observation.
Yes, wondered about that. What would you suggest?

Re: Default Cumulus web page working in PHP using realtime.t

Posted: Thu 10 Feb 2011 11:14 am
by Synewave
I have mine set to 48 secs upload interval, works fine.

Re: Default Cumulus web page working in PHP using realtime.t

Posted: Thu 10 Feb 2011 11:44 am
by tjaliwalpa
Synewave wrote:I have mine set to 48 secs upload interval, works fine.
Shall give that a try. I guess the most the data can be out od sync is 47 seconds.

Re: Default Cumulus web page working in PHP using realtime.t

Posted: Thu 10 Feb 2011 12:01 pm
by beteljuice
Keep your Ajax call at approx. 15s - think about it ;)

Re: Default Cumulus web page working in PHP using realtime.t

Posted: Thu 10 Feb 2011 12:16 pm
by Synewave
beteljuice wrote:Keep your Ajax call at approx. 15s - think about it ;)
I have that set to 15 secs too. Seems to be the optimum to avoid 'clashes'.

Re: Default Cumulus web page working in PHP using realtime.t

Posted: Thu 10 Feb 2011 2:32 pm
by daj
Yes, keep your Ajax calls at 15 seconds so it will pick up any updates regularly. My original point was more to do with why your upload from Cumulus every 15 seconds