php-general Digest 29 May 2009 18:12:18 -0000 Issue 6148

2009-05-29 Thread php-general-digest-help

php-general Digest 29 May 2009 18:12:18 - Issue 6148

Topics (messages 293340 through 293355):

detecting spam keywords with stripos
293340 by: Merlin Morgenstern
293341 by: Per Jessen
293343 by: Tom Worster
293346 by: Merlin Morgenstern
293347 by: Stuart
293348 by: Bastien Koert
293352 by: Per Jessen

Re: Hebrew Directory Names
293342 by: Tom Worster
293345 by: Nitsan Bin-Nun

Re: cURL loop?
293344 by: Daniel Brown

recipes anyone?
293349 by: PJ
293350 by: Richard Heyes
293351 by: Bob McConnell

Numerical Recipe - Scheduling Question
293353 by: bruce
293354 by: kyle.smith
293355 by: Stuart

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---

Hi there,

I am matching text against an array of keywords to detect spam. 
Unfortunatelly there are some false positives due to the fact that 
stripos also finds the keyword inside a word.

E.G. Bewerbung - Werbung

First thought: use strpos, but this does not help in all cases
Second thought: split text into words and use in_array, but this does 
not find things like zu Hause or flexible/Arbeit


Does somebody have an idea on how to make my function better in terms of 
not detecting the string inside a word? Here is the code:


while ($row = db_get_row($result)){
$keyword[]  = $row-keyword;
$weight[]   = $row-weight;
};  
$num_results = db_numrows($result); 

for ($i=0;$i$num_results;$i++){
$findme  = $keyword[$i];
$pos = stripos($data[txt], $findme);
$pos2 = stripos($data[title], $findme);
if ($pos !== false OR $pos2 !== false){ // spam!
$spam_level += $weight[$i];
$triggered_keywords .= $keyword[$i].', ';
}
}
$spam[score] += $spam_level;

Thank you for any help!

Merlin
---End Message---
---BeginMessage---
Merlin Morgenstern wrote:

 Hi there,
 
 I am matching text against an array of keywords to detect spam.
 Unfortunatelly there are some false positives due to the fact that
 stripos also finds the keyword inside a word.
 E.G. Bewerbung - Werbung
 
 First thought: use strpos, but this does not help in all cases
 Second thought: split text into words and use in_array, but this does
 not find things like zu Hause or flexible/Arbeit

First thought - use Spamassassin.
Second thought - use regexes.

/Per

-- 
Per Jessen, Zürich (17.1°C)

---End Message---
---BeginMessage---
On 5/29/09 5:36 AM, Merlin Morgenstern merli...@fastmail.fm wrote:

 Does somebody have an idea on how to make my function better in terms of
 not detecting the string inside a word?

i agree with per. learn pcre: http://us.php.net/manual/en/book.pcre.php

as for successfully filtering spam by keyword matching: good luck!


---End Message---
---BeginMessage---



Per Jessen wrote:

Merlin Morgenstern wrote:


Hi there,

I am matching text against an array of keywords to detect spam.
Unfortunatelly there are some false positives due to the fact that
stripos also finds the keyword inside a word.
E.G. Bewerbung - Werbung

First thought: use strpos, but this does not help in all cases
Second thought: split text into words and use in_array, but this does
not find things like zu Hause or flexible/Arbeit


First thought - use Spamassassin.
Second thought - use regexes.

/Per




sorry this is a different scneario. I do need to to it this way in my 
case. It is about spam inside user postings.


Any ideas?
---End Message---
---BeginMessage---
2009/5/29 Merlin Morgenstern merli...@fastmail.fm:


 Per Jessen wrote:

 Merlin Morgenstern wrote:

 Hi there,

 I am matching text against an array of keywords to detect spam.
 Unfortunatelly there are some false positives due to the fact that
 stripos also finds the keyword inside a word.
 E.G. Bewerbung - Werbung

 First thought: use strpos, but this does not help in all cases
 Second thought: split text into words and use in_array, but this does
 not find things like zu Hause or flexible/Arbeit

 First thought - use Spamassassin.
 Second thought - use regexes.

 /Per



 sorry this is a different scneario. I do need to to it this way in my case.
 It is about spam inside user postings.

 Any ideas?

I've had to solve this problem before and the conclusion I came to is
that when doing this kind of simple matching you either accept false
positives or false negatives. Alternatives include implementing
Bayesian filtering or some other algorithm that's more complex than
simple matching or use a pre-existing solution.

I'm sure you could integrate SpamAssassin or similar because at the
end of the day all those systems expect is a bunch of 

Re: [PHP] Confirmation email caught by spam filter

2009-05-29 Thread Per Jessen
Ashley Sheridan wrote:

 On Thu, 2009-05-28 at 07:45 +0200, Per Jessen wrote:
 Ashley Sheridan wrote:
 
  I've also seen this happen where the address that the mail was sent
  from is different from the MX record for the domain the email says
  it is sent from. The only way round this is to have the MX and A
  records point to the same server.
 
 It's not a real problem - lots of companies have different inbound
 and outbound servers.
 
 
 /Per
 
 The spam filters we use at work have this problem, not any others that
 I've seen, but I was just saying it is a problem, and in a corporate
 environment, not just someone with an over zealous firewall.
 
 Would setting up a backup MX record solve this do you think?

Possibly, but it depends on how that check is done.  It really ought to
be fixed by the receiving end (fixed=removed).  It is perfectly normal
to have separate inbound and outbound mail-servers.  For instance, if
you're having your email filtered by an external service such as
Spamchek or Messagelabs.  A check on inbound mail that says it must be
sent by the MX listed for the sending domain is really only going to
hurt the receiving end.  I personally wouldn't do anything to try to
fix it from my side. 


/Per

-- 
Per Jessen, Zürich (14.2°C)


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] detecting spam keywords with stripos

