Re: [fw-general] Continue Processing after an action is completed

2009-02-08 Thread swilhelm

Store the data needed for further processing in some persistent queue and use
a cron job to poll the "further processing queue" on regular intervals.

- Steve W.


Ashley McConnell wrote:
> 
> Hi Folks,
> 
> I would like to be able to call an action / respond to the client and then
> continue on with some further processing.
> 
> I have tried a couple of things: -
> 
> Using fork: -
> http://www.php.net/manual/en/function.pcntl-fork.php
> 
> This doesn't work on my windows installation and i'm not sure it will be
> enabled on my hosting.
> 
> Using a headers hack method:-
> 
> http://www.brandonchecketts.com/archives/performing-post-output-script-processing-in-php
> 
> This seems to work the first time, but not the next time you call it.
> 
> Register Shutdown function
> http://uk2.php.net/register_shutdown_function
> 
> This doesn't work at all - it just blocks until the "other processing" is
> finished.
> 
> Is there anything that works with the Zend Framework? Any other ideas?
> 
> Thanks for your help
> All the best,
> Ash
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Continue-Processing-after-an-action-is-completed-tp21900147p21908043.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Continue Processing after an action is completed

2009-02-08 Thread Matthew Weier O'Phinney
-- Ashley McConnell  wrote
(on Sunday, 08 February 2009, 11:20 AM -0800):
> Matthew Weier O'Phinney-3 wrote:
> > From the above experiments you've tried, it sounds like you want to
> > offload some processing to occur after the content is delivered, but
> > want it to occur without keeping the connection to the client. With this
> > in mind, I'd suggest building a job queue. With this sort of solution,
> > you send a message to the queue, and then a queue processor queries it
> > periodically and performs routines pertinent to the message sent.
> > 
> > There is a Zend_Queue proposal under review, but not yet accepted. There
> > are also commercial solutions such as Zend Platform's Job Queue which
> > can perform this work. 
> > 
> > You can also roll your own, something I've done before myself. Usually,
> > you provide a callback, and the arguments for the callback, and your
> > queue processor then does the processing. I've done implementations that
> > used static class methods for the callbacks, as well as some that would
> > instantiate the given class and then call the given method with the
> > provided arguments (utilizing call_user_func_array()).
> 
> Thanks for your reply.  Sounds great, just as some background - what I am
> doing is uploading results from a race in my racing simulator - writing them
> to the db and then I am intending to do some processing to figure out if
> anyone broke any records or passed any milestone (1000 laps for example).
> 
> I haven't been using PHP very long, so forgive me the silly question, but
> what form would a queue processor take?  Is it a php script run as a daemon? 
> Is there a way for Zend to kick it off if it isn't running already?

Depends on the path you choose for the job queue, really. I've typically
used cron to run my queue, but other options include having a daemon
running in the background checking periodically for updates (and said
daemon does not necessarily need to be written in PHP -- just needs to
invoke your script that does the processing). Platform's Job Queue runs
as a daemon, for instance.

You _don't_ want your web application to trigger it, as you'll run into
the exact situation you were having before.

-- 
Matthew Weier O'Phinney
Software Architect   | matt...@zend.com
Zend Framework   | http://framework.zend.com/


Re: [fw-general] Continue Processing after an action is completed

2009-02-08 Thread A.J. Brown
This won't work on a windows host, but If you you can pass all of the proper
variables as arguments, You can try executing the task in the background via
shell in postDispatch.

Just append "&" to the end of the command.

system('php -f /path/to/file.php var1 var2 &');

It may not work on a share host either, though :)


On Sun, Feb 8, 2009 at 9:48 AM, Ashley McConnell
wrote:

>
>
>
> keith Pope-4 wrote:
> >
> > The thing that springs to mind is using the postDispatch on either the
> > Front Controller or the Action Controller
> >
> >
>
> Hi Keith,
>
> Thanks for the reply - I did try that actually, but it seems to run before
> the connection to the client is closed.  I tried a sleep(5) in there and
> the
> page took around 5 seconds to fully load, whereas without the postDispatch
> it was almost instant.
>
> All the best,
> Ash
>
> --
> View this message in context:
> http://www.nabble.com/Continue-Processing-after-an-action-is-completed-tp21900147p21900748.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>


-- 
A.J. Brown
web | http://ajbrown.org
phone | (937) 660-3969


Re: [fw-general] ZF 1.6.2 not being maintained/supported for php 5.1.4+ users??

2009-02-08 Thread till
On Sun, Feb 8, 2009 at 12:03 AM, ardx  wrote:
> (...)
> I'm not defending the fact that Centos is stuck at php 5.1.6 because that's
> what rhel 5.2 has. Evidently if you pay Redhat extra money, over and above
> the cost of rhel 5, you can get a stack with a more recent version of php.

