Thanks a lot Shaun. <div><br></div><div>That sure will pave my way to the right direction. </div><div>I'll start playing. </div><div><br></div><div>Thanks everyone!<br><br><div class="gmail_quote">On Wed, Oct 10, 2012 at 10:27 AM, Shaun Fryer <span dir="ltr"><<a href="mailto:sfryer@sourcery.ca" target="_blank">sfryer@sourcery.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Antonio,<br>
<br>
That makes sense. Unfortunately it's a little beyond the scope of a<br>
simple email to provide a complete solution for your situation.<br>
However, you might try something like the following.<br>
<br>
You'll need two things. #1. an ajax function of some kind. Given that<br>
you aren't interested in learning JS, I'd recommend using a<br>
cross-browser abstraction library which has an ajax method, such as<br>
jQuery. #2. You'll need a popup dialogue of some kind. There are<br>
plenty to choose from. For the purposes of providing an example, I've<br>
[arbitrarily] chosen the facybox jQuery plugin. I have no direct<br>
experience with it, but the API seems simple enough, so it should work<br>
fine.<br>
<br>
Add a script tag including the jQuery library, followed by one for the<br>
plugin for your popup ( <a href="http://bitbonsai.com/facybox/" target="_blank">http://bitbonsai.com/facybox/</a> ). Now in a<br>
separate script tag below this, add code similar to that below<br>
(modified accordingly).<br>
<br>
var nMilliseconds = 60*1000; // frequency of server check in milliseconds<br>
var checkServerStatus = function () {<br>
  $.ajax({ url: "/path/to/your/log/file/script" }).done(function<br>
(jqXHR, textStatus) {<br>
    if (/a regexp matching text in your log file/.test(jqXHR.responseText))<br>
      $.facybox("The text you wish the user to see in the popup dialogue.");<br>
    else setTimeout( checkServerStatus, nMilliseconds );<br>
  });<br>
};<br>
setTimeout( checkServerStatus, nMilliseconds );<br>
<br>
The above is just pseudo-code, but it *should* work with very little<br>
modification, assuming you're using the indicated JS libraries.<br>
<br>
Hope this helps.<br>
<div class="im HOEnZb">--<br>
Shaun Fryer<br>
----------------------------------------------------------<br>
perl -e 'print chr for map{$_+=22}($ARGV[0])=~/(\d\d)/g' \<br>
        52959394107588899482799210587992861082757785799222<br>
----------------------------------------------------------<br>
<br>
<br>
</div><div class="HOEnZb"><div class="h5">On Wed, Oct 10, 2012 at 9:51 AM, Antonio Sun <<a href="mailto:antoniosun@lavabit.com">antoniosun@lavabit.com</a>> wrote:<br>
> Hi, thanks a lot for your offer Shaun.<br>
><br>
> That was actually what I thought the solution to be. Now let's forget what I<br>
> said and focus on what I need to accomplish.<br>
><br>
> Yes, I totally control the page content. The situation is,<br>
><br>
> I am designing a web portal that can launch back-end server side processes.<br>
> The problem is that the process can finish in seconds, or it might need<br>
> hours to finish, depending how much work the process has. So my design is to<br>
> spawn a sub process, and capture all its outputs to a log text file, then<br>
> return immediately to the user, in a web notice page saying, your job is<br>
> queued; here is the log url; please check manually if is finished or not.<br>
><br>
> But my all my fellow coworkers said they don't want to check themselves.<br>
> Instead, they want my web portal to check for them. I couldn't think of any<br>
> solution from the server side to capture the end of the sub process, then<br>
> informed the already submitted web notice page. Hence, I'm turning to the<br>
> javascript front-end for solutions. Because I have zero knowledge of<br>
> Javascript, it might not be feasible at all. But I know the best solution is<br>
> that if I can have a desktop notification mechanism just like gmail does,<br>
> that should solve the problem, because my sub process control task does know<br>
> when the sub process ends, and write a specific ending tag to the end of the<br>
> log file, which is what I was planning to watch/search for. Every page of my<br>
> portal does include a standard master template (except the log text file),<br>
> so if I can send a signal at the end of my sub process and capture that by<br>
> the master template, then pop up a javascript window, that will do as well.<br>
><br>
> Sorry for the lengthy gibberish, hope that you can figure something out from<br>
> it.<br>
><br>
> Thanks<br>
><br>
> On Wed, Oct 10, 2012 at 3:01 AM, Shaun Fryer <<a href="mailto:sfryer@sourcery.ca">sfryer@sourcery.ca</a>> wrote:<br>
>><br>
>> Hi Antonio,<br>
>><br>
>> I might be able to help you, but first I need to know a bit more<br>
>> detail about what you're trying to do. When you say watch for certain<br>
>> keywords from a webpage, what do you mean exactly? If you mean<br>
>> searching through a static html document looking for a give word or<br>
>> words, that's fairly trivial. However, if you can add javascript to<br>
>> the page in question, then you probably control the page, and<br>
>> therefore should already know it's content. So question is, why would<br>
>> you need front-end code in JavaScript to do it? If you mean doing an<br>
>> HTTP request from within a web-page, or even a Cross Origin request,<br>
>> in order to receive info from a 3rd-party website, then things could<br>
>> become considerably more complicated.<br>
>><br>
>> Cheers,<br>
>> --<br>
>> Shaun Fryer<br>
>> ----------------------------------------------------------<br>
>> perl -e 'print chr for map{$_+=22}($ARGV[0])=~/(\d\d)/g' \<br>
>>         52959394107588899482799210587992861082757785799222<br>
>> ----------------------------------------------------------<br>
>><br>
>><br>
>> On Tue, Oct 9, 2012 at 5:48 PM, Antonio Sun <<a href="mailto:antoniosun@lavabit.com">antoniosun@lavabit.com</a>><br>
>> wrote:<br>
>> > Hi,<br>
>> ><br>
>> > I know it's kind of OT, but since we have a lot of web experts here, let<br>
>> > me<br>
>> > try my luck here first.<br>
>> ><br>
>> > I have zero knowledge of Javascript, I'm wondering if you could give me<br>
>> > a<br>
>> > big favor to show me how to watch for certain keyword from a web page<br>
>> > using<br>
>> > Javascript.<br>
>> ><br>
>> > Basically, I have a slow updating web page, and I need a client side<br>
>> > Javascript to watch for a specific keyword in that page and pop up an<br>
>> > window<br>
>> > if the keyword is found.<br>
>> ><br>
>> > As I have zero knowledge of Javascript, I hope that your answer is as<br>
>> > complete as possible.<br>
>> ><br>
>> > Thanks a lot in advance<br>
>> ><br>
>> > Antonio<br>
>> ><br>
>> ><br>
>> > _______________________________________________<br>
>> > toronto-pm mailing list<br>
>> > <a href="mailto:toronto-pm@pm.org">toronto-pm@pm.org</a><br>
>> > <a href="http://mail.pm.org/mailman/listinfo/toronto-pm" target="_blank">http://mail.pm.org/mailman/listinfo/toronto-pm</a><br>
>> ><br>
><br>
><br>
</div></div></blockquote></div><br></div>