Skip to main content
added 52 characters in body
Source Link
J. W. Perry
  • 1.1k
  • 5
  • 3

Ok soAs it turns out, there is clearly not a way to have SE let you know by email immediately when an answer is posted to a question, but I have written (not really super proud of this yet but it works) a grep tool where you can paste the URL to the question, the frequency that you want Mathematica to check, and the number of times you want Mathematica to keep checking. Although it aborts well on discovery of a new answer, as well as manually, it seems sort of trashy to me to not have a nicer abort button than "Evaluation->Abort Evaluation", or "Alt +".

The grep does export then import to and from a flat file on your default local.

Anyway, here is my code, feel free to improve:

Set link to the URL of the post.

Set cnum to the current number of answers (default 0).

Set checktimer to the frequency that you wish to probe this site in seconds (careful here, don't slam SE).

Set stopcheck to the number of times you you wish to probe. (all

All is currently set to every 5 minutes (300 seconds) for 1 hour).

grep[file_, patt_] := 
With[{data = Import[file, "Lines"]}, 
Pick[Transpose[{Range[Length[data]], data}], 
StringFreeQ[data, patt], False]] 

link = "http://meta.mathematica.stackexchange.com/questions/1293/get-notified-of-answers-to-a-question";
cnum = 0; (*current number of posts*)
checktimer = 300; (*check every number of seconds*)
stopcheck = 12;(*stop the loop after stop multiplied by checktimer seconds*)

The grep function should seem pretty clear, I used it in the past spideringscraping data from web sites (probably ripped it off somewhere long ago).

Here is the implementation:

For[i = 1, i <= stopcheck, i++,
Pause[checktimer];(*seconds*)
Export["segrep.txt", Import[link, "Plaintext"]];
If[Length[grep["segrep.txt", {"improve this answer"}]] > cnum,
SendMail[
"To" -> "[email protected]",
"Subject" -> "Stackexchange!",
"Body" -> "You have a new Mathematica answer on stackexchange!",
"From" -> "[email protected]",
"Server" -> "smtp.gmail.com",
"UserName" -> "[email protected]",
"Password" -> "your-outbound-password",(*<<<---Needs Password, else add in prompt*)
"PortNumber" -> 587,
"EncryptionProtocol" -> "StartTLS"];
Abort[];
]
]

You clearly need to put your two email addresses and password inside the quotes correctly. If you use a gmail outbound to your phone email push, then the rest will probably work as is (otherwise alter).

Change the URL, and change checktimer and cnum to some small numbers for your test. Don't slam the site.

P.S. The hardest part of this was finding the distinguishing difference between a question with n versus n+1 answers in any SE community. It turned out that grepping "improve this answer" did the trick.

On to the final test...

Ok so there is clearly not a way to have SE let you know by email immediately when an answer is posted to a question, but I have written (not really super proud of this yet but it works) a grep tool where you can paste the URL to the question, the frequency that you want Mathematica to check, and the number of times you want Mathematica to keep checking. Although it aborts well on discovery of a new answer, as well as manually, it seems sort of trashy to me to not have a nicer abort button than "Evaluation->Abort Evaluation", or "Alt +".

The grep does export then import to and from a flat file on your default local.

Anyway, here is my code, feel free to improve:

Set cnum to the current number of answers (default 0).

Set checktimer to the frequency that you wish to probe this site (careful here, don't slam SE).

Set stopcheck to the number of times you you wish to probe. (all currently set to every 5 minutes for 1 hour)

grep[file_, patt_] := 
With[{data = Import[file, "Lines"]}, 
Pick[Transpose[{Range[Length[data]], data}], 
StringFreeQ[data, patt], False]]
link = "http://meta.mathematica.stackexchange.com/questions/1293/get-notified-of-answers-to-a-question";
cnum = 0; (*current number of posts*)
checktimer = 300; (*check every number of seconds*)
stopcheck = 12;(*stop the loop after stop multiplied by checktimer seconds*)

The grep function should seem pretty clear, I used it in the past spidering web sites (probably ripped it off somewhere long ago).

Here is the implementation:

For[i = 1, i <= stopcheck, i++,
Pause[checktimer];(*seconds*)
Export["segrep.txt", Import[link, "Plaintext"]];
If[Length[grep["segrep.txt", {"improve this answer"}]] > cnum,
SendMail[
"To" -> "[email protected]",
"Subject" -> "Stackexchange!",
"Body" -> "You have a new Mathematica answer on stackexchange!",
"From" -> "[email protected]",
"Server" -> "smtp.gmail.com",
"UserName" -> "[email protected]",
"Password" -> "your-outbound-password",(*<<<---Needs Password, else add in prompt*)
"PortNumber" -> 587,
"EncryptionProtocol" -> "StartTLS"];
Abort[];
]
]

You clearly need to put your two email addresses and password inside the quotes correctly. If you use a gmail outbound to your phone email push, then the rest will probably work as is (otherwise alter).

Change the URL, and change checktimer and cnum to some small numbers for your test. Don't slam the site.

P.S. The hardest part of this was finding the distinguishing difference between a question with n versus n+1 answers in any SE community. It turned out that grepping "improve this answer" did the trick.

On to the final test...

As it turns out, there is not a way to have SE let you know by email immediately when an answer is posted to a question, but I have written (not really super proud of this yet but it works) a grep tool where you can paste the URL to the question, the frequency that you want Mathematica to check, and the number of times you want Mathematica to keep checking. Although it aborts well on discovery of a new answer, as well as manually, it seems sort of trashy to me to not have a nicer abort button than "Evaluation->Abort Evaluation", or "Alt +".

The grep does export then import to and from a flat file on your default local.

Anyway, here is my code, feel free to improve:

Set link to the URL of the post.

Set cnum to the current number of answers (default 0).

Set checktimer to the frequency that you wish to probe this site in seconds (careful here, don't slam SE).

Set stopcheck to the number of times you you wish to probe.

All is currently set to every 5 minutes (300 seconds) for 1 hour.

grep[file_, patt_] := 
With[{data = Import[file, "Lines"]}, 
Pick[Transpose[{Range[Length[data]], data}], 
StringFreeQ[data, patt], False]] 

link = "http://meta.mathematica.stackexchange.com/questions/1293/get-notified-of-answers-to-a-question";
cnum = 0; (*current number of posts*)
checktimer = 300; (*check every number of seconds*)
stopcheck = 12;(*stop the loop after stop multiplied by checktimer seconds*)

The grep function should seem pretty clear, I used it in the past scraping data from web sites (probably ripped it off somewhere long ago).

Here is the implementation:

For[i = 1, i <= stopcheck, i++,
Pause[checktimer];(*seconds*)
Export["segrep.txt", Import[link, "Plaintext"]];
If[Length[grep["segrep.txt", {"improve this answer"}]] > cnum,
SendMail[
"To" -> "[email protected]",
"Subject" -> "Stackexchange!",
"Body" -> "You have a new Mathematica answer on stackexchange!",
"From" -> "[email protected]",
"Server" -> "smtp.gmail.com",
"UserName" -> "[email protected]",
"Password" -> "your-outbound-password",(*<<<---Needs Password, else add in prompt*)
"PortNumber" -> 587,
"EncryptionProtocol" -> "StartTLS"];
Abort[];
]
]

You clearly need to put your two email addresses and password inside the quotes correctly. If you use a gmail outbound to your phone email push, then the rest will probably work as is (otherwise alter).

Change the URL, and change checktimer and cnum to some small numbers for your test. Don't slam the site.

P.S. The hardest part of this was finding the distinguishing difference between a question with n versus n+1 answers in any SE community. It turned out that grepping "improve this answer" did the trick.

On to the final test...

deleted 1 character in body
Source Link
J. W. Perry
  • 1.1k
  • 5
  • 3

Ok so there is clearly not a way to have SE let you know by email immediately when an answer is posted to youra question, but I have written (not really super proud of this yet but it works) a grep tool where you can paste the URL to the question, the frequency that you want Mathematica to check, and the number of times you want Mathematica to keep checking. Although it aborts well on discovery of a new answer, as well as manually, it seems sort of trashy to me to not have a nicer abort button than "Evaluation->Abort Evaluation", or "Alt +".

The grep does export then import to and from a flat file on your default local.

Anyway, here is my code, feel free to improve:

Set cnum to the current number of answers (default 0).

Set checktimer to the frequency that you wish to probe this site (careful here, don't slam SE).

Set stopcheck to the number of times you you wish to probe. (all currently set to every 5 minutes for 1 hour)

grep[file_, patt_] := 
With[{data = Import[file, "Lines"]}, 
Pick[Transpose[{Range[Length[data]], data}], 
StringFreeQ[data, patt], False]]
link = "http://meta.mathematica.stackexchange.com/questions/1293/get-\notifiednotified-of-answers-to-a-question";
cnum = 0; (*current number of posts*)
checktimer = 300; (*check every number of seconds*)
stopcheck = 12;(*stop the loop after stop multiplied by checktimer seconds*)

The grep function should seem pretty clear, I used it in the past spidering web sites (probably ripped it off somewhere long ago).

Here is the implementation:

For[i = 1, i <= stopcheck, i++,
Pause[checktimer];(*seconds*)
Export["segrep.txt", Import[link, "Plaintext"]];
If[Length[grep["segrep.txt", {"improve this answer"}]] > cnum,
SendMail[
"To" -> "[email protected]",
"Subject" -> "Stackexchange!",
"Body" -> "You have a new Mathematica answer on stackexchange!",
"From" -> "[email protected]",
"Server" -> "smtp.gmail.com",
"UserName" -> "[email protected]",
"Password" -> "your-outbound-password",(*<<<---Needs Password, else add in prompt*)
"PortNumber" -> 587,
"EncryptionProtocol" -> "StartTLS"];
Abort[];
]
]

You clearly need to put your two email addresses and password inside the quotes correctly. If you use a gmail outbound to your phone email push, then the rest will probably work as is (otherwise alter).

Change the URL, and change checktimer and cnum to some small numbers for your test. Don't slam the site.

P.S. The hardest part of this was finding the distinguishing difference between a question with n versus n+1 answers in any SE community. It turned out that grepping "improve this answer" did the trick.

On to the final test...

Ok so there is clearly not a way to have SE let you know by email immediately when an answer is posted to your question, but I have written (not really super proud of this yet but it works) a grep tool where you can paste the URL to the question, the frequency that you want Mathematica to check, and the number of times you want Mathematica to keep checking. Although it aborts well on discovery of a new answer, as well as manually, it seems sort of trashy to me to not have a nicer abort button than "Evaluation->Abort Evaluation", or "Alt +".

The grep does export then import to and from a flat file on your default local.

Anyway, here is my code, feel free to improve:

Set cnum to the current number of answers (default 0).

Set checktimer to the frequency that you wish to probe this site (careful here, don't slam SE).

Set stopcheck to the number of times you you wish to probe. (all currently set to every 5 minutes for 1 hour)

grep[file_, patt_] := 
With[{data = Import[file, "Lines"]}, 
Pick[Transpose[{Range[Length[data]], data}], 
StringFreeQ[data, patt], False]]
link = "http://meta.mathematica.stackexchange.com/questions/1293/get-\notified-of-answers-to-a-question";
cnum = 0; (*current number of posts*)
checktimer = 300; (*check every number of seconds*)
stopcheck = 12;(*stop the loop after stop multiplied by checktimer seconds*)

The grep function should seem pretty clear, I used it in the past spidering web sites (probably ripped it off somewhere long ago).

Here is the implementation:

For[i = 1, i <= stopcheck, i++,
Pause[checktimer];(*seconds*)
Export["segrep.txt", Import[link, "Plaintext"]];
If[Length[grep["segrep.txt", {"improve this answer"}]] > cnum,
SendMail[
"To" -> "[email protected]",
"Subject" -> "Stackexchange!",
"Body" -> "You have a new Mathematica answer on stackexchange!",
"From" -> "[email protected]",
"Server" -> "smtp.gmail.com",
"UserName" -> "[email protected]",
"Password" -> "your-outbound-password",(*<<<---Needs Password, else add in prompt*)
"PortNumber" -> 587,
"EncryptionProtocol" -> "StartTLS"];
Abort[];
]
]

You clearly need to put your two email addresses and password inside the quotes correctly. If you use a gmail outbound to your phone email push, then the rest will probably work as is (otherwise alter).

Change the URL, and change checktimer and cnum to some small numbers for your test. Don't slam the site.

P.S. The hardest part of this was finding the distinguishing difference between a question with n versus n+1 answers in any SE community. It turned out that grepping "improve this answer" did the trick.

On to the final test...

Ok so there is clearly not a way to have SE let you know by email immediately when an answer is posted to a question, but I have written (not really super proud of this yet but it works) a grep tool where you can paste the URL to the question, the frequency that you want Mathematica to check, and the number of times you want Mathematica to keep checking. Although it aborts well on discovery of a new answer, as well as manually, it seems sort of trashy to me to not have a nicer abort button than "Evaluation->Abort Evaluation", or "Alt +".

The grep does export then import to and from a flat file on your default local.

Anyway, here is my code, feel free to improve:

Set cnum to the current number of answers (default 0).

Set checktimer to the frequency that you wish to probe this site (careful here, don't slam SE).

Set stopcheck to the number of times you you wish to probe. (all currently set to every 5 minutes for 1 hour)

grep[file_, patt_] := 
With[{data = Import[file, "Lines"]}, 
Pick[Transpose[{Range[Length[data]], data}], 
StringFreeQ[data, patt], False]]
link = "http://meta.mathematica.stackexchange.com/questions/1293/get-notified-of-answers-to-a-question";
cnum = 0; (*current number of posts*)
checktimer = 300; (*check every number of seconds*)
stopcheck = 12;(*stop the loop after stop multiplied by checktimer seconds*)

The grep function should seem pretty clear, I used it in the past spidering web sites (probably ripped it off somewhere long ago).

Here is the implementation:

For[i = 1, i <= stopcheck, i++,
Pause[checktimer];(*seconds*)
Export["segrep.txt", Import[link, "Plaintext"]];
If[Length[grep["segrep.txt", {"improve this answer"}]] > cnum,
SendMail[
"To" -> "[email protected]",
"Subject" -> "Stackexchange!",
"Body" -> "You have a new Mathematica answer on stackexchange!",
"From" -> "[email protected]",
"Server" -> "smtp.gmail.com",
"UserName" -> "[email protected]",
"Password" -> "your-outbound-password",(*<<<---Needs Password, else add in prompt*)
"PortNumber" -> 587,
"EncryptionProtocol" -> "StartTLS"];
Abort[];
]
]

You clearly need to put your two email addresses and password inside the quotes correctly. If you use a gmail outbound to your phone email push, then the rest will probably work as is (otherwise alter).

Change the URL, and change checktimer and cnum to some small numbers for your test. Don't slam the site.

P.S. The hardest part of this was finding the distinguishing difference between a question with n versus n+1 answers in any SE community. It turned out that grepping "improve this answer" did the trick.

On to the final test...

added 30 characters in body
Source Link
J. W. Perry
  • 1.1k
  • 5
  • 3

Ok so there is clearly not a way to have SE let you know by email immediately when an answer is posted to your question, but I have written (not really super proud of this yet but it works) a grep tool where you can paste the URL to the question, the frequency that you want Mathematica to check, and the number of times you want Mathematica to keep checking. Although it aborts well on discovery of a new answer, as well as manually, it seems sort of trashy to me to not have a nicer abort button than "Evaluation->Abort Evaluation", or "Alt +".

The grep does export then import to and from a flat file on your default local.

Anyway, here is my code, feel free to improve:

Set cnum to the current number of answers (default 0).

Set checktimer to the frequency that you wish to probe this site (careful here, don't slam SE).

Set stopcheck to the number of times you you wish to probe. (all currently set to every 5 minutes for 1 hour)

grep[file_, patt_] := 
With[{data = Import[file, "Lines"]}, 
Pick[Transpose[{Range[Length[data]], data}], 
StringFreeQ[data, patt], False]]
link = "http://meta.mathematica.stackexchange.com/questions/1293/get-\notified-of-answers-to-a-question";
cnum = 0; (*current number of posts*)
checktimer = 300; (*check every number of seconds*)
stopcheck = 12;(*stop the loop after stop multiplied by checktimer seconds*)

The grep function should seem pretty clear, I used it in the past spidering web sites (probably ripped it off somewhere long ago).

Here is the implementation:

For[i = 1, i <= stopcheck, i++,
Pause[checktimer];(*seconds*)
Export["segrep.txt", Import[link, "Plaintext"]];
If[Length[grep["segrep.txt", {"improve this answer"}]] > cnum,
SendMail[
"To" -> "your-toinbound[email protected]",
"Subject" -> "Stackexchange!",
"Body" -> "You have a new mathematicaMathematica answer on stackexchange"stackexchange!",
"From" -> "your-fromoutbound[email protected]",
"Server" -> "smtp.gmail.com",
"UserName" -> "youremail@gmail"your-outbound-email@gmail.com",
"Password" -> "yourpassword""your-outbound-password",(*<<<---Needs Password, else add in prompt*)
"PortNumber" -> 587,
"EncryptionProtocol" -> "StartTLS"];
Abort[];
]
]

You clearly need to put your two email addresses in correctly and the password for your outboundinside the quotes correctly. If you use a gmail outbound to your phone email push, then the rest will probably work as is (otherwise alter).

Change the URL, and change checktimer and cnum to some small numbers for your test. Don't slam the site.

P.S. The hardest part of this was finding the distinguishing difference between a question with n versus n+1 answers in any SE community. It turned out that grepping "improve this answer" did the trick.

On to the final test...

Ok so there is clearly not a way to have SE let you know by email immediately when an answer is posted to your question, but I have written (not really super proud of this yet but it works) a grep tool where you can paste the URL to the question, the frequency that you want Mathematica to check, and the number of times you want Mathematica to keep checking. Although it aborts well on discovery of a new answer, as well as manually, it seems sort of trashy to me to not have a nicer abort button than "Evaluation->Abort Evaluation", or "Alt +".

The grep does export then import to and from a flat file on your default local.

Anyway, here is my code, feel free to improve:

Set cnum to the current number of answers (default 0).

Set checktimer to the frequency that you wish to probe this site (careful here, don't slam SE).

Set stopcheck to the number of times you you wish to probe. (all currently set to every 5 minutes for 1 hour)

grep[file_, patt_] := 
With[{data = Import[file, "Lines"]}, 
Pick[Transpose[{Range[Length[data]], data}], 
StringFreeQ[data, patt], False]]
link = "http://meta.mathematica.stackexchange.com/questions/1293/get-\notified-of-answers-to-a-question";
cnum = 0; (*current number of posts*)
checktimer = 300; (*check every number of seconds*)
stopcheck = 12;(*stop the loop after stop multiplied by checktimer seconds*)

The grep function should seem pretty clear, I used it in the past spidering web sites (probably ripped it off somewhere long ago).

Here is the implementation:

For[i = 1, i <= stopcheck, i++,
Pause[checktimer];(*seconds*)
Export["segrep.txt", Import[link, "Plaintext"]];
If[Length[grep["segrep.txt", {"improve this answer"}]] > cnum,
SendMail[
"To" -> "your-to[email protected]",
"Subject" -> "Stackexchange!",
"Body" -> "You have a new mathematica answer on stackexchange",
"From" -> "your-from[email protected]",
"Server" -> "smtp.gmail.com",
"UserName" -> "youremail@gmail.com",
"Password" -> "yourpassword",(*<<<---Needs Password, else add in prompt*)
"PortNumber" -> 587,
"EncryptionProtocol" -> "StartTLS"];
Abort[];
]
]

You clearly need to put your two email addresses in correctly and the password for your outbound. If you use a gmail outbound to your phone email push, then the rest will probably work as is (otherwise alter).

Change the URL, and change checktimer and cnum to some small numbers for your test. Don't slam the site.

P.S. The hardest part of this was finding the distinguishing difference between a question with n versus n+1 answers in any SE community. It turned out that grepping "improve this answer" did the trick.

On to the final test...

Ok so there is clearly not a way to have SE let you know by email immediately when an answer is posted to your question, but I have written (not really super proud of this yet but it works) a grep tool where you can paste the URL to the question, the frequency that you want Mathematica to check, and the number of times you want Mathematica to keep checking. Although it aborts well on discovery of a new answer, as well as manually, it seems sort of trashy to me to not have a nicer abort button than "Evaluation->Abort Evaluation", or "Alt +".

The grep does export then import to and from a flat file on your default local.

Anyway, here is my code, feel free to improve:

Set cnum to the current number of answers (default 0).

Set checktimer to the frequency that you wish to probe this site (careful here, don't slam SE).

Set stopcheck to the number of times you you wish to probe. (all currently set to every 5 minutes for 1 hour)

grep[file_, patt_] := 
With[{data = Import[file, "Lines"]}, 
Pick[Transpose[{Range[Length[data]], data}], 
StringFreeQ[data, patt], False]]
link = "http://meta.mathematica.stackexchange.com/questions/1293/get-\notified-of-answers-to-a-question";
cnum = 0; (*current number of posts*)
checktimer = 300; (*check every number of seconds*)
stopcheck = 12;(*stop the loop after stop multiplied by checktimer seconds*)

The grep function should seem pretty clear, I used it in the past spidering web sites (probably ripped it off somewhere long ago).

Here is the implementation:

For[i = 1, i <= stopcheck, i++,
Pause[checktimer];(*seconds*)
Export["segrep.txt", Import[link, "Plaintext"]];
If[Length[grep["segrep.txt", {"improve this answer"}]] > cnum,
SendMail[
"To" -> "your-inbound[email protected]",
"Subject" -> "Stackexchange!",
"Body" -> "You have a new Mathematica answer on stackexchange!",
"From" -> "your-outbound[email protected]",
"Server" -> "smtp.gmail.com",
"UserName" -> "your-outbound-email@gmail.com",
"Password" -> "your-outbound-password",(*<<<---Needs Password, else add in prompt*)
"PortNumber" -> 587,
"EncryptionProtocol" -> "StartTLS"];
Abort[];
]
]

You clearly need to put your two email addresses and password inside the quotes correctly. If you use a gmail outbound to your phone email push, then the rest will probably work as is (otherwise alter).

Change the URL, and change checktimer and cnum to some small numbers for your test. Don't slam the site.

P.S. The hardest part of this was finding the distinguishing difference between a question with n versus n+1 answers in any SE community. It turned out that grepping "improve this answer" did the trick.

On to the final test...

Source Link
J. W. Perry
  • 1.1k
  • 5
  • 3
Loading