Not pouring salt in your wound, but this is hilarious.

I'm pretty sure there are unoffical RPM repositories that carry a more
recent version for you. And everyone else should persue this route
too, or use another Linux distro.

E.g. the following is referenced all over:
http://www.jasonlitka.com/yum-repository/

I know he offers PHP 5.2.5 at least.

Till


Re: [fw-general] Continue Processing after an action is completed

2009-02-08 Thread Ashley McConnell



Matthew Weier O'Phinney-3 wrote:
> 
> 
> From the above experiments you've tried, it sounds like you want to
> offload some processing to occur after the content is delivered, but
> want it to occur without keeping the connection to the client. With this
> in mind, I'd suggest building a job queue. With this sort of solution,
> you send a message to the queue, and then a queue processor queries it
> periodically and performs routines pertinent to the message sent.
> 
> There is a Zend_Queue proposal under review, but not yet accepted. There
> are also commercial solutions such as Zend Platform's Job Queue which
> can perform this work. 
> 
> You can also roll your own, something I've done before myself. Usually,
> you provide a callback, and the arguments for the callback, and your
> queue processor then does the processing. I've done implementations that
> used static class methods for the callbacks, as well as some that would
> instantiate the given class and then call the given method with the
> provided arguments (utilizing call_user_func_array()).
> 
> 

Hi Matthew,

Thanks for your reply.  Sounds great, just as some background - what I am
doing is uploading results from a race in my racing simulator - writing them
to the db and then I am intending to do some processing to figure out if
anyone broke any records or passed any milestone (1000 laps for example).

I haven't been using PHP very long, so forgive me the silly question, but
what form would a queue processor take?  Is it a php script run as a daemon? 
Is there a way for Zend to kick it off if it isn't running already?

Thanks again for your help
All the best,
Ash
-- 
View this message in context: 
http://www.nabble.com/Continue-Processing-after-an-action-is-completed-tp21900147p21902316.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Continue Processing after an action is completed

2009-02-08 Thread Matthew Weier O'Phinney
-- Ashley McConnell  wrote
(on Sunday, 08 February 2009, 07:50 AM -0800):
> I would like to be able to call an action / respond to the client and then
> continue on with some further processing.
> 
> I have tried a couple of things: -
> 
> Using fork: -
> http://www.php.net/manual/en/function.pcntl-fork.php
> 
> This doesn't work on my windows installation and i'm not sure it will be
> enabled on my hosting.
> 
> Using a headers hack method:-
> 
> http://www.brandonchecketts.com/archives/performing-post-output-script-processing-in-php
> 
> This seems to work the first time, but not the next time you call it.
> 
> Register Shutdown function
> http://uk2.php.net/register_shutdown_function
> 
> This doesn't work at all - it just blocks until the "other processing" is
> finished.
> 
> Is there anything that works with the Zend Framework? Any other ideas?

>From the above experiments you've tried, it sounds like you want to
offload some processing to occur after the content is delivered, but
want it to occur without keeping the connection to the client. With this
in mind, I'd suggest building a job queue. With this sort of solution,
you send a message to the queue, and then a queue processor queries it
periodically and performs routines pertinent to the message sent.

There is a Zend_Queue proposal under review, but not yet accepted. There
are also commercial solutions such as Zend Platform's Job Queue which
can perform this work. 

You can also roll your own, something I've done before myself. Usually,
you provide a callback, and the arguments for the callback, and your
queue processor then does the processing. I've done implementations that
used static class methods for the callbacks, as well as some that would
instantiate the given class and then call the given method with the
provided arguments (utilizing call_user_func_array()).

-- 
Matthew Weier O'Phinney
Software Architect   | matt...@zend.com
Zend Framework   | http://framework.zend.com/


Re: [fw-general] "subviews"

2009-02-08 Thread Matthew Weier O'Phinney
-- Matthew Weier O'Phinney  wrote
(on Sunday, 08 February 2009, 10:19 AM -0500):
> -- Aspra Flavius Adrian  wrote
> (on Sunday, 08 February 2009, 01:45 PM +0100):
> > Hi. How could I trigger another /module/controller/action in order to
> > catch its output which should then be displayed inside a dojo
> > container?
> > 
> > Imagine the /default/index/index rendering the "homepage", which
> > should contain several blocks like "the latest forum entries" (from
> > /forum/index/latest) and "best wiki articles" (from /wiki/index/best).
> 
> If you're indeed using Dojo, consider using ContentPane's with the
> "href" attribute pointing to actions that have the content you wish to
> display. That approach will require more requests, but be very dynamic.
> 
> The other possibility is to use one of the following:
> 
>   * partial() view helper allows you to specify the module in which to
> look for the view script.
> 
>   * action() view helper dispatches another action and returns the
> content
> 
>   * ActionStack action helper/plugin will allow you to specify one or
> more actions to perform during the request lifecycle. Have each
> render to a distinct response segment, and build the final output in
> your layout script.
> 
> In terms of performance, ActionStack will be faster than partial(), which
> will in turn be faster than action(). However, partial() and action()
> allow you to build the view within a single action view script, while
> ActionStack will require a different strategy.

