Re: [fw-general] Strange error with XAMPP and Zend

2009-03-09 Thread Anees

The culprit was an outdated libmysql.dll supplied with XAMPP. Got updated one
from the newest distribution of PHP and copied it into xampp\apache\bin and
that solved the issue.

Thanks



Anees wrote:
> 
> When i tried to call the site it shows an error from Apache and page is
> not loading
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Strange-error-with-XAMPP-and-Zend-tp22407800p22407884.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend Form and navigating away - data lost

2009-03-09 Thread Lucas Corbeaux
If you really want to prevent all users errors inside your forms (as 
it's not always a good idea, but we don't always have the choice to 
decide), I see two ways to solve the problem :


- Avoid the external links on your forms if possible, or warning user 
that his data will be lost (not really simple and elegant).
- "Manually" save user's data on blur event or periodically, using Ajax 
on client side and the isValidPartial() method (or processAjax() if you 
want to retrieve the error messages) on server. Store user data into 
session, and use it to populate the Zend_Form before (re)displaying.


Hope this helps...
Lucas

gibler a écrit :

Is there a way of keeping unsaved data i.e not yet submitted for a zend form?

I've discovered that users are navigating (by following links on the webpage
that has the form) away and when they use the back button to get back to the
form, they get a nice empty form showing.

My controller logic is based on 
http://akrabat.com/2008/02/21/simple-zend_form-example/

http://akrabat.com/2008/02/21/simple-zend_form-example/ .
  




[fw-general] Zend_Date: Unable to parse the date format string

2009-03-09 Thread Joó Ádám
Hi list,

I get the exception “Unable to parse the date format string 'ISO_8601'
at letter 'O'” when executing the following:

$date = new Zend_Date('2009-03-09 09:20', 'ISO_8601');

This was working properly a few days ago, what could be the problem?


Thanks,
Ádám


Re: [fw-general] Zend_Date: Unable to parse the date format string

2009-03-09 Thread Ben Scholzen 'DASPRiD'
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

$date = new Zend_Date('2009-03-09 09:20', Zend_Date::ISO_8601);
...
:  ___   _   ___ ___ ___ _ ___:
: |   \ /_\ / __| _ \ _ (_)   \   :
: | |) / _ \\__ \  _/   / | |) |  :
: |___/_/:\_\___/_| |_|_\_|___/   :
:::
: Web: http://www.dasprids.de :
: E-mail : m...@dasprids.de   :
: Jabber : jab...@dasprids.de :
: ICQ: 105677955  :
:::


Joó Ádám schrieb:
> Hi list,
> 
> I get the exception “Unable to parse the date format string 'ISO_8601'
> at letter 'O'” when executing the following:
> 
> $date = new Zend_Date('2009-03-09 09:20', 'ISO_8601');
> 
> This was working properly a few days ago, what could be the problem?
> 
> 
> Thanks,
> Ádám
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkm016sACgkQ0HfT5Ws789CU/QCfZrMt0e7rdV51UX30b17ApRHJ
5VkAoMttpFf4Ux1+HFc9OVDbmFJmWWU2
=EDJg
-END PGP SIGNATURE-


Re: [fw-general] Zend_Date: Unable to parse the date format string

2009-03-09 Thread Joó Ádám
> $date = new Zend_Date('2009-03-09 09:20', Zend_Date::ISO_8601);

Ah, so it’s value had changed to 'c'…
Thanks, DASPRiD!

Ádám


Re: [fw-general] Facebook Integration

2009-03-09 Thread Marko Korhonen

Hi,

I have one dev application running like this:

