Re: [fw-general] Quick Question

2009-02-22 Thread dele454

THANK YOU SO MUCH COLIN AND EVERYONE THAT HELPED OUT. I looked into the issue
it was exactly what Colin anticipated. My bootstrap was running two response
dispatches. Hence the problem. I must have inserted this while i was still
learning about the framework.

[code]
$response = self::$front->dispatch(); //
first call
self::sendResponse($response);
self::$front->dispatch(); // second call
[/code]

It makes sense now. Thanks a mil Colin!!



Colin Guthrie-6 wrote:
> 
> 'Twas brillig, and dele454 at 20/02/09 07:34 did gyre and gimble:
>> Hi,
>> 
>> I have this issue that's been lingering in my codes. Whenever i use the
>> Zend_Mail or Zend_Captcha or any component that generates some kind of
>> resource, i always get such resource twice. In context, if  i use the
>> Zend_Mail to send out mails - will recieve the same copy of that mail
>> twice.
>> 
>> Likewise for captcha, the image will be generate twice and saved in my
>> captcha image location - though with two different texts on them.
>> 
>> I have tried all sorts to recitfy this but to no avail. Any reason why
>> this
>> is so?
> 
> I'm guessing that your dispatch loop is running twice for some reason... 
> either that or you are handling it in the pre/postDispatch methods of a 
> controller that you actually initialise twice (e.g. by running an action 
> of that controller via an actionStack()).
> 
> I'd imagine something like that is happening. You can easily test this 
> by copying the Dispatcher class and sprinkling it with log calls.
> 
> Col
> 
> -- 
> 
> Colin Guthrie
> gmane(at)colin.guthr.ie
> http://colin.guthr.ie/
> 
> Day Job:
>Tribalogic Limited [http://www.tribalogic.net/]
> Open Source:
>Mandriva Linux Contributor [http://www.mandriva.com/]
>PulseAudio Hacker [http://www.pulseaudio.org/]
>Trac Hacker [http://trac.edgewall.org/]
> 
> 
> 


-
dee
-- 
View this message in context: 
http://www.nabble.com/Quick-Question-tp22116080p22147624.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Quick Question

2009-02-20 Thread Brenton Alker
dele454 wrote:
> Hi,
> 
> I have this issue that's been lingering in my codes. Whenever i use the
> Zend_Mail or Zend_Captcha or any component that generates some kind of
> resource, i always get such resource twice. In context, if  i use the
> Zend_Mail to send out mails - will recieve the same copy of that mail twice.
> 
> Likewise for captcha, the image will be generate twice and saved in my
> captcha image location - though with two different texts on them.
> 
> I have tried all sorts to recitfy this but to no avail. Any reason why this
> is so?
> 
> -
> dee

Make sure you don't have something like an image tag with an empty src
attribute in your html.

I had an issue with pages being double rendered/hit twice for every
request. Turned out to be this, because the browser was actually
requesting the same url twice (once for the page, once for the image).

-- 

Brenton Alker

http://blog.tekerson.com/



signature.asc
Description: OpenPGP digital signature


Re: [fw-general] Quick Question

2009-02-20 Thread dele454

Thanks Colin. But in my case i dont have a button linking directly to the
component.

The typical scenerio is, you submit the form, my controller processes it,
and at the end sends all the values via email. For captcha, it render with
the page loading. So there isnt any direct user action to the components so
to speak.



Colin Guthrie-6 wrote:
> 
> 'Twas brillig, and dele454 at 20/02/09 10:22 did gyre and gimble:
>> Thanks Colin,
>> 
>> I am going to be looking into this over the weekend. And let you know the
>> outcome on your suggestions.
>> 
>> Thanks a mil. Will keep you posted.
> 
> No worries.
> 
> Other things that can cause this (but not specifically ZF based):
> 
>   1. Users double clicking submit buttons! Always use javascript to 
> disable the button after the first click. It doesn't stop it 100% but it 
> helps.
>   2. Using ajax to submit the form but not disabling the default form 
> handler when doing so and thus having it submit "organically" also.
> 
> So watch out for those too :)
> 
> Col
> 
> -- 
> 
> Colin Guthrie
> gmane(at)colin.guthr.ie
> http://colin.guthr.ie/
> 
> Day Job:
>Tribalogic Limited [http://www.tribalogic.net/]
> Open Source:
>Mandriva Linux Contributor [http://www.mandriva.com/]
>PulseAudio Hacker [http://www.pulseaudio.org/]
>Trac Hacker [http://trac.edgewall.org/]
> 
> 
> 


-
dee
-- 
View this message in context: 
http://www.nabble.com/Quick-Question-tp22116080p22118336.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Quick Question

2009-02-20 Thread dele454

Thanks Colin,

I am going to be looking into this over the weekend. And let you know the
outcome on your suggestions.

Thanks a mil. Will keep you posted.



Colin Guthrie-6 wrote:
> 
> 'Twas brillig, and dele454 at 20/02/09 07:34 did gyre and gimble:
>> Hi,
>> 
>> I have this issue that's been lingering in my codes. Whenever i use the
>> Zend_Mail or Zend_Captcha or any component that generates some kind of
>> resource, i always get such resource twice. In context, if  i use the
>> Zend_Mail to send out mails - will recieve the same copy of that mail
>> twice.
>> 
>> Likewise for captcha, the image will be generate twice and saved in my
>> captcha image location - though with two different texts on them.
>> 
>> I have tried all sorts to recitfy this but to no avail. Any reason why
>> this
>> is so?
> 
> I'm guessing that your dispatch loop is running twice for some reason... 
> either that or you are handling it in the pre/postDispatch methods of a 
> controller that you actually initialise twice (e.g. by running an action 
> of that controller via an actionStack()).
> 
> I'd imagine something like that is happening. You can easily test this 
> by copying the Dispatcher class and sprinkling it with log calls.
> 
> Col
> 
> -- 
> 
> Colin Guthrie
> gmane(at)colin.guthr.ie
> http://colin.guthr.ie/
> 
> Day Job:
>Tribalogic Limited [http://www.tribalogic.net/]
> Open Source:
>Mandriva Linux Contributor [http://www.mandriva.com/]
>PulseAudio Hacker [http://www.pulseaudio.org/]
>Trac Hacker [http://trac.edgewall.org/]
> 
> 
> 


-
dee
-- 
View this message in context: 
http://www.nabble.com/Quick-Question-tp22116080p22118173.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Quick Question one SubForms and INI files

2008-09-30 Thread fozzyuw


Matthew Weier O'Phinney-3 wrote:
> 
> Not currently, though it's something I'd like to change in an upcoming
> version. If you want to see it sooner, extend Zend_Form and create a new
> method for adding sub forms that does not require a Zend_Form object.
> 

Ah.  Great, thanks for confirming that for me.  In the mean time, I just
condensed that code into an iterator loop for simplicity.

-
$config = new Zend_Config_Ini('projectForms.ini', 'project form');
$subforms = array();
while($current = $config->project->form->current()) {
$subforms[$config->project->form->key()] = 
new Zend_Form_SubForm($config->project->form->current());
$config->project->form->next();
}
$this->addSubForms($subforms);
-
-- 
View this message in context: 
http://www.nabble.com/Quick-Question-one-SubForms-and-INI-files-tp19749538p19750962.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Quick Question one SubForms and INI files

2008-09-30 Thread Matthew Weier O'Phinney
-- fozzyuw <[EMAIL PROTECTED]> wrote
(on Tuesday, 30 September 2008, 01:14 PM -0700):
> I've got an INI file for configuring a series of Zend SubForms and I'm
> trying to see if there's a way I can condense the following code...
> -
> $config = new Zend_Config_Ini('projectForms.ini', 'project form');
> 
> $subforms = array();
> 
> $subforms['title'] = new Zend_Form_SubForm($config->project->form->title);
> $subforms['dates'] = new Zend_Form_SubForm($config->project->form->dates);
> $subforms['resources'] = new
> Zend_Form_SubForm($config->project->form->resources);
> [...]
> 
> // Attach sub-forms to main form
> $this->addSubForms($subforms);
> -
> 
> I have 11 subForms right now.  I'm wondering if there's a way I can just
> feed the entire subForm INI object to the Form constructor and it'll create
> all the subforms automatically.  

Not currently, though it's something I'd like to change in an upcoming
version. If you want to see it sooner, extend Zend_Form and create a new
method for adding sub forms that does not require a Zend_Form object.

> I can't seem to find any details on this
> and it seems "addSubForms()" only takes Form objects (or an array of Form
> objects).
> 
> I'd like to see if something like this is possible...
> 
> --
> $config = new Zend_Config_Ini('projectForms.ini', 'project form');
> $this->addSubForms($config->project->form);
> --

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


RE: [fw-general] quick question...

2007-05-01 Thread Bill Karwin
As Philip also says, this is done sometimes by SQL generators to make it
easier on the person who developed the code for the SQL generator. It
makes it easier because then they don't have to write code for the case
of adding the first term to a WHERE clause.  That is, if the SQL
statement is assumed to contain the syntax "WHERE 1 = 1" by default,
then any real conditions you specify can simply be appended to the WHERE
clause with an AND operation.
 
It shouldn't be a problem to have the extra 1=1 term, even though it
seems inelegant and messy.  SQL optimizers should be smart enough to
factor out any operand of an AND expression that evaluates to TRUE for
every row.  "WHERE TRUE AND " is equivalent to "WHERE ".
 
Similarly, a SQL optimizer should be able to factor out any operand of
an OR expression that evaluates to FALSE for every row.  "WHERE FALSE OR
" is equivalent to "WHERE ".
 
FWIW, Zend_Db_Select does not need to add the artificial 1=1 term!  :-)
If you specify no conditions in the WHERE clause, Zend_Db_Select simply
omits that clause.
 
Regards,
Bill Karwin
 
 




From: Adam Balgach [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 01, 2007 1:59 PM
To: Zend Mailing List
Subject: [fw-general] quick question...


has the group ever heard of using 1=1 in the where clause of a
SQL statement?  Some other auto generating sql apps put this in, and I
had just never seen it before.  I don't think its a. good coding or b.
good convention.  But I wanted to check before I made a feature request.


Thanks,
A.




Re: [fw-general] quick question...

2007-05-01 Thread Philip G

On 5/1/07, Adam Balgach <[EMAIL PROTECTED]> wrote:


has the group ever heard of using 1=1 in the where clause of a SQL
statement?  Some other auto generating sql apps put this in, and I had just
never seen it before.  I don't think its a. good coding or b. good
convention.  But I wanted to check before I made a feature request.

Thanks,
A.



Many people do that for situations where they are unsure if there will be a
where clause or not. So, to make things simpler, they just use 1=1 and tack
on "AND ..." to the end.

As far as I know, there isn't any harm in it. It makes coding SQL statements
easier if there is a change there will be no conditional checks ( a grab all
).

--
Philip
[EMAIL PROTECTED]
http://www.gpcentre.net/