Sandaysoft

Support forum for Cumulus weather station software
It is currently Wed May 22, 2013 6:45 am
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  [ 145 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9, 10  Next
Author Message
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Fri Feb 17, 2012 10:59 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
Now available an alternative stylesheet for use with 'include's which has the button highlights INSIDE the buttons. Useful for pages with a dark background.

Attachment:
noaarep_alt.txt


You do not have the required permissions to view the files attached to this post.

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


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Mon Feb 20, 2012 9:52 pm 
Offline

Joined: Tue Jan 03, 2012 6:14 pm
Posts: 11
Location: Reading, Berkshire
Weather Station: Maplin N96FY
Operating System: Windows Vista
Anybody know what the following warning is telling me?:

Warning: putenv(): Safe Mode warning: Cannot set environment variable 'TZ' - it's not in the allowed list in /tier-11/pwpstore6/10/shinfieldriseweather/htdocs/NOAA-reports.php on line 160

It appears on my NOAA style reports.

I thank you in advance for your assistance in this matter

_________________
Image
http://www.shinfieldriseweather.webspac ... nmedia.com


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Mon Feb 20, 2012 10:05 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
Yes, if you are running PHP in "safe mode" (as I do), then only certain commands are allowed to 'write' data to the host. Setting the TZ is not allowed. I think there is a later version of the script that fixes this.

_________________
Mark
Wilmslow Astro Weather


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Mon Feb 20, 2012 10:22 pm 
Offline

Joined: Tue Jan 03, 2012 6:14 pm
Posts: 11
Location: Reading, Berkshire
Weather Station: Maplin N96FY
Operating System: Windows Vista
Thanks for that - I did not drill down this thread far enough - I will comment out and that should fix.

Much appreciated :D

_________________
Image
http://www.shinfieldriseweather.webspac ... nmedia.com


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Wed Feb 22, 2012 1:47 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
Tip: If you have existing NOAA style reports from other softwares, then you should be able to copy them to the NOAA-reports directory and as long as you rename them in the Cumulus format they should be found and displayed OK ;)

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


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Sat Mar 10, 2012 9:33 am 
Offline
User avatar

Joined: Sun Jul 03, 2011 6:23 pm
Posts: 324
Location: Eastleigh, Hampshire, UK
Weather Station: Davis VP2 - 24hr FARS
Operating System: Windows 7 - 64 bit
Just wanted to say thanks to beteljuice for all the work he's put into this.

Finally got round to adding it to my site this morning. Took a few minutes and worked first time :) .

I'll try the alt.css later.

Duke

_________________
Duke

Nightingale Weather PHP
Eastleigh, Hampshire, UK


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Sat Mar 10, 2012 5:31 pm 
Offline
User avatar

Joined: Sun Jul 03, 2011 6:23 pm
Posts: 324
Location: Eastleigh, Hampshire, UK
Weather Station: Davis VP2 - 24hr FARS
Operating System: Windows 7 - 64 bit
Just looked at my NOAA page and there is a problem displaying the degree sign:

Quote:
N 50� 57' 58" Lon: W 001� 22' 51"

Temperature (�C),


Nightingale NOAA

What have I failed to do correctly?

Duke

_________________
Duke

Nightingale Weather PHP
Eastleigh, Hampshire, UK


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Sun Mar 11, 2012 12:19 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
I'm glad you see that as well, I'm fed up of people telling me I'm seeing things when I get funny characters on their sites (Including ordinary html) !

The unproven response is the wrong charset is applied to the format in which the file was written and / or saved in.

The report itself is created by Cumulus, Notepad++ says "ANSI as UTF-8"
Notepad++ reports your page as "ANSI as UTF-8", and is declared as UTF-8 in it's META data.

Interestingly, in my browser, your .txt reports show the black diamond, but not in notepad++, the .txt reports on my site do not show the black diamond in my browser :bash:

Time for an experiment :shock:

Using notepad I want you to modify NOAA-reports.php :?
MAKE A BACKUP OF IT FIRST !

Go down to about line 430 and change from this:
Code:

if($rpt){
   echo "<pre>\n";
   echo preg_replace('|<|Uis','&lt;',$rpt);
   echo "</pre>\n";
}
echo "</div> <!-- END noaa_rep_container -->\n";
To this:
Code:

if($rpt){

// NASTY work-around, the ONLY way I find black diamond question mark (or deg character)
   $checkIt = explode("(", $rpt);
   $dodgy = substr($checkIt[1],0 , 1);

// the ONLY way I can replace when black diamond (unconditionally) to &deg
   $rpt = str_replace($dodgy,'&deg;',$rpt);
// END nasty work around


   echo "<pre>\n";
   echo preg_replace('|<|Uis','&lt;',$rpt);
   echo "</pre>\n";
}
echo "</div> <!-- END noaa_rep_container -->\n";
Caution: I can't find the real code for the black diamond anywhere :( This will replace ALL instances of the 'black diamond' with ° (degree symbol)

Edit: a couple of silly errors removed.

Upload the modified file to your site and let's see what happens :roll: (Edit: It works !)

If anyone has a definitive answer as to why this kind of problem occurs and how to prevent it in the first place .....

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


Last edited by beteljuice on Sun Mar 11, 2012 3:47 pm, edited 4 times in total.

Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Sun Mar 11, 2012 5:43 am 
Offline
User avatar