class IndexController extends Zend_Controller_Action
{
protected $fb = null;
protected $fb_apikey = "apikey";
protected $fb_secret = "secret";
protected $fb_callbackurl = "http://www.myfacebookapp_domain.com/";;
protected $fb_appurl = "http://apps.facebook.com/my_app_in_facebook/";;

protected $app_path = "/home/_applications/my_app/";
protected $user = 0;

public function init()
{
$this->_initFacebook();
}

public function indexAction()
{
// start doing your own stuff
}

protected function _initFacebook()
{
require_once "/home/_library/facebook-platform/client/facebook.php";

$this->fb = new Facebook($this->fb_apikey, $this->fb_secret);

$this->user = $this->fb->require_login();

//catch the exception that gets thrown if the cookie has an invalid
session_key in it
try
{
if (!$this->fb->api_client->users_isAppAdded())
{
$this->fb->redirect($this->fb->get_add_url());
}
}
catch (Exception $ex)
{
//this will clear cookies for your application and 
redirect them to a
login prompt
$this->fb->set_user(null, null);

$this->fb->redirect($this->fb_callbackurl);
}
}
}

br, Marko

-- 
View this message in context: 
http://www.nabble.com/Facebook-Integration-tp22407798p22409735.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Date: Unable to parse the date format string

2009-03-09 Thread Ben Scholzen 'DASPRiD'
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Well, just don't use internal values but the public constants.
...
:  ___   _   ___ ___ ___ _ ___:
: |   \ /_\ / __| _ \ _ (_)   \   :
: | |) / _ \\__ \  _/   / | |) |  :
: |___/_/:\_\___/_| |_|_\_|___/   :
:::
: Web: http://www.dasprids.de :
: E-mail : m...@dasprids.de   :
: Jabber : jab...@dasprids.de :
: ICQ: 105677955  :
:::


Joó Ádám schrieb:
>> $date = new Zend_Date('2009-03-09 09:20', Zend_Date::ISO_8601);
> 
> Ah, so it’s value had changed to 'c'…
> Thanks, DASPRiD!
> 
> Ádám
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkm07TUACgkQ0HfT5Ws789DnogCgyVyKkd0Xtq9KeOe5i54cDUrI
29sAoIyLHGJ9gUfD798FZhirIpvorMLD
=W2M9
-END PGP SIGNATURE-


[fw-general] Zend Db how to update rows like "price=price+formValue['price'] "

2009-03-09 Thread Mantasgl

Hi

I have a form in which I write a price and i want that prices of my products
could be increased by that form value.

A simple query would look like "UPDATE product SET price = price +
$formvalue['price']"

This works in phpmyadmin.

So how could I write such a query with zend db?
-- 
View this message in context: 
http://www.nabble.com/Zend-Db-how-to-update-rows-like-%22price%3Dprice%2BformValue-%27price%27--%22-tp22411774p22411774.html
Sent from the Zend Framework mailing list archive at Nabble.com.




Re: [fw-general] Zend Db how to update rows like "price=price+formValue['price'] "

2009-03-09 Thread vadim gavrilov
I think the same thing just using the db object

$db->query("UPDATE product SET price = price + {$value}");

OR using the $db->update method



On Mon, Mar 9, 2009 at 1:58 PM, Mantasgl  wrote:

>
> Hi
>
> I have a form in which I write a price and i want that prices of my
> products
> could be increased by that form value.
>
> A simple query would look like "UPDATE product SET price = price +
> $formvalue['price']"
>
> This works in phpmyadmin.
>
> So how could I write such a query with zend db?
> --
> View this message in context:
> http://www.nabble.com/Zend-Db-how-to-update-rows-like-%22price%3Dprice%2BformValue-%27price%27--%22-tp22411774p22411774.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>


-- 
Vincent Gabriel.
Lead Developer, Senior Support.
Zend Certified Engineer.


Re: [fw-general] Zend Db how to update rows like "price=price+formValue['price'] "

2009-03-09 Thread Sudheer Satyanarayana

Mantasgl wrote:

Hi

I have a form in which I write a price and i want that prices of my products
could be increased by that form value.

A simple query would look like "UPDATE product SET price = price +
$formvalue['price']"

This works in phpmyadmin.

So how could I write such a query with zend db?
  

$db->update('product', $columnValuesArray);

Or
$result = $db->query("UPDATE product SET price = price 
+$formvalue['price']");

Where $db is your Zend_Db adapter.



--

With warm regards,
Sudheer. S
Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, 
Personal: http://sudheer.net



Re: [fw-general] Zend Db how to update rows like "price=price+formValue['price'] "

2009-03-09 Thread Mantasgl

thx ;)
-- 
View this message in context: 
http://www.nabble.com/Zend-Db-how-to-update-rows-like-%22price%3Dprice%2BformValue-%27price%27--%22-tp22411774p22413426.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] pagination and other data

