cloudy cloudy

Author Topic: Alternative ATOM Feed Alert Program  (Read 80721 times)

0 Members and 1 Guest are viewing this topic.

curly

  • Guest
Re: Alternative ATOM Feed Alert Program
« Reply #285 on: March 30, 2011, 01:15:37 AM »
They're still down.

You don't suppose the servers went down due to an overload?    :-k

Offline FLWeather

  • Posts: 304
  • Jupiter, FL
    • Live Jupiter, FL Weather
Re: Alternative ATOM Feed Alert Program
« Reply #286 on: March 31, 2011, 10:08:20 PM »
This is a great script! Thank you very much!
Just one question... How do I get the warnings and watches back on the top of my main page? Thank you for any help!
Joe
http://www.joe4speed.com/wxindex.php

curly

  • Guest
Re: Alternative ATOM Feed Alert Program
« Reply #287 on: April 01, 2011, 12:39:30 AM »
This is a great script! Thank you very much!
Just one question... How do I get the warnings and watches back on the top of my main page? Thank you for any help!
Joe
http://www.joe4speed.com/wxindex.php

Did you get any of that nasty weather this morning?

To add the alert box to a page, decide where you want it and paste this into the html:
Code: [Select]
<?php
echo "\n<!-- AtomFeed Alert Box-->";
include(
"AtomArray.php");
print 
$alert_box;
echo 
"\n<!-- end AtomFeed Alert Box-->\n";
?>

Offline FLWeather

  • Posts: 304
  • Jupiter, FL
    • Live Jupiter, FL Weather
Re: Alternative ATOM Feed Alert Program
« Reply #288 on: April 01, 2011, 04:22:03 AM »
I'm still waiting for it to arrive, Curly!!! It's taking its sweet time!

Thank you very much for the help and a great code! :)

Offline kewee

  • Posts: 71
Re: Alternative ATOM Feed Alert Program
« Reply #289 on: April 22, 2011, 11:15:06 PM »
Having trouble with the cron job using Windows Task Scheduler. I have followed the setup but when it runs it never completes. When I refresh it still shows a status of running. It works fine when I run it in the browser. Anyone have any ideas or an alternate cron program that I can use?

Rick
« Last Edit: April 22, 2011, 11:55:17 PM by kewee »

warwickpaweather

  • Guest
Re: Alternative ATOM Feed Alert Program
« Reply #290 on: April 23, 2011, 10:36:30 AM »
Wait  one minute....where is Curly....shows he's now a "guest"?

Offline sacreysouthern

  • Posts: 246
  • Echo Valley Weather
  • Benton, AR, USA
    • Echo Valley Weather
Re: Alternative ATOM Feed Alert Program
« Reply #291 on: April 23, 2011, 11:32:54 AM »
I noticed that, too.  Not only that his weather script download page is gone, too.
GR2AE, GR3, Davis VP2 Pro CWOP ID: D2073

Offline ALITTLEweird1

  • Mark
  • Global Moderator
  • Posts: 5,155
  • North Bend, WA
    • North Bend Weather
Re: Alternative ATOM Feed Alert Program
« Reply #292 on: April 23, 2011, 02:19:27 PM »
Thats not good. i sent him an email.
"Nature can do without man, but man cannot do without nature."

Davis VP2 + VP2 Solar + VP2 UV + Lightning Detector + Logitech Webcam

warwickpaweather

  • Guest
Re: Alternative ATOM Feed Alert Program
« Reply #293 on: April 23, 2011, 03:24:16 PM »
I found him on wxforums but he's not answering my message.....

Offline Mikla

  • Posts: 1
    • Boca Falls Weather (Boca Raton, Fl)
Re: Alternative ATOM Feed Alert Program
« Reply #294 on: April 23, 2011, 04:47:31 PM »
I don't know if this has been covered before, but for those that don't use Linux or, want or have access to Task Scheduler (e.g., my host does not allow me access), or you don't want to change your index file to a php file, then this is a good alternative.  Since it is an asynchronous request, it allows the page to load as it is getting the data.

First you need jQuery: http://docs.jquery.com/Downloading_jQuery#Download_jQuery
For the script below, it is installed in a "js" subdirectory under the folder where the page is executed.

Create a webpage (straight .html is fine) and add the code below.  For existing pages, add the javascript code and a div with the id of "v_Alerts" where you want the alert box to show up.