And I should probably go on record to recommend against action() and
ActionStack, really. Most of the time if you find yourself doing that,
it means you're executing application logic within your action
controllers -- logic that is usually best implemented in your models.

A more appropriate solution would be one of the following:

  * Creation of a view helper that interacts with the necessary model
and builds the appropriate display

  * Passing the appropriate model to the view and then render()ing an
additional view script within it (or calling partial() and passing
the model).

-- 
Matthew Weier O'Phinney
Software Architect   | matt...@zend.com
Zend Framework   | http://framework.zend.com/


Re: [fw-general] Continue Processing after an action is completed

2009-02-08 Thread Ashley McConnell



keith Pope-4 wrote:
> 
> The thing that springs to mind is using the postDispatch on either the
> Front Controller or the Action Controller
> 
> 

Hi Keith,

Thanks for the reply - I did try that actually, but it seems to run before
the connection to the client is closed.  I tried a sleep(5) in there and the
page took around 5 seconds to fully load, whereas without the postDispatch
it was almost instant.

All the best,
Ash

-- 
View this message in context: 
http://www.nabble.com/Continue-Processing-after-an-action-is-completed-tp21900147p21900748.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Continue Processing after an action is completed

2009-02-08 Thread keith Pope
The thing that springs to mind is using the postDispatch on either the
Front Controller or the Action Controller

2009/2/8 Ashley McConnell :
>
> Hi Folks,
>
> I would like to be able to call an action / respond to the client and then
> continue on with some further processing.
>
> I have tried a couple of things: -
>
> Using fork: -
> http://www.php.net/manual/en/function.pcntl-fork.php
>
> This doesn't work on my windows installation and i'm not sure it will be
> enabled on my hosting.
>
> Using a headers hack method:-
>
> http://www.brandonchecketts.com/archives/performing-post-output-script-processing-in-php
>
> This seems to work the first time, but not the next time you call it.
>
> Register Shutdown function
> http://uk2.php.net/register_shutdown_function
>
> This doesn't work at all - it just blocks until the "other processing" is
> finished.
>
> Is there anything that works with the Zend Framework? Any other ideas?
>
> Thanks for your help
> All the best,
> Ash
>
> --
> View this message in context: 
> http://www.nabble.com/Continue-Processing-after-an-action-is-completed-tp21900147p21900147.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>



-- 
--
[MuTe]
--


[fw-general] Continue Processing after an action is completed

2009-02-08 Thread Ashley McConnell

Hi Folks,

I would like to be able to call an action / respond to the client and then
continue on with some further processing.

I have tried a couple of things: -

Using fork: -
http://www.php.net/manual/en/function.pcntl-fork.php

This doesn't work on my windows installation and i'm not sure it will be
enabled on my hosting.

Using a headers hack method:-

http://www.brandonchecketts.com/archives/performing-post-output-script-processing-in-php

This seems to work the first time, but not the next time you call it.

Register Shutdown function
http://uk2.php.net/register_shutdown_function

This doesn't work at all - it just blocks until the "other processing" is
finished.

Is there anything that works with the Zend Framework? Any other ideas?

Thanks for your help
All the best,
Ash

-- 
View this message in context: 
http://www.nabble.com/Continue-Processing-after-an-action-is-completed-tp21900147p21900147.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] "subviews"

2009-02-08 Thread Matthew Weier O'Phinney
-- Aspra Flavius Adrian  wrote
(on Sunday, 08 February 2009, 01:45 PM +0100):
> Hi. How could I trigger another /module/controller/action in order to
> catch its output which should then be displayed inside a dojo
> container?
> 
> Imagine the /default/index/index rendering the "homepage", which
> should contain several blocks like "the latest forum entries" (from
> /forum/index/latest) and "best wiki articles" (from /wiki/index/best).

If you're indeed using Dojo, consider using ContentPane's with the
"href" attribute pointing to actions that have the content you wish to
display. That approach will require more requests, but be very dynamic.

The other possibility is to use one of the following:

  * partial() view helper allows you to specify the module in which to
look for the view script.

  * action() view helper dispatches another action and returns the