2009-03-09 Thread David Mintz
On Sun, Mar 8, 2009 at 3:37 AM, mapes911  wrote:

>
> hi all,
>
> i have pagination set up on a set of data and all works fine. but i am
> trying to add some ajax functionality to my page reloads and i've run
> across
> a problem.
>
> i have this code in my pagination.phtml
> pageCount): ?>
> 
> 
> previous)): ?>
>   "javascript:ajaxReLoadCommentWall('',' $this->previous;?>');">Previous  |
> 
>
> 
> pagesInRange as $page): ?>
>  current): ?>
> "javascript:ajaxReLoadCommentWall('',' $page;?>');">  |
>  
> |
>  
> 
>
> 
> next)): ?>
>   "javascript:ajaxReLoadCommentWall('',' $this->next;?>');">Next
> 
> 
> 
>
> my problem is that i have no idea how to assign the variable $this->id in
> the controller or the model or anywhere for that matter!
>
> my first thought was that there might be a way to attach some data to the
> paginator within the model where it is setup.
>
> this is the code i have there...
>
>$postsAndUsers = PWallPosts::fetchPostsAndUsers($id);
>
>$paginator = Zend_Paginator::factory($postsAndUsers);
>$paginator->setItemCountPerPage($count);
>$paginator->setCurrentPageNumber($page);
>$paginator->setPageRange($pageRange);
>
>Zend_Paginator::setDefaultScrollingStyle('Elastic');
>
>
> Zend_View_Helper_PaginationControl::setDefaultViewPartial('proposal/pagination.phtml');
>
> can i somehow attach the $id to paginator?
>
> i also tried assigning this id to the view when i setup my controller. but
> the view information is not available in the pagination.phtml because it's
> a
> partial right?
>
> anyway, i'm confused now and i'm sure there is a simple way to pass this id
> into my phtml script somehow.. but i don't see it.. perhaps its time for
> bed
> :)
>


Just a thought:  rethink your Javascript function so that it does not
require $this->id to be passed in at all.
Use php to "hard-code" the id into the javascript either as a global or as
local function variable.

var id = id?>;
function ajaxReLoadCommentWall(pageNum) {
/// do your thing
}


-- 
David Mintz
http://davidmintz.org/

The subtle source is clear and bright
The tributary streams flow through the darkness


Re: [fw-general] Best coding practice? Form takes too long to load now.

2009-03-09 Thread bytte

Thanks Christoph for your insightful reply. You're right. I'm using 4 nested
for each loops with a few select queries in each loop. I will try to make a
join query and then loop through the returned result array. As I understand
from your reply that should make the page load faster and put a lot less
load on the mysql server.



ChristophDorn wrote:
> 
> bytte wrote:
>> Hey that was interesting. I have the indexes defined and I see though
>> Firebug
>> that there's currently 381 queries being performed at 0.14949 seconds. I
>> guess that means they're not the culprit?
>>   
> 381 DB queries is a lot of queries for a single web page. Even if they
> only take 0.15 seconds combined, they will bring your DB server to it's
> knees as soon as you start putting some traffic through that page and
> other pages using the same DB.
> 
> You are likely running DB queries in a loop which is not good practice.
> You should be using the "IN" SQL clause or use joins. It is much faster
> to add some more loops to your PHP than to run DB queries. If this page
> is going to be run a lot I would even check if you need to fetch the
> data from the DB on every page request or if you can cache some
> semi-static data.
> 
> 
> -- 
> Christoph Dorn
>    http://www.ChristophDorn.com/
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Best-coding-practice--Form-takes-too-long-to-load-now.-tp22309252p22413665.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend_Form : values ignored with setAttrib('disabled', 'disabled')

2009-03-09 Thread Thomas VEQUAUD
Hi everyone,