2009-05-29 Thread Merlin Morgenstern

Hi there,

I am matching text against an array of keywords to detect spam. 
Unfortunatelly there are some false positives due to the fact that 
stripos also finds the keyword inside a word.

E.G. Bewerbung - Werbung

First thought: use strpos, but this does not help in all cases
Second thought: split text into words and use in_array, but this does 
not find things like zu Hause or flexible/Arbeit


Does somebody have an idea on how to make my function better in terms of 
not detecting the string inside a word? Here is the code:


while ($row = db_get_row($result)){
$keyword[]  = $row-keyword;
$weight[]   = $row-weight;
};  
$num_results = db_numrows($result); 

for ($i=0;$i$num_results;$i++){
$findme  = $keyword[$i];
$pos = stripos($data[txt], $findme);
$pos2 = stripos($data[title], $findme);
if ($pos !== false OR $pos2 !== false){ // spam!
$spam_level += $weight[$i];
$triggered_keywords .= $keyword[$i].', ';
}
}
$spam[score] += $spam_level;

Thank you for any help!

Merlin

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] detecting spam keywords with stripos

2009-05-29 Thread Per Jessen
Merlin Morgenstern wrote:

 Hi there,
 
 I am matching text against an array of keywords to detect spam.
 Unfortunatelly there are some false positives due to the fact that
 stripos also finds the keyword inside a word.
 E.G. Bewerbung - Werbung
 
 First thought: use strpos, but this does not help in all cases
 Second thought: split text into words and use in_array, but this does
 not find things like zu Hause or flexible/Arbeit

First thought - use Spamassassin.
Second thought - use regexes.

/Per

-- 
Per Jessen, Zürich (17.1°C)


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] detecting spam keywords with stripos

2009-05-29 Thread Tom Worster
On 5/29/09 5:36 AM, Merlin Morgenstern merli...@fastmail.fm wrote:

 Does somebody have an idea on how to make my function better in terms of
 not detecting the string inside a word?

i agree with per. learn pcre: http://us.php.net/manual/en/book.pcre.php

as for successfully filtering spam by keyword matching: good luck!



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] cURL loop?

2009-05-29 Thread Daniel Brown
On Thu, May 28, 2009 at 23:31, espontaneo acohln...@gmail.com wrote:

 Hello! I am currently working on a script that will scrape data from a
 property advertising web page. The web page has multiple pages. What I'm
 getting is only the first page. What I wanted to do is to use curl to scrape
 all the data from that page. I just learned php so I don't know how I can do
 this.

There are a variety of ways, but rather than writing your own
spider script, you may want to look into the built-in spidering
capabilities of `wget` and `curl` from the command line.  Both have
Windows and *NIX builds, so platform isn't an issue; so long as you
have access to the shell, you should be fine.

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Hebrew Directory Names

2009-05-29 Thread Tom Worster
On 5/28/09 2:06 PM, Nitsan Bin-Nun nit...@binnun.co.il wrote:

 preg_replace(/([\xE0-\xFA])/e,chr(215).chr(ord(\${1})-80),$s);

...

 The preg_replace() above convert the Hebrew chars into UTF8.

that preg_replace takes a byte string $s and:

- leaves bytes with value 0-127 intact
- converts bytes with value 224-250 to the utf8 multibyte character code of
the corresponding win-1255 character
- produces an invalid utf8 output for all other code points, for which see:
http://en.wikipedia.org/wiki/Windows-1255

so it's a win-1255 to utf-8 converter only so long as you are confident that
code points 128-223 and 251-255 are never in the subject string.

try iconv('CP1255', 'UTF-8', $s) instead.





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Hebrew Directory Names

2009-05-29 Thread Nitsan Bin-Nun
Your point is right but these code point does not exist in the subject
string so this isn't the issue here.

I'm really stuck at this one :S

Thank you again for trying to help!

On Fri, May 29, 2009 at 2:40 PM, Tom Worster f...@thefsb.org wrote:

 On 5/28/09 2:06 PM, Nitsan Bin-Nun nit...@binnun.co.il wrote:

  preg_replace(/([\xE0-\xFA])/e,chr(215).chr(ord(\${1})-80),$s);

 ...

  The preg_replace() above convert the Hebrew chars into UTF8.

 that preg_replace takes a byte string $s and:

 - leaves bytes with value 0-127 intact
 - converts bytes with value 224-250 to the utf8 multibyte character code of
 the corresponding win-1255 character
 - produces an invalid utf8 output for all other code points, for which see:
 http://en.wikipedia.org/wiki/Windows-1255

 so it's a win-1255 to utf-8 converter only so long as you are confident
 that
 code points 128-223 and 251-255 are never in the subject string.

 try iconv('CP1255', 'UTF-8', $s) instead.







Re: [PHP] detecting spam keywords with stripos

2009-05-29 Thread Merlin Morgenstern



Per Jessen wrote:

Merlin Morgenstern wrote:


Hi there,

I am matching text against an array of keywords to detect spam.
Unfortunatelly there are some false positives due to the fact that
stripos also finds the keyword inside a word.
E.G. Bewerbung - Werbung

First thought: use strpos, but this does not help in all cases
Second thought: split text into words and use in_array, but this does
not find things like zu Hause or flexible/Arbeit


First thought - use Spamassassin.
Second thought - use regexes.

/Per




sorry this is a different scneario. I do need to to it this way in my 
case. It is about spam inside user postings.


Any ideas?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] detecting spam keywords with stripos

