Page 1 of 1

Cumulus to clientrawhour.txt gives zero length file

Posted: Tue 17 Sep 2013 9:42 pm
by Dinant
Hello Steve,

I want to make a file "clientrawhour.txt" which can be used with WU-Graphs v 1.8.0 from Radomir Luza to graph the last hour. Normally the file is being produced by Weather Display. I don't like WD, so I want to use Cumulus. I have made a clientrawhourT.txt file which is about 14K in size and have added the file to the internet files section. The file which being produced after the web tags are substituted has a size of zero! I think I know why. The clientrawhourT.txt is 14k (more than 500 web tags) and it contains only one line!
I am using version 1.9.4 build 1082. The file clientrawhourT.txt is being attached.

Dinant

Re: Cumulus to clientrawhour.txt gives zero length file

Posted: Tue 17 Sep 2013 10:03 pm
by beteljuice
Have you tried just the first few entries to make sure you have your file settings and tick boxes all correct ?

Re: Cumulus to clientrawhour.txt gives zero length file

Posted: Wed 18 Sep 2013 6:53 am
by steve
Dinant wrote: I think I know why. The clientrawhourT.txt is 14k (more than 500 web tags) and it contains only one line!
Yes, the parser which the web tags code uses can't cope with a line 14k characters long; there will be an error message to this effect in the diags file. I don't actually know what the limit is, sorry, but I suspect it is a lot less than 14k, possibly as low as 255.

Re: Cumulus to clientrawhour.txt gives zero length file

Posted: Wed 18 Sep 2013 11:46 am
by beteljuice
Will the graphics prog accept a line delimited files ?

As you are having to imitate a WD file there must be an interface which is parsing it to give the graphics prog what it really wants.

Re: Cumulus to clientrawhour.txt gives zero length file

Posted: Wed 18 Sep 2013 2:48 pm
by mcrossley
The realtimegaugesT.txt file worked OK with a single line slightly smaller than 2K characters.

Re: Cumulus to clientrawhour.txt gives zero length file

Posted: Wed 18 Sep 2013 2:59 pm
by nitrx
Is rapidfire added to the logs on Wundergroound in that case you can use v1.79 of the graphs my daily graph is now updatet every 15 minutes http://www.apeldoorn.tk/weer/wugraphs.php

Re: Cumulus to clientrawhour.txt gives zero length file

Posted: Wed 18 Sep 2013 4:38 pm
by Dinant
beteljuice wrote:Have you tried just the first few entries to make sure you have your file settings and tick boxes all correct ?

Yes, if I replace al spaces between the web tags by CR+LF, so everything web tag is on a separate line then it works fine. But that file isn't a clientrawhour.txt file as being produced by WD. As a result the hour tab in the WU-Graphs v 1.8.0 doesn't work.

Dinant

Re: Cumulus to clientrawhour.txt gives zero length file

Posted: Wed 18 Sep 2013 4:45 pm
by Dinant
mcrossley wrote:The realtimegaugesT.txt file worked OK with a single line slightly smaller than 2K characters.
I am also using the realtimegaugesT.txt file. That file is in JSON format and about 2000 bytes and the longest line is about 46 bytes. After every comma in the file you may or may not enter a CR+LF. That's why this file is not a problem.

Dinant

Re: Cumulus to clientrawhour.txt gives zero length file

Posted: Wed 18 Sep 2013 5:00 pm
by mcrossley
Dinant wrote:
mcrossley wrote:The realtimegaugesT.txt file worked OK with a single line slightly smaller than 2K characters.
I am also using the realtimegaugesT.txt file. That file is in JSON format and about 2000 bytes and the longest line is about 46 bytes. After every comma in the file you may or may not enter a CR+LF. That's why this file is not a problem.

Dinant
Yes but older versions which were slightly shorter were formatted as a single line, I only made it multi-line for readability in later versions, not because Cumulus couldn't parse it.

Re: Cumulus to clientrawhour.txt gives zero length file

Posted: Wed 18 Sep 2013 5:17 pm
by Dinant
steve wrote:
Dinant wrote: I think I know why. The clientrawhourT.txt is 14k (more than 500 web tags) and it contains only one line!
Yes, the parser which the web tags code uses can't cope with a line 14k characters long; there will be an error message to this effect in the diags file. I don't actually know what the limit is, sorry, but I suspect it is a lot less than 14k, possibly as low as 255.
Hello Steve,

I have a question:
If I replace the space between the webtags by CR+LF (so one web tag on every line).
Is there a trick to concat the lines of the clientrawhour.txt file just before sending to the web?

Dinant

Re: Cumulus to clientrawhour.txt gives zero length file

Posted: Wed 18 Sep 2013 5:20 pm
by steve
Dinant wrote:If I replace the space between the webtags by CR+LF (so one web tag on every line).
Is there a trick to concat the lines of the clientrawhour.txt file just before sending to the web?
I have no idea, but someone else might.

Re: Cumulus to clientrawhour.txt gives zero length file

Posted: Wed 18 Sep 2013 7:10 pm
by beteljuice
WU-Graphs v 1.8.0 doesn't work.
... but as I suggested, modify the code to accept the input you are giving. :o

Re: Cumulus to clientrawhour.txt gives zero length file

Posted: Wed 18 Sep 2013 11:02 pm
by BigOkie
steve wrote:
Dinant wrote:If I replace the space between the webtags by CR+LF (so one web tag on every line).
Is there a trick to concat the lines of the clientrawhour.txt file just before sending to the web?
I have no idea, but someone else might.
Here's a vbscript you might use

Open notepad and copy/paste the following:

Code: Select all

Const ForReading = 1
Const ForWriting = 2

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\temp\clientrawday.txt", ForReading)

strText = objFile.ReadAll
objFile.Close
strNewText = Replace(strText, vbCrLf, " ")

Set objFile = objFSO.OpenTextFile("C:\temp\clientrawday.txt", ForWriting)
objFile.WriteLine strNewText
objFile.Close
Obviously you need to modify the two filename variables. In this example, the source file overwrites the original. You invoke it by calling from the command line..

cscript script.vbs (or whatever name you wish to give the VBscript file).

You could also call this from task scheduler.

Re: Cumulus to clientrawhour.txt gives zero length file

Posted: Thu 19 Sep 2013 4:28 pm
by Dinant
beteljuice wrote:
WU-Graphs v 1.8.0 doesn't work.
... but as I suggested, modify the code to accept the input you are giving. :o
That's a good suggestion and probably the quickest way to solve this problem!

I have examined the WU-Graphs v 1.8.0 php code.
On line 130 of WUG-inc-hour.php it says:
// extract data
$clRawData = @file_get_contents($clientRawHpath.'clientrawhour.txt');
// data to array
$Data = explode(' ', $clRawData);

I have change this into:
// extract data
$clRawData = @file_get_contents($clientRawHpath.'clientrawhour.txt');
// data to array
$Data = explode(chr(10), $clRawData);

Now the hour graphs are shown correctly with a clientrawhour.txt file generated by Cumulus.
See http://www.weerstationmarkelo.nl/grafieken/wu-grafieken

Thanks for your help.

Dinant