I'd like to use the same form in differents modes : "write" (evaluator) and
then "readonly" (assessed)... So, for the second mode, I wanted to use
setAttrib to disable inputs form but, by this way, input values are ignored.
I tried to use setIgnore(false) but same thing : values ignored.
I think that setAttrib should just modify the HTML display, not the
behaviour of a form element.

-- 
Thomas VEQUAUD  http://thomas.vequaud.free.fr/
Expert EPITECH en Ingénierie Informatique
Tél : +33(0)6.50.39.28.10  Fax: +33(0)9.58.46.10.07


Re: [fw-general] Best coding practice? Form takes too long to load now.

2009-03-09 Thread Christoph Dorn




I cannot speak to whether the page will load faster as the queries are
executing fast on a non-loaded DB server but it should save you a lot
of trouble down the road.

Christoph


bytte wrote:

  Thanks Christoph for your insightful reply. You're right. I'm using 4 nested
for each loops with a few select queries in each loop. I will try to make a
join query and then loop through the returned result array. As I understand
from your reply that should make the page load faster and put a lot less
load on the mysql server.



ChristophDorn wrote:
  
  
bytte wrote:


  Hey that was interesting. I have the indexes defined and I see though
Firebug
that there's currently 381 queries being performed at 0.14949 seconds. I
guess that means they're not the culprit?
  
  

381 DB queries is a lot of queries for a single web page. Even if they
only take 0.15 seconds combined, they will bring your DB server to it's
knees as soon as you start putting some traffic through that page and
other pages using the same DB.

You are likely running DB queries in a loop which is not good practice.
You should be using the "IN" SQL clause or use joins. It is much faster
to add some more loops to your PHP than to run DB queries. If this page
is going to be run a lot I would even check if you need to fetch the
data from the DB on every page request or if you can cache some
semi-static data.


-- 
Christoph Dorn
 	http://www.ChristophDorn.com/




  
  
  



-- 

  

  Christoph
Dorn


  
  http://www.ChristophDorn.com/

  






Re: [fw-general] A simple plugin manager class to handle all plugins by request or more

2009-03-09 Thread David Toniolo

Hello again,

i wrote a tutorial (only in German at the moment) how to use the plugin
manager with setters instead of constructor arguments.

http://php.bolzz.com/bolzz/source/Quickstart_PluggerPlugin.phps Tutorial:
Usage with setters or constructor arguments. (German) 


Short description about plugin manager:

This plugin manager has to be initialized in your bootstrap. After that, the
plugger registers a plugin only, if the current request is linked to the
plugin. This increases performance of an application, because plugins are
loaded only if they are needed.

greets
David
-- 
View this message in context: 
http://www.nabble.com/A-simple-plugin-manager-class-to-handle-all-plugins-by-request-or-more-tp15001950p22417527.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] A simple plugin manager class to handle all plugins by request or more

2009-03-09 Thread David Toniolo

Hello again,

i wrote a tutorial (only in German, sorry) how to use this plugin manager
with setters or with constructor arguments.

http://php.bolzz.com/bolzz/source/Quickstart_PluggerPlugin.phps Tutorial 

Description:

This plugin manager has to be initialized in your bootstrap. After that, the
plugger registers plugins only if current request is linked to a plugin.
This increases performance.

Note:
Because plugger works in constructor and from bootstrap, it is needed to set
a baseUrl manually by front controller in the bootstrap. The plugger's job
is done before dispatcher sets baseUrl automatically.

-- 
View this message in context: 
http://www.nabble.com/A-simple-plugin-manager-class-to-handle-all-plugins-by-request-or-more-tp15001950p22417836.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Form : values ignored with setAttrib('disabled', 'disabled')

2009-03-09 Thread mark_79_smith

I think that is standard behaviour for forms in general. Disabled elements in
forms will not be sent with the rest of the elements.