2009-05-29 Thread Stuart
2009/5/29 Merlin Morgenstern merli...@fastmail.fm:


 Per Jessen wrote:

 Merlin Morgenstern wrote:

 Hi there,

 I am matching text against an array of keywords to detect spam.
 Unfortunatelly there are some false positives due to the fact that
 stripos also finds the keyword inside a word.
 E.G. Bewerbung - Werbung

 First thought: use strpos, but this does not help in all cases
 Second thought: split text into words and use in_array, but this does
 not find things like zu Hause or flexible/Arbeit

 First thought - use Spamassassin.
 Second thought - use regexes.

 /Per



 sorry this is a different scneario. I do need to to it this way in my case.
 It is about spam inside user postings.

 Any ideas?

I've had to solve this problem before and the conclusion I came to is
that when doing this kind of simple matching you either accept false
positives or false negatives. Alternatives include implementing
Bayesian filtering or some other algorithm that's more complex than
simple matching or use a pre-existing solution.

I'm sure you could integrate SpamAssassin or similar because at the
end of the day all those systems expect is a bunch of text. If they
require the headers of an email you can supply fake ones and remove
any effect headers have on the score. Whether that's worth it depends
on the volume your talking about and how much manual moderation checks
you want to have to do.

-Stuart

-- 
http://stut.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] detecting spam keywords with stripos

2009-05-29 Thread Bastien Koert
On Fri, May 29, 2009 at 10:02 AM, Merlin Morgenstern
merli...@fastmail.fmwrote:



 Per Jessen wrote:

 Merlin Morgenstern wrote:

  Hi there,

 I am matching text against an array of keywords to detect spam.
 Unfortunatelly there are some false positives due to the fact that
 stripos also finds the keyword inside a word.
 E.G. Bewerbung - Werbung

 First thought: use strpos, but this does not help in all cases
 Second thought: split text into words and use in_array, but this does
 not find things like zu Hause or flexible/Arbeit


 First thought - use Spamassassin.
 Second thought - use regexes.

 /Per



 sorry this is a different scneario. I do need to to it this way in my case.
 It is about spam inside user postings.

 Any ideas?

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


Regex is your best bet, but nothing will be fool proof. Case in point (shit,
shiite, sh*t, s**t, merde, Scheiße! as/a and so on)




-- 

Bastien

Cat, the other other white meat


[PHP] recipes anyone?

2009-05-29 Thread PJ
I'd like to get some input on how to deal with recipes.
use html pages to store and display, XML or db or... ? And what about
clips, like flvs ? TIA.

-- 
Hervé Kempf: Pour sauver la planète, sortez du capitalisme.
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] recipes anyone?

2009-05-29 Thread Richard Heyes
Hi,

 I'd like to get some input on how to deal with recipes.
 use html pages to store and display, XML or db or... ? And what about
 clips, like flvs ? TIA.

Actual recipes? As in a pork roast? I would put them on the file
system in .html files. You could use a PHP file to serve them, and
have a URL like this:

http://www.pig-supper.com/recipe/pork-roast.html

recipe could be a PHP file that adds a common header and footer. I
do similar with my site. Eg:

http://www.phpguru.org/static/canvas.html

Or did you mean something else entirely...?

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 23rd May)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] recipes anyone?

2009-05-29 Thread Bob McConnell
From: PJ
 
 I'd like to get some input on how to deal with recipes.
 use html pages to store and display, XML or db or... ? And what about
 clips, like flvs ? TIA.
 

There are as many ways to do cookbooks as there are cooks. I am familiar
with half a dozen, without counting the professional packages put out by
another department here where I work.

RecipeML is one option, but it is seriously incomplete if you need to
include nutritional information.

Qookbooks, Gormet (Gnome), Krecipes (KDE) MealMaster, Master Cook,
Recipants, etc. all have different storage formats and display formats.
Some are well documented, some are buried in the code, and some are
still kept secret. You can take your pick, or combine them and roll your
own.

A bigger issue is how to import existing recipe files. I have several
years of messages collected from newsgroups like rec.food.recipes,
r.f.cooking, r.f.baking, etc. that I would like to put into a usable,
and searchable format. But there are too many variations in the formats
and naming conventions used to be able to write a single routine to
handle them all. It is much easier just to use those already published
in MealMaster formats. At least that one is documented clearly now that
they are out of business.

Bob McConnell

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] detecting spam keywords with stripos

2009-05-29 Thread Per Jessen
Stuart wrote:

 I'm sure you could integrate SpamAssassin or similar because at the
 end of the day all those systems expect is a bunch of text. 

Exactly.  You can run SA as a daemon (spamd) and feed data to it using
spamc. Works very well. The full ruleset is probably too much, but it's
easy to roll your own too.

 If they require the headers of an email you can supply fake ones and
 remove any effect headers have on the score. 

SA doesn't require them, and without them scoring would (obviously) be
based on the text only.


/Per

-- 
Per Jessen, Zürich (20.9°C)


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Numerical Recipe - Scheduling Question

2009-05-29 Thread bruce
Hi..

Got a need to be able to allow a user to specify the frequency to run
certain apps/processes.. I need to be able to have the user specify a start
Time, as well as a periodic frequency (once, hourly, daily, weekly...) as
well as allow the user to specify every XX minutes...

So i basically need to be able to determine when the future
events/occurances are, based on the user input.

I've searched the net for alogorithms dealing with scheduling and haven't
come up with any php based solutions.. I've also looked at numerical recipes
and some other sources (freshmeat/sourceforge/etc..) with no luck..

I have found an approach in another language that I could port to php.. But
before I code/recreate this, I figured I'd see if anyone here has pointers
or suggestions...

Cron doesn't work for me, as it can run a process at a given time.. but it
doesn't tell me when the next 'X' occurance would be...

Thoughts/Comments..

Thanks


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Numerical Recipe - Scheduling Question

2009-05-29 Thread kyle.smith
I'm confused as to why cron doesn't work for you.  It doesn't explicitly
tell you when the next X occurences will be, but math does.  If you
schedule something to run every 5 minutes starting at 1:45 PM, it's
simple work to be able to report that the next times would be 1:50 PM,
1:55 PM, 2:00 PM etc.

