Asynchronous alert

Discussion in 'Perl Misc' started by * Tong *, Jan 14, 2007.

  1. * Tong *

    * Tong * Guest

    Hi,

    I'm trying to write an alert detection script.

    Generally, the script loops to detect if the alert criteria is met,
    and if so, alert the user. Somewhat like this:

    for(;;){
    my $alerted;
    my $flag=detect_flag
    if($flag){
    alert_user unless $alerted;
    $alerted=1
    }
    }

    The 'alert_user' can be as simple as a pop up window via Xdialog. Once the
    alert goes off, it might take some time to resolve, but I don't want to
    alert user again and again, hence the '$alerted' var. The problem is that
    I need a way to clear the '$alerted' var. I think, to make it simple, the
    best time is when the user confirm the alert pop up window.

    Now, what's the easiest way to do it? The reason I wanted to use Xdialog is
    because it's extreme easy to code, but I can't think of a way to clear the
    '$alerted' var.

    please help

    thanks a lot

    --
    Tong (remove underscore(s) to reply)
    http://xpt.sf.net/techdocs/
    http://xpt.sf.net/tools/

    --
    Posted via a free Usenet account from http://www.teranews.com
    * Tong *, Jan 14, 2007
    #1
    1. Advertising

  2. * Tong *

    * Tong * Guest

    On Sun, 14 Jan 2007 15:23:56 -0600, Mumia W. (NOSPAM) wrote:

    >> I'm trying to write an alert detection script.
    >>
    >> Generally, the script loops to detect if the alert criteria is met,
    >> and if so, alert the user. Somewhat like this:


    my $alerted;
    for(;;){
    my $flag=detect_flag
    if($flag){
    alert_user unless $alerted;
    $alerted=1
    }
    }

    >> The 'alert_user' can be as simple as a pop up window via Xdialog. Once the
    >> alert goes off, it might take some time to resolve, but I don't want to
    >> alert user again and again, hence the '$alerted' var. The problem is that
    >> I need a way to clear the '$alerted' var. I think, to make it simple, the
    >> best time is when the user confirm the alert pop up window.
    >>
    >> Now, what's the easiest way to do it? The reason I wanted to use Xdialog is
    >> because it's extreme easy to code, but I can't think of a way to clear the
    >> '$alerted' var.
    >>
    >> please help
    >>
    >> thanks a lot
    >>

    >
    > Most probably, making $alerted a package variable will do it. You might
    > also be able to solve the problem by putting "my $alerted" above the for
    > loop.


    thanks for the suggestion. please see above. Please note that, what I need
    is the simplest solution.

    > Since the program you posted is not complete, it's hard to comment
    > further.


    IMHO, as a *general purpose* *high-level* code snip, it is complete. What
    only lacks is the way/mechanism to reset $alerted asynchronous, which I
    don't know and is asking -- how to reset it determines how the alert_user()
    is coded, and there is no need to dive into the detect_flag() at all.

    thanks

    --
    Tong (remove underscore(s) to reply)
    http://xpt.sf.net/techdocs/
    http://xpt.sf.net/tools/

    --
    Posted via a free Usenet account from http://www.teranews.com
    * Tong *, Jan 14, 2007
    #2
    1. Advertising

  3. On 01/14/2007 02:05 PM, * Tong * wrote:
    > Hi,
    >
    > I'm trying to write an alert detection script.
    >
    > Generally, the script loops to detect if the alert criteria is met,
    > and if so, alert the user. Somewhat like this:
    >
    > for(;;){
    > my $alerted;
    > my $flag=detect_flag
    > if($flag){
    > alert_user unless $alerted;
    > $alerted=1
    > }
    > }
    >
    > The 'alert_user' can be as simple as a pop up window via Xdialog. Once the
    > alert goes off, it might take some time to resolve, but I don't want to
    > alert user again and again, hence the '$alerted' var. The problem is that
    > I need a way to clear the '$alerted' var. I think, to make it simple, the
    > best time is when the user confirm the alert pop up window.
    >
    > Now, what's the easiest way to do it? The reason I wanted to use Xdialog is
    > because it's extreme easy to code, but I can't think of a way to clear the
    > '$alerted' var.
    >
    > please help
    >
    > thanks a lot
    >


    Most probably, making $alerted a package variable will do it. You might
    also be able to solve the problem by putting "my $alerted" above the for
    loop.

    Since the program you posted is not complete, it's hard to comment further.

    Posting Guidelines for comp.lang.perl.misc:
    http://www.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html

    --
    Windows Vista and your freedom in conflict:
    http://www.securityfocus.com/columnists/420/2
    Mumia W. (NOSPAM), Jan 14, 2007
    #3
  4. On 01/14/2007 02:59 PM, * Tong * wrote:
    > On Sun, 14 Jan 2007 15:23:56 -0600, Mumia W. (NOSPAM) wrote:
    >
    >>> I'm trying to write an alert detection script.
    >>>
    >>> Generally, the script loops to detect if the alert criteria is met,
    >>> and if so, alert the user. Somewhat like this:

    >
    > my $alerted;


    Doh! How did I miss that?

    > for(;;){
    > my $flag=detect_flag
    > if($flag){
    > alert_user unless $alerted;
    > $alerted=1
    > }
    > }
    >
    >>> The 'alert_user' can be as simple as a pop up window via Xdialog. Once the
    >>> alert goes off, it might take some time to resolve, but I don't want to
    >>> alert user again and again, hence the '$alerted' var. The problem is that
    >>> I need a way to clear the '$alerted' var. I think, to make it simple, the
    >>> best time is when the user confirm the alert pop up window.
    >>>
    >>> Now, what's the easiest way to do it? The reason I wanted to use Xdialog is
    >>> because it's extreme easy to code, but I can't think of a way to clear the
    >>> '$alerted' var.
    >>>
    >>> please help
    >>>
    >>> thanks a lot
    >>>

    >> Most probably, making $alerted a package variable will do it. You might
    >> also be able to solve the problem by putting "my $alerted" above the for
    >> loop.

    >
    > thanks for the suggestion. please see above. Please note that, what I need
    > is the simplest solution.
    >
    >> Since the program you posted is not complete, it's hard to comment
    >> further.

    >
    > IMHO, as a *general purpose* *high-level* code snip, it is complete. What
    > only lacks is the way/mechanism to reset $alerted asynchronous, which I
    > don't know and is asking -- how to reset it determines how the alert_user()
    > is coded, and there is no need to dive into the detect_flag() at all.
    >
    > thanks
    >


    Under what conditions do you want to clear the $alerted flag?


    --
    Windows Vista and your freedom in conflict:
    http://techdirt.com/articles/20061019/102225.shtml
    Mumia W. (NOSPAM), Jan 15, 2007
    #4
  5. * Tong *

    * Tong * Guest

    On Mon, 15 Jan 2007 01:39:30 -0600, Mumia W. (NOSPAM) wrote:

    >>>> I'm trying to write an alert detection script.
    >>>>
    >>>> Generally, the script loops to detect if the alert criteria is met,
    >>>> and if so, alert the user. Somewhat like this:

    >>
    >> my $alerted;
    >> for(;;){
    >> my $flag=detect_flag
    >> if($flag){
    >> alert_user unless $alerted;
    >> $alerted=1
    >> }
    >> }
    >>
    >>>> The 'alert_user' can be as simple as a pop up window via Xdialog. Once the
    >>>> alert goes off, it might take some time to resolve, but I don't want to
    >>>> alert user again and again, hence the '$alerted' var. The problem is that
    >>>> I need a way to clear the '$alerted' var. I think, to make it simple, the
    >>>> best time is when the user confirm the alert pop up window.
    >>>>
    >>>> Now, what's the easiest way to do it? The reason I wanted to use Xdialog is
    >>>> because it's extreme easy to code, but I can't think of a way to clear the
    >>>> '$alerted' var.

    >>
    >> IMHO, as a *general purpose* *high-level* code snip, it is complete. What
    >> only lacks is the way/mechanism to reset $alerted asynchronous, which I
    >> don't know and is asking -- how to reset it determines how the alert_user()
    >> is coded, and there is no need to dive into the detect_flag() at all.

    >
    > Under what conditions do you want to clear the $alerted flag?


    I think, to make it simple, the best time is when the user confirm the
    alert pop up window -- i.e., user click, pop up gone, $alerted cleared.

    how is that?

    --
    Tong (remove underscore(s) to reply)
    http://xpt.sf.net/techdocs/
    http://xpt.sf.net/tools/

    --
    Posted via a free Usenet account from http://www.teranews.com
    * Tong *, Jan 15, 2007
    #5
  6. On 01/15/2007 03:42 PM, * Tong * wrote:
    > On Mon, 15 Jan 2007 01:39:30 -0600, Mumia W. (NOSPAM) wrote:
    >
    >>>>> I'm trying to write an alert detection script.
    >>>>>
    >>>>> Generally, the script loops to detect if the alert criteria is met,
    >>>>> and if so, alert the user. Somewhat like this:
    >>> my $alerted;
    >>> for(;;){
    >>> my $flag=detect_flag
    >>> if($flag){
    >>> alert_user unless $alerted;
    >>> $alerted=1
    >>> }
    >>> }
    >>>
    >>>>> The 'alert_user' can be as simple as a pop up window via Xdialog. Once the
    >>>>> alert goes off, it might take some time to resolve, but I don't want to
    >>>>> alert user again and again, hence the '$alerted' var. The problem is that
    >>>>> I need a way to clear the '$alerted' var. I think, to make it simple, the
    >>>>> best time is when the user confirm the alert pop up window.
    >>>>>
    >>>>> Now, what's the easiest way to do it? The reason I wanted to use Xdialog is
    >>>>> because it's extreme easy to code, but I can't think of a way to clear the
    >>>>> '$alerted' var.
    >>> IMHO, as a *general purpose* *high-level* code snip, it is complete. What
    >>> only lacks is the way/mechanism to reset $alerted asynchronous, which I
    >>> don't know and is asking -- how to reset it determines how the alert_user()
    >>> is coded, and there is no need to dive into the detect_flag() at all.

    >> Under what conditions do you want to clear the $alerted flag?

    >
    > I think, to make it simple, the best time is when the user confirm the
    > alert pop up window -- i.e., user click, pop up gone, $alerted cleared.
    >
    > how is that?
    >


    You need to post an actual (short) program. The solution is not simply
    conceptual.

    Posting Guidelines for comp.lang.perl.misc:
    http://www.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html


    --
    Windows Vista and your freedom in conflict:
    http://www.badvista.org/
    Mumia W. (NOSPAM), Jan 16, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Amir

    asynchronous design

    Amir, Oct 10, 2003, in forum: VHDL
    Replies:
    3
    Views:
    565
  2. Jamie
    Replies:
    13
    Views:
    7,579
    Renaud Pacalet
    Oct 23, 2003
  3. Jamie
    Replies:
    4
    Views:
    999
    Thomas Stanka
    Oct 22, 2003
  4. Mersh
    Replies:
    0
    Views:
    478
    Mersh
    Mar 13, 2007
  5. Ganesh
    Replies:
    0
    Views:
    539
    Ganesh
    Jun 29, 2007
Loading...

Share This Page