phpweather-devel Mailing List for PHP Weather (Page 22)
Brought to you by:
iridium
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(4) |
Dec
(7) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(2) |
Feb
(52) |
Mar
(79) |
Apr
(9) |
May
(28) |
Jun
(17) |
Jul
(25) |
Aug
(48) |
Sep
(18) |
Oct
(6) |
Nov
|
Dec
(8) |
2003 |
Jan
(26) |
Feb
(10) |
Mar
(2) |
Apr
(21) |
May
(23) |
Jun
(15) |
Jul
(15) |
Aug
(8) |
Sep
(16) |
Oct
(3) |
Nov
(4) |
Dec
|
2004 |
Jan
(35) |
Feb
(35) |
Mar
(9) |
Apr
(6) |
May
(1) |
Jun
(3) |
Jul
(3) |
Aug
(6) |
Sep
|
Oct
|
Nov
|
Dec
|
2005 |
Jan
(4) |
Feb
(6) |
Mar
(6) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
(2) |
Nov
|
Dec
|
2006 |
Jan
|
Feb
(5) |
Mar
(7) |
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
From: Martin G. <gim...@gi...> - 2002-02-12 16:32:43
|
"Max Hammond" <ma...@fl...> writes: >> We should also be careful not to send the JavaScript to people who >> use older browsers - PHP has a function that can help with this >> (get_browser()). > > I'm not convinved that it's worth the bother. When 0.01% of people > are using browsers that won't understand this kind of javascript, > it's probably not worth it. 5 years ago, yes, you had to take into > account the fact that a good handful of people would be using > netscape 2, but even then, we were designing for the shiny new > Netscape 3, with all it's advanced features. Yes, but people might have javascript turned off, even in their new fancy browser. So, there should still be a way to get the normal report. > There is a reason for doing a browser-detect though, or at least > finding a way around the problem: some people use screen readers, or > parsers like betsie to present easy-to-read versions of a page. They > won't like javascript. I don't know betsie, but you're right: there has to be an option to turn this javascript-thing off. And it would be preferable if the script could try and guess when to turn if off. -- Martin Geisler My GnuPG Key: 0xF7F6B57B See my homepage at http://www.gimpster.com/ for: PHP Weather => Shows the current weather on your webpage. PHP Shell => A telnet-connection (almost :-) in a PHP page. |
From: Ray v. B. <r_v...@ho...> - 2002-02-12 14:29:09
|
>I did some experiments with replacing text in an id-referenced tag. I use >the innerHTML property, that worked also. Maybe for Opera as >well. Forgot to tell that I did these experiments in my own test php script, and on IE5.0.... Ray _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx |
From: Ray v. B. <r_v...@ho...> - 2002-02-12 14:17:05
|
>Great - if it works in Mozilla and IE, then that will cover most of >the browsers people use. Someone should try with Opera too... Tried opera 6.0.1 on Win2k. The page loads, displaying the 'Retrieving...' text. After 5 secs, the status line says 'Done', but the page is not updated. When looking at the source, it shows the entire page, including the js. It seems that the js doesn't execute or doesn't execute properly, allthough no error message is issued... I did some experiments with replacing text in an id-referenced tag. I use the innerHTML property, that worked also. Maybe for Opera as well. Oh-oh, tried it on IE5.5 @ work. The screen stays blank until the entire page is received. It then shows the weather info right away. Is there a difference between IE5.0 and IE5.5 with respect to this matter? Ray _________________________________________________________________ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com |
From: Max H. <ma...@fl...> - 2002-02-12 12:09:46
|
> We should also be careful not to send the JavaScript to people who use > older browsers - PHP has a function that can help with this > (get_browser()). I'm not convinved that it's worth the bother. When 0.01% of people are using browsers that won't understand this kind of javascript, it's probably not worth it. 5 years ago, yes, you had to take into account the fact that a good handful of people would be using netscape 2, but even then, we were designing for the shiny new Netscape 3, with all it's advanced features. There is a reason for doing a browser-detect though, or at least finding a way around the problem: some people use screen readers, or parsers like betsie to present easy-to-read versions of a page. They won't like javascript. Max |
From: Martin G. <gim...@gi...> - 2002-02-11 20:38:57
|
"Max Hammond" <ma...@fl...> writes: >>> Did you all note that this won't work on windoze servers anyway? >> >> Which part? > > flush() won't. I see... > http://www.php.net/manual/en/function.flush.php > > <quote> > Several servers, especially on Win32, will still buffer the output from your > script until it terminates before transmitting the results to the browser. > > Server modules for Apache like mod_gzip may do buffering of their own that > will cause flush() to not result in data being sent immediately to the > client. > </quote> Well, I think we'll just have to live with that... perhaps it would help, if we produced a lot of whitespace as the page suggests. We should also be careful not to send the JavaScript to people who use older browsers - PHP has a function that can help with this (get_browser()). -- Martin Geisler My GnuPG Key: 0xF7F6B57B See my homepage at http://www.gimpster.com/ for: PHP Weather => Shows the current weather on your webpage. PHP Shell => A telnet-connection (almost :-) in a PHP page. |
From: Max H. <ma...@fl...> - 2002-02-11 17:04:52
|
> > But one thing: the <script> elements should be *within* the <html> > > element. All the browsers I know will render a page before they > > receive the final </html> anyway. > > Yes, but the browser can only render the page if it knows the layout. > So I think we should be safe, if we output the javascript just before > the </html> tag. That's what I thought. After all, <script> is a sub-element of <html>... > > Did you all note that this won't work on windoze servers anyway? > > Which part? flush() won't. http://www.php.net/manual/en/function.flush.php <quote> Several servers, especially on Win32, will still buffer the output from your script until it terminates before transmitting the results to the browser. Server modules for Apache like mod_gzip may do buffering of their own that will cause flush() to not result in data being sent immediately to the client. </quote> Max |
From: Martin G. <gim...@gi...> - 2002-02-11 15:26:39
|
"Ray van Beek" <r_v...@ho...> writes: > It works for me too, IE5.0. Great! Great - if it works in Mozilla and IE, then that will cover most of the browsers people use. Someone should try with Opera too... > One suggestion though, you flush the page each time the function > wait_for_report is called. To me, it seems that that is only > required once: immediately after the </html> tag. The page is then > sent to the browser, and the browser can start processing a complete > page. I don't know if it's necessary to flush the page so often, but I wanted to make sure, that the browser gets some data, so that it can begin rendering the page. I believe that I've read about a case, where they had to send several empty lines to the browser before it "got the message" and started rendering. But I haven't done any tests of things like that, so we'll probably have to adjust this later. > [...] > > What I would like to do in the coming days is creating a table that > maps the different icon files to a Sky Cover/Precipitation > combination table. A <IMG SRC=icon.php> construction in the webpage > calls the icon.php function. This function then searches the table > for the proper image file, that is then returned directly. To keep > this mechanism 'tunable', the names of the icons files are entered > in a include file. If someone likes to take his own set of icons, he > only has to change the file names in the include file. As far as I > can see it, the icon.php function can use the internal results of > the phpweather script. It sounds like a good approach, but how should it work, if people just specify <IMG SRC="icon.php">? Don't you mean something like this <IMG SRC="<?php weather_icon() ?>"> > Like I said, I will start my first experiments probably this week, I > keep you informed. Great. I think it would be a good idea to split this code out into another file, so that people can include it if needed. The 'old' code in PHP Weather really needs to be split up into several files, or even better: we should move to the 'new' version in CVS and work on that. It's been a long time since I've looked at the code, but as I remember it, it does most of the things the 'old' code does, and it does it better (more detailed, more special cases, etc...) -- Martin Geisler My GnuPG Key: 0xF7F6B57B See my homepage at http://www.gimpster.com/ for: PHP Weather => Shows the current weather on your webpage. PHP Shell => A telnet-connection (almost :-) in a PHP page. |
From: Martin G. <gim...@gi...> - 2002-02-11 15:13:07
|
"Max Hammond" <ma...@fl...> writes: >> >I've actually got something working - take a look at >> > >> > http://www.gimpster.com/php/phpweather/demo2.php?sleep=5 >> > >> >The idea is this: > > <snip> > > That was exactly what I had in mind earlier :) You're right - it was a good idea :-) > But one thing: the <script> elements should be *within* the <html> > element. All the browsers I know will render a page before they > receive the final </html> anyway. Yes, but the browser can only render the page if it knows the layout. So I think we should be safe, if we output the javascript just before the </html> tag. > Did you all note that this won't work on windoze servers anyway? Which part? > I assume that the sleep() is just there so we can see what's going > on? Exactly. -- Martin Geisler My GnuPG Key: 0xF7F6B57B See my homepage at http://www.gimpster.com/ for: PHP Weather => Shows the current weather on your webpage. PHP Shell => A telnet-connection (almost :-) in a PHP page. |
From: Max H. <ma...@fl...> - 2002-02-10 20:55:46
|
> >I've actually got something working - take a look at > > > > http://www.gimpster.com/php/phpweather/demo2.php?sleep=5 > > > >The idea is this: <snip> That was exactly what I had in mind earlier :) > One suggestion though, you flush the page each time the function > wait_for_report is called. To me, it seems that that is only > required once: > immediately after the </html> tag. The page is then sent to the > browser, and > the browser can start processing a complete page. > > Hmmm, while typing this, I'm not so sure anymore: doesn't the browser > disconnect from the server when a complete page is received? If so, the > remaining stuff (js with metar data) is not received anymore.... No, flush() flushes the output buffer, it doesn't tear down the TCP connection. I agree that it's only needed once, though, after the static elements have been written. But one thing: the <script> elements should be *within* the <html> element. All the browsers I know will render a page before they receive the final </html> anyway. Did you all note that this won't work on windoze servers anyway? I assume that the sleep() is just there so we can see what's going on? Max |
From: Ray v. B. <r_v...@ho...> - 2002-02-10 20:33:18
|
>I've actually got something working - take a look at > > http://www.gimpster.com/php/phpweather/demo2.php?sleep=5 > >The idea is this: > > o Instead of calling print_pretty_metar(), we call some other > function. This function will write 'Please wait...' in a <span> > tag with the id attribute set accordingly. The ICAO is saved in an > array > > o We call flush() after writing 'Please wait...'. This will push the > content from the server toward the client. This will (hopefully) > make the browser start rendering the page, so that the user see > the 'Please wait...' text. The browser wont start rendering the > page, if it doesn't know the size of the box containing the > 'Please wait...' text. > > o At the very end of the page, we go through the stored ICAOs. For > each stored ICAO, we retrieve the METAR, and retrieve the > pretty-print. > > o We then write some JavaScript that will replace the text in the > <span> tags inserted earlier in the text. > > o We call flush() again, so that the JavaScript is sent to the > client, and so that the browser will execute it. > > o We repeat this process until we have made scripts for all the > stored ICAOs. > >It works in my browser (which is Mozilla 0.9.7). It works for me too, IE5.0. Great! One suggestion though, you flush the page each time the function wait_for_report is called. To me, it seems that that is only required once: immediately after the </html> tag. The page is then sent to the browser, and the browser can start processing a complete page. Hmmm, while typing this, I'm not so sure anymore: doesn't the browser disconnect from the server when a complete page is received? If so, the remaining stuff (js with metar data) is not received anymore.... This is from your comment on my original post on icons: >Well, there has been some people working on this, but I haven't >received any code that solves the problem. The problem is (as I see >it) that there isn't a field in the METAR that tells you if the >weather is good or bad. You'll have to combine the information, and >either select an appropriate image from a huge list of ready-made >images, or perhaps generate the image on the fly using the GD library >from within PHP. I've been looking around on the internet. I downloaded several icon sets of which the single icons can be linked to metar-like data. Most of the icon sets concentrate on a combinatation of Sky Cover and Precipitation variants. A few examples: sun, sun with one cloud, sun with a lot of cloads, cloads only, light and heavy rain with different sun/cloud combinations. Thunderstorms with different sun/cloud combinations. Additionally, there are arrows pointing to different directions to indicate the wind direction. What I would like to do in the coming days is creating a table that maps the different icon files to a Sky Cover/Precipitation combination table. A <IMG SRC=icon.php> construction in the webpage calls the icon.php function. This function then searches the table for the proper image file, that is then returned directly. To keep this mechanism 'tunable', the names of the icons files are entered in a include file. If someone likes to take his own set of icons, he only has to change the file names in the include file. As far as I can see it, the icon.php function can use the internal results of the phpweather script. Like I said, I will start my first experiments probably this week, I keep you informed. Bye for now, Ray _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. |
From: Martin G. <gim...@gi...> - 2002-02-10 15:00:38
|
"Ray van Beek" <r_v...@ho...> writes: > The problem with the loading part in the first part of the page and > the reconstruction of the "Loading..." text is that the server does > not return a page before the entire page is processed, at least that > is what i see. Maybe with very large pages, the browser does not > wait for the end and starts displaying before it has received the > end. I've actually got something working - take a look at http://www.gimpster.com/php/phpweather/demo2.php?sleep=5 The idea is this: o Instead of calling print_pretty_metar(), we call some other function. This function will write 'Please wait...' in a <span> tag with the id attribute set accordingly. The ICAO is saved in an array o We call flush() after writing 'Please wait...'. This will push the content from the server toward the client. This will (hopefully) make the browser start rendering the page, so that the user see the 'Please wait...' text. The browser wont start rendering the page, if it doesn't know the size of the box containing the 'Please wait...' text. o At the very end of the page, we go through the stored ICAOs. For each stored ICAO, we retrieve the METAR, and retrieve the pretty-print. o We then write some JavaScript that will replace the text in the <span> tags inserted earlier in the text. o We call flush() again, so that the JavaScript is sent to the client, and so that the browser will execute it. o We repeat this process until we have made scripts for all the stored ICAOs. It works in my browser (which is Mozilla 0.9.7). What I've done is just a quick hack - we should probably restructure a couple of things to implement this properly. You can see the code here: http://www.gimpster.com/showsource.php?file=/php/phpweather/demo2.php > Martin, you're right. Generating a new page from js which contains php > is not parsed at the server but processed in the browser directly. Right... -- Martin Geisler My GnuPG Key: 0xF7F6B57B See my homepage at http://www.gimpster.com/ for: PHP Weather => Shows the current weather on your webpage. PHP Shell => A telnet-connection (almost :-) in a PHP page. |
From: Ray v. B. <r_v...@ho...> - 2002-02-10 13:13:47
|
The problem with the loading part in the first part of the page and the reconstruction of the "Loading..." text is that the server does not return a page before the entire page is processed, at least that is what i see. Maybe with very large pages, the browser does not wait for the end and starts displaying before it has received the end. Martin, you're right. Generating a new page from js which contains php is not parsed at the server but processed in the browser directly. Ray >From: "Max Hammond" <ma...@fl...> >To: <php...@li...> >Subject: RE: Iconize weather info and something else >Date: Sun, 10 Feb 2002 10:02:08 -0000 > > >Another idea: > >some js at the top of the page that says "Loading..." that is sent before >the metar load is started, and then some more at the bottom (ie, after the >metar has been loaded and processed) that rewrites the document to just >display the metar? I've no idea what kind of event handler you'd need to >get >it to carry on :) > >Max > > > -----Original Message----- > > From: php...@li... > > [mailto:php...@li...]On Behalf Of Martin > > Geisler > > Sent: 10 February 2002 09:55 > > To: php...@li... > > Subject: Re: Iconize weather info and something else > > > > > > "Ray van Beek" <r_v...@ho...> writes: > > > > > - some javascript. When this page has been loaded, the javascript > > > executes. The javascript should then generate a new 'page' (nr-2). > > > This nr-2 page contains php script that retrieves the metar data. > > > The nr-2 page comes to the browser only when the metar data has been > > > received and processed. The nr-2 page contains javascript (outputted > > > by the php) that sets a javascript metar-variable. > > > > I don't know very much about java(script), but I do know this: > > java(script) runs on the client and PHP runs at the server. The client > > will not be able to make a page nr-2 with come PHP code, as this code > > is executed only at the server. So I think the step above would fail. > > > > But I've seen several pages that redirect you to another page after > > 5-10 seconds. So we could make a page that says 'Retrieving data...', > > and then after 5 seconds the user is redirected to a page that > > displays the data. The first page should trigger the PHP code that > > retrieves the data, so that the data is ready 5 seconds later. > > > > It's just that this would impose a 5 seconds-penalty to every report > > shown, and it also makes the caching mechanisms useless. > > > > What we need is this: a way to update a page on the client at the > > moment data arrives. I don't know if java(script) can be run > > asynchronously in the background, so that the script could wait for > > data in the background (the same way as the browser waits for data in > > the foreground as it is now) and then update the right paragraph on > > the page when the data has arrived. > > > > > [...] > > > > -- > > Martin Geisler My GnuPG Key: 0xF7F6B57B > > > > See my homepage at http://www.gimpster.com/ for: > > PHP Weather => Shows the current weather on your webpage. > > PHP Shell => A telnet-connection (almost :-) in a PHP page. > > > > _______________________________________________ > > PHPWeather-devel mailing list > > PHP...@li... > > https://lists.sourceforge.net/lists/listinfo/phpweather-devel > > > > >_______________________________________________ >PHPWeather-devel mailing list >PHP...@li... >https://lists.sourceforge.net/lists/listinfo/phpweather-devel _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com |
From: Max H. <ma...@fl...> - 2002-02-10 10:02:15
|
Another idea: some js at the top of the page that says "Loading..." that is sent before the metar load is started, and then some more at the bottom (ie, after the metar has been loaded and processed) that rewrites the document to just display the metar? I've no idea what kind of event handler you'd need to get it to carry on :) Max > -----Original Message----- > From: php...@li... > [mailto:php...@li...]On Behalf Of Martin > Geisler > Sent: 10 February 2002 09:55 > To: php...@li... > Subject: Re: Iconize weather info and something else > > > "Ray van Beek" <r_v...@ho...> writes: > > > - some javascript. When this page has been loaded, the javascript > > executes. The javascript should then generate a new 'page' (nr-2). > > This nr-2 page contains php script that retrieves the metar data. > > The nr-2 page comes to the browser only when the metar data has been > > received and processed. The nr-2 page contains javascript (outputted > > by the php) that sets a javascript metar-variable. > > I don't know very much about java(script), but I do know this: > java(script) runs on the client and PHP runs at the server. The client > will not be able to make a page nr-2 with come PHP code, as this code > is executed only at the server. So I think the step above would fail. > > But I've seen several pages that redirect you to another page after > 5-10 seconds. So we could make a page that says 'Retrieving data...', > and then after 5 seconds the user is redirected to a page that > displays the data. The first page should trigger the PHP code that > retrieves the data, so that the data is ready 5 seconds later. > > It's just that this would impose a 5 seconds-penalty to every report > shown, and it also makes the caching mechanisms useless. > > What we need is this: a way to update a page on the client at the > moment data arrives. I don't know if java(script) can be run > asynchronously in the background, so that the script could wait for > data in the background (the same way as the browser waits for data in > the foreground as it is now) and then update the right paragraph on > the page when the data has arrived. > > > [...] > > -- > Martin Geisler My GnuPG Key: 0xF7F6B57B > > See my homepage at http://www.gimpster.com/ for: > PHP Weather => Shows the current weather on your webpage. > PHP Shell => A telnet-connection (almost :-) in a PHP page. > > _______________________________________________ > PHPWeather-devel mailing list > PHP...@li... > https://lists.sourceforge.net/lists/listinfo/phpweather-devel > |
From: Martin G. <gim...@gi...> - 2002-02-10 09:55:26
|
"Ray van Beek" <r_v...@ho...> writes: > - some javascript. When this page has been loaded, the javascript > executes. The javascript should then generate a new 'page' (nr-2). > This nr-2 page contains php script that retrieves the metar data. > The nr-2 page comes to the browser only when the metar data has been > received and processed. The nr-2 page contains javascript (outputted > by the php) that sets a javascript metar-variable. I don't know very much about java(script), but I do know this: java(script) runs on the client and PHP runs at the server. The client will not be able to make a page nr-2 with come PHP code, as this code is executed only at the server. So I think the step above would fail. But I've seen several pages that redirect you to another page after 5-10 seconds. So we could make a page that says 'Retrieving data...', and then after 5 seconds the user is redirected to a page that displays the data. The first page should trigger the PHP code that retrieves the data, so that the data is ready 5 seconds later. It's just that this would impose a 5 seconds-penalty to every report shown, and it also makes the caching mechanisms useless. What we need is this: a way to update a page on the client at the moment data arrives. I don't know if java(script) can be run asynchronously in the background, so that the script could wait for data in the background (the same way as the browser waits for data in the foreground as it is now) and then update the right paragraph on the page when the data has arrived. > [...] -- Martin Geisler My GnuPG Key: 0xF7F6B57B See my homepage at http://www.gimpster.com/ for: PHP Weather => Shows the current weather on your webpage. PHP Shell => A telnet-connection (almost :-) in a PHP page. |
From: Ray v. B. <r_v...@ho...> - 2002-02-10 08:48:49
|
Kristian, I've started doing some experiments with Javascript and php, but then I realized that I did things in the wrong order. It is important to know that php is executed first on the server, that results in a page that is 'executed' in the browser. I think that this construction is of no use: the page loads only in the browser when the php script has received the metar data. I reread Kristians suggestion and I think you mean this: It should be possible to have a webpage (nr-1) that contains: - a text 'Retrieving data...' with some id/name (dhtml-tag) in that part. - some javascript. When this page has been loaded, the javascript executes. The javascript should then generate a new 'page' (nr-2). This nr-2 page contains php script that retrieves the metar data. The nr-2 page comes to the browser only when the metar data has been received and processed. The nr-2 page contains javascript (outputted by the php) that sets a javascript metar-variable. - some other javascript that cyclicly tests metar-variable. Once set, it updates the 'Retrieving data...' text via the id/name tag and closes the nr-2 page. This same script can check for timeouts: When the page nr-2 does not come (while the php does not execute, or the noaa server cannot be found, or whatever), the nr-1 page cyclic javascript can terminate the second page and display something like 'Metar data not found...'. I think that is what Martin meant. Some Javascript questions though: - is it possible to have two webpages (one started by the other) from which a Javascript can access data from the other? - If inter-webpage communication via Javascript is not possible, maybe the same could be accomplished by frames in stead of pages? I am willing to try this, but let me know if the above is correct... Greetz, Ray _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. |
From: Martin G. <gim...@gi...> - 2002-02-09 14:02:25
|
Kristian Kristensen <zi...@zi...> writes: > Regarding the javascript... > > You could include some javascript file that outputs the metar > information you're interested in. This javascript file would be a php > file that outputs javascript, eg. a string called 'metar' that contains > the metar information you would like to write on your page. > When the original page loads you check if 'metar' contains something or > not. If i does you output the metar otherwise your write 'Retriving > metar... Please wait' And what do we do, when we get tired of waiting? :-) We have to detect when the metar is loaded, but how do we propagate that information from the server out to the client? > This should work, but I haven't tried it :-) Neither have I, as I don't know JavaScript... -- Martin Geisler My GnuPG Key: 0xF7F6B57B See my homepage at http://www.gimpster.com/ for: PHP Weather => Shows the current weather on your webpage. PHP Shell => A telnet-connection (almost :-) in a PHP page. |
From: Kristian K. <zi...@zi...> - 2002-02-08 17:43:49
|
Regarding the javascript... You could include some javascript file that outputs the metar information you're interested in. This javascript file would be a php file that outputs javascript, eg. a string called 'metar' that contains the metar information you would like to write on your page. When the original page loads you check if 'metar' contains something or not. If i does you output the metar otherwise your write 'Retriving metar... Please wait' This should work, but I haven't tried it :-) Try it out or write back, the idea should be possible to accomplish. Best, Kristian * Martin Geisler (gim...@gi...) wrote: > "Ray van Beek" <r_v...@ho...> writes: > > > Hi all, > > > > I am interested in showing some simple icons that indicate > > cloud/sun/rain/snow etc, as you can see on portals, sites of > > newspapers etc. Is somebody engaged in this? > > Well, there has been some people working on this, but I haven't > received any code that solves the problem. The problem is (as I see > it) that there isn't a field in the METAR that tells you if the > weather is good or bad. You'll have to combine the information, and > either select an appropriate image from a huge list of ready-made > images, or perhaps generate the image on the fly using the GD library > from within PHP. > > > The other thing is more a suggestion. The account I have is on a > > rather slow server. This means that when someone is requesting the > > page with the phpweather script, it can take a long time before the > > requested page is showing. The script first need to get the METAR > > data from the noaa site. Then the page generated. Then the page is > > sent to the one that requested the page. Would it be possible to > > have the script responded right away by showing the complete page > > but with a remark like 'Retrieving METAR data ... please wait'? Then > > when the script has received and processed the METAR data, the > > remark is replaced by the actual data. > > That would be very cool - but how should that be done in HTML? It > might be possible to do this by using JavaScript or Java. > > > In general, during the time the METAR data has not been received and > > processed, some indication should be shown that shows this status. > > After processing, the indication is replaced with the actual data. > > Would that be possible? > > It's difficult to make HTML pages respond to things happening at the > server, after the page is loaded, as a HTTP request for a page is > stateless: you request a page, the webserver sends it to you, and > that's it. The browser doesn't communicate any further with the server > about that particular page. > > It could be possible to make some JavaScript or another widely used > language runs at the client, that would be ask the server for the > weather information after the page has been rendered with the 'Please > wait...' text. > > But I think it would be difficult to make this reliable and cross- > platform. > > -- > Martin Geisler My GnuPG Key: 0xF7F6B57B > > See my homepage at http://www.gimpster.com/ for: > PHP Weather => Shows the current weather on your webpage. > PHP Shell => A telnet-connection (almost :-) in a PHP page. > > _______________________________________________ > PHPWeather-devel mailing list > PHP...@li... > https://lists.sourceforge.net/lists/listinfo/phpweather-devel > -- http://www.whizit.dk | Open Source skills http://www.zianet.dk |
From: Max H. <ma...@fl...> - 2002-02-07 11:34:31
|
> > I am interested in showing some simple icons that indicate > > cloud/sun/rain/snow etc, as you can see on portals, sites of > > newspapers etc. Is somebody engaged in this? You could try www.wunderground.com - find a station you're interested in, and then look for "Add this sticker to your homepage". Obviously, not as much control as using phpweather to do it, but no dev work needed. Max -- Never put the words "Diabolical Master Plan" on a CV |
From: Martin G. <gim...@gi...> - 2002-02-07 11:28:16
|
"Ray van Beek" <r_v...@ho...> writes: > Hi all, > > I am interested in showing some simple icons that indicate > cloud/sun/rain/snow etc, as you can see on portals, sites of > newspapers etc. Is somebody engaged in this? Well, there has been some people working on this, but I haven't received any code that solves the problem. The problem is (as I see it) that there isn't a field in the METAR that tells you if the weather is good or bad. You'll have to combine the information, and either select an appropriate image from a huge list of ready-made images, or perhaps generate the image on the fly using the GD library from within PHP. > The other thing is more a suggestion. The account I have is on a > rather slow server. This means that when someone is requesting the > page with the phpweather script, it can take a long time before the > requested page is showing. The script first need to get the METAR > data from the noaa site. Then the page generated. Then the page is > sent to the one that requested the page. Would it be possible to > have the script responded right away by showing the complete page > but with a remark like 'Retrieving METAR data ... please wait'? Then > when the script has received and processed the METAR data, the > remark is replaced by the actual data. That would be very cool - but how should that be done in HTML? It might be possible to do this by using JavaScript or Java. > In general, during the time the METAR data has not been received and > processed, some indication should be shown that shows this status. > After processing, the indication is replaced with the actual data. > Would that be possible? It's difficult to make HTML pages respond to things happening at the server, after the page is loaded, as a HTTP request for a page is stateless: you request a page, the webserver sends it to you, and that's it. The browser doesn't communicate any further with the server about that particular page. It could be possible to make some JavaScript or another widely used language runs at the client, that would be ask the server for the weather information after the page has been rendered with the 'Please wait...' text. But I think it would be difficult to make this reliable and cross- platform. -- Martin Geisler My GnuPG Key: 0xF7F6B57B See my homepage at http://www.gimpster.com/ for: PHP Weather => Shows the current weather on your webpage. PHP Shell => A telnet-connection (almost :-) in a PHP page. |
From: Martin G. <gim...@gi...> - 2002-02-05 09:27:00
|
"Ray van Beek" <r_v...@ho...> writes: > Hi Martin (and others), > > The script you sent me worked fine! It prints the pretty string as > it is intended to. Great! I'll make new tarballs right away. > I had to modify one line though: the script produces a warning: > Warning: Variable used in global statement already exists in the > function in phpweather.inc on line 486 > > I found that by uncommenting the $useXML; variable in line 486, the > warning disappears. Ahh - that's because there's two 'global'-statements, and $useXML is in both. > Thanks again! Well, thanks for bringing this to my attention. > Ray -- Martin Geisler My GnuPG Key: 0xF7F6B57B See my homepage at http://www.gimpster.com/ for: PHP Weather => Shows the current weather on your webpage. PHP Shell => A telnet-connection (almost :-) in a PHP page. |
From: Ray v. B. <r_v...@ho...> - 2002-02-05 07:59:23
|
Hi all, I am interested in showing some simple icons that indicate cloud/sun/rain/snow etc, as you can see on portals, sites of newspapers etc. Is somebody engaged in this? The other thing is more a suggestion. The account I have is on a rather slow server. This means that when someone is requesting the page with the phpweather script, it can take a long time before the requested page is showing. The script first need to get the METAR data from the noaa site. Then the page generated. Then the page is sent to the one that requested the page. Would it be possible to have the script responded right away by showing the complete page but with a remark like 'Retrieving METAR data ... please wait'? Then when the script has received and processed the METAR data, the remark is replaced by the actual data. In general, during the time the METAR data has not been received and processed, some indication should be shown that shows this status. After processing, the indication is replaced with the actual data. Would that be possible? Ray _________________________________________________________________ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com |
From: Ray v. B. <r_v...@ho...> - 2002-02-05 07:47:37
|
Hi Martin (and others), The script you sent me worked fine! It prints the pretty string as it is intended to. I had to modify one line though: the script produces a warning: Warning: Variable used in global statement already exists in the function in phpweather.inc on line 486 I found that by uncommenting the $useXML; variable in line 486, the warning disappears. I have two other questions, but i will ask them in another thread. Thanks again! Ray >From: Martin Geisler <gim...@gi...> >To: php...@li... >Subject: Re: (no subject) >Date: Tue, 05 Feb 2002 00:27:33 +0100 > >"Ray van Beek" <r_v...@ho...> writes: > > >>(By the way: please subscribe to the list - postings from > >>non-subscribed addresses are held for approval until I either > >>approve them or rejects them.) > >> > > > > I did yesterday, hopefully, things go better now.. > >Yes, your mails are getting through now - great :-) > > > Yes, that works fine with me... I know this must work in php, but on > > the other hand, why does the construction not work in the phpweather > > script I have. > >I've just realized, that the trick employed above with $GLOBALS won't >work, as we're not interested in getting the variables into the global >scope, but rather into the /local/ scope. Global variables are not >visible in the local scope of a function, unless it has been declared >using the 'global' keyword... > >I don't think it's possible to get the variables into the local scope >by calling a function... > >What we can do, is to stop using extract. It's actually only used two >times in phpweather.inc. And str_replace is only used once, so that >can be removed as well, so that should make PHP Weather compatible >with PHP version 3.0.3 - I hope :-) > >I've attached a new phpweather.inc - please try it out and tell me if >it works on your system. I experienced some strange errors with the >temperature and dewpoint for Thule AB - the temperature information >was present in the METAR, but it was parsed as a comment... very >strange. The offending METAR was: > > BGTL 041855Z 09005KT 6000 -SN BR FEW010 SCT035 OVC050 M23/M23 > A2970 RMK SLP073 ESTMD WND 8/5// 9/8// PSR13 > ><< phpweather.inc >> > >-- >Martin Geisler My GnuPG Key: 0xF7F6B57B > >See my homepage at http://www.gimpster.com/ for: >PHP Weather => Shows the current weather on your webpage. >PHP Shell => A telnet-connection (almost :-) in a PHP page. _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx |
From: Ray v. B. <r_v...@ho...> - 2002-02-04 20:52:54
|
>(By the way: please subscribe to the list - postings from >non-subscribed addresses are held for approval until I either approve >them or rejects them.) > I did yesterday, hopefully, things go better now.. >>function extract($array) { >> >> while (list($key, $val) = each($array)) { >> $GLOBALS["\"". $key. "\""] = $val; >> } >>} > >Why have you wrapped $key in a pair of double quotes? Sorry, my fault! This was one of my experiments to see why the $GLOBALS construction was not working with me. At first, I did try your original function, without any result though.... > >>I tracked the data from the METAR string to the extract function. I >>found that at a given iteration of the loop, the temp_c key is >>coming by. Then at the end of the function, I checked for a variable >>$temp_c but this results in nothing to be printed with: >> >>printf($temp_c); >> >>Is the $GLOBAL contruction >>correct for php3.0.3? > >Well, I don't know? I was hoping that you could test that for me :-) >Try making a simple file like this: > >function f($a) { > $GLOBALS['foo'] = $a; >} > >f('Hello'); > >echo $foo; > >That should print Hello, indicating that the function f is able to >access the global variables through $GLOBALS. > Yes, that works fine with me... I know this must work in php, but on the other hand, why does the construction not work in the phpweather script I have. Then I tried following, I changed your script to this: <html> <head> <title>PHP Weather</title> </head> <body> <?php function f($a) { $GLOBALS['foo'] = $a; printf("GLOBALS[] within function: ".$GLOBALS['foo']."<br>"); printf("foo within function : ".$foo."<br>"); } function g() { printf("GLOBALS[] within other function: ".$GLOBALS['foo']."<br>"); printf("foo within other function : ".$foo."<br>"); } f('Hello'); printf("GLOBALS[] outside function: ".$GLOBALS['foo']."<br>"); printf("foo outside function : ".$foo."<br>"); g(); ?> </body> </html> and this is what I got: GLOBALS[] within function: Hello foo within function : GLOBALS[] outside function: Hello foo outside function : Hello GLOBALS[] within other function: Hello foo within other function : Apperently (in php3.0.3 only?) the variables created via $GLOBALS are only available in 'global' space and not in the function where it is added to the globals. Even in another function it is not available. Now that explains why I am not able to see a variable like temp_c in the phpweather script. It is added to the globals in a function, and it is used in another. This is what I got in the script: "16880919 minutes ago, at 00:00 UTC, the wind was calm in Aalborg, Denmark. The temperature was degrees Celsius ( degrees Fahrenheit), and the pressure was hPa ( inHg). The relative humidity was %. The sky was clear." I bet that all variables that are being used in this part of the script don't exist (or cannot be seen) in the function that prints this out. Checking on the php docu:(http://www.php.net/manual/en/language.variables.scope.php) "You may notice that this is a little bit different from the C language in that global variables in C are automatically available to functions unless specifically overridden by a local definition. This can cause some problems in that people may inadvertently change a global variable. In PHP global variables must be declared global inside a function if they are going to be used in that function." The only thing we have to do is making the $GLOBALS[$key] variables that are created in the extract() function available in the other functions. How can we do that (I'm a newbie to php)? >>By the way: I know that it would be best to ask the admin of the >>host provider to upgrade, I found out that my account is stored on >>some virtual server in a server farm. The company I obtained the >>account from only rents a virtual server, so I don't think that this >>company is able to upgrade php 3... unfortunately. > >But... it's really easy to install PHP4 - if they managed to install >PHP3, then it shouldn't take them more that half an hour to install >PHP4... but on the other hand: I would like to support all possible >versions of PHP, so it's not all bad :-) Yep, I'm going to ask them to upgrade to php4 , lets see what they have to say.... Thanks again for your help! Ray _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx |
From: Martin G. <gim...@gi...> - 2002-02-04 20:25:10
|
Thierry Bucco <th...@so...> writes: > Hi, > > Thank you for your great work. > > However I've a little question, I'm trying to know the current > weather for my town (NICE in France). > > I can get several informations but how can I know if it's raining or > not ? Hmm - you could look at the 'weather' entry in the decoded metar, but that contains the whole description. The codes for rain (or precipitation as it's called in the documentation) can be found here: http://tgsv5.nws.noaa.gov/oso/oso1/oso12/fmh1/fmh1ch12.htm Look at section 12.6.8. So you could figure out if it's raining by doing something like this: $metar = get_metar('NICE'); if (ereg('(RA|DZ|SN|SG|GR|GS|PE|IC|UP)', $metar) { echo "It's raining!"; } else { echo "No rain."; } I hope that helps you. -- Martin Geisler My GnuPG Key: 0xF7F6B57B See my homepage at http://www.gimpster.com/ for: PHP Weather => Shows the current weather on your webpage. PHP Shell => A telnet-connection (almost :-) in a PHP page. |
From: Thierry B. <th...@so...> - 2002-02-04 10:42:26
|
Hi, Thank you for your great work. However I've a little question, I'm trying to know the current weather for my town (NICE in France). I can get several informations but how can I know if it's raining or not ? Thanks. Thierry |