Is this running in a web browser, somehow?  If not, PHP is not the
solution.

HTH,
Kyle

-Original Message-
From: bruce [mailto:bedoug...@earthlink.net] 
Sent: Friday, May 29, 2009 1:11 PM
To: php-general@lists.php.net
Subject: [PHP] Numerical Recipe - Scheduling Question

Hi..

Got a need to be able to allow a user to specify the frequency to run
certain apps/processes.. I need to be able to have the user specify a
start Time, as well as a periodic frequency (once, hourly, daily,
weekly...) as well as allow the user to specify every XX minutes...

So i basically need to be able to determine when the future
events/occurances are, based on the user input.

I've searched the net for alogorithms dealing with scheduling and
haven't come up with any php based solutions.. I've also looked at
numerical recipes and some other sources (freshmeat/sourceforge/etc..)
with no luck..

I have found an approach in another language that I could port to php..
But before I code/recreate this, I figured I'd see if anyone here has
pointers or suggestions...

Cron doesn't work for me, as it can run a process at a given time.. but
it doesn't tell me when the next 'X' occurance would be...

Thoughts/Comments..

Thanks


--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Numerical Recipe - Scheduling Question

2009-05-29 Thread Stuart
2009/5/29 kyle.smith kyle.sm...@inforonics.com:
 I'm confused as to why cron doesn't work for you.  It doesn't explicitly
 tell you when the next X occurences will be, but math does.  If you
 schedule something to run every 5 minutes starting at 1:45 PM, it's
 simple work to be able to report that the next times would be 1:50 PM,
 1:55 PM, 2:00 PM etc.

You can be a lot more intelligent than that. I have a job queue system
running on several sites I maintain that uses a simple run_at
timestamp. A cron job runs every minute and essentially does this...

* Locks the job queue.

* Does the equivalent of select job from job_queue where run_at =
unix_timestamp() order by run_at asc limit 1.

* If no jobs need running it simply exits otherwise it locks the job
it got back and unlocks the queue.

* Runs the job (wrapped in a safe environment that catches output and
errors and does something useful with them).

* Marks the job as completed or with an error status.

* If the job is marked as recurring it creates a new job by cloning
the job it just ran, sets run_at based upon the schedule definition
(which can be a time of day, a time of day + a day of week, a time of
day + a day of month or simply a number of seconds) and sets the
status to new.

* Either removes the completed job from the queue or archives it
complete with errors and output for later inspection depending on the
job config and status.

* If this processor has been running for  60 minutes it exits,
otherwise it looks for another job to run.

This system will automatically scale up to 60 job processors per hour,
but obviously you can modify the cron config to run more or less as
your requirements dictate. Assuming the job queue is on a shared
resource such as a database this can also scale across machines
effectively infinitely.

There's also a whole bunch of stuff around catching crashed jobs and
doing something useful with them, but I'll leave how to handle those
as an exercise for the reader.

 Is this running in a web browser, somehow?  If not, PHP is not the
 solution.

Total codswallop! PHP is no more tied to web browsers than a
hovercraft is tied to water. My job queue system is 100% PHP (although
it can run jobs not written in PHP, but that's a topic for another
day) and beyond initial development it's never given me any problems.

Hmm, might have to write that lot up as a blog post with some example
code. Sometime...

-Stuart

-- 
http://stut.net/

 -Original Message-
 From: bruce [mailto:bedoug...@earthlink.net]
 Sent: Friday, May 29, 2009 1:11 PM
 To: php-general@lists.php.net
 Subject: [PHP] Numerical Recipe - Scheduling Question

 Hi..

 Got a need to be able to allow a user to specify the frequency to run
 certain apps/processes.. I need to be able to have the user specify a
 start Time, as well as a periodic frequency (once, hourly, daily,
 weekly...) as well as allow the user to specify every XX minutes...

 So i basically need to be able to determine when the future
 events/occurances are, based on the user input.

 I've searched the net for alogorithms dealing with scheduling and
 haven't come up with any php based solutions.. I've also looked at
 numerical recipes and some other sources (freshmeat/sourceforge/etc..)
 with no luck..

 I have found an approach in another language that I could port to php..
 But before I code/recreate this, I figured I'd see if anyone here has
 pointers or suggestions...

 Cron doesn't work for me, as it can run a process at a given time.. but
 it doesn't tell me when the next 'X' occurance would be...

 Thoughts/Comments..

 Thanks


 --
 PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
 http://www.php.net/unsub.php


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Numerical Recipe - Scheduling Question