Also, on the line "url: 'AtomAlerts/AtomFeed.php?rand=' + (new Date()).valueOf()" change the location to that of your "AtomFeed.php" file (leave the ?rand.. part).

Create a php file named "AtomAlertAjax.php" with the contents shown below (or whatever you want in your alert box).

Then run the html page... the page should load and when the javascript calls are complete, the alert box should show up.

The line "setTimeout("SetAlerts()", 60 * 1000);" controls how often the script checks for new info.  In this case it is every 60 seconds.

If you do not want to use the body onload event, then you can use the jquery function:
$(document).ready(function () {
   SetAlerts();
});

Example: http://www.bocafallsweather.com/testalerts.html

Webpage (e.g., index.html):
Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
<script type="text/javascript" src="js/jquery-1.5.1.js"></script> <!-- change folder to where this is located -->
<script type="text/javascript">
function SetAlerts() {
   $.ajax({
      url: 'AtomAlerts/AtomFeed.php?rand=' + (new Date()).valueOf(), //change to the location of your AtomFeed.php
      dataType: 'text',
      success: function (data, textStatus) {
       try {
         //alert('Status is '+textStatus);
         //alert('JSON data string is: '+data);
         GetAlerts();
         } catch (err) {
            //Handle errors here
         }
         setTimeout("SetAlerts()", 60 * 1000);
      },
      error: function (xhr, ajaxOptions, thrownError) {
         alert('ErrorStatus: ' + xhr.status);
         alert('ErrorThrown: ' + thrownError);
      }
   });
}
function GetAlerts() {
   $.ajax({
      url: 'AtomAlertAjax.php?rand=' + (new Date()).valueOf(),
      dataType: 'text',
      success: function (data, textStatus) {
       try{
         //alert('Status is '+textStatus);
         //alert('JSON data string is: '+data);
        
          $('#v_Alerts').html(data)
 
         } catch (err) {
            //Handle errors here
         }
      },
      error: function (xhr, ajaxOptions, thrownError) {
         alert('ErrorStatus: ' + xhr.status);
         alert('ErrorThrown: ' + thrownError);
      }
   });
}
// Uncomment the following three lines if you don't want to use the body unload function
//$(document).ready(function () {
// SetAlerts();
//});

</script>
</head>
<body onload="SetAlerts()"> <!-- you can use the jQuery ready function instead of the onload function -->
<h2>ALERTS</h2>

<div id="v_Alerts"></div>

<br />
<div>Some more page data</div>

</body>
</html>

AtomAlertAjax.php:
Code: [Select]
<?php
echo "\n<!-- AtomFeed Alert Box-->";
include(
"AtomArray.php");
print 
$alert_box;
echo 
"\n<!-- end AtomFeed Alert Box-->\n";
?>

« Last Edit: April 23, 2011, 05:50:40 PM by Mikla »

Offline gateway2capecod

  • Posts: 1,942
  • West Wareham, Ma. USA
    • West Wareham,Ma Weather
Re: Alternative ATOM Feed Alert Program
« Reply #295 on: April 26, 2011, 08:17:55 PM »
hello...

can someone help me out with 2 things concerning this script.?

1) in the Atom-feed-Config.php file...what do I place in this section for my area?

###  COUNTY/ZONE SET UP  ######################################################################################

$Code_Location = array(
    "INZ005" => "Elkhart Co", // ELKHART IN - priority zone listed first
    "INC039" => array(1 => "INC039",'a' => "INZ005"),  // COUNTY CODE => COUNTY CODE => ZONE CODE
    "MDC005" => array(1 => "MDC005",'a' => "MDZ011",'b' => "MDZ006"),  // COUNTY CODE =>  COUNTY CODE => ZONE CODE => ZONE CODE
    "MDZ006" => "No.Balt.Co.", // N Baltimore
    "MDZ011" => "So.Balt.Co." // S Baltimore
);

My Noaa Zone is MAZ021 and the County Zone is MAC023 for Plymouth County, but what else should I also add in? Should I add in the Noaa Zones for Western and eastern plymouth County? Stumped as to what I should be adding for this section and could use some insight from someone that knows what to do with this?

2) on the top of my homepage in the warning box it currently reads "No Warnings, Watches or Advisories"...in what file can I edit this, so that when there are no watches.,warnings or advisories..it reads "There are currently no Watches,Warnings or Advisories in the Area"?