Thomas VEQUAUD wrote:
> 
> Hi everyone,
> 
> I'd like to use the same form in differents modes : "write" (evaluator)
> and
> then "readonly" (assessed)... So, for the second mode, I wanted to use
> setAttrib to disable inputs form but, by this way, input values are
> ignored.
> I tried to use setIgnore(false) but same thing : values ignored.
> I think that setAttrib should just modify the HTML display, not the
> behaviour of a form element.
> 
> -- 
> Thomas VEQUAUD  http://thomas.vequaud.free.fr/
> Expert EPITECH en Ingénierie Informatique
> Tél : +33(0)6.50.39.28.10  Fax: +33(0)9.58.46.10.07
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Zend_Form-%3A-values-ignored-with-setAttrib%28%27disabled%27%2C-%27disabled%27%29-tp22417413p22417984.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Making Zend_Cache Page not cache the index action

2009-03-09 Thread christophermanning

In mycontroller, I only don't want to cache the indexAction, all the other
actions should be cached.

Is there are better way to make that happen than the following?

$frontendCacheOptions = array(
  'regexps' => array('^/mycontroller(/|/index)?' => array('cache' => false))
);

The above works, but it's a bit unintuitive and clumsy. Perhaps a future
enhancement would be the option to provide a module/controller/action
combination; or if that would be to limiting, perhaps an example in the
documentation for the right regular expression to use in this situation
would help users. This is all considering you can hit the indexAction from:
mycontroller
mycontroller/
mycontroller/index

I suppose pulling the $cache from the registry and putting a
$cache->cancel(); in the indexAction would achieve the same thing.
-- 
View this message in context: 
http://www.nabble.com/Making-Zend_Cache-Page-not-cache-the-index-action-tp22418028p22418028.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] debug horror - a parse error, no error output to be found anywhere

2009-03-09 Thread David Mintz
I suppose this is not even ZF-specific, but...

I have been doing some Ajax stuff, intentionally outputting content-type
javascript/application followed by javascript code for the client to eval.
Working away, all is well until suddenly my javascript is being returned as
text/html. After a lot of diagnostic echo() I finally narrowed it down to
the fact that I had introduced a syntax error in a class that was being
instantiated along the way. (Too bad Zend Studio's usual red syntax
error-flagging is not working today.)  There was nothing in the browser
output stream (at last not by the time it got to me) and nothing in any
error log by way of error message about this condition. But MY content-type
header was apparently being overwritten by the default text/html, it seems,
once execution blew up.

The whole thing is really weird, and quite a cruel torture. (I know, I
should learn to properly use a proper debugger and I swear I will some day
before they put a toe-tag on me --- or cart me away to the psychiatric
hospital.)

Has this happened to you? If so, what do you do to safeguard against it
happening again?

-- 
David Mintz
http://davidmintz.org/

The subtle source is clear and bright
The tributary streams flow through the darkness


[fw-general] security/Zend Session

2009-03-09 Thread 411161

If I have some code that checks to see if a user is logged in and I want to
do this for every page where is the best place to do this?

I use modules and just want to do it for a particular module, does that
change things?
-- 
View this message in context: 
http://www.nabble.com/security-Zend-Session-tp22419047p22419047.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] debug horror - a parse error, no error output to be found anywhere

2009-03-09 Thread till
On Mon, Mar 9, 2009 at 8:53 PM, David Mintz  wrote:
> I suppose this is not even ZF-specific, but...
>
> I have been doing some Ajax stuff, intentionally outputting content-type
> javascript/application followed by javascript code for the client to eval.
> Working away, all is well until suddenly my javascript is being returned as
> text/html. After a lot of diagnostic echo() I finally narrowed it down to
> the fact that I had introduced a syntax error in a class that was being
> instantiated along the way. (Too bad Zend Studio's usual red syntax
> error-flagging is not working today.)  There was nothing in the browser
> output stream (at last not by the time it got to me) and nothing in any
> error log by way of error message about this condition. But MY content-type
> header was apparently being overwritten by the default text/html, it seems,
> once execution blew up.
>
> The whole thing is really weird, and quite a cruel torture. (I know, I
> should learn to properly use a proper debugger and I swear I will some day
> before they put a toe-tag on me --- or cart me away to the psychiatric
> hospital.)
>
> Has this happened to you? If so, what do you do to safeguard against it
> happening again?

Yes, of course.

I safe guard with the following measures:

a) error_log (php.ini) is setup and I have a terminal open with tail -f on it
b) I usually also have a listener on the log which adds a notice on our CI setup
c) I have a task to "php -l" all files in our CI setup -- evaluates a
file for "syntax errors"

Hope that helps,
Till


Re: [fw-general] Zend_Form : values ignored with setAttrib('disabled', 'disabled')

2009-03-09 Thread Matthew Weier O'Phinney
-- mark_79_smith  wrote
(on Monday, 09 March 2009, 12:46 PM -0700):
> 
> I think that is standard behaviour for forms in general. Disabled elements in
> forms will not be sent with the rest of the elements.

Yes, precisely. Disabled == not submitted; readonly == not mutable.

> Thomas VEQUAUD wrote:
> > I'd like to use the same form in differents modes : "write" (evaluator)
> > and
> > then "readonly" (assessed)... So, for the second mode, I wanted to use
> > setAttrib to disable inputs form but, by this way, input values are
> > ignored.
> > I tried to use setIgnore(false) but same thing : values ignored.
> > I think that setAttrib should just modify the HTML display, not the
> > behaviour of a form element.

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


[fw-general] No default module defined for this application when instantiating Zend_Db::factory

2009-03-09 Thread rumeau

I created a project with Zend Studio, wich creates the initial structure for
the Zend Framework Application, an Initialize class is created,  at this
point everything works fine, but when i try to open a DB conection i get the
following exception.

Fatal error: Uncaught exception 'Zend_Controller_Exception' with message 'No
default module defined for this application' in
/home/test/library/Zend/Controller/Dispatcher/Standard.php:380
Stack trace:
#0 /home/test/library/Zend/Controller/Dispatcher/Standard.php(203):
Zend_Controller_Dispatcher_Standard->getControllerClass(Object(Zend_Controller_Request_Http))
#1 /home/test/library/Zend/Controller/Dispatcher/Standard.php(237):
Zend_Controller_Dispatcher_Standard->isDispatchable(Object(Zend_Controller_Request_Http))
 
#2 /home/test/library/Zend/Controller/Front.php(934):
Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http),
Object(Zend_Controller_Response_Http)) 
#3 /home/test/application/bootstrap.php(28):
Zend_Controller_Front->dispatch() 
#4 /home/test/public_html/index.php(8): require('/home/test/a...') 
#5 {main} thrown in
/home/test/library/Zend/Controller/Dispatcher/Standard.php on line 380


the code that seems to trigger this error is this:

public function initDb()
{
$config = new Zend_Config_Xml($this->_root .
'/configuration/configuration.xml', 'database');

$this->_db = Zend_Db::factory($config->production);
Zend_Db_Table_Abstract::setDefaultAdapter($this->_db);

if($this->_env == 'test'){
$profiler = new Zend_Db_Profiler_Firebug('All DB Queries');
$profiler->setEnabled(true);

// Attach the profiler to your db adapter
$this->_db->setProfiler($profiler);
}
}


The exception dissapears when i comment the factory line:

$this->_db = Zend_Db::factory($config->production);


I dont know why this affects the front controller, i found a workaround
setting the default module in the bootstrap, but the default module should
be set by default in the front controller.

any help is appreciated.

info:
Zend Framework: 1.7.6

thanks

-- 
View this message in context: 
http://www.nabble.com/No-default-module-defined-for-this-application-when-instantiating-Zend_Db%3A%3Afactory-tp22426528p22426528.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] No default module defined for this application when instantiating Zend_Db::factory

2009-03-09 Thread Brenton Alker
Hi,