2009-05-29 Thread Bastien Koert
On Fri, May 29, 2009 at 2:12 PM, Stuart stut...@gmail.com wrote:

 2009/5/29 kyle.smith kyle.sm...@inforonics.com:
  I'm confused as to why cron doesn't work for you.  It doesn't explicitly
  tell you when the next X occurences will be, but math does.  If you
  schedule something to run every 5 minutes starting at 1:45 PM, it's
  simple work to be able to report that the next times would be 1:50 PM,
  1:55 PM, 2:00 PM etc.

 You can be a lot more intelligent than that. I have a job queue system
 running on several sites I maintain that uses a simple run_at
 timestamp. A cron job runs every minute and essentially does this...

 * Locks the job queue.

 * Does the equivalent of select job from job_queue where run_at =
 unix_timestamp() order by run_at asc limit 1.

 * If no jobs need running it simply exits otherwise it locks the job
 it got back and unlocks the queue.

 * Runs the job (wrapped in a safe environment that catches output and
 errors and does something useful with them).

 * Marks the job as completed or with an error status.

 * If the job is marked as recurring it creates a new job by cloning
 the job it just ran, sets run_at based upon the schedule definition
 (which can be a time of day, a time of day + a day of week, a time of
 day + a day of month or simply a number of seconds) and sets the
 status to new.

 * Either removes the completed job from the queue or archives it
 complete with errors and output for later inspection depending on the
 job config and status.

 * If this processor has been running for  60 minutes it exits,
 otherwise it looks for another job to run.

 This system will automatically scale up to 60 job processors per hour,
 but obviously you can modify the cron config to run more or less as
 your requirements dictate. Assuming the job queue is on a shared
 resource such as a database this can also scale across machines
 effectively infinitely.

 There's also a whole bunch of stuff around catching crashed jobs and
 doing something useful with them, but I'll leave how to handle those
 as an exercise for the reader.

  Is this running in a web browser, somehow?  If not, PHP is not the
  solution.

 Total codswallop! PHP is no more tied to web browsers than a
 hovercraft is tied to water. My job queue system is 100% PHP (although
 it can run jobs not written in PHP, but that's a topic for another
 day) and beyond initial development it's never given me any problems.

 Hmm, might have to write that lot up as a blog post with some example
 code. Sometime...

 -Stuart

 --
 http://stut.net/

  -Original Message-
  From: bruce [mailto:bedoug...@earthlink.net]
  Sent: Friday, May 29, 2009 1:11 PM
  To: php-general@lists.php.net
  Subject: [PHP] Numerical Recipe - Scheduling Question
 
  Hi..
 
  Got a need to be able to allow a user to specify the frequency to run
  certain apps/processes.. I need to be able to have the user specify a
  start Time, as well as a periodic frequency (once, hourly, daily,
  weekly...) as well as allow the user to specify every XX minutes...
 
  So i basically need to be able to determine when the future
  events/occurances are, based on the user input.
 
  I've searched the net for alogorithms dealing with scheduling and
  haven't come up with any php based solutions.. I've also looked at
  numerical recipes and some other sources (freshmeat/sourceforge/etc..)
  with no luck..
 
  I have found an approach in another language that I could port to php..
  But before I code/recreate this, I figured I'd see if anyone here has
  pointers or suggestions...
 
  Cron doesn't work for me, as it can run a process at a given time.. but
  it doesn't tell me when the next 'X' occurance would be...
 
  Thoughts/Comments..
 
  Thanks
 
 
  --
  PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
  http://www.php.net/unsub.php
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


I would be very interested in that. I am developing a project where a queue
is required to manage load. Your post above has some pointers that I like,
but more information would be greatly appreciated.

-- 

Bastien

Cat, the other other white meat


Re: [PHP] recipes anyone?

2009-05-29 Thread PJ
Bob McConnell wrote:
 From: PJ
   
 I'd like to get some input on how to deal with recipes.
 use html pages to store and display, XML or db or... ? And what about
 clips, like flvs ? TIA.

 

 There are as many ways to do cookbooks as there are cooks. I am familiar
 with half a dozen, without counting the professional packages put out by
 another department here where I work.

 RecipeML is one option, but it is seriously incomplete if you need to
 include nutritional information.

 Qookbooks, Gormet (Gnome), Krecipes (KDE) MealMaster, Master Cook,
 Recipants, etc. all have different storage formats and display formats.
 Some are well documented, some are buried in the code, and some are
 still kept secret. You can take your pick, or combine them and roll your
 own.

 A bigger issue is how to import existing recipe files. I have several
 years of messages collected from newsgroups like rec.food.recipes,
 r.f.cooking, r.f.baking, etc. that I would like to put into a usable,
 and searchable format. But there are too many variations in the formats
 and naming conventions used to be able to write a single routine to
 handle them all. It is much easier just to use those already published
 in MealMaster formats. At least that one is documented clearly now that
 they are out of business.

 Bob McConnell
   
Thank you gentlemen. Basically, that's what I figured. But this does
give me some more stuff to mull over. The only thing I'm really
wondering is if it's worth doing anything with XML.
I do have a number of recipes already in HTML; probably will try to
re-use them and modify/or adapt with CSS.
Thanks, again.

-- 
Hervé Kempf: Pour sauver la planète, sortez du capitalisme.
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] recipes anyone?

2009-05-29 Thread Bob McConnell
From: PJ
 Bob McConnell wrote:
 From: PJ
   
 I'd like to get some input on how to deal with recipes.
 use html pages to store and display, XML or db or... ? And what
about
 clips, like flvs ? TIA.

 

 There are as many ways to do cookbooks as there are cooks. I am
familiar
 with half a dozen, without counting the professional packages put out
by
 another department here where I work.

 RecipeML is one option, but it is seriously incomplete if you need to
 include nutritional information.

 Qookbooks, Gormet (Gnome), Krecipes (KDE) MealMaster, Master Cook,
 Recipants, etc. all have different storage formats and display
formats.
 Some are well documented, some are buried in the code, and some are
 still kept secret. You can take your pick, or combine them and roll
your
 own.

 A bigger issue is how to import existing recipe files. I have several
 years of messages collected from newsgroups like rec.food.recipes,
 r.f.cooking, r.f.baking, etc. that I would like to put into a usable,
 and searchable format. But there are too many variations in the
formats
 and naming conventions used to be able to write a single routine to
 handle them all. It is much easier just to use those already
published
 in MealMaster formats. At least that one is documented clearly now
that
 they are out of business.

 Bob McConnell
   
 Thank you gentlemen. Basically, that's what I figured. But this does
 give me some more stuff to mull over. The only thing I'm really
 wondering is if it's worth doing anything with XML.
 I do have a number of recipes already in HTML; probably will try to
 re-use them and modify/or adapt with CSS.
 Thanks, again.

A lot depends on what you are actually going to do with them. If you
need output in several different forms, then XML/XSLT might be the best
way to go. But, I have seen an automated translation of the RecipeML DTD
into an SQL schema, and it was not pretty. Unless you are very familiar
with XML, or just want some practice, I wouldn't go there.

