Sandaysoft

Support forum for Cumulus weather station software
It is currently Wed May 22, 2013 5:05 pm
Please click here before posting. Help me to help you!
Useful Links: Cumulus FAQ • Enhancement requests • Wiki (documentation)
Please put your approximate location into your profile
Add your web site to the Cumulus user map
Vantage Pro2 users with firmware 3.00 should upgrade to fw 3.12 and Cumulus 1.9.4

All times are UTC




Post new topic Reply to topic  [ 77 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
Author Message
 Post subject: Re: JavaScript 'Viewer' of Cumulus generated NOAA style repo
PostPosted: Mon Jun 04, 2012 10:45 pm 
Offline
User avatar

Joined: Tue Dec 09, 2008 1:37 pm
Posts: 1846
Location: Dudley, West Midlands, UK
Weather Station: None !
Operating System: XP SP3
It's more devious than that !

If I look at my examples with IE8 the 'rules' are obeyed, but apparently (having done a google and reading M$ support) it's all down to the DOCTYPE declaration as to wether IE8 obeys the <pre> white-space and line return rules.

_________________
Image
......................Imagine, what you will KNOW tomorrow !


Top
 Profile  
 
 Post subject: Re: JavaScript 'Viewer' of Cumulus generated NOAA style repo
PostPosted: Sun Jul 01, 2012 2:45 pm 
Offline

Joined: Thu Dec 29, 2011 4:51 pm
Posts: 8
Location: Somerset, UK
Weather Station: Fine offset
Operating System: Windows 7
radelrama wrote:
Hi beetlejuice and thx a lot for that code!!

I'm using an non-php Webserver and included Cumulus with Steelgauges in my web page since very little time, I have only data for this month...
I was looking for a simple solution to display reports, downloaded thankfully and adapted your files according to your instructions, generated/copied reports month/year.
The reports page loads, counts files correctly, but stays on

"Looking for files reports/NOAAMO0312.txt

Report for ???? ???"


Other users web pages (with the exactly same code) DO display correctly, so shame on me: What am I doing wrong?
Didn't change any code... Tried renaming files for Jan/Feb reports to exist, doesn't change anything.

Well, tried the whole day and humbly asking for help...


Thx 4 help,
Radelrama


I have exactly the same problem. I have created and uploaded NOAA files for 2012, but get exactly the same issue as Radelrama describes above. Can anyone help? The URL to my NOAA page is http://deadwing.webplus.net/DW9194/NOAA-reports.html

Many thanks.


Top
 Profile  
 
 Post subject: Re: JavaScript 'Viewer' of Cumulus generated NOAA style repo
PostPosted: Sun Jul 01, 2012 11:53 pm 
Offline
User avatar

Joined: Tue Dec 09, 2008 1:37 pm
Posts: 1846
Location: Dudley, West Midlands, UK
Weather Station: None !
Operating System: XP SP3
For some reason your server returns a code 302 (found / temp redirect) which then for a browser (but not the code) goes to a 404 (file not found).

The 404s are the result of the code looking for all possible files from Jan start year to Dec this year.

Time to get your hands dirty !

Go into the .js file with notepad or similar, go down to

function betelLoader (url, nav, thisnum)

Look for this line:

Code:
    if(x.readyState == 4 && x.status == 400) { // file does not exist

and change it to:
Code:
    if(x.readyState == 4 && x.status >= 302) { // file does not exist

_________________
Image
......................Imagine, what you will KNOW tomorrow !


Top
 Profile  
 
 Post subject: Re: JavaScript 'Viewer' of Cumulus generated NOAA style repo
PostPosted: Mon Jul 02, 2012 11:30 am 
Offline

Joined: Thu Dec 29, 2011 4:51 pm
Posts: 8
Location: Somerset, UK
Weather Station: Fine offset
Operating System: Windows 7
beteljuice wrote:
For some reason your server returns a code 302 (found / temp redirect) which then for a browser (but not the code) goes to a 404 (file not found).

The 404s are the result of the code looking for all possible files from Jan start year to Dec this year.

Time to get your hands dirty !

Go into the .js file with notepad or similar, go down to

function betelLoader (url, nav, thisnum)

Look for this line:

Code:
    if(x.readyState == 4 && x.status == 400) { // file does not exist

and change it to:
Code:
    if(x.readyState == 4 && x.status >= 302) { // file does not exist


Many thanks for your quick response. I just changed the noaarep.js file per your instructions, and unfortunately it still does not work :( . Any ideas?

UPDATE: By the way - I put in dummy files for August through December and it works OK, so this can be a workaround if I can't get the script working. I have removed them for now, as it would be great if I could get it functioning correctly.


Top
 Profile  
 
 Post subject: Re: JavaScript 'Viewer' of Cumulus generated NOAA style repo
PostPosted: Mon Jul 02, 2012 12:31 pm 
Offline
User avatar

Joined: Tue Dec 09, 2008 1:37 pm
Posts: 1846
Location: Dudley, West Midlands, UK
Weather Station: None !
Operating System: XP SP3
I forgot about 304 being a valid entry, but thats not the problem !
The 302 redirects to a 404, but due to the way your server is set-up it is being considered 'cross-domain" so the fetch script folds :bash:

Try this fix instead:
Code:
if((x.readyState == 4 && x.status >= 400) || x.status == 302) { // file does not exist

If that doen't work it needs someone with a better understanding than me of ajax calls I'm afraid :oops:

_________________
Image
......................Imagine, what you will KNOW tomorrow !


Top
 Profile  
 
 Post subject: Re: JavaScript 'Viewer' of Cumulus generated NOAA style repo
PostPosted: Mon Jul 02, 2012 12:33 pm 
Offline
User avatar

Joined: Thu Jan 07, 2010 9:44 pm
Posts: 2512
Location: Wilmslow, Cheshire, UK
Weather Station: Davis VP2
Operating System: XP SP3, Win 7
The problem is the the XMLHttpRequest returns a status = 0 to the redirect (which is the 302). So I think you will have to test for that instead?

Code:
if(x.readyState === 4 && (x.status === 400 || x.status === 0)) { // file does not exist


Edit: added missing brace!

_________________
Mark
Wilmslow Astro Weather


Last edited by mcrossley on Mon Jul 02, 2012 6:07 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: JavaScript 'Viewer' of Cumulus generated NOAA style repo
PostPosted: Mon Jul 02, 2012 5:32 pm 
Offline

Joined: Thu Dec 29, 2011 4:51 pm
Posts: 8
Location: Somerset, UK
Weather Station: Fine offset
Operating System: Windows 7
mcrossley wrote:
The problem is the the XMLHttpRequest returns a status = 0 to the redirect (which is the 302). So I think you will have to test for that instead?

Code:
if(x.readyState === 4 && (x.status === 400 || x.status === 0) { // file does not exist


Many thanks to you and beteljuice - I have finally got it working!....once I had added the missing bracket ;)

Code:
if(x.readyState === 4 && (x.status === 400 || x.status === 0)) { // file does not exist


Thanks again for your quick responses.


Top
 Profile  
 
 Post subject: Re: JavaScript 'Viewer' of Cumulus generated NOAA style repo
PostPosted: Mon Jul 02, 2012 6:06 pm 
Offline
User avatar

Joined: Thu Jan 07, 2010 9:44 pm
Posts: 2512
Location: Wilmslow, Cheshire, UK
Weather Station: Davis VP2
Operating System: XP SP3, Win 7
hystrix wrote:
..once I had added the missing bracket ;)
Doh! :roll:

_________________
Mark
Wilmslow Astro Weather


Top
 Profile  
 
 Post subject: Re: JavaScript 'Viewer' of Cumulus generated NOAA style repo
PostPosted: Mon Jul 02, 2012 11:23 pm 
Offline
User avatar

Joined: Tue Dec 09, 2008 1:37 pm
Posts: 1846
Location: Dudley, West Midlands, UK
Weather Station: None !
Operating System: XP SP3
Thanks Mark, although I don't understand it :P

Edit: why === (logic test), and where's >= 400 gone ?

_________________
Image
......................Imagine, what you will KNOW tomorrow !


Top
 Profile  
 
 Post subject: Re: JavaScript 'Viewer' of Cumulus generated NOAA style repo
PostPosted: Tue Jul 03, 2012 7:53 am 
Offline
User avatar

Joined: Thu Jan 07, 2010 9:44 pm
Posts: 2512
Location: Wilmslow, Cheshire, UK
Weather Station: Davis VP2
Operating System: XP SP3, Win 7
beteljuice wrote:
Thanks Mark, although I don't understand it :P

Edit: why === (logic test)
Just good practice, you should always use the exactly equals === unless there is a good reason to use the 'equivalent' == comparison to avoid getting caught by auto-casting issues.
beteljuice wrote:
and where's >= 400 gone ?
I just took your original code
Code:
if(x.readyState == 4 && x.status == 400) { // file does not exist
and added in the check for a state=4 status=0. I haven't actually looked at your code, just what has been posted on this thread! :o
I guess that really should be >== 400, or even just replace the whole lot with
Code:
if(x.readyState === 4 && x.status !== 200)


I'm not sure if this is generally applicable or just to this hosting provider who is using a redirect for 404 errors - I've not seen that before.

_________________
Mark
Wilmslow Astro Weather


Top
 Profile  
 
 Post subject: Re: JavaScript 'Viewer' of Cumulus generated NOAA style repo
PostPosted: Sat Dec 22, 2012 10:03 pm 
Offline

Joined: Sat Dec 22, 2012 4:54 am
Posts: 6
Location: Fallon, Nevada, USA
Weather Station: Ambient Weather WS-2080
Operating System: Windows 7 Home Premium
Can anyone help me and tell me what I'm doing wrong........ why the NOAA report won't display in columns ?

http://webpages.charter.net/cgvad1/noaa.htm

Thanks,

Glenn


Top
 Profile  
 
 Post subject: Re: JavaScript 'Viewer' of Cumulus generated NOAA style repo
PostPosted: Sun Dec 23, 2012 12:41 am 
Offline
User avatar

Joined: Tue Dec 09, 2008 1:37 pm
Posts: 1846
Location: Dudley, West Midlands, UK
Weather Station: None !
Operating System: XP SP3
The only problem that I can see at this moment in time is that you 'neatened up' the code - which stuffs the first line in the <pre> section of the report ;)

Should be:
Code:
               <pre>
<!-- Report displays here --><span id="theReport"></span>
               </pre>

This bit <!-- Report displays here --><span id="theReport"></span> MUST be at the start of the line.

_________________
Image
......................Imagine, what you will KNOW tomorrow !


Top
 Profile  
 
 Post subject: Re: JavaScript 'Viewer' of Cumulus generated NOAA style repo
PostPosted: Mon Dec 24, 2012 1:02 am 
Offline

Joined: Sat Dec 22, 2012 4:54 am
Posts: 6
Location: Fallon, Nevada, USA
Weather Station: Ambient Weather WS-2080
Operating System: Windows 7 Home Premium
Thanks Beteljuice............ tried that and it moved the text all the way to the left but still no columns.............

http://webpages.charter.net/cgvad1/noaa.htm


Glenn


Top
 Profile  
 
 Post subject: Re: JavaScript 'Viewer' of Cumulus generated NOAA style repo
PostPosted: Mon Dec 24, 2012 1:13 am 
Offline
User avatar

Joined: Tue Dec 09, 2008 1:37 pm
Posts: 1846
Location: Dudley, West Midlands, UK
Weather Station: None !
Operating System: XP SP3
Not sure what you mean ?

There are no columns in the report itself - just character spacing.
Quote:
NOAA Style Reports:
The word Style is IMPORTANT - these are NOT NOAA reports !
It also means that the layout is 'fixed' and is meant to look like the old teleprinter output.
This is the way the software(s) have created them and is nothing to do with the script !
As far as I can see the report and it's nav menu look like everyones elses, are you seeing something different ?

_________________
Image
......................Imagine, what you will KNOW tomorrow !


Top
 Profile  
 
 Post subject: Re: JavaScript 'Viewer' of Cumulus generated NOAA style repo
PostPosted: Mon Dec 24, 2012 6:10 am 
Offline

Joined: Mon Aug 10, 2009 10:16 pm
Posts: 1793
Location: World...
Weather Station: No weather station
Operating System: No operating system
Glenn, the only problem I can see with your page is that the display of the report is too large (width wise) for the space available within the white portion of the page - you might have to adjust some of the CSS properties (unfortunately, I cannot guide you on that 'adventure' as I do not use the 'Sunny Weather' template set). May I suggest that you contact Jacques Desroches (the designer of those templates) for some assistance.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 77 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

All times are UTC


Who is online

Users browsing this forum: Bing [Bot], huggied, sfws and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group