Thanks for any help, and by the way this script seems a bit better than the basic Atom script.

I have also yet to configure a Cron job or windows task scheduler part of the instructions, since I am on E-rice, I will most likely have to use the windows task scheduler option, but will do that afterwards.

..Chris

warwickpaweather

  • Guest
Re: Alternative ATOM Feed Alert Program
« Reply #296 on: April 26, 2011, 09:22:38 PM »
Chris,,,it may be a while til I get home from work, but I'll send you the vbscript for task manager,,,in fact, if i remember correctly, Curly, when he was with us on the forum, had a copy of the VB script included in the instructions.....


chris

Offline Silversword

  • --Stan Y.
  • Posts: 965
  • Maui, Hawaii
    • Up Country Maui Weather
Re: Alternative ATOM Feed Alert Program
« Reply #297 on: April 26, 2011, 09:53:46 PM »
Hi Chris,

I have been trying to work with this program also and ran into several issues.

I don't understand all the necessary configurations that need to be done.  I have in the location area for the Atom-feed-Config.php file as follows, don't know if this is correct or not:

$Code_Location = array(
    "HIZ020" => "Windward Haleakala", // Maui HI - priority zone listed first
    "HIC009" => array(1 => "HIC009",'a' => "HIZ019"),  // COUNTY CODE => COUNTY CODE => ZONE CODE
    "HIC009" => array(1 => "HIC000",'a' => "HIZ020",'b' => "HIZ019"),  // COUNTY CODE =>  COUNTY CODE => ZONE CODE => ZONE CODE
    "HIZ020" => "Windward Haleakala", // Windward Haleakala
    "HIZ019" => "Central Maui Valley" // Central Maui Valley
);

As far as the cron job, I have no idea what this is, but attached is the one that I found some place for XP OS's.

Guess that we are in the same boat at this time. Otherwise, hope all is well with you.

--Stan Y.
   Maui, Hawaii
WD 10.37s Bld 72
WDL 6.05

Dell Optiplex GX280-Intel Pentium 4 CPU 3.00GHz, 4 GB RAM
Webcam: Axis 211
Wx Sta: Davis Vantage Pro 2+

Offline ALITTLEweird1

  • Mark
  • Global Moderator
  • Posts: 5,155
  • North Bend, WA
    • North Bend Weather
Re: Alternative ATOM Feed Alert Program
« Reply #298 on: April 26, 2011, 10:18:00 PM »
This is what mine has. Its been working great for a long time now. You dont have to use all of the areas, just delete the lines if you dont want to use them all. I added some surrounding areas to show more results.

Code: [Select]
// county/zone codes => location
$Code_Location = array(
    "WAZ505" => "Snoqualmie,Wa", // Snoqualmie Wa - priority zone listed first
    "WAC033" => "King County",  // King County
    "WAZ508" => "Seattle Metropolitan Area, WA", // Seattle
    "WAZ509" => "Tacoma Area, WA", // Tacoma
    "WAZ519" => "West Slopes Central Cascades and Passes, WA", //
    "WAC061" => "Snohomish County, WA", // Snohomish County, WA
    "WAC037" => "Kittitas County, WA", // Kittitas County, WA
    "WAC053" => "Pierce County, WA" // Pierce County, WA

);

"Nature can do without man, but man cannot do without nature."

Davis VP2 + VP2 Solar + VP2 UV + Lightning Detector + Logitech Webcam

Offline Silversword

  • --Stan Y.
  • Posts: 965
  • Maui, Hawaii
    • Up Country Maui Weather
Re: Alternative ATOM Feed Alert Program
« Reply #299 on: April 26, 2011, 10:29:55 PM »
Hi Mark,

I will try to get mine to read like yours and see what happens for my area. Looks like I will need just 3 or 4 zones for the Island of Maui.

Thanks for the insight.  Next to tackle that cron job issue if I need to..  Will try with out it first and maybe Chris will be able to help me out a bit when his time permits.

--Stan Y.
   Maui, Hawaii
WD 10.37s Bld 72
WDL 6.05

Dell Optiplex GX280-Intel Pentium 4 CPU 3.00GHz, 4 GB RAM
Webcam: Axis 211
Wx Sta: Davis Vantage Pro 2+

 

cumulus