phpweather-checkins Mailing List for PHP Weather (Page 16)
Brought to you by:
iridium
You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
(7) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
(1) |
Feb
(1) |
Mar
(184) |
Apr
(31) |
May
(45) |
Jun
(15) |
Jul
(11) |
Aug
(40) |
Sep
(19) |
Oct
(8) |
Nov
(6) |
Dec
(17) |
| 2003 |
Jan
(5) |
Feb
|
Mar
(12) |
Apr
(5) |
May
(2) |
Jun
(3) |
Jul
(3) |
Aug
(3) |
Sep
(17) |
Oct
(10) |
Nov
|
Dec
(4) |
| 2004 |
Jan
(21) |
Feb
(11) |
Mar
|
Apr
|
May
(3) |
Jun
(7) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2005 |
Jan
(4) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Martin G. <gim...@us...> - 2002-03-25 23:44:22
|
Update of /cvsroot/phpweather/phpweather
In directory usw-pr-cvs1:/tmp/cvs-serv15592
Modified Files:
db_updater.php
Log Message:
This should make the browsers understand, that this is text, and not
HTML. It also works from the commandline, at least on my system.
Index: db_updater.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/db_updater.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- db_updater.php 25 Mar 2002 23:33:29 -0000 1.7
+++ db_updater.php 25 Mar 2002 23:44:19 -0000 1.8
@@ -1,5 +1,6 @@
-#!/usr/bin/php -f
<?php
+/* This is plain text, not HTML: */
+header ('Content-type: text/plain');
error_reporting(E_ALL);
function print_usage() {
@@ -23,7 +24,7 @@
$fn = $argv[1];
} else {
print_usage();
- exit(1);
+ exit();
}
define('PHPWEATHER_BASE_DIR', dirname(__FILE__));
|
|
From: Martin G. <gim...@us...> - 2002-03-25 23:33:32
|
Update of /cvsroot/phpweather/phpweather/db
In directory usw-pr-cvs1:/tmp/cvs-serv12552/db
Modified Files:
pw_db_common.php
Log Message:
Nicer output. When we run this from a cronjob, we can just redirect it
to /dev/null, but it's nice to see how it goes when run by hand.
Index: pw_db_common.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/db/pw_db_common.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- pw_db_common.php 25 Mar 2002 21:12:09 -0000 1.6
+++ pw_db_common.php 25 Mar 2002 23:33:29 -0000 1.7
@@ -78,6 +78,8 @@
$fp = fopen($file, 'r');
$i = 0;
+ $inserted = 0;
+ $updated = 0;
while (!feof($fp)) {
@@ -103,12 +105,15 @@
if ($this->get_metar($icao)) {
$this->update_metar($icao, addslashes($metar), $timestamp);
+ $updated++;
} else {
$this->insert_metar($icao, addslashes($metar), $timestamp);
+ $inserted++;
}
if ($i % 100 == 0) {
- $this->debug("Inserted $i METARs...");
+ printf("Inserted %6d new METARs, updated %6d METARs...\n",
+ $inserted, $updated);
}
$i++;
|
|
From: Martin G. <gim...@us...> - 2002-03-25 23:33:32
|
Update of /cvsroot/phpweather/phpweather
In directory usw-pr-cvs1:/tmp/cvs-serv12552
Modified Files:
db_updater.php
Log Message:
Nicer output. When we run this from a cronjob, we can just redirect it
to /dev/null, but it's nice to see how it goes when run by hand.
Index: db_updater.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/db_updater.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- db_updater.php 25 Mar 2002 20:58:08 -0000 1.6
+++ db_updater.php 25 Mar 2002 23:33:29 -0000 1.7
@@ -31,11 +31,11 @@
$db = new db_layer(array());
if ($db->db->connect()) {
+ echo "Connected to database - updating METARs...\n";
$db->db->update_all_metars($fn);
- exit(0);
+ echo "Done - database updated.\n";
} else {
echo "An error occurred while connecting to the database!\n";
- exit(1);
}
?>
|
|
From: Martin G. <gim...@us...> - 2002-03-25 23:26:15
|
Update of /cvsroot/phpweather/phpweather/db
In directory usw-pr-cvs1:/tmp/cvs-serv10749/db
Modified Files:
pw_db_dba.php
Log Message:
Hmm, typoes in the debug - what's next?
Index: pw_db_dba.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/db/pw_db_dba.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- pw_db_dba.php 25 Mar 2002 21:22:55 -0000 1.5
+++ pw_db_dba.php 25 Mar 2002 23:26:10 -0000 1.6
@@ -148,7 +148,7 @@
* @see update_metar()
*/
function insert_metar($station, $metar, $timestamp) {
- $this->debug("Inserting this row into the DBA database:<br><code>$metar . ':' . $timestamp</code>");
+ $this->debug("Inserting this row into the DBA database:<br><code>$metar:$timestamp</code>");
dba_insert($station, $metar . ':' . $timestamp, $this->link_id);
}
@@ -162,7 +162,7 @@
* @see insert_metar()
*/
function update_metar($station, $metar, $timestamp) {
- $this->debug("Updating this row in the DBA database:<br><code>$metar . ':' . $timestamp</code>");
+ $this->debug("Updating this row in the DBA database:<br><code>$metar:$timestamp</code>");
dba_replace($station, $metar . ':' . $timestamp, $this->link_id);
}
|
|
From: Max H. <ir...@us...> - 2002-03-25 22:10:22
|
Update of /cvsroot/phpweather/web In directory usw-pr-cvs1:/tmp/cvs-serv21327 Modified Files: index.php Log Message: Minor update Index: index.php =================================================================== RCS file: /cvsroot/phpweather/web/index.php,v retrieving revision 1.13 retrieving revision 1.14 diff -u -3 -r1.13 -r1.14 --- index.php 25 Mar 2002 20:27:49 -0000 1.13 +++ index.php 25 Mar 2002 22:10:17 -0000 1.14 @@ -133,7 +133,7 @@ --> -Due to limitations of the SourceForge server, we can not load the most up-to-date information here. To see +Due to limitations of the SourceForge server, we can not load the most up-to-date information for all stations here. To see PHPWeather working properly, you can go <a href="http://www.warwick.ac.uk/~msufi/phpweather" target="new">here</a>. <? |
|
From: Max H. <ir...@us...> - 2002-03-25 21:50:43
|
Update of /cvsroot/phpweather/phpweather-1.x
In directory usw-pr-cvs1:/tmp/cvs-serv14408
Modified Files:
locale_nl.inc
Log Message:
Updated translation, thanks to Ray van Beek <r_v...@ho...>
Index: locale_nl.inc
===================================================================
RCS file: /cvsroot/phpweather/phpweather-1.x/locale_nl.inc,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- locale_nl.inc 24 Mar 2002 19:52:32 -0000 1.2
+++ locale_nl.inc 25 Mar 2002 21:50:35 -0000 1.3
@@ -1,10 +1,10 @@
<?php
/*
- * This file holds the Dutch translation of PHP Weather. To use it,
- * just include it in the main phpweather.inc file.
- *
- * Author: Nicky Haan <ni...@ne...>
- */
+* This file holds the Dutch translation of PHP Weather. To use it,
+* just include it in the main phpweather.inc file.
+*
+* Author: Nicky Haan <ni...@ne...>
+*/
/* Unsets old language variables and loads new ones. */
if (isset($strings)) {
@@ -53,8 +53,7 @@
'Heavy' => 'Zwaar ',
'nearby' => 'Dichtbij ',
'current_weather' => 'Het huidige weer is <b>%s</b>. ',
- 'pretty_print_metar' => '<blockquote><p><b>%s</b> minuten geleden, om <b>%s</b> UTC, de wind blies %s nabij %s. De temperatuur was <b>%s</b> graden Celsius (<b>%s</b> graden Fahrenheit), %s en de barometerdruk was <b>%s</b> hPa (<b>%s</b> inHg). De relatieve vochtigheid was <b>%s%%</b>. %s %s %s %s %s</p></blockquote>'
- );
+ 'pretty_print_metar' => '<blockquote><p><b>%s</b> minuten geleden, om <b>%s</b> UTC, de wind blies %s nabij %s. De temperatuur was <b>%s</b> graden Celsius (<b>%s</b> graden Fahrenheit), %s en de barometerdruk was <b>%s</b> hPa (<b>%s</b> inHg). De relatieve vochtigheid was <b>%s%%</b>. %s %s %s %s %s</p></blockquote>');
$wind_dir_text_short_array = array(
'N',
|
|
From: Martin G. <gim...@us...> - 2002-03-25 21:23:00
|
Update of /cvsroot/phpweather/phpweather/db
In directory usw-pr-cvs1:/tmp/cvs-serv5112/db
Modified Files:
pw_db_dba.php
Log Message:
Second try on this
Index: pw_db_dba.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/db/pw_db_dba.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- pw_db_dba.php 25 Mar 2002 21:19:54 -0000 1.4
+++ pw_db_dba.php 25 Mar 2002 21:22:55 -0000 1.5
@@ -148,7 +148,7 @@
* @see update_metar()
*/
function insert_metar($station, $metar, $timestamp) {
- $this->debug("Inserting this row into the DBA database:<br><code>$row</code>");
+ $this->debug("Inserting this row into the DBA database:<br><code>$metar . ':' . $timestamp</code>");
dba_insert($station, $metar . ':' . $timestamp, $this->link_id);
}
@@ -162,7 +162,7 @@
* @see insert_metar()
*/
function update_metar($station, $metar, $timestamp) {
- $this->debug("Updating this row in the DBA database:<br><code>$row</code>");
+ $this->debug("Updating this row in the DBA database:<br><code>$metar . ':' . $timestamp</code>");
dba_replace($station, $metar . ':' . $timestamp, $this->link_id);
}
|
|
From: Martin G. <gim...@us...> - 2002-03-25 21:20:01
|
Update of /cvsroot/phpweather/phpweather/db
In directory usw-pr-cvs1:/tmp/cvs-serv4092/db
Modified Files:
pw_db_dba.php
Log Message:
More debug info needed!
Index: pw_db_dba.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/db/pw_db_dba.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- pw_db_dba.php 20 Mar 2002 19:26:50 -0000 1.3
+++ pw_db_dba.php 25 Mar 2002 21:19:54 -0000 1.4
@@ -148,6 +148,7 @@
* @see update_metar()
*/
function insert_metar($station, $metar, $timestamp) {
+ $this->debug("Inserting this row into the DBA database:<br><code>$row</code>");
dba_insert($station, $metar . ':' . $timestamp, $this->link_id);
}
@@ -161,6 +162,7 @@
* @see insert_metar()
*/
function update_metar($station, $metar, $timestamp) {
+ $this->debug("Updating this row in the DBA database:<br><code>$row</code>");
dba_replace($station, $metar . ':' . $timestamp, $this->link_id);
}
|
|
From: Martin G. <gim...@us...> - 2002-03-25 21:12:16
|
Update of /cvsroot/phpweather/phpweather/db
In directory usw-pr-cvs1:/tmp/cvs-serv1924
Modified Files:
pw_db_common.php
Log Message:
Stupid error...
Index: pw_db_common.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/db/pw_db_common.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- pw_db_common.php 25 Mar 2002 21:09:28 -0000 1.5
+++ pw_db_common.php 25 Mar 2002 21:12:09 -0000 1.6
@@ -110,7 +110,7 @@
if ($i % 100 == 0) {
$this->debug("Inserted $i METARs...");
}
- $i++
+ $i++;
} /* while (!feof($fp)) */
|
|
From: Martin G. <gim...@us...> - 2002-03-25 21:09:33
|
Update of /cvsroot/phpweather/phpweather/db
In directory usw-pr-cvs1:/tmp/cvs-serv1252/db
Modified Files:
pw_db_common.php
Log Message:
We need more debug-output...
Index: pw_db_common.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/db/pw_db_common.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- pw_db_common.php 25 Mar 2002 20:38:12 -0000 1.4
+++ pw_db_common.php 25 Mar 2002 21:09:28 -0000 1.5
@@ -77,6 +77,8 @@
$fp = fopen($file, 'r');
+ $i = 0;
+
while (!feof($fp)) {
$line = trim(fgets($fp, 256));
@@ -104,6 +106,11 @@
} else {
$this->insert_metar($icao, addslashes($metar), $timestamp);
}
+
+ if ($i % 100 == 0) {
+ $this->debug("Inserted $i METARs...");
+ }
+ $i++
} /* while (!feof($fp)) */
|
|
From: Martin G. <gim...@us...> - 2002-03-25 20:58:14
|
Update of /cvsroot/phpweather/phpweather
In directory usw-pr-cvs1:/tmp/cvs-serv29403
Modified Files:
db_updater.php
Log Message:
It seams that I cannot make the connection to the DBA database.
Index: db_updater.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/db_updater.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- db_updater.php 25 Mar 2002 20:20:17 -0000 1.5
+++ db_updater.php 25 Mar 2002 20:58:08 -0000 1.6
@@ -30,7 +30,12 @@
require_once(PHPWEATHER_BASE_DIR . '/db_layer.php');
$db = new db_layer(array());
-$db->db->connect();
-$db->db->update_all_metars($fn);
+if ($db->db->connect()) {
+ $db->db->update_all_metars($fn);
+ exit(0);
+} else {
+ echo "An error occurred while connecting to the database!\n";
+ exit(1);
+}
?>
|
|
From: Martin G. <gim...@us...> - 2002-03-25 20:38:19
|
Update of /cvsroot/phpweather/phpweather/db
In directory usw-pr-cvs1:/tmp/cvs-serv23112/db
Modified Files:
pw_db_common.php
Log Message:
Hmm, it seams that there can be garbage in the METAR reports...
Index: pw_db_common.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/db/pw_db_common.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- pw_db_common.php 25 Mar 2002 19:35:55 -0000 1.3
+++ pw_db_common.php 25 Mar 2002 20:38:12 -0000 1.4
@@ -100,9 +100,9 @@
$icao = substr($metar, 0, 4);
if ($this->get_metar($icao)) {
- $this->update_metar($icao, $metar, $timestamp);
+ $this->update_metar($icao, addslashes($metar), $timestamp);
} else {
- $this->insert_metar($icao, $metar, $timestamp);
+ $this->insert_metar($icao, addslashes($metar), $timestamp);
}
} /* while (!feof($fp)) */
|
|
From: Max H. <ir...@us...> - 2002-03-25 20:27:55
|
Update of /cvsroot/phpweather/web
In directory usw-pr-cvs1:/tmp/cvs-serv19869
Modified Files:
index.php
Log Message:
bugger it
Index: index.php
===================================================================
RCS file: /cvsroot/phpweather/web/index.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- index.php 25 Mar 2002 20:26:29 -0000 1.12
+++ index.php 25 Mar 2002 20:27:49 -0000 1.13
@@ -1,9 +1,9 @@
<?php
require_once('include/header.php');
-require_once('../phpweather/phpweather.php');
-require_once('../phpweather/output/pw_text_en.php');
-require_once('../phpweather/output/pw_images.php');
-require_once('../phpweather/pw_utilities.php');
+require_once('phpweather/phpweather.php');
+require_once('phpweather/output/pw_text_en.php');
+require_once('phpweather/output/pw_images.php');
+require_once('phpweather/pw_utilities.php');
?>
<p>This is the homepage of PHP Weather at <a
|
|
From: Martin G. <gim...@us...> - 2002-03-25 20:26:40
|
Update of /cvsroot/phpweather/phpweather
In directory usw-pr-cvs1:/tmp/cvs-serv19240
Modified Files:
phpweather.php
Log Message:
This was giving errors if there wasn't any data available.
Index: phpweather.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/phpweather.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- phpweather.php 24 Mar 2002 17:25:35 -0000 1.18
+++ phpweather.php 25 Mar 2002 20:26:33 -0000 1.19
@@ -685,15 +685,20 @@
/*
* Compute windchill if temp < 40f and windspeed > 3 mph
*/
- if ($decoded_metar['temperature']['temp_f'] <= '40' && $decoded_metar['wind']['miles_per_hour'] > '3'){
- $decoded_metar['windchill']['windchill_f'] =
- number_format(35.74 + 0.6215*$decoded_metar['temperature']['temp_f']
- - 35.75*pow($decoded_metar['wind']['miles_per_hour'],0.16)
- + 0.4275*$decoded_metar['temperature']['temp_f']*pow($decoded_metar['wind']['miles_per_hour'],0.16));
- $decoded_metar['windchill']['windchill_c'] =
- number_format(13.112 + 0.6215*$decoded_metar['temperature']['temp_c']
- - 13.37*pow(($decoded_metar['wind']['miles_per_hour']/1.609),0.16)
- + 0.3965*$decoded_metar['temperature']['temp_c']*pow(($decoded_metar['wind']['miles_per_hour']/1.609),0.16));
+ if (!empty($decoded_metar['temperature']['temp_f']) &&
+ $decoded_metar['temperature']['temp_f'] <= '40' &&
+ !empty($decoded_metar['wind']['miles_per_hour']) &&
+ $decoded_metar['wind']['miles_per_hour'] > '3'){
+ $decoded_metar['windchill']['windchill_f'] =
+ number_format(35.74 + 0.6215*$decoded_metar['temperature']['temp_f']
+ - 35.75*pow($decoded_metar['wind']['miles_per_hour'], 0.16)
+ + 0.4275*$decoded_metar['temperature']['temp_f'] *
+ pow($decoded_metar['wind']['miles_per_hour'], 0.16));
+ $decoded_metar['windchill']['windchill_c'] =
+ number_format(13.112 + 0.6215*$decoded_metar['temperature']['temp_c']
+ - 13.37*pow(($decoded_metar['wind']['miles_per_hour']/1.609), 0.16)
+ + 0.3965*$decoded_metar['temperature']['temp_c'] *
+ pow(($decoded_metar['wind']['miles_per_hour']/1.609), 0.16));
}
/* Finally we store our decoded METAR in $this->decoded_metar so
|
|
From: Max H. <ir...@us...> - 2002-03-25 20:26:33
|
Update of /cvsroot/phpweather/web
In directory usw-pr-cvs1:/tmp/cvs-serv19337
Modified Files:
.cvsignore index.php
Log Message:
Try to keep it real :)
Index: .cvsignore
===================================================================
RCS file: /cvsroot/phpweather/web/.cvsignore,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- .cvsignore 18 Mar 2002 16:37:29 -0000 1.2
+++ .cvsignore 25 Mar 2002 20:26:29 -0000 1.3
@@ -1,2 +1,3 @@
phpweather
phpweather-1.x
+egbe.txt
Index: index.php
===================================================================
RCS file: /cvsroot/phpweather/web/index.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- index.php 24 Mar 2002 22:49:52 -0000 1.11
+++ index.php 25 Mar 2002 20:26:29 -0000 1.12
@@ -1,9 +1,9 @@
<?php
require_once('include/header.php');
-require_once('phpweather/phpweather.php');
-require_once('phpweather/output/pw_text_en.php');
-require_once('phpweather/output/pw_images.php');
-require_once('phpweather/pw_utilities.php');
+require_once('../phpweather/phpweather.php');
+require_once('../phpweather/output/pw_text_en.php');
+require_once('../phpweather/output/pw_images.php');
+require_once('../phpweather/pw_utilities.php');
?>
<p>This is the homepage of PHP Weather at <a
@@ -14,7 +14,8 @@
<?
$weather = new phpweather(array());
-$weather->set_metar("EGBE 242120Z 21005KT 200V270 CAVOK 08/03 Q1031");
+$egbe = fread(fopen('egbe.txt', 'r'),filesize('egbe.txt'));
+$weather->set_metar($egbe);
$text = new pw_text_en($weather, array('mark_begin' => '<font color="blue">',
'mark_end' => '</font>'));
$images = new pw_images($weather, array('icons_path' => 'phpweather/icons/'));
|
|
From: Max H. <ir...@us...> - 2002-03-25 20:24:55
|
Update of /cvsroot/phpweather/web In directory usw-pr-cvs1:/tmp/cvs-serv18689 Added Files: egbe.txt Log Message: Current coventry weather - adding to CVS just to make sure it's left alone really --- NEW FILE --- EGBE 25/1950 251950Z 35008KT 8000 BKN030 11/06 Q1029= |
|
From: Martin G. <gim...@us...> - 2002-03-25 20:20:23
|
Update of /cvsroot/phpweather/phpweather
In directory usw-pr-cvs1:/tmp/cvs-serv17180
Modified Files:
db_updater.php
Log Message:
Let's try just one more time...
Index: db_updater.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/db_updater.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- db_updater.php 25 Mar 2002 20:17:49 -0000 1.4
+++ db_updater.php 25 Mar 2002 20:20:17 -0000 1.5
@@ -15,11 +15,11 @@
$fn = $filename;
} else if (!empty($argv[0]) &&
file_exists($argv[0]) &&
- ereg('[012][0-9]Z.TXT', $filename)) {
+ ereg('[012][0-9]Z.TXT', $argv[0])) {
$fn = $argv[0];
} else if (!empty($argv[1]) &&
file_exists($argv[1]) &&
- ereg('[012][0-9]Z.TXT', $filename)) {
+ ereg('[012][0-9]Z.TXT', $argv[1])) {
$fn = $argv[1];
} else {
print_usage();
|
|
From: Martin G. <gim...@us...> - 2002-03-25 20:17:54
|
Update of /cvsroot/phpweather/phpweather
In directory usw-pr-cvs1:/tmp/cvs-serv16538
Modified Files:
db_updater.php
Log Message:
I admit it, that my own fault :-)
Index: db_updater.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/db_updater.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- db_updater.php 25 Mar 2002 20:16:36 -0000 1.3
+++ db_updater.php 25 Mar 2002 20:17:49 -0000 1.4
@@ -11,7 +11,7 @@
if (!empty($filename) &&
file_exists($filename) &&
- ereg('[012][0-9]Z.TXT', $filename) {
+ ereg('[012][0-9]Z.TXT', $filename)) {
$fn = $filename;
} else if (!empty($argv[0]) &&
file_exists($argv[0]) &&
|
|
From: Martin G. <gim...@us...> - 2002-03-25 20:16:41
|
Update of /cvsroot/phpweather/phpweather In directory usw-pr-cvs1:/tmp/cvs-serv16167 Modified Files: db_updater.php Log Message: Argh - yet another difference between my system and SourceForge! Index: db_updater.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/db_updater.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- db_updater.php 25 Mar 2002 20:11:19 -0000 1.2 +++ db_updater.php 25 Mar 2002 20:16:36 -0000 1.3 @@ -1,4 +1,4 @@ -#!/usr/bin/php4 -f +#!/usr/bin/php -f <?php error_reporting(E_ALL); |
|
From: Martin G. <gim...@us...> - 2002-03-25 20:11:25
|
Update of /cvsroot/phpweather/phpweather
In directory usw-pr-cvs1:/tmp/cvs-serv14233
Modified Files:
db_updater.php
Log Message:
Ugh! This is kinda ugly - when I run this at SourceForge, then the
script isn't included in $argv - when I run this on my machine, the
first entry in $argv is the filename the script was invoked as...
Let's just call this a temporary fix :-)
Index: db_updater.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/db_updater.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- db_updater.php 25 Mar 2002 19:39:05 -0000 1.1
+++ db_updater.php 25 Mar 2002 20:11:19 -0000 1.2
@@ -9,9 +9,17 @@
}
-if (!empty($filename) && file_exists($filename)) {
+if (!empty($filename) &&
+ file_exists($filename) &&
+ ereg('[012][0-9]Z.TXT', $filename) {
$fn = $filename;
-} else if (!empty($argv[1]) && file_exists($argv[1])) {
+} else if (!empty($argv[0]) &&
+ file_exists($argv[0]) &&
+ ereg('[012][0-9]Z.TXT', $filename)) {
+ $fn = $argv[0];
+} else if (!empty($argv[1]) &&
+ file_exists($argv[1]) &&
+ ereg('[012][0-9]Z.TXT', $filename)) {
$fn = $argv[1];
} else {
print_usage();
|
|
From: Martin G. <gim...@us...> - 2002-03-25 19:39:09
|
Update of /cvsroot/phpweather/phpweather
In directory usw-pr-cvs1:/tmp/cvs-serv4986
Added Files:
db_updater.php
Log Message:
This little script will update the METAR database with new data. It's
meant to be called periodically from a cronjob.
--- NEW FILE ---
#!/usr/bin/php4 -f
<?php
error_reporting(E_ALL);
function print_usage() {
echo "Usage:\n";
echo " From the commandline: db_updater.php /path/to/new/metars or\n";
echo " In a webbrowser: db_updater.php?filename=/path/to/new/metars\n";
}
if (!empty($filename) && file_exists($filename)) {
$fn = $filename;
} else if (!empty($argv[1]) && file_exists($argv[1])) {
$fn = $argv[1];
} else {
print_usage();
exit(1);
}
define('PHPWEATHER_BASE_DIR', dirname(__FILE__));
require_once(PHPWEATHER_BASE_DIR . '/db_layer.php');
$db = new db_layer(array());
$db->db->connect();
$db->db->update_all_metars($fn);
?>
|
|
From: Martin G. <gim...@us...> - 2002-03-25 19:35:58
|
Update of /cvsroot/phpweather/phpweather/db
In directory usw-pr-cvs1:/tmp/cvs-serv4090
Modified Files:
pw_db_common.php
Log Message:
Hehe - this is kind of cool :-) We can now update the databases with
fresh data from cycle files. These files contain all the METARs
received in the last 'cycle' at the NWS.
Index: pw_db_common.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/db/pw_db_common.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- pw_db_common.php 20 Mar 2002 19:26:50 -0000 1.2
+++ pw_db_common.php 25 Mar 2002 19:35:55 -0000 1.3
@@ -57,6 +57,58 @@
$this->result_id = false;
}
+
+ /**
+ * Updates the database with new data from a cycle file.
+ *
+ * This method is used when a new cycle-file has received. The idea
+ * is, that it is run periodically to update the database with fresh
+ * data. This should be done from a different script than the main
+ * script (the script the uses see), as this can take some time.
+ *
+ * @param string The filename of the new cycle file. The filename
+ * should be an absolute filename.
+ *
+ * Or would it be better, if it was relative to PHPWEATHER_BASE_DIR?
+ *
+ * @see insert_metar(), update_metar()
+ */
+ function update_all_metars($file) {
+
+ $fp = fopen($file, 'r');
+
+ while (!feof($fp)) {
+
+ $line = trim(fgets($fp, 256));
+ if ($line == '') {
+ continue;
+ }
+
+ /* We have now moved past one or more blank lines, next is the
+ * date: */
+ $date = explode(':', strtr($line, '/ ', '::'));
+ $timestamp = gmmktime($date[3], $date[4], 0,
+ $date[1], $date[2], $date[0]);
+
+ /* The next lines are the METAR: */
+ $metar = trim(fgets($fp, 256));
+ while (!feof($fp) && ($line = trim(fgets($fp, 256))) != '') {
+ $metar .= ' ' . $line;
+ }
+
+ /* The ICAO is always the first four characters in the METAR: */
+ $icao = substr($metar, 0, 4);
+
+ if ($this->get_metar($icao)) {
+ $this->update_metar($icao, $metar, $timestamp);
+ } else {
+ $this->insert_metar($icao, $metar, $timestamp);
+ }
+
+ } /* while (!feof($fp)) */
+
+ fclose($fp);
+ }
}
?>
|
|
From: Martin G. <gim...@us...> - 2002-03-25 19:32:23
|
Update of /cvsroot/phpweather/phpweather/db
In directory usw-pr-cvs1:/tmp/cvs-serv3394
Modified Files:
pw_db_mysql.php
Log Message:
It seams that the Debian guys have decided to include MySQL support as
a loadable module for Apache. So I needed these lines to make things
work. I've looked at how things are done in phpMyAdmin so I think it
will work on Windows too.
Index: pw_db_mysql.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/db/pw_db_mysql.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- pw_db_mysql.php 20 Mar 2002 19:26:50 -0000 1.2
+++ pw_db_mysql.php 25 Mar 2002 19:32:18 -0000 1.3
@@ -13,11 +13,20 @@
class pw_db_mysql extends pw_db_common {
/**
- * This constructor does nothing besides calling the parent constructor.
+ * This constructor does nothing besides calling the parent
+ * constructor.
*
* @param array the initial properties of the object
*/
function pw_db_mysql($input) {
+ /* We have to load the MySQL extension on some systems: */
+ if (!extension_loaded('mysql')) {
+ if (ereg('win', PHP_OS)) {
+ dl('mysql.dll');
+ } else {
+ dl('mysql.so');
+ }
+ }
$this->pw_db_common($input);
}
@@ -219,8 +228,7 @@
metar varchar(255) NOT NULL,
timestamp timestamp(14),
PRIMARY KEY (icao),
- UNIQUE icao (icao)
-)');
+ UNIQUE icao (icao))');
/* Then we make a table for the stations. */
$this->query('DROP TABLE IF EXISTS ' . $this->properties['db_stations']);
@@ -231,8 +239,7 @@
country varchar(128) NOT NULL,
PRIMARY KEY (icao),
UNIQUE icao (icao),
- KEY cc (cc)
-)');
+ KEY cc (cc))');
return true; // Succes!
|
|
From: Martin G. <gim...@us...> - 2002-03-25 13:08:56
|
Update of /cvsroot/phpweather/phpweather-1.x In directory usw-pr-cvs1:/tmp/cvs-serv30973 Modified Files: locale_it.inc Log Message: Correct translation of 'windchill' thanks to Carlo Gulin (carlogulin). Index: locale_it.inc =================================================================== RCS file: /cvsroot/phpweather/phpweather-1.x/locale_it.inc,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- locale_it.inc 24 Mar 2002 19:52:32 -0000 1.2 +++ locale_it.inc 25 Mar 2002 13:08:53 -0000 1.3 @@ -37,7 +37,7 @@ 'wind_str_calm' => '<b>calma</b>', 'wind_vrb_long' => 'direzione variabile', 'wind_vrb_short' => 'VAR', - 'windchill' => ' the windchill was <b>%s</b> °C (<b>%s</b> °F) ', + 'windchill' => ' potere raffreddante del vento era del <b>%s</b> °C (<b>%s</b> °F) ', 'precip_last_hour' => 'nella ultima ora. ', 'precip_last_6_hours' => 'nelle ultime 3 fino 6 ore. ', 'precip_last_24_hours' => 'nelle ultime 24 ore. ', |
|
From: Max H. <ir...@us...> - 2002-03-24 22:55:36
|
Update of /cvsroot/phpweather/web/include In directory usw-pr-cvs1:/tmp/cvs-serv10801 Modified Files: footer.php Log Message: Minor syntactical Index: footer.php =================================================================== RCS file: /cvsroot/phpweather/web/include/footer.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- footer.php 18 Mar 2002 16:51:37 -0000 1.1 +++ footer.php 24 Mar 2002 22:55:33 -0000 1.2 @@ -5,7 +5,7 @@ src="http://sourceforge.net/sflogo.php?group_id=23245" width="88" height="31" border="0" alt="SourceForge Logo" align="right"></a> -<p>This page was last modified on <? echo date('F \t\h\e jS, Y', getlastmod()) ?>.</p> +<p>This page was last modified on <? echo date('F jS, Y', getlastmod()) ?>.</p> </body> |