phpweather-devel Mailing List for PHP Weather (Page 10)
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: Jake O. <ja...@or...> - 2003-04-07 23:36:14
|
OK, I know I discussed this before, but the output wasn't as good as I would've liked, mostly because the data sucked.=20 Anyway, we'll try this again. I can get access to a "metar.txt" file = from a local weather station that contains the following: "METAR SNRV 072215Z AUTO 18308KT 13/01 A3016 RMK A02 SLP212 NOSPECI = P0000 T01310015" And I currently have a site setup at http://www.sunrayinc.com/sunriver/weather/index.php that loads weather, parses it through a "print_table()" function (basically, a hacked = version of the original that came in the pw_text.php file that didn't work when it = was released, but I managed to make it work how I wanted -- I'll send code = if anybody wants it). I'd like to be able to somehow get this data into something useful (automatically, if possible) as my default metar data = so I can use this data instead of the one I'm currently using (KRDM, which is = 40 miles from here, but still the closest), as well as pass variables via = the URL (so I can use my http://www.sunrayinc.com/sunriver/weather/windimage.php?icao=3Dsnrv = files that I created to get the images I want and lay it out like I want). Any ideas? I'm not a wonderful PHP programmer by any means, and it was probably a fluke I got the print_table to work for me to begin with :). -Jake | Jake Ortman - Jack of All Trades Geek | ja...@or... http://utterlyboring.com | *Instant Messaging Usernames:* | AIM: jakeortman Y!: jake-ortman | ICQ: 7739361 MSN: jak...@ho... |
From: Martin G. <gim...@gi...> - 2003-04-07 21:13:06
|
Klaus Dahlke <kla...@gm...> writes: > I tried in the first place to extend the key and change > 'update-metar' to 'insert_metar', but as the timestamp is the time > of the metar, the system get still confused and reports 'duplicate > entry'. If you relax your demands on the keys in the database, and then make update_metar call insert_metar, then it's easy to put the same row into the database several times. With no indexes at all, or just a normal index on the icao and perhaps also on timestamp I get lots of METARs into the database. The problem is that I get three new rows each time someone submits a station(!) I think it's a problem with the logic in data_retrieval.php. The get_metar_from_web() function retrieves a METAR from NWS and tries to adjust the timestamp in a clever way if it think's it's too old. I've not looked into it, but I think it must be there the problem lies. If we're going to do this right, then there should be some support for deleting old contents, support for selecting old reports and the logic should be updated. It sure would be cool to have a fourth drop-down box where people could select a different data to see data from, or even to generate graphs that show the tendency over the last day/week/month... Klaus, if you want to work on this, then let me know and I can add you to the project --- this project really needs someone who can put some energy into it. Just create an account at SourceForge and mail me the account name and I'll setup the CVS write permissions for you. -- Martin Geisler My GnuPG Key: 0xF7F6B57B See http://gimpster.com/ and http://phpweather.net/ for: PHP Weather: Shows the current weather on your webpage and PHP Shell: A telnet-connection (almost :-) in a PHP page. Join Freenet: http://gimpster.com/downloads/freenet/ |
From: Klaus D. <kla...@gm...> - 2003-04-07 19:27:24
|
On Sun, 6 Apr 2003 23:38:21 +0200 Klaus Dahlke <kla...@gm...> wrote: > On Sun, 06 Apr 2003 17:58:09 +0200 > Martin Geisler <gim...@gi...> wrote: > > > > > > But as Klaus notes, then it shouldn't be that difficult for the SQL > > based backends: just fetch the newest METAR for a given station per > > default and then always insert new METARs instead of replacing the one > > ones. > > Martin, > > as I mentioned before, inserting gets duplicate keys, I don't know > exactly why and how. Anyways, what I did so far: > > Not to interfere with the flow logic of the program I look at what would > happen if I try to save teh metars in an own history table. > I created a new table (metars_history) with the colums req_time, icao, > metar, metar_time (time of request, icao, metar, time metar was > created). req_time and icao are set to UNIQUE. > > I put the following statement into defaults-dist.php: > $this->properties['db_metars_hist'] = 'metars_history'; > > I inserted a new function to pw_db_mysql.php: > > function insert_metar_history($icao, $metar, $timestamp) { > $this->query(sprintf('INSERT INTO %s SET icao = "%s", ' . > 'metar = "%s", metar_time = FROM_UNIXTIME(%d), > req_time = NOW()', > $this->properties['db_metars_hist'], $icao, > addslashes($metar), intval($timestamp))); > } > > > I added two lines in data_retrieval.php: > > /* We then cache the METAR in our database */ > if ($new_station) { > $this->debug('get_metar_from_web(): Inserting new METAR for > <code>' . > $this->get_location() . '</code>'); > $this->db->insert_metar($icao, $metar, $timestamp); > ---> $this->db->insert_metar_history($icao, $metar, $timestamp); > } else { > $this->debug('get_metar_from_web(): Updating METAR for <code>' . > $this->get_location() . '</code>'); > $this->db->update_metar($icao, $metar, $timestamp); > --> $this->db->insert_metar_history($icao, $metar, $timestamp); > } > > Unfortunately, the insert doesn' happen. Is it easy with this concept to get the history table populated? > Hi all, I must have made something wrong on Sunday night. I just run phpweather and yes, the metar is with the above setup in the 'metar_history' table. So, everything seems to work now. Cheers, Klaus |
From: Klaus D. <kla...@gm...> - 2003-04-07 19:07:25
|
On Sun, 6 Apr 2003 23:23:09 +0200 (CEST) Ondrej Jombik <ne...@po...> wrote: > On Sun, 6 Apr 2003, Martin Geisler wrote: > > > So this won't be possible to implementent without database schema > change. We can remove primary key completely, or extend it with > "timestamp" field. In the second case new primary key will contain > "icao" and "timestamp" columns. > > [1] Database schema of "metars" table > > mysql/phpweather> \d metars > +--------+-----------+-----------+-----+--------------------------------------+ > | table | name | type | len | flags | > +--------+-----------+-----------+-----+--------------------------------------+ > | metars | icao | string | 4 | not_null primary_key unique_key | > | metars | metar | string | 255 | not_null | > | metars | timestamp | timestamp | 14 | not_null unsigned zerofill timestamp | > +--------+-----------+-----------+-----+--------------------------------------+ > mysql/phpweather> > > -- Ondrej, I tried in the first place to extend the key and change 'update-metar' to 'insert_metar', but as the timestamp is the time of the metar, the system get still confused and reports 'duplicate entry'. On the weekend, I will check something if I add an auto-increment column to the table (either metars or using an additional history table). Cheers, Klaus Cheers, |
From: Ondrej J. <ne...@po...> - 2003-04-07 00:29:11
|
Cc to devel list as it can be interested also for others. On Sun, 6 Apr 2003, Jonathan Drucker wrote: > Well, it isnt that it doesnt work right, it is that i am not really > sure how to get it on my site. I have it unzipped to the webroot on my > server, but i am not sure how to get it to show up on my webpage. Is > it a form, or a table, etc? Thanks for the help, and if the problem > still doesnt make sense, i will try again..hehe :-) Well, if files are in webroot and phpWeather is configured properly, you should be able to access them and see some weathers, etc. This is probably what did you mean with sentence, that you have test script already working. Now you have some different page - your homepage. You want to have phpWeather there. It is not certain what this mean, thus there are these three alternatives. 1. Most simple one There is no problem to put link on your site to working phpWeather installation. You can even link particular location. Simply bookmark and than create link. 2. Classic one You can take phpWeather test script code and integrate it into your page. This is not so complicated, however your page will basically looks like test script in phpWeather. An example for this case can be seen here: http://nepto.sk/specials/weather/ 3. Difficult one Since phpWeather is nicely coded using object-oriented advantages, you can create phpWeather object and call particular methods for metar parsing. Than you can print out any information you are interested in giving it arbitrary design and presentation form. An example for this case can be seen here: http://nepto.sk/about_me/news.php?lang=en This is my private news page, but in the right upper corner there is a box with current weather in city where I live. Weather information are displayed in box. That is example of arbitrary presentation form. Now you have to choose what solution you want. -- _/| Ondrej Jombik - ne...@ph... - http://www.nepto.sk - OJ812-RIPE <_ \ Platon SDG - open source software development - http://platon.sk `\| Ako sa do hory vola, tak sa zhori traktor! (c) 1999 Rattkin/MFF '` |
From: Ondrej J. <ne...@po...> - 2003-04-07 00:29:11
|
On Sun, 6 Apr 2003, Martin Geisler wrote: > >> Is there a quick workaround to keep the old metars? Or do I have to > >> adjust db/pw_db_mysql.php and subsequently date_retrieval.php to > >> have a fourth column with the actual system time as part of the > >> key? > > Several times ago I also wanted to have this feature. But there was > > no such time for its implementation. Martin, I think this is written > > on the long-term TODO list, isn't it? ;-) > But as Klaus notes, then it shouldn't be that difficult for the SQL > based backends: just fetch the newest METAR for a given station per > default and then always insert new METARs instead of replacing the one > ones. But looking at the database schema of "metars" table [1], "icao" is a primary key, thus inserting additional metar for particular airport may cause problems. So this won't be possible to implementent without database schema change. We can remove primary key completely, or extend it with "timestamp" field. In the second case new primary key will contain "icao" and "timestamp" columns. [1] Database schema of "metars" table mysql/phpweather> \d metars +--------+-----------+-----------+-----+--------------------------------------+ | table | name | type | len | flags | +--------+-----------+-----------+-----+--------------------------------------+ | metars | icao | string | 4 | not_null primary_key unique_key | | metars | metar | string | 255 | not_null | | metars | timestamp | timestamp | 14 | not_null unsigned zerofill timestamp | +--------+-----------+-----------+-----+--------------------------------------+ mysql/phpweather> -- _/| Ondrej Jombik - ne...@ph... - http://www.nepto.sk - OJ812-RIPE <_ \ Platon SDG - open source software development - http://platon.sk `\| This message was written with Pine, the fastest IMAP mail client '` |
From: Klaus D. <kla...@gm...> - 2003-04-06 21:38:35
|
On Sun, 06 Apr 2003 17:58:09 +0200 Martin Geisler <gim...@gi...> wrote: > > But as Klaus notes, then it shouldn't be that difficult for the SQL > based backends: just fetch the newest METAR for a given station per > default and then always insert new METARs instead of replacing the one > ones. Martin, as I mentioned before, inserting gets duplicate keys, I don't know exactly why and how. Anyways, what I did so far: Not to interfere with the flow logic of the program I look at what would happen if I try to save teh metars in an own history table. I created a new table (metars_history) with the colums req_time, icao, metar, metar_time (time of request, icao, metar, time metar was created). req_time and icao are set to UNIQUE. I put the following statement into defaults-dist.php: $this->properties['db_metars_hist'] = 'metars_history'; I inserted a new function to pw_db_mysql.php: function insert_metar_history($icao, $metar, $timestamp) { $this->query(sprintf('INSERT INTO %s SET icao = "%s", ' . 'metar = "%s", metar_time = FROM_UNIXTIME(%d), req_time = NOW()', $this->properties['db_metars_hist'], $icao, addslashes($metar), intval($timestamp))); } I added two lines in data_retrieval.php: /* We then cache the METAR in our database */ if ($new_station) { $this->debug('get_metar_from_web(): Inserting new METAR for <code>' . $this->get_location() . '</code>'); $this->db->insert_metar($icao, $metar, $timestamp); ---> $this->db->insert_metar_history($icao, $metar, $timestamp); } else { $this->debug('get_metar_from_web(): Updating METAR for <code>' . $this->get_location() . '</code>'); $this->db->update_metar($icao, $metar, $timestamp); --> $this->db->insert_metar_history($icao, $metar, $timestamp); } Unfortunately, the insert doesn' happen. Is it easy with this concept to get the history table populated? Thanks and best regards, Klaus |
From: Martin G. <gim...@gi...> - 2003-04-06 15:59:12
|
Ondrej Jombik <ne...@po...> writes: >> Is there a quick workaround to keep the old metars? Or do I have to >> adjust db/pw_db_mysql.php and subsequently date_retrieval.php to have >> a fourth column with the actual system time as part of the key? > > Several times ago I also wanted to have this feature. But there was > no such time for its implementation. Martin, I think this is written > on the long-term TODO list, isn't it? ;-) Yes, I guess it is... :-) Together with TAF reports, a working www.phpweather.net/ and so on... If anybody wants to work with any of this, then don't hesitate. But as Klaus notes, then it shouldn't be that difficult for the SQL based backends: just fetch the newest METAR for a given station per default and then always insert new METARs instead of replacing the one ones. -- Martin Geisler My GnuPG Key: 0xF7F6B57B See http://gimpster.com/ and http://phpweather.net/ for: PHP Weather: Shows the current weather on your webpage and PHP Shell: A telnet-connection (almost :-) in a PHP page. Join Freenet: http://gimpster.com/downloads/freenet/ |
From: Ondrej J. <ne...@po...> - 2003-04-06 01:22:07
|
> Hey everyone. I am having trouble getting phpWeather to show on my > site. I am not quite sure how to get it to be implemented. When i run > the test page, everything works just fine. I am very new to php, so > try to keep it simple :-) Thanks for the help!!! Actually you did not write what it is not working properly. Write us how phpWeather behave and what is your expected behaviour. -- _/| Ondrej Jombik - ne...@ph... - http://www.nepto.sk - OJ812-RIPE <_ \ Platon SDG - open source software development - http://platon.sk `\| UNIX is user friendly. It's selective about who its friends are! '` |
From: Ondrej J. <ne...@po...> - 2003-04-06 01:22:07
|
> Is there a quick workaround to keep the old metars? Or do I have to > adjust db/pw_db_mysql.php and subsequently date_retrieval.php to have > a fourth column with the actual system time as part of the key? Several times ago I also wanted to have this feature. But there was no such time for its implementation. Martin, I think this is written on the long-term TODO list, isn't it? ;-) -- _/| Ondrej Jombik - ne...@ph... - http://www.nepto.sk - OJ812-RIPE <_ \ Platon SDG - open source software development - http://platon.sk `\| This message was written with Pine, the fastest IMAP mail client '` |
From: Klaus D. <kla...@gm...> - 2003-04-05 21:59:06
|
Hi all, thanks for puting phpweather to work! Perhaps someone can give me a hint as I am not a great programmer. When running phpweather it 'overrides' teh metar per station, but I like to keep a history to see how weather changes, how good or bad last summer was. I digged around a bit in the coding. In 'data_retrieval.php' teh metar data are either inserted or updated (depending whether $icao already exist). The first try was simply to replace the method 'update' with 'insert' what failed as no unique index exist. I then modiefied the table settings to have 'timestamp' as part of the primary key. But even then an error for duplicate record occurs. Is there a quick workaround to keep the old metars? Or do I have to adjust db/pw_db_mysql.php and subsequently date_retrieval.php to have a fourth column with the actual system time as part of the key? Cheers, Klaus |
From: Jonathan D. <jo...@ya...> - 2003-04-05 00:04:21
|
Hey everyone. I am having trouble getting phpWeather to show on my site. I am not quite sure how to get it to be implemented. When i run the test page, everything works just fine. I am very new to php, so try to keep it simple :-) Thanks for the help!!! __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com |
From: Martin G. <gim...@gi...> - 2003-03-02 21:27:28
|
"Greg Findon" <gr...@ou...> writes: > is there a way of getting the script to return the local time from > the weather station rather than in UTC format? Not without changing the code a little. Look in output/pw_text.php at around line 679 for this line: $gmtime = gmdate('H:i', $time); If you use data('H:o', $time) instead, then you'll get the local date. You'll also have to update all the translations because they have 'UTC' coded in... Replacing UTC with the code for you timezone will probably be OK for most languages, but it would be nice, if each translation had a translated version of 'local time' that could be used here. -- Martin Geisler My GnuPG Key: 0xF7F6B57B See http://gimpster.com/ and http://phpweather.net/ for: PHP Weather => Shows the current weather on your webpage and PHP Shell => A telnet-connection (almost :-) in a PHP page. |
From: Martin G. <gim...@gi...> - 2003-03-02 20:21:55
|
"Danny Ledger" <da...@sq...> writes: > This is a multipart question.... > > How does PHP Weather address timeouts? For example, what is the > expected behavior if the NWS site is down? In that case, PHP Weather will report that there's no data for the station. The database will be updated with an empty METAR, but it's timestamp will be set to expire 10 minutes in the future, so that METAR looks fresh for 10 minutes. > I don't know much about fsokopen() and file() functions. I do know > that PHP handles files and sockets the same. In addition, it would > seem that best practices suggest using socket_set_timeout() which > sets the timeout after the connection is made. Hmm, yes perhaps... so we should set the timeout so something like 10 seconds instead of the default 60 seconds, or whatever the default might be? > If PHP Weather has logic to gracefully fail in the event of an NWS > outage, can someone please point me at it? I don't know if it's graceful, but it basically reports what it sees: that there's no data for the station. -- Martin Geisler My GnuPG Key: 0xF7F6B57B See http://gimpster.com/ and http://phpweather.net/ for: PHP Weather => Shows the current weather on your webpage and PHP Shell => A telnet-connection (almost :-) in a PHP page. |
From: Greg F. <gr...@ou...> - 2003-02-27 13:03:44
|
is there a way of getting the script to return the local time from the weather station rather than in UTC format? |
From: Danny L. <da...@sq...> - 2003-02-27 03:57:01
|
This is a multipart question.... How does PHP Weather address timeouts? For example, what is the expected behavior if the NWS site is down? I don't know much about fsokopen() and file() functions. I do know that PHP handles files and sockets the same. In addition, it would seem that best practices suggest using socket_set_timeout() which sets the timeout after the connection is made. If PHP Weather has logic to gracefully fail in the event of an NWS outage, can someone please point me at it? Thanks, -- Danny Ledger (a.k.a squatty) da...@sq... http://www.squatty.com |
From: Martin G. <gim...@gi...> - 2003-02-21 23:08:25
|
Staci <sco...@wi...> writes: (Please direct your answers to the list and not to me personally.) > On Fri, 21 Feb 2003, Martin Geisler wrote: >> >> We could then make the wrapper function accept arguments that >> control whether or not the drop-down box should be rendered... but >> then we're adding complexity again :-) > > How about a workaround? > > Could you just let us choose the default, move my city to the top of > the dropdown list so it's the one that's there before a person > chooses one? That's already fairly easy to do with the methods presented today... And that's the key issue here: PhpWeather already gives you the pieces to build this kind of thing, it's just assumed that the user knows how to piece them together. > regarding adding complexity...it's up to you. I can't write it > myself, of course, so how much work you're willing to put into it is > up to you. (if you're going to say "none" tell me now and I'll start > looking for another tool. :P ) Well, it's not surposed to be that difficult - look at this code: <?php require('/some/path/to/phpweather/phpweather.php'); require(PHPWEATHER_BASE_DIR . 'pw_utilities.php'); require(PHPWEATHER_BASE_DIR . '/output/pw_text_en.php'); require(PHPWEATHER_BASE_DIR . '/output/pw_images.php'); $weather = new phpweather(); $text = new pw_text_en($weather); $icons = new pw_images($weather); $location = $weather->get_location(); $report = $text->print_pretty(); $sky = $icons->get_sky_image(); $wind = $icons->get_winddir_image(); $temp = $icons->get_temp_image(); ?> This gives you all available information in five variables, it's then up to you to put them into suitable HTML codes. -- Martin Geisler My GnuPG Key: 0xF7F6B57B See http://gimpster.com/ and http://phpweather.net/ for: PHP Weather => Shows the current weather on your webpage and PHP Shell => A telnet-connection (almost :-) in a PHP page. |
From: Martin G. <gim...@gi...> - 2003-02-21 11:52:02
|
Staci <sco...@wi...> writes: > On Wed, 19 Feb 2003, Martin Geisler wrote: > >> But you've got a point: we could make a wrapper function that would >> make the report, the icons and the dropdown boxes. There's no need >> to make things harder than necessary? :-) > > What a great way of thinking about it!! > > That would sure be nice.... > > I'd really like to just have the icons/message for the weather, > rather than the dropdown etc, I know where I live, my friends know > where I live, do I have to always have the dropdown? Well, no, that depends on the wrapper function. And that's exactly the problem with these functions: it's one size fits all --- to have configurable output you'll use the function from PhpWeather directly, to have the stock report-with-icons-and-drop-down you'll use a wrapper function. We could then make the wrapper function accept arguments that control whether or not the drop-down box should be rendered... but then we're adding complexity again :-) -- Martin Geisler My GnuPG Key: 0xF7F6B57B See http://gimpster.com/ and http://phpweather.net/ for: PHP Weather => Shows the current weather on your webpage and PHP Shell => A telnet-connection (almost :-) in a PHP page. |
From: Martin G. <gim...@gi...> - 2003-02-19 21:35:37
|
Staci <sco...@wi...> writes: > Hi! > > First, I'd like to ask what the heck happened in those instructions? > You were so good in the Install and Config directions, spelled it > out for those of us who could potentially be linux-illiterate, > really did good. But once it was installed and I went to try to > include it in my webpage, the instructions suddenly assume a > knowledge of coding and/or php that I just don't have. Why are they > so sketchy compared to the install directions?? Probably because I wrote the INSTALL and README files first, and the HTML/PDF/... files much later when I was much better with PHP. So I've expected more knowledge of PHP --- people have to start somewhere with PHP, but I've never meant them to start with PhpWeather. > I'd like some help with that. I have no experience using php or > including php-stuff on my website. What exactly are the html-tags I > have to insert? Do I have to do anything special other than put in a > tag? The problem is, that you have to define exactly what it is you mean by 'include it into your webpage'? This means something different for every webpage. But you've got a point: we could make a wrapper function that would make the report, the icons and the dropdown boxes. There's no need to make things harder than necessary? :-) -- Martin Geisler My GnuPG Key: 0xF7F6B57B See http://gimpster.com/ and http://phpweather.net/ for: PHP Weather => Shows the current weather on your webpage and PHP Shell => A telnet-connection (almost :-) in a PHP page. |
From: Martin G. <gim...@gi...> - 2003-02-19 21:23:19
|
"Max Hammond" <ma...@fl...> writes: >> But once it was installed and I went to try to include it in my >> webpage, the instructions suddenly assume a knowledge of coding >> and/or php that I just don't have. Why are they so sketchy compared >> to the install directions?? > > I believe that PHPWeather was originally intended almost as a > library, rather than a fully-fledged application (Martin?), and so > its focus was for moderately experienced PHP programmers. It's not > designed to be an application really, just something that you could > include within one. Yes, that's very much how I see it now... PhpWeather gives you the tools to put a weather report on a website, it gives you some tools to build dropdown boxes with lists of countries, stations and languages, and that's about it. So it's easiest to use when you have to experience with PHP. But perhaps we should make a wrapper function that does all this with one call? -- Martin Geisler My GnuPG Key: 0xF7F6B57B See http://gimpster.com/ and http://phpweather.net/ for: PHP Weather => Shows the current weather on your webpage and PHP Shell => A telnet-connection (almost :-) in a PHP page. |
From: Max H. <ma...@fl...> - 2003-02-19 17:00:58
|
> Hi! Hi there, > First, I'd like to ask what the heck happened in those instructions? You > were so good in the Install and Config directions, spelled it out > for those > of us who could potentially be linux-illiterate, really did good. > But once > it was installed and I went to try to include it in my webpage, the > instructions suddenly assume a knowledge of coding and/or php that I just > don't have. Why are they so sketchy compared to the install directions?? I believe that PHPWeather was originally intended almost as a library, rather than a fully-fledged application (Martin?), and so its focus was for moderately experienced PHP programmers. It's not designed to be an application really, just something that you could include within one. > I'd like some help with that. I have no experience using php or including > php-stuff on my website. What exactly are the html-tags I have > to insert? Do > I have to do anything special other than put in a tag? You have to have a PHP page, rather than HTML. Might I suggest http://www.php.net/manual/en/tutorial.php as a decent introduction. (Navigation's a bit funny now, but you can turn the page with the links at the top, in the grey bar). If you need help with PHP, please mail me directly, rather off-topic for this list. Cheers, Max -- Logic merely enables one to be wrong with authority. * Doctor Who |
From: Staci <sco...@wi...> - 2003-02-19 16:50:58
|
Hi! First, I'd like to ask what the heck happened in those instructions? You were so good in the Install and Config directions, spelled it out for those of us who could potentially be linux-illiterate, really did good. But once it was installed and I went to try to include it in my webpage, the instructions suddenly assume a knowledge of coding and/or php that I just don't have. Why are they so sketchy compared to the install directions?? I'd like some help with that. I have no experience using php or including php-stuff on my website. What exactly are the html-tags I have to insert? Do I have to do anything special other than put in a tag? Thanks, sl |
From: Martin G. <gim...@gi...> - 2003-02-17 22:36:29
|
<da...@he...> writes: Hi there > I've installed and configured phpweather - using mysql db. The > original index page and speed test runs fine. The tables are formed > and have been populated. Good... > However, test.php throws an error: > Notice: Undefined variable: time in XXX /output/pw_text.php on line 1050 > > The result is data unavailable. > > Any ideas? Please advise. The test.php that comes with PhpWeather is only meant to test METAR reports manually. You can enter a report in the input field and have PhpWeather try and parse it. If the report lacks the time/date part, then you'll see the notice about the undefined variable. This is because every valid METAR must have a time/date part. If you're referring to some other test.php, then please write again. -- Martin Geisler My GnuPG Key: 0xF7F6B57B See http://gimpster.com/ and http://phpweather.net/ for: PHP Weather => Shows the current weather on your webpage and PHP Shell => A telnet-connection (almost :-) in a PHP page. |
From: <da...@he...> - 2003-02-17 20:39:01
|
Hello. I've installed and configured phpweather - using mysql db. The original index page and speed test runs fine. The tables are formed and have been populated. However, test.php throws an error: Notice: Undefined variable: time in XXX /output/pw_text.php on line 1050 The result is data unavailable. Any ideas? Please advise. -dehemke |
From: Jake O. <ja...@or...> - 2003-01-27 22:49:11
|
OK, just an FYI, I'm playing with this code at http://www.sunrayinc.com/sunriver/weather/index-new.php . I'll keep you posted on my success. Right now it's grabbing the entire file, but, in reality, all I need is the last line of the file (as all I'm displaying = is the most current conditions). Any idea on to do just that? I'll work on getting the station into the CSV and into the database. -Jake -----Original Message----- From: php...@li... [mailto:php...@li...] On Behalf Of = Martin Geisler Sent: Monday, January 27, 2003 1:25 PM To: php...@li... Subject: Re: Getting Data from Personal Weather Stations "Jake Ortman" <ja...@or...> writes: >>I think your best bet is to contact the maintainer (Steve Runner?) and >>ask him how he collects the data. Perhaps you could get access to the >>data in a comma separated file or something like that. > > Sorry I wasn't clear. WUnderground publishes the CSV file here: > http://www.wunderground.com/weatherstation/WXDailyHistory.asp?ID=3DKORSUN= RI1&f > ormat=3D1 > > I had no intention of trying to do reg exp search crap to convert info from > a web page (man, that would be a mess and a half). > > Anyway, would I be able to hook into this?=20 Yes, it's doable - the code below does it! I think I've managed to extract everything that can be extracted from the file... There's still some problems: the height of the clouds isn't present in the data. I've set it to '///' which is the code used at mountain stations when the cloud layer is below the station level... it comes out at 'nil meter' in the report. Also, the names of the stations is fake. You could assign names by editing stations.csv, reloading the database and carefully give the generated METAR reports the same ICAO. <?php error_reporting(E_ALL); include('php/phpweather/phpweather.php'); include('php/phpweather/output/pw_text_en.php'); $weather =3D new phpweather(); $i =3D 0; $fp =3D fopen('http://www.wunderground.com/weatherstation/WXDailyHistory.asp?ID=3D= KORS UNRI1&format=3D1', 'r'); while ($line =3D fgets($fp, 1024)) { if ($line !=3D "\n" && $line !=3D "<br>\n") { $data =3D explode(',', $line); if (count($data) !=3D 14 || $data[0] =3D=3D 'Time') continue; $i++; //print_r($data); $icao =3D sprintf('XX%02d', $i); =20 ereg('([0-3][0-9]) ([0-9]{2}):([0-9]{2})', $data[0], $regs); $date =3D sprintf(' %02d%02d%02dZ', $regs[1], $regs[2], $regs[3]); $temp =3D strtr(sprintf(' %02d/%02d', ($data[1]-32) * 5/9, ($data[2]-32) * 5/9), '-', 'M'); $altimeter =3D sprintf(' A%04d', $data[3]*100); $wind =3D sprintf(' %02d0%02dG%02dKT', round($data[5]/10), round($data[6] * 0.869), round($data[7] * 0.869)); if ($data[9] > 0) $precipitation =3D sprintf(' P%04d', round($data[9]*100)); else $precipitation =3D ''; $clouds =3D sprintf(' %s///', $data[10]); $conditions =3D ' ' . $data[11]; $metar =3D $icao . $date . $wind . $temp . $clouds . $conditions . $altimeter . $precipitation . "\n"; //echo $metar; $weather->set_metar($metar); $text =3D new pw_text_en($weather); //print_r($text); =20 echo '<blockquote>' . $text->print_pretty() . "</blockquote>\n"; } } ?> --=20 Martin Geisler My GnuPG Key: 0xF7F6B57B See http://gimpster.com/ and http://phpweather.net/ for: PHP Weather =3D> Shows the current weather on your webpage and PHP Shell =3D> A telnet-connection (almost :-) in a PHP page. ------------------------------------------------------- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld =3D Something 2 See! http://www.vasoftware.com _______________________________________________ PHPWeather-devel mailing list PHP...@li... https://lists.sourceforge.net/lists/listinfo/phpweather-devel |