I have been looking at this idea for some time, and have pretty much
decided on a Postgres server for the back end with a custom schema.
There are several features I want that are not all available in any of
the consumer grade packages I have seen; like a web based front end,
exclusion of specific ingredients due to allergies and being able to
attach dated notes about alterations or substitutions I try each time I
prepare a recipe. I just need to sit down with my collected notes and a
few days to patch it together. But lately I have been spending most of
my time with our grandchildren instead of the computer.

Good luck,

Bob McConnell

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Numerical Recipe - Scheduling Question

2009-05-29 Thread Stuart
2009/5/29 Bastien Koert phps...@gmail.com:

 On Fri, May 29, 2009 at 2:12 PM, Stuart stut...@gmail.com wrote:

 Hmm, might have to write that lot up as a blog post with some example
 code. Sometime...

 I would be very interested in that. I am developing a project where a queue
 is required to manage load. Your post above has some pointers that I like,
 but more information would be greatly appreciated.

http://stut.net/blog/2009/05/29/php-job-queue/

Pretty much a brain dump but it does provide a little more info than
my earlier post. Comments welcome.

-Stuart

-- 
http://stut.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] recipes anyone?

2009-05-29 Thread Michael A. Peters

PJ wrote:

I'd like to get some input on how to deal with recipes.
use html pages to store and display, XML or db or... ? And what about
clips, like flvs ? TIA.



I believe there is already an xml format for recipes.
I would either use that format to store them, or use equivalent database 
fields to store them.


When displaying, you'd need to translate the recipe xml format to html 
but you should also make the xml format available for people with 
software designed to work with recipe's.


http://www.happy-monkey.net/recipebook/

is one xml specification. There may be others.
I use to maintain the Fedora package for a python/Gtk2+ recipe manager, 
it used sqlite internally but could import from at least one xml format 
- not sure if the one I linked to is it or not.


You'll need to use one of the xml tools to convert xml recipe's to html 
for viewing, but by using xml in your code, you both make the recipe's 
readily available via xml to your users and make it easy for you to add 
recipe's to your site that use the specified xml format.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] recipes anyone?

2009-05-29 Thread Michael A. Peters

PJ wrote:

  

Thank you gentlemen. Basically, that's what I figured. But this does
give me some more stuff to mull over. The only thing I'm really
wondering is if it's worth doing anything with XML.


For display in a web browser, the only thing you should do with xml is 
what browsers know how to handle - xhtml and MathML (maybe a few others 
??) - and IE still doesn't properly support either of those.


xml however is an excellent way to store information for data exchange 
between different applications, assuming the specification (DTD) is 
logical and well documented.


Don't use xml just for the sake of using xml, if that's what you are 
asking. Use it because a good xml specification already exists for what 
you want to do that makes it easier for data sharing between different 
apps / hardware.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] recipes anyone?

2009-05-29 Thread Michael A. Peters

Bob McConnell wrote:
 like a web based front end,
 exclusion of specific ingredients due to allergies and being able to
 attach dated notes about alterations or substitutions I try each time

That sounds wicked.
One of my brothers is allergic to corn.
Being able to flag ingredients that contain corn (usually ingredients 
that contain corn syrup) would also be great.


Fortunately nothing too drastic happens when he gets corn, he gets a 
rash and a bad attitude - but it still manages to slip its way into a 
lot of things you wouldn't think contain corn.


I think it may be corn syrup itself and not corn that he is allergic to, 
I don't remember.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Confirmation email caught by spam filter

2009-05-29 Thread Dee Ayy
Are you sure it's a PHP thing?

The way I have some of my email accounts setup is that I only accept
email from folks in my address book.  If I just registered a new
account somewhere, chances are I do not have them in my address book,
so it will go to the Junk/Spam folder.

If this is your issue, educate your users to make sure they check
their Junk/Spam folder depending upon their Junk/Spam filtering
settings when they are first registering.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] recipes anyone?

2009-05-29 Thread Shawn McKenzie
Michael A. Peters wrote:
 Bob McConnell wrote:
 like a web based front end,
 exclusion of specific ingredients due to allergies and being able to
 attach dated notes about alterations or substitutions I try each time
 
 That sounds wicked.
 One of my brothers is allergic to corn.
 Being able to flag ingredients that contain corn (usually ingredients
 that contain corn syrup) would also be great.
 
 Fortunately nothing too drastic happens when he gets corn, he gets a
 rash and a bad attitude - but it still manages to slip its way into a
 lot of things you wouldn't think contain corn.
 
 I think it may be corn syrup itself and not corn that he is allergic to,
 I don't remember.

Oh God, please don't get PJ started on corn!

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Numerical Recipe - Scheduling Question

2009-05-29 Thread Shawn McKenzie
bruce wrote:
 Hi..
 
 Got a need to be able to allow a user to specify the frequency to run
 certain apps/processes.. I need to be able to have the user specify a start
 Time, as well as a periodic frequency (once, hourly, daily, weekly...) as
 well as allow the user to specify every XX minutes...
 
 So i basically need to be able to determine when the future
 events/occurances are, based on the user input.
 
 I've searched the net for alogorithms dealing with scheduling and haven't
 come up with any php based solutions.. I've also looked at numerical recipes
 and some other sources (freshmeat/sourceforge/etc..) with no luck..
 
 I have found an approach in another language that I could port to php.. But
 before I code/recreate this, I figured I'd see if anyone here has pointers
 or suggestions...
 
 Cron doesn't work for me, as it can run a process at a given time.. but it
 doesn't tell me when the next 'X' occurance would be...
 
 Thoughts/Comments..
 
 Thanks
 

This is confusing.  When and where do you need to be able to determine
when the future events/occurances are?  You need to display this after
the user schedules the app/process or an admin needs to login and see
this at any given time?

Regardless it is easy with the PHP time/date functions.  Once you've
collected and stored the start/stop times and interval, something
similar to:

$interval = 1 week;

$next = $start_time;
while ($next = $end_time) {
$next = strtotime(+$interval, $next);
echo date(DATE_RFC822, $next) .\n;
}


-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: Numerical Recipe - Scheduling Question

2009-05-29 Thread bruce
hey shawn...

strtotime (or something similar) might just work

i'll always know the interval... which can be used to compute the nexttime,
which then becomes the next starttime...

i'm assuming there's an equally simple way to find the last day of a given
month if i choose that as an interval as well..

for my initial needs.. this might work.. until i free up time to actually
craft a more generic solution, independent of the underlying language/os..

thanks



for next month.. and the start

-Original Message-
From: Shawn McKenzie [mailto:nos...@mckenzies.net]
Sent: Friday, May 29, 2009 2:48 PM
To: php-general@lists.php.net
Subject: [PHP] Re: Numerical Recipe - Scheduling Question


bruce wrote:
 Hi..

 Got a need to be able to allow a user to specify the frequency to run
 certain apps/processes.. I need to be able to have the user specify a
start
 Time, as well as a periodic frequency (once, hourly, daily, weekly...) as
 well as allow the user to specify every XX minutes...

 So i basically need to be able to determine when the future
 events/occurances are, based on the user input.

 I've searched the net for alogorithms dealing with scheduling and haven't
 come up with any php based solutions.. I've also looked at numerical
recipes
 and some other sources (freshmeat/sourceforge/etc..) with no luck..

 I have found an approach in another language that I could port to php..
But
 before I code/recreate this, I figured I'd see if anyone here has pointers
 or suggestions...

 Cron doesn't work for me, as it can run a process at a given time.. but it
 doesn't tell me when the next 'X' occurance would be...

 Thoughts/Comments..

 Thanks


This is confusing.  When and where do you need to be able to determine
when the future events/occurances are?  You need to display this after
the user schedules the app/process or an admin needs to login and see
this at any given time?

Regardless it is easy with the PHP time/date functions.  Once you've
collected and stored the start/stop times and interval, something
similar to:

$interval = 1 week;

$next = $start_time;
while ($next = $end_time) {
$next = strtotime(+$interval, $next);
echo date(DATE_RFC822, $next) .\n;
}


--
Thanks!
-Shawn
http://www.spidean.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: Numerical Recipe - Scheduling Question

2009-05-29 Thread bruce
hey shawn...

on the strtotime function... it appears to simply take intervals of a string
type..

is there a way to have it take intervals of the number of secs? or is there
another time function that takes the current date/time, and allows you to
add an interval in secs?

thanks



-Original Message-
From: Shawn McKenzie [mailto:nos...@mckenzies.net]
Sent: Friday, May 29, 2009 2:48 PM
To: php-general@lists.php.net
Subject: [PHP] Re: Numerical Recipe - Scheduling Question


bruce wrote:
 Hi..

 Got a need to be able to allow a user to specify the frequency to run
 certain apps/processes.. I need to be able to have the user specify a
start
 Time, as well as a periodic frequency (once, hourly, daily, weekly...) as
 well as allow the user to specify every XX minutes...

 So i basically need to be able to determine when the future
 events/occurances are, based on the user input.

 I've searched the net for alogorithms dealing with scheduling and haven't
 come up with any php based solutions.. I've also looked at numerical
recipes
 and some other sources (freshmeat/sourceforge/etc..) with no luck..

 I have found an approach in another language that I could port to php..
But
 before I code/recreate this, I figured I'd see if anyone here has pointers
 or suggestions...

 Cron doesn't work for me, as it can run a process at a given time.. but it
 doesn't tell me when the next 'X' occurance would be...

 Thoughts/Comments..

 Thanks


This is confusing.  When and where do you need to be able to determine
when the future events/occurances are?  You need to display this after
the user schedules the app/process or an admin needs to login and see
this at any given time?

Regardless it is easy with the PHP time/date functions.  Once you've
collected and stored the start/stop times and interval, something
similar to:

$interval = 1 week;

$next = $start_time;
while ($next = $end_time) {
$next = strtotime(+$interval, $next);
echo date(DATE_RFC822, $next) .\n;
}


--
Thanks!
-Shawn
http://www.spidean.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Numerical Recipe - Scheduling Question

2009-05-29 Thread Stuart
2009/5/29 bruce bedoug...@earthlink.net:
 hey shawn...

 on the strtotime function... it appears to simply take intervals of a string
 type..

 is there a way to have it take intervals of the number of secs? or is there
 another time function that takes the current date/time, and allows you to
 add an interval in secs?

$timestamp = time() + $num_secs;

-Stuart

-- 
http://stut.net/

 -Original Message-
 From: Shawn McKenzie [mailto:nos...@mckenzies.net]
 Sent: Friday, May 29, 2009 2:48 PM
 To: php-general@lists.php.net
 Subject: [PHP] Re: Numerical Recipe - Scheduling Question


 bruce wrote:
 Hi..

 Got a need to be able to allow a user to specify the frequency to run
 certain apps/processes.. I need to be able to have the user specify a
 start
 Time, as well as a periodic frequency (once, hourly, daily, weekly...) as
 well as allow the user to specify every XX minutes...

 So i basically need to be able to determine when the future
 events/occurances are, based on the user input.

 I've searched the net for alogorithms dealing with scheduling and haven't
 come up with any php based solutions.. I've also looked at numerical
 recipes
 and some other sources (freshmeat/sourceforge/etc..) with no luck..

 I have found an approach in another language that I could port to php..
 But
 before I code/recreate this, I figured I'd see if anyone here has pointers
 or suggestions...

 Cron doesn't work for me, as it can run a process at a given time.. but it
 doesn't tell me when the next 'X' occurance would be...

 Thoughts/Comments..

 Thanks


 This is confusing.  When and where do you need to be able to determine
 when the future events/occurances are?  You need to display this after
 the user schedules the app/process or an admin needs to login and see
 this at any given time?

 Regardless it is easy with the PHP time/date functions.  Once you've
 collected and stored the start/stop times and interval, something
 similar to:

 $interval = 1 week;

 $next = $start_time;
 while ($next = $end_time) {
        $next = strtotime(+$interval, $next);
        echo date(DATE_RFC822, $next) .\n;
 }


 --
 Thanks!
 -Shawn
 http://www.spidean.com

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Confirmation email caught by spam filter