content

  * ActionStack action helper/plugin will allow you to specify one or
more actions to perform during the request lifecycle. Have each
render to a distinct response segment, and build the final output in
your layout script.

In terms of performance, ActionStack will be faster than partial(), which
will in turn be faster than action(). However, partial() and action()
allow you to build the view within a single action view script, while
ActionStack will require a different strategy.

-- 
Matthew Weier O'Phinney
Software Architect   | matt...@zend.com
Zend Framework   | http://framework.zend.com/


[fw-general] INI routes reqs

2009-02-08 Thread Joó Ádám
Hi,

I have the following routes in my INI config file:

companies_index.type = "Zend_Controller_Router_Route_Static"
companies_index.route= "cegek"
companies_index.defaults.controller  = "companies"
companies_index.defaults.action  = "index"

companies_read.route = "cegek/:id"
companies_read.defaults.controller   = "companies"
companies_read.defaults.action   = "read"
companies_read.defaults.id   = ":id"
companies_read.reqs.id   = "\d+"

Just like in the docs. However, companies_read seems to capture
http://example.com/cegek too, even there is the reqs attribute set to
\d+ !
Any idea what's wrong?


Thanks,
Ádám


Re: [fw-general] Why $form->getValue() is not working?

2009-02-08 Thread PHPScriptor

:-) hahaha, you posted it at your first post, but I think we all looked over
it.

:handshake: gladd we could help.

Greetings

-
visit my website at  http://www.phpscriptor.com/ http://www.phpscriptor.com/ 
-- 
View this message in context: 
http://www.nabble.com/Why-%24form-%3EgetValue%28%29-is-not-working--tp21868209p21899359.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Why $form->getValue() is not working?

2009-02-08 Thread Deepak Shrestha
On Sun, Feb 8, 2009 at 9:22 PM, PHPScriptor  wrote:
>
> your viewscript:
>
> searchstr ?>
>
> does that work?
>
> try something like this:
>
> searchstr; ?>
>
> or
> searchstr; ?>
>
> -
> visit my website at  http://www.phpscriptor.com/ http://www.phpscriptor.com/
> --
> View this message in context: 
> http://www.nabble.com/Why-%24form-%3EgetValue%28%29-is-not-working--tp21868209p21898834.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>

Sorry, my blunder Thanks again for pointing out that. I have
looked at my view script for about hundred times but couldn't locate
this typo.

Thanks

-- 
===
Registered Linux User #460714
Currently Using Fedora 8, 10
===


Re: [fw-general] "subviews"

2009-02-08 Thread keith Pope
There are various ways to achieve this.

Using the action stack helper
Using forwarding
Using the action view helper

You should also look at the performance related issues here:

http://framework.zend.com/manual/en/performance.view.html#performance.view.action

2009/2/8 Aspra Flavius Adrian :
> Hi. How could I trigger another /module/controller/action in order to
> catch its output which should then be displayed inside a dojo
> container?
>
> Imagine the /default/index/index rendering the "homepage", which
> should contain several blocks like "the latest forum entries" (from
> /forum/index/latest) and "best wiki articles" (from /wiki/index/best).
>
> Thanks.
>
> --Flavius
>



-- 
--
[MuTe]
--


Re: [fw-general] Why $form->getValue() is not working?

2009-02-08 Thread PHPScriptor

your viewscript:

searchstr ?>

does that work?

try something like this:

searchstr; ?>

or
searchstr; ?>

-
visit my website at  http://www.phpscriptor.com/ http://www.phpscriptor.com/ 
-- 
View this message in context: 
http://www.nabble.com/Why-%24form-%3EgetValue%28%29-is-not-working--tp21868209p21898834.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] "subviews"

2009-02-08 Thread Aspra Flavius Adrian
Hi. How could I trigger another /module/controller/action in order to
catch its output which should then be displayed inside a dojo
container?

Imagine the /default/index/index rendering the "homepage", which
should contain several blocks like "the latest forum entries" (from
/forum/index/latest) and "best wiki articles" (from /wiki/index/best).

Thanks.

--Flavius


Re: [fw-general] Why $form->getValue() is not working?

2009-02-08 Thread Deepak Shrestha
On Sun, Feb 8, 2009 at 2:03 AM, A.J. Brown  wrote:
> Hi Deepak,
>
> Can you pastebin both the controller and the form (in seperate pastes)?
> Attaching would be fine too.  I'll help you debug it.
>
> --
> A.J. Brown
> web | http://ajbrown.org
> phone | (937) 660-3969
>

Hi,

here are the files as attachment

A big Thanks


-- 
===
Registered Linux User #460714
Currently Using Fedora 8, 10
===


View.phtml
Description: Binary data
<>
<>