Joined: Sun Jul 03, 2011 6:23 pm
Posts: 324
Location: Eastleigh, Hampshire, UK
Weather Station: Davis VP2 - 24hr FARS
Operating System: Windows 7 - 64 bit
Thanks for the quick reply. Unfortunately that did not resolve it.

The result of that was a one line page in XAMPP:

Quote:
Parse error: syntax error, unexpected T_VAR in W:\htdocs\weather\NOAA-reports.php on line 434


and live:

Quote:
Parse error: syntax error, unexpected T_VAR in /home/night239/public_html/weather/NOAA-reports.php on line 434


Duke

_________________
Duke

Nightingale Weather PHP
Eastleigh, Hampshire, UK


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Sun Mar 11, 2012 6:01 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
Sorry - I got a bit of a JavaScript head on, the two var shouldn't be there.

Previous post edited - try that.

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


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Sun Mar 11, 2012 6:11 am 
Offline
User avatar

Joined: Sun Jul 03, 2011 6:23 pm
Posts: 324
Location: Eastleigh, Hampshire, UK
Weather Station: Davis VP2 - 24hr FARS
Operating System: Windows 7 - 64 bit
beteljuice wrote:
Sorry - I got a bit of a JavaScript head on.

:lol:

How's it look for you? Nightingale NOAA

All good here. thank you :D

Duke

_________________
Duke

Nightingale Weather PHP
Eastleigh, Hampshire, UK


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Sun Mar 11, 2012 9:30 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
I 'think' this may be due to the page construction.

Duke is using a XHTML page, and has included a header META tag to specify the character set encoding, but no xml tag. The standard says...

Quote:
Historically, the character encoding of an HTML document is either specified by a web server via the charset parameter of the HTTP Content-Type header, or via a meta element in the document itself. In an XML document, the character encoding of the document is specified on the XML declaration (e.g., <?xml version="1.0" encoding="EUC-JP"?>). In order to portably present documents with specific character encodings, the best approach is to ensure that the web server provides the correct headers. If this is not possible, a document that wants to set its character encoding explicitly must include both the XML declaration an encoding declaration and a meta http-equiv statement (e.g., <meta http-equiv="Content-type" content="text/html; charset=EUC-JP" />). In XHTML-conforming user agents, the value of the encoding declaration of the XML declaration takes precedence.

Note: be aware that if a document must include the character encoding declaration in a meta http-equiv statement, that document may always be interpreted by HTTP servers and/or user agents as being of the internet media type defined in that statement. If a document is to be served as multiple media types, the HTTP server must be used to set the encoding of the document.

Dukes web server is not providing any character encoding information in the header.
Code:
RESPONSE HEADERS
Connection:Keep-Alive
Content-Type:text/html
Date:Sun, 11 Mar 2012 09:07:28 GMT
Keep-Alive:timeout=2, max=100
Server:Apache
Transfer-Encoding:chunked
X-Powered-By:PHP/5.3.10
Note, no charset after 'text/html'. So I think this statement applies
Quote:
If this is not possible [server providing encoding in the header], a document that wants to set its character encoding explicitly must include both the XML declaration an encoding declaration and a meta http-equiv statement

But Dukes page does not have an <xml> declaration.

It would be interesting to know if that fixed the problem without beteljuices workaround. These encoding issues keep popping up.

_________________
Mark
Wilmslow Astro Weather


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Sun Mar 11, 2012 1:06 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
Thank you both - a (sort of) result :clap:

First post has been updated to include link to work-around.

@ Mark, I remember when text was easy (single type face / size and with bold / underline and only in 'English' :lol:

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


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Sun Mar 11, 2012 5:15 pm 
Offline
User avatar

Joined: Sun Jul 03, 2011 6:23 pm
Posts: 324
Location: Eastleigh, Hampshire, UK
Weather Station: Davis VP2 - 24hr FARS
Operating System: Windows 7 - 64 bit
Mark, I will willingly try what you suggest. But, being a novice, how exactly do I put the "XML" in?

Currently
Quote:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>


Duke

_________________
Duke

Nightingale Weather PHP
Eastleigh, Hampshire, UK


Top
 Profile  
 
 Post subject: Re: PHP Web 'viewer' for Cumulus NOAA Style reports
PostPosted: Mon Mar 12, 2012 10:29 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
I'm no expert either, but I think the top of you page needs to look like this:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
...


The standard also says:
Quote:
An XML declaration is not required in all XML documents; however XHTML document authors are strongly encouraged to use XML declarations in all their documents. Such a declaration is required when the character encoding of the document is other than the default UTF-8 or UTF-16 and no encoding was determined by a higher-level protocol. Here is an example of an XHTML document. In this example, the XML declaration is included.

Which would imply that UTF-8 is the default encoding anyway - but your server seems to be treating the page as text/html rather than application/xhtml+xml.
And there is a warning about this situation! :
Quote:
Be aware that processing instructions are rendered on some user agents. Also, some user agents interpret the XML declaration to mean that the document is unrecognized XML rather than HTML, and therefore may not render the document as expected. For compatibility with these types of legacy browsers, you may want to avoid using processing instructions and XML declarations. Remember, however, that when the XML declaration is not included in a document, the document can only use the default character encodings UTF-8 or UTF-16.


Argh! It's all too complicated. :bash:

_________________
Mark
Wilmslow Astro Weather


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 145 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9, 10  Next

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 3 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