2009-05-29 Thread LAMP
partially, this is my issue. but it looks like the message add the 
email address ord...@mydomain.com to you address book didn't help. at 
least not noticeable.


afan



Dee Ayy wrote:

Are you sure it's a PHP thing?

The way I have some of my email accounts setup is that I only accept
email from folks in my address book.  If I just registered a new
account somewhere, chances are I do not have them in my address book,
so it will go to the Junk/Spam folder.

If this is your issue, educate your users to make sure they check
their Junk/Spam folder depending upon their Junk/Spam filtering
settings when they are first registering.

  



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] recipes anyone?

2009-05-29 Thread PJ
Michael A. Peters wrote:
 Bob McConnell wrote:
  like a web based front end,
  exclusion of specific ingredients due to allergies and being able to
  attach dated notes about alterations or substitutions I try each time

 That sounds wicked.
 One of my brothers is allergic to corn.
 Being able to flag ingredients that contain corn (usually ingredients
 that contain corn syrup) would also be great.

 Fortunately nothing too drastic happens when he gets corn, he gets a
 rash and a bad attitude - but it still manages to slip its way into a
 lot of things you wouldn't think contain corn.

 I think it may be corn syrup itself and not corn that he is allergic
 to, I don't remember.

Oh my god, you have just treaded into one horrible hornet's nest... corn
is probably the worst thing imaginable when it come to the food chain,
nutrition, ecology, global warmiing, allergies, green fuel, etc. etc.
not to mention that we as human beings are practically being turned
into corn ourselves.
Maybe your brother already knows about some of this, but it would be
worth it for you to pursue the subject and you would be horrifies what
corn is doing to our bodies and our planet. That is truly Montezuma's
Revenge. If you want to know where to look, I'll check it out from my
reading... I don't have that on me at the moment. ;-)

-- 
Hervé Kempf: Pour sauver la planète, sortez du capitalisme.
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] recipes anyone?

2009-05-29 Thread PJ
Shawn McKenzie wrote:
 Michael A. Peters wrote:
   
 Bob McConnell wrote:
 
 like a web based front end,
 exclusion of specific ingredients due to allergies and being able to
 attach dated notes about alterations or substitutions I try each time
   
 That sounds wicked.
 One of my brothers is allergic to corn.
 Being able to flag ingredients that contain corn (usually ingredients
 that contain corn syrup) would also be great.

 Fortunately nothing too drastic happens when he gets corn, he gets a
 rash and a bad attitude - but it still manages to slip its way into a
 lot of things you wouldn't think contain corn.

 I think it may be corn syrup itself and not corn that he is allergic to,
 I don't remember.
 

 Oh God, please don't get PJ started on corn!

   
Too late! :-P

-- 
Hervé Kempf: Pour sauver la planète, sortez du capitalisme.
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Numerical Recipe - Scheduling Question

2009-05-29 Thread Shawn McKenzie
bruce wrote:
 hey shawn...
 
 strtotime (or something similar) might just work
 
 i'll always know the interval... which can be used to compute the nexttime,
 which then becomes the next starttime...
 
 i'm assuming there's an equally simple way to find the last day of a given
 month if i choose that as an interval as well..

If you search, there are 100s of ways to do these types of things.
Check the date/time functions.  There are many and many ways to use
theme.  Here is one:

date('t', strtotime($year-$month-01));

 for my initial needs.. this might work.. until i free up time to actually
 craft a more generic solution, independent of the underlying language/os..
 
 thanks
 
 
 
 for next month.. and the start
 
 -Original Message-
 From: Shawn McKenzie [mailto:nos...@mckenzies.net]
 Sent: Friday, May 29, 2009 2:48 PM
 To: php-general@lists.php.net
 Subject: [PHP] Re: Numerical Recipe - Scheduling Question
 
 
 bruce wrote:
 Hi..

 Got a need to be able to allow a user to specify the frequency to run
 certain apps/processes.. I need to be able to have the user specify a
 start
 Time, as well as a periodic frequency (once, hourly, daily, weekly...) as
 well as allow the user to specify every XX minutes...

 So i basically need to be able to determine when the future
 events/occurances are, based on the user input.

 I've searched the net for alogorithms dealing with scheduling and haven't
 come up with any php based solutions.. I've also looked at numerical
 recipes
 and some other sources (freshmeat/sourceforge/etc..) with no luck..

 I have found an approach in another language that I could port to php..
 But
 before I code/recreate this, I figured I'd see if anyone here has pointers
 or suggestions...

 Cron doesn't work for me, as it can run a process at a given time.. but it
 doesn't tell me when the next 'X' occurance would be...

 Thoughts/Comments..

 Thanks

 
 This is confusing.  When and where do you need to be able to determine
 when the future events/occurances are?  You need to display this after
 the user schedules the app/process or an admin needs to login and see
 this at any given time?
 
 Regardless it is easy with the PHP time/date functions.  Once you've
 collected and stored the start/stop times and interval, something
 similar to:
 
 $interval = 1 week;
 
 $next = $start_time;
 while ($next = $end_time) {
   $next = strtotime(+$interval, $next);
   echo date(DATE_RFC822, $next) .\n;
 }
 
 
 --
 Thanks!
 -Shawn
 http://www.spidean.com
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php