rumeau wrote:
> I created a project with Zend Studio, wich creates the initial structure
> for the Zend Framework Application, an Initialize class is created, at
> this point everything works fine, but when i try to open a DB conection
> i get the following exception.
> 
> Fatal error: Uncaught exception 'Zend_Controller_Exception' with message 'No 
> default module defined for this application' in 
> /home/test/library/Zend/Controller/Dispatcher/Standard.php:380
> Stack trace:
> #0 /home/test/library/Zend/Controller/Dispatcher/Standard.php(203): 
> Zend_Controller_Dispatcher_Standard->getControllerClass(Object(Zend_Controller_Request_Http))
>  #1 /home/test/library/Zend/Controller/Dispatcher/Standard.php(237): 
> Zend_Controller_Dispatcher_Standard->isDispatchable(Object(Zend_Controller_Request_Http))
>  
> #2 /home/test/library/Zend/Controller/Front.php(934): 
> Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http),
>  Object(Zend_Controller_Response_Http)) 
> #3 /home/test/application/bootstrap.php(28): 
> Zend_Controller_Front->dispatch() 
> #4 /home/test/public_html/index.php(8): require('/home/test/a...') 
> #5 {main} thrown in 
> /home/test/library/Zend/Controller/Dispatcher/Standard.php on line 380
...

Sounds to me like that line is throwing an exception or some sort and
the framework is trying to handle it with the error controller, which it
can't find.

Try adding:

Zend_Controller_Front::getInstance()->throwExceptions(true);

to your bootstrap to see if you can get more information about the
initial exception (of course you will not want this setting on in
production)

-- 

Brenton Alker

http://blog.tekerson.com/



signature.asc
Description: OpenPGP digital signature


Re: [fw-general] No default module defined for this application when instantiating Zend_Db::factory

2009-03-09 Thread rumeau

Thanks so much, that solved the problem, i was using an enviroment wich
disabled the throwExceptions property.

Thanks again.


rumeau wrote:
> 
> I created a project with Zend Studio, wich creates the initial structure
> for the Zend Framework Application, an Initialize class is created,  at
> this point everything works fine, but when i try to open a DB conection i
> get the following exception.
> 
> Fatal error: Uncaught exception 'Zend_Controller_Exception' with
> message 'No default module defined for this application' in
> /home/test/library/Zend/Controller/Dispatcher/Standard.php:380
> Stack trace:
> #0 /home/test/library/Zend/Controller/Dispatcher/Standard.php(203):
> Zend_Controller_Dispatcher_Standard->getControllerClass(Object(Zend_Controller_Request_Http))
> #1 /home/test/library/Zend/Controller/Dispatcher/Standard.php(237):
> Zend_Controller_Dispatcher_Standard->isDispatchable(Object(Zend_Controller_Request_Http))
>  
> #2 /home/test/library/Zend/Controller/Front.php(934):
> Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http),
> Object(Zend_Controller_Response_Http)) 
> #3 /home/test/application/bootstrap.php(28):
> Zend_Controller_Front->dispatch() 
> #4 /home/test/public_html/index.php(8): require('/home/test/a...') 
> #5 {main} thrown in
> /home/test/library/Zend/Controller/Dispatcher/Standard.php on line
> 380
> 
> the code that seems to trigger this error is this:
> 
> public function initDb()
> {
>   $config = new Zend_Config_Xml($this->_root .
> '/configuration/configuration.xml', 'database');
> 
>   $this->_db = Zend_Db::factory($config->production);
>   Zend_Db_Table_Abstract::setDefaultAdapter($this->_db);
>   
>   if($this->_env == 'test'){
>   $profiler = new Zend_Db_Profiler_Firebug('All DB Queries');
>   $profiler->setEnabled(true);
>   
>   // Attach the profiler to your db adapter
>   $this->_db->setProfiler($profiler);
>   }
> }
> 
> The exception dissapears when i comment the factory line:
> 
> $this->_db = Zend_Db::factory($config->production);
> 
> I dont know why this affects the front controller, i found a workaround
> setting the default module in the bootstrap, but the default module should
> be set by default in the front controller.
> 
> any help is appreciated.
> 
> info:
> Zend Framework: 1.7.6
> 
> thanks
> 
> 

-- 
View this message in context: 
http://www.nabble.com/No-default-module-defined-for-this-application-when-instantiating-Zend_Db%3A%3Afactory-tp22426528p22426725.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] debug horror - a parse error, no error output to be found anywhere

2009-03-09 Thread Eric Coleman

http://pecl.php.net/package/scream

Not sure if ZF is still using the silence operator thingie anymore,  
but scream stops it, very helpful.


- Eric

On Mar 9, 2009, at 5:09 PM, till wrote:

On Mon, Mar 9, 2009 at 8:53 PM, David Mintz   
wrote:

I suppose this is not even ZF-specific, but...

I have been doing some Ajax stuff, intentionally outputting content- 
type
javascript/application followed by javascript code for the client  
to eval.
Working away, all is well until suddenly my javascript is being  
returned as
text/html. After a lot of diagnostic echo() I finally narrowed it  
down to
the fact that I had introduced a syntax error in a class that was  
being

instantiated along the way. (Too bad Zend Studio's usual red syntax
error-flagging is not working today.)  There was nothing in the  
browser
output stream (at last not by the time it got to me) and nothing in  
any
error log by way of error message about this condition. But MY  
content-type
header was apparently being overwritten by the default text/html,  
it seems,

once execution blew up.

The whole thing is really weird, and quite a cruel torture. (I  
know, I
should learn to properly use a proper debugger and I swear I will  
some day
before they put a toe-tag on me --- or cart me away to the  
psychiatric

hospital.)

Has this happened to you? If so, what do you do to safeguard  
against it

happening again?


Yes, of course.

I safe guard with the following measures:

a) error_log (php.ini) is setup and I have a terminal open with tail  
-f on it
b) I usually also have a listener on the log which adds a notice on  
our CI setup

c) I have a task to "php -l" all files in our CI setup -- evaluates a
file for "syntax errors"

Hope that helps,
Till




Re: [fw-general] debug horror - a parse error, no error output to be found anywhere

2009-03-09 Thread Matthew Weier O'Phinney
-- Eric Coleman  wrote
(on Monday, 09 March 2009, 11:29 PM -0400):
> http://pecl.php.net/package/scream
>
> Not sure if ZF is still using the silence operator thingie anymore, but 
> scream stops it, very helpful.

It is in Zend_Loader::isReadable()... but most likely by 1.8 at the
latest, it won't.


> On Mar 9, 2009, at 5:09 PM, till wrote:
>
>> On Mon, Mar 9, 2009 at 8:53 PM, David Mintz   
>> wrote:
>>> I suppose this is not even ZF-specific, but...
>>>
>>> I have been doing some Ajax stuff, intentionally outputting content- 
>>> type
>>> javascript/application followed by javascript code for the client to 
>>> eval.
>>> Working away, all is well until suddenly my javascript is being  
>>> returned as
>>> text/html. After a lot of diagnostic echo() I finally narrowed it  
>>> down to
>>> the fact that I had introduced a syntax error in a class that was  
>>> being
>>> instantiated along the way. (Too bad Zend Studio's usual red syntax
>>> error-flagging is not working today.)  There was nothing in the  
>>> browser
>>> output stream (at last not by the time it got to me) and nothing in  
>>> any
>>> error log by way of error message about this condition. But MY  
>>> content-type
>>> header was apparently being overwritten by the default text/html, it 
>>> seems,
>>> once execution blew up.
>>>
>>> The whole thing is really weird, and quite a cruel torture. (I know, 
>>> I
>>> should learn to properly use a proper debugger and I swear I will  
>>> some day
>>> before they put a toe-tag on me --- or cart me away to the  
>>> psychiatric
>>> hospital.)
>>>
>>> Has this happened to you? If so, what do you do to safeguard against 
>>> it
>>> happening again?
>>
>> Yes, of course.
>>
>> I safe guard with the following measures:
>>
>> a) error_log (php.ini) is setup and I have a terminal open with tail  
>> -f on it
>> b) I usually also have a listener on the log which adds a notice on  
>> our CI setup
>> c) I have a task to "php -l" all files in our CI setup -- evaluates a
>> file for "syntax errors"
>>
>> Hope that helps,
>> Till
>

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


Re: [fw-general] security/Zend Session

2009-03-09 Thread Sudheer Satyanarayana

411161 wrote:

If I have some code that checks to see if a user is logged in and I want to
do this for every page where is the best place to do this?

I use modules and just want to do it for a particular module, does that
change things?
  

Front controller plugin.


--

With warm regards,
Sudheer. S
Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, 
Personal: http://sudheer.net