Thread: Re: Bug
Brought to you by:
iridium
From: Ray v. B. <r_v...@ho...> - 2002-02-23 17:03:37
|
>From: "Rui Fernandes" <nov...@ne...> >To: <php...@gi...> >Subject: Bug >Date: Fri, 22 Feb 2002 12:17:24 -0000 > >Dear friend, > >I've found a bug in the script. When I asked the information for London, it >came: > >54 minutes ago, at 11:20 UTC, the wind was blowing at a speed of 10.3 >meters per second (23.0 miles per hour) from West in London / Gatwick >Airport, United Kingdom. The temperature was 13 degrees Celsius (55 degrees >Fahrenheit), and the pressure was 1,001 hPa (29.56 inHg). The relative >humidity was 76.7%. There were scattered clouds at a height of 914 meter >(3000 feet) and scattered clouds at a height of 1280 meter (4200 feet). The >visibility was >11.3 kilometers (>7 miles). Current weather is . >(...missing...) > >I can't find the problem. Can you solve it? I have seen similar texts. For example, take the next metar: EHEH 231555Z 27013KT 9999 FEW018 03/01 Q0996 BLU It doesn't specify any precipitation or other weather phenomena. Therefor, the $weather_str stays empty, leading to the missing text. Maybe this should be changed to omitting the entire line ('Current weather is .')? Ray EHEH 231555Z 27013KT 9999 FEW018 03/01 Q0996 BLU _________________________________________________________________ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com |
From: Ray v. B. <r_v...@ho...> - 2002-02-24 07:53:35
|
> > I have seen similar texts. For example, take the next metar: > > > > EHEH 231555Z 27013KT 9999 FEW018 03/01 Q0996 BLU > > > > It doesn't specify any precipitation or other weather phenomena. > > Therefor, the $weather_str stays empty, leading to the missing text. > > Maybe this should be changed to omitting the entire line ('Current > > weather is .')? > >But if $weather_str is left as the empty string, then it shouldn't be >able to sneak 'Current weather is' into the report :-) $weather_str is >copied directly to the output, it's not prefixed with 'Current >weather' or anything like that. ...snip... if (isset($data['weather'])) { $weather_str = sprintf($strings['current_weather'], $data['weather']); } else { $weather_str = ''; } ...snip... At some point the script test the existence of $data['weather']. Alltough the string itself is empty, it has been set previously: Somewhere at the beginning of the process_metar() function. As you can see, some other strings are set as well: ...snip... $decoded_metar['temp_visibility_miles'] = ''; $cloud_layers = 0; $decoded_metar['remarks'] = ''; $decoded_metar['weather'] = ''; ...snip... I found this by temporary adding two printf lines in the first snippet above. It shows that the isset() function finds that the the 'weather' string has been set (empty). This results in printing the 'Current weather is .' line. Greetz, Ray _________________________________________________________________ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com |
From: Martin G. <gim...@gi...> - 2002-02-24 09:45:57
|
"Ray van Beek" <r_v...@ho...> writes: >> But if $weather_str is left as the empty string, then it shouldn't >> be able to sneak 'Current weather is' into the report :-) >> $weather_str is copied directly to the output, it's not prefixed >> with 'Current weather' or anything like that. > > ..snip... > if (isset($data['weather'])) { > $weather_str = sprintf($strings['current_weather'], $data['weather']); > } else { > $weather_str = ''; > } > ..snip... Ahh - now I see it. The test should be if (!empty($data['weather'])) so that the empty string is considered false... I'll fix that in the next release. We should also have your beautiful icons with in that release - the current weather and wind icons look great. (See http://www.devolder.nl/cgibin/phpweather/table.php) Judging from your temperature table-cell in the bottom of your page, are you working on some sort of thermometer? You know: a little glass one with red mercury rising with the temperature. I think that would be a great addition to the other icons. -- 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-24 14:35:24
|
>I'll fix that in the next release. We should also have your beautiful >icons with in that release - the current weather and wind icons look >great. (See http://www.devolder.nl/cgibin/phpweather/table.php) > >Judging from your temperature table-cell in the bottom of your page, >are you working on some sort of thermometer? You know: a little glass >one with red mercury rising with the temperature. I think that would >be a great addition to the other icons. I wasn't working on that. But I think that would be a great idea. I'll start on that right away. I let you know when it is ready... 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-24 15:02:12
|
"Ray van Beek" <r_v...@ho...> writes: >> Judging from your temperature table-cell in the bottom of your >> page, are you working on some sort of thermometer? You know: a >> little glass one with red mercury rising with the temperature. I >> think that would be a great addition to the other icons. > > I wasn't working on that. But I think that would be a great idea. I'll > start on that right away. I let you know when it is ready... It was only a suggestion - I didn't mean to put pressure on you. But since you like the idea, I'll look forward to see your work :-) -- 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-24 00:01:11
|
"Ray van Beek" <r_v...@ho...> writes: > I have seen similar texts. For example, take the next metar: > > EHEH 231555Z 27013KT 9999 FEW018 03/01 Q0996 BLU > > It doesn't specify any precipitation or other weather phenomena. > Therefor, the $weather_str stays empty, leading to the missing text. > Maybe this should be changed to omitting the entire line ('Current > weather is .')? But if $weather_str is left as the empty string, then it shouldn't be able to sneak 'Current weather is' into the report :-) $weather_str is copied directly to the output, it's not prefixed with 'Current weather' or anything like that. -- 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. |