[fw-general] time out problem

2006-12-22 Thread Michael Depetrillo

Hello

I am trying to run a very simple ZF application with the latest code base
and keep getting this error:

*Fatal error*: Maximum execution time of 30 seconds exceeded in *
/home/mike/workspace/domain.com/Zend-6.0
/library/Zend/Controller/Dispatcher.php* on line *568

*The problem first occurs in the Zend_Controller_Front::dispatch() method.

//The $className variable is set to "IndexController"
$moduleClass = $this->_getModuleClass($request, $className);
//This function returns $moduleClass as "_IndexController"
   if ($className != $moduleClass) {
   $classLoaded = $this->loadClass($moduleClass,
$this->getDispatchDirectory());

In the Zend_Controller_Dispatcher::loadClass() method the following section
of code is making the script time out.

// The $class variable is set too "_IndexController" going into the while
loop.  This results in an endless loop.
while (strstr($class, '_')) {
   if (class_exists($class)) {
   return $class;
   }
}

Does anyone know what I can do about this? Here is a copy of my
application.  I am using the incubator.

// index.php
$router = new Zend_Controller_RewriteRouter();

$controllerpath = array (
   'default' => dirname(__FILE__) . "/controllers",
);

$controller = Zend_Controller_Front::getInstance();
$controller->setControllerDirectory($controllerpath);
$controller->setParam('useModules', true);
$controller->setRequest(new Zend_Controller_Request_Http());
$controller->setRouter($router);
$controller->dispatch();

// ./controllers/IndexController.php
class IndexController extends Zend_Controller_Action {
   public function indexAction() {
   $this->view = new Zend_View();

$this->view->addScriptPath("/home/mike/workspace/domain.com/public_html/views");
   echo $this->view->render("home.php");
   }
}

--
Michael DePetrillo
[EMAIL PROTECTED]
Mobile: (858) 761-1605
AIM: klassicd


Re: [fw-general] Zend_Search_Lucene UTF-8 encoding

2006-12-22 Thread Sebi
>'&' is used as a part of query syntax.
>But Analyzer is used after query recognition to process lexemes or 
>phrases. So htmlentities() may be used.

I will try to replace with some alpha digit pattern;

>From the other side, it doesn't help with a problem, which we have for 
 > full UTF-8 support.
>Index manipulation engine can work with UTF-8 characters, but we can't 
>recognize, if it's alpha, digit or any other type of characters. Thus 
>input text can't be tokenized correctly.
>It doesn't depend on a format (UTF-8, HTML encoded, URL encoded or so on).

>Current solution is based on iconv translation intelligence. It, in 
>principle, should translate white spaces to ascii white space and 
>letters to ascii letters.

In my case iconv failed to convert UTF letters to ascii letters. I think I will 
create a list with all non-ascii latin characters,
together with some non-ascii patterns. This is the most elegant way to 
implement this. After this I will call iconv() for the 
replaced text. In this way I will help iconv intelligence. :)  

>I don't expect, that we will have UTF-8 compatible ctype_alpha(), 
>ctype_digit() functions.
>Thus the only way I see now is to treat all non-ascii characters as 
>letters and use ctype_...() for ascii characters.

>I saw a lot of UTF-8 support requests, so I think to implement this soon.
>But it's a question for me, if this behavior should be default or not.
 >From one point of view it's a solution. From other, it should be used 
>with care (non-letters may be treated as a part of words).


 > > I want to index text in UTF-8 format. I use latin characters.  
>>  Here are some examples of characters (encoded in ISO-8859-1): ó, é, á, etc.
>>  
> > I used iconv function  iconv('ISO-8859-1', 'ASCII//TRANSLIT', 'Animación') 
> > and i got Animaci'on which also contains some break 
> > characters for the tokenizer. Also, for characters like é, á I got 'a, 'e.
> > 
> > The solution is to replace `'` character with some alpha-digit pattern. But 
> > what If I get other break 
> > characters for other latin characters? Or maybe I will use other UTF-8 
> > characters from german language 
> > which also produce some distinct break characters (not alpha-digit 
> > characters).
> > 
> > I saw that some people used htmlentities which produce only 2 break 
> > characters ('&' and ';'). In this case I 
> > can find 2 alphadigit patterns to match them more easily. And htmlentities 
> > encode all utf-8 characters. Is this
> > the best solution? Maybe there are some Analyzers which I can use and which 
> > not break on '&' and ';' characters. 
>>  
> > Maybe someone has a better solution or some opinions on this problem. 
> > 
> > Thank you.





__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com


Re: [fw-general] Merging two Zend_Configs

2006-12-22 Thread Nico Edtinger

You could use array_merge():

 1, 'y' => 2, 'z' => 3));
$user_config = new Zend_Config(array('y' => 4, 'a' => 5));

$config = new Zend_Config(array_merge($master_config->asArray(),  
$user_config->asArray()));

var_dump($config->asArray());

/* output:
array(4) {
  ["x"]=>
  int(1)
  ["y"]=>
  int(4)
  ["z"]=>
  int(3)
  ["a"]=>
  int(5)
}
*/

?>

nico


[22.12.2006 13:03] Steve wrote:

Hi,

I've been trying to figure out the best way to merge two  
Zend_Config objects together.


What I want to be able to do is have one master INI file in my  
application directory and then one INI file per application  
instance, which will allow me to override settings in the master  
INI file. I took a look around the documentation and the code for  
Zend_Config but wasn't able to find an existing way to do this.


What I think I'll have to do is write a recursive iterator or a  
combination of asArray() and a custom array_merge function but I  
wanted to check here if I'm missing something and if there is an  
easier way to accomplish this?


Thanks,

Steve





Re: [fw-general] Two Problems after upgrading to 0.6.0

2006-12-22 Thread kcrane377

I had the same issue with the request object not being passed to the action
on first migration. Changing the constructor to init() fixed the issue.

class IndexController extends Zend_Controller_Action
{
public function __construct()
{...}

public function viewAction()
{
$id = $this->_getParam('id');
}

...

change to: 

class IndexController extends Zend_Controller_Action
{
public function init()
{...}

public function viewAction()
{
$id = $this->_getParam('id');
}
...

As far as the noRouteAction. It should not be called since its been removed. 
__call will handle this now.  Please supply your routing method (default,
rewriterouter) info to help diagnose your routing issue.



Lindemann Medien wrote:
> 
> Hello,
> 
>  
> 
> I have to problems after upgrading to 0.6.0:
> 
>  
> 
> -Fatal error: Call to a member function getParam() on a non-object
> in /var/www/entwicklung/trunk/library/Zend/Controller/Action.php on line
> 302
> 
>  
> 
> Source Code:
> 
>  $zielgruppe_id = $this->_getParam('id');
> 
>  
> 
>  
> 
> -The Main Page (like http://localhost/) is always routing to
> /noroute.. Always.. I removed the /noroute action from my index controller
> but this won´t change anything.. I saw that the routing changed a lot, I
> think there is my main problem. 
> 
>  
> 
> I looked at
> http://framework.zend.com/manual/en/zend.controller.migration.html but i
> don´t see the “hint” to solve my two problems..
> 
>  
> 
>  
> 
> Thanks,
> 
> Marc 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Two-Problems-after-upgrading-to-0.6.0-tf2870778s16154.html#a8027300
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Search_Lucene UTF-8 encoding

2006-12-22 Thread Alexander Veremyev

'&' is used as a part of query syntax.
But Analyzer is used after query recognition to process lexemes or 
phrases. So htmlentities() may be used.



From the other side, it doesn't help with a problem, which we have for 
 full UTF-8 support.
Index manipulation engine can work with UTF-8 characters, but we can't 
recognize, if it's alpha, digit or any other type of characters. Thus 
input text can't be tokenized correctly.

It doesn't depend on a format (UTF-8, HTML encoded, URL encoded or so on).

Current solution is based on iconv translation intelligence. It, in 
principle, should translate white spaces to ascii white space and 
letters to ascii letters.


I don't expect, that we will have UTF-8 compatible ctype_alpha(), 
ctype_digit() functions.
Thus the only way I see now is to treat all non-ascii characters as 
letters and use ctype_...() for ascii characters.


I saw a lot of UTF-8 support requests, so I think to implement this soon.
But it's a question for me, if this behavior should be default or not.
From one point of view it's a solution. From other, it should be used 
with care (non-letters may be treated as a part of words).



With best regards,
   Alexander Veremyev.

Sebi wrote:
I want to index text in UTF-8 format. I use latin characters.  
Here are some examples of characters (encoded in ISO-8859-1): ó, é, á, etc.


I used iconv function  iconv('ISO-8859-1', 'ASCII//TRANSLIT', 'Animación') and i got Animaci'on which also contains some break 
characters for the tokenizer. Also, for characters like é, á I got 'a, 'e.


The solution is to replace `'` character with some alpha-digit pattern. But what If I get other break 
characters for other latin characters? Or maybe I will use other UTF-8 characters from german language 
which also produce some distinct break characters (not alpha-digit characters).


I saw that some people used htmlentities which produce only 2 break characters ('&' and ';'). In this case I 
can find 2 alphadigit patterns to match them more easily. And htmlentities encode all utf-8 characters. Is this
the best solution? Maybe there are some Analyzers which I can use and which not break on '&' and ';' characters. 

Maybe someone has a better solution or some opinions on this problem. 


Thank you.




__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 







Re: [fw-general] Routing Question

2006-12-22 Thread Martel Valgoerad

Andrew Yager wrote:

Should there be any difference in processing 

$route = new Zend_Controller_Router_Route("/", 
array("controller"=>"index", "action"=>"index"), $formats);


and 

$route = new Zend_Controller_Router_StaticRoute("/", 
array("controller"=>"index", "action"=>"index"), $formats);


Of course not.

I have found that the latter matches, where the former does not, and am 
wondering if that's a bug or intended behaviour.


It's a bug and I have fixed it with revision 2469. Please update your sources 
and give it a try.



Andrew


--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"All animals are equal but some animals are more equal than others." --
George Orwell


Re: [fw-general] Merging two Zend_Configs

2006-12-22 Thread Matthew Ratzloff

There's no merge function.  This will work, however:

$config = new Zend_Config($subordinate->asArray() + $master->asArray());

This will allow master values to be redefined in the subordinate.  If you 
want to prevent that, swap the order.


It would be kind of neat if you could do something like this:

$config = $subordinate->mergeInto($master);

Internally, it would just do what I wrote above, except it wouldn't need to 
create a new object and it would honor $allowModifications (I suppose; I 
never saw the point of that parameter when it's so easily sidestepped). 
Zend_Config::isModifiable() would have to be added in that case.  Rob?


-Matt

- Original Message - 
From: "Steve" <[EMAIL PROTECTED]>

To: 
Sent: Friday, December 22, 2006 4:03 AM
Subject: [fw-general] Merging two Zend_Configs


Hi,

I've been trying to figure out the best way to merge two Zend_Config objects 
together.


What I want to be able to do is have one master INI file in my application 
directory and then one INI file per application instance, which will allow 
me to override settings in the master INI file. I took a look around the 
documentation and the code for Zend_Config but wasn't able to find an 
existing way to do this.


What I think I'll have to do is write a recursive iterator or a combination 
of asArray() and a custom array_merge function but I wanted to check here if 
I'm missing something and if there is an easier way to accomplish this?


Thanks,

Steve



Re: Fw: [fw-general] Zend_Search_Lucene questions

2006-12-22 Thread Alexander Veremyev

Sebi wrote:
OK Alexander. I understand this. How can I manage this situation? 
Because I will index all words from text fields (this is the default 
behavior of the tokenizer, isn't it?). So, there will be words like 
'and', 'a', 'an', 'than' and many others which will apear in many  
documents. I know that MYSQL fulltext index has a full list with these 
common words, and they exclude this words from the index.


Tell me how can I select common terms in an efficient way. Where should 
I add this? Is there a class which I can extend?

I wait your answer.


There are two additional analyzer filters (thanks to Lukas!).

StopWords filter and ShortWords filter.

Usage example:
---
$stopWords = array('a', 'an', 'at', 'the', 'and', 'or', 'is', 'am');
$stopWordsFilter = new 
Zend_Search_Lucene_Analysis_TokenFilter_StopWords($stopWords);


$analyzer = new 
Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum_CaseInsensitive();

$analyzer->addFilter($stopWordsFilter);

Zend_Search_Lucene_Analysis_Analyzer::setDefault($analyzer);
---
$stopWordsFilter = new Zend_Search_Lucene_Analysis_TokenFilter_StopWords();
$stopWordsFilter->loadFromFile($my_stopwords_file);

$analyzer = new 
Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum_CaseInsensitive();

$analyzer->addFilter($stopWordsFilter);

Zend_Search_Lucene_Analysis_Analyzer::setDefault($analyzer);
---
$shortWordsFilter = new 
Zend_Search_Lucene_Analysis_TokenFilter_ShortWords();


$analyzer = new 
Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum_CaseInsensitive();

$analyzer->addFilter($shortWordsFilter);

Zend_Search_Lucene_Analysis_Analyzer::setDefault($analyzer);
---

I've just updated the documentation (Zend_Search. Extensibility. 
section) and made some small fixes.

Please take SVN version to work with these filters.


With best regards,
   Alexander Veremyev.




Re: [fw-general] Two Problems after upgrading to 0.6.0

2006-12-22 Thread Lee Saferite

I know this has been covered before, but as a reminder to people upgrading
to the new MVC code:

If your old controller code used __construct() to setup you controller, you
either need to move that code into a function called init() or fix your
constructor code to allow for the passing of request/response/invokeArgs

The new Zend_Controller_Action class provides a stub function called init()
that you can override to do any controller level setup if needed.

Lee.

On 12/22/06, Lee Saferite <[EMAIL PROTECTED]> wrote:


Actually, a call to $this->_getParam('id') gets translated into
$this->getRequest()->getParam('id') in the Action class.  So, his code
'should' work.  It seems that the internal call to getRequest() is not
returning a valid object.

The source code provided is insufficient to diagnose the problem.  If you
send your setup code, We can give you a better idea of the problem.

The error message you are getting seems like the constructor for your
controller is not setting the Request object, do you have a custom
__construct() function on your controller?  If so you need to either move
that code into the init() function or make your __construct function accept
the correct parameters and call the parent constructor.

Lee.

On 12/22/06, Simon Mundy <[EMAIL PROTECTED]> wrote:
>
> Hi Lindemann
>
> The '_getParam' method was used previously to retrieve request variables
> from the dispatcher token. However, you've now got a request object that
> takes care of that instead.
>
> Try:-
>
> $request = $this->getRequest();
> $id = $request->id;
>
> ...from inside your action.
>
>  * Source Code:*
>
>  $zielgruppe_id = $this->_getParam('id');
>
>
>  --
>
> Simon Mundy | Director | PEPTOLAB
>
> """ " "" "" "" "" """ " "" " " " "  "" "" "
> 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
> Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654
> 4124
> http://www.peptolab.com
>
>
>



Re: [fw-general] Two Problems after upgrading to 0.6.0

2006-12-22 Thread Lee Saferite

Actually, a call to $this->_getParam('id') gets translated into
$this->getRequest()->getParam('id') in the Action class.  So, his code
'should' work.  It seems that the internal call to getRequest() is not
returning a valid object.

The source code provided is insufficient to diagnose the problem.  If you
send your setup code, We can give you a better idea of the problem.

The error message you are getting seems like the constructor for your
controller is not setting the Request object, do you have a custom
__construct() function on your controller?  If so you need to either move
that code into the init() function or make your __construct function accept
the correct parameters and call the parent constructor.

Lee.

On 12/22/06, Simon Mundy <[EMAIL PROTECTED]> wrote:


Hi Lindemann

The '_getParam' method was used previously to retrieve request variables
from the dispatcher token. However, you've now got a request object that
takes care of that instead.

Try:-

$request = $this->getRequest();
$id = $request->id;

...from inside your action.

*Source Code:*

 $zielgruppe_id = $this->_getParam('id');


--

Simon Mundy | Director | PEPTOLAB

""" " "" "" "" "" """ " "" " " " "  "" "" "
202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124
http://www.peptolab.com





Re: [fw-general] Two Problems after upgrading to 0.6.0

2006-12-22 Thread Simon Mundy

Hi Lindemann

The '_getParam' method was used previously to retrieve request  
variables from the dispatcher token. However, you've now got a  
request object that takes care of that instead.


Try:-

$request = $this->getRequest();
$id = $request->id;

...from inside your action.

Source Code:

 $zielgruppe_id = $this->_getParam('id');


--

Simon Mundy | Director | PEPTOLAB

""" " "" "" "" "" """ " "" " " " "  "" "" "
202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654  
4124

http://www.peptolab.com




[fw-general] Two Problems after upgrading to 0.6.0

2006-12-22 Thread Lindemann Medien
Hello,

 

I have to problems after upgrading to 0.6.0:

 

-Fatal error: Call to a member function getParam() on a non-object
in /var/www/entwicklung/trunk/library/Zend/Controller/Action.php on line 302

 

Source Code:

 $zielgruppe_id = $this->_getParam('id');

 

 

-The Main Page (like http://localhost/) is always routing to
/noroute.. Always.. I removed the /noroute action from my index controller
but this won´t change anything.. I saw that the routing changed a lot, I
think there is my main problem. 

 

I looked at
http://framework.zend.com/manual/en/zend.controller.migration.html but i
don´t see the “hint” to solve my two problems..

 

 

Thanks,

Marc 



Re: [fw-general] Problem after upgrading to 0.6.0

2006-12-22 Thread Lee Saferite

You would get that if you had no Zend_Controller_Request object.
What does your bootstrap code look like?

Lee.

On 12/22/06, Marc Lindemann <[EMAIL PROTECTED]> wrote:


 Hello,



I have to problems after upgrading to 0.6.0:



-*Fatal error*: Call to a member function getParam() on a
non-object in *
/var/www/entwicklung/trunk/library/Zend/Controller/Action.php* on line *
302*

* *

*Source Code:*

 $zielgruppe_id = $this->_getParam('id');





-The Main Page (like http://localhost/) is always routing to
/noroute.. Always.. I removed the /noroute action from my index controller
but this won´t change anything.. I saw that the routing changed a lot, I
think there is my main problem.



I looked at
http://framework.zend.com/manual/en/zend.controller.migration.html but i
don´t see the "hint" to solve my two problems..





Thanks,

Marc





Re: [fw-general] Router problem in 0.6.0

2006-12-22 Thread Matthias Zitzmann

That's it, thanks!

Matthias



Luiz Vitor schrieb:

Hi Matthias

If I'm not wrong, the Routes are processed recursively, so the most 
generic routes should be defined first.


You defined the "page" route dinamicaly and as last, It'll be the 
first one processed and will always be used.


So try changing your routes array to this:

$routes= array(
'page'=> new Zend_Controller_Router_Route(':page/*', 
array('controller' => 'index', 'action' => 'index')),
'form'=> new Zend_Controller_Router_Route('form/:action/*', 
array('controller' => 'form', 'action' => 'index')),
'files'=> new Zend_Controller_Router_Route('files/view/*', 
array('controller' => 'files', 'action' => 'view'))

);

Luiz

On 12/22/06, *Matthias Zitzmann* <[EMAIL PROTECTED] 
> wrote:


Hi folks,

yesterday I moved my application from a patched 0.1.5 to 0.6.0. There
were a few changes I need to do in my View-Class (I'm using __get and
__set, if I extend Zend_View_Abstract, this won't work any
longer). This
changes were done in about three hours. The bigger problem is,
that the
routing doesn't work any more. I also used the RewriteRouter before
that, here is some code:

$routes= array(
'form'=> new
Zend_Controller_Router_Route('form/:action/*', array('controller'
=> 'form', 'action' => 'index')),
'files'=> new Zend_Controller_Router_Route('files/view/*',
array('controller' => 'files', 'action' => 'view')),
'page'=> new Zend_Controller_Router_Route(':page/*',
array('controller' => 'index', 'action' => 'index'))
);

$controller = Zend_Controller_Front::getInstance();
$router = new Zend_Controller_RewriteRouter();

$controller->setRouter($router);
$router->removeDefaultRoutes();
$router->addRoutes($routes);
$controller->setControllerDirectory('app/control');
$controller->dispatch();


The most curious thing is, that now anything is redirected to the
'indexAction' of the 'indexController' - 'files' and 'form', too.
Here
is my .htaccess:

RewriteEngine on
RewriteBase /
RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php


Does anybody get an idea? It drives me crazy ...



Greets and thanks

Matthias




Re: [fw-general] Router problem in 0.6.0

2006-12-22 Thread Michał Minicki
Matthias Zitzmann <[EMAIL PROTECTED]> napisał(a):

> $routes= array(
> 'form'=> new Zend_Controller_Router_Route('form/:action/*', 
> array('controller' => 'form', 'action' => 'index')),
> 'files'=> new Zend_Controller_Router_Route('files/view/*', 
> array('controller' => 'files', 'action' => 'view')),
> 'page'=> new Zend_Controller_Router_Route(':page/*', 
> array('controller' => 'index', 'action' => 'index'))
> );
> 
> The most curious thing is, that now anything is redirected to the 
> 'indexAction' of the 'indexController' - 'files' and 'form', too. Here 
> is my .htaccess:
> Does anybody get an idea? It drives me crazy ...

Manual states that you should define the most generic routes first because 
they are matched in reversed order. And your "page" route will catch 
practically anything because it contains catch-all symbol (*). 

> Matthias

-- 
Martel



Re: [fw-general] Merging two Zend_Configs

2006-12-22 Thread Steve

Hi Simon,

Yeah, I realise that's possible but I need to be able to have two seperate 
INI files for a couple of reasons. Primarily, it's a multi-developer/user 
environment and we need to prevent the majority of developers/users being 
able to access the master INI file but still be able to configure their own 
site.


Thanks,

Steve


- Original Message - 
From: "Simon Mundy" <[EMAIL PROTECTED]>

To: "Zend Framework" 
Sent: Friday, December 22, 2006 12:22 PM
Subject: Re: [fw-general] Merging two Zend_Configs



Hi Steve,

You only need the one ini file for that. You can break up the ini  file 
into 'sections', with each section having the ability to inherit  from 
previous sections. For example:-


[all]
db.username = foo
db.password = bar
db.database = mydatabase

[development:all]
db.username = foodev
db.password = bardev

[local:development]
db.username = foolocal


When you need to load the config file, simply use the following (cut  and 
pasted from the manual):-


$config = new Zend_Config_Ini('/path/to/config.ini', 'development');

...where 'development' means that you'll end up by overriding the 
password and username for the 'db' directives in your config file. If 
you'd used 'local' then you'd get the 'foolocal' username, the  'bardev' 
password and the 'mydatabase' database name.


Hope that helps


Hi,

I've been trying to figure out the best way to merge two  Zend_Config 
objects together.


What I want to be able to do is have one master INI file in my 
application directory and then one INI file per application  instance, 
which will allow me to override settings in the master  INI file. I took 
a look around the documentation and the code for  Zend_Config but wasn't 
able to find an existing way to do this.


What I think I'll have to do is write a recursive iterator or a 
combination of asArray() and a custom array_merge function but I  wanted 
to check here if I'm missing something and if there is an  easier way to 
accomplish this?


Thanks,

Steve




--

Simon Mundy | Director | PEPTOLAB

""" " "" "" "" "" """ " "" " " " "  "" "" "
202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654  4124
http://www.peptolab.com



Re: [fw-general] Merging two Zend_Configs

2006-12-22 Thread Simon Mundy

Hi Steve,

You only need the one ini file for that. You can break up the ini  
file into 'sections', with each section having the ability to inherit  
from previous sections. For example:-


[all]
db.username = foo
db.password = bar
db.database = mydatabase

[development:all]
db.username = foodev
db.password = bardev

[local:development]
db.username = foolocal


When you need to load the config file, simply use the following (cut  
and pasted from the manual):-


$config = new Zend_Config_Ini('/path/to/config.ini', 'development');

...where 'development' means that you'll end up by overriding the  
password and username for the 'db' directives in your config file. If  
you'd used 'local' then you'd get the 'foolocal' username, the  
'bardev' password and the 'mydatabase' database name.


Hope that helps


Hi,

I've been trying to figure out the best way to merge two  
Zend_Config objects together.


What I want to be able to do is have one master INI file in my  
application directory and then one INI file per application  
instance, which will allow me to override settings in the master  
INI file. I took a look around the documentation and the code for  
Zend_Config but wasn't able to find an existing way to do this.


What I think I'll have to do is write a recursive iterator or a  
combination of asArray() and a custom array_merge function but I  
wanted to check here if I'm missing something and if there is an  
easier way to accomplish this?


Thanks,

Steve




--

Simon Mundy | Director | PEPTOLAB

""" " "" "" "" "" """ " "" " " " "  "" "" "
202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654  
4124

http://www.peptolab.com




[fw-general] Merging two Zend_Configs

2006-12-22 Thread Steve
Hi,

I've been trying to figure out the best way to merge two Zend_Config objects 
together.

What I want to be able to do is have one master INI file in my application 
directory and then one INI file per application instance, which will allow me 
to override settings in the master INI file. I took a look around the 
documentation and the code for Zend_Config but wasn't able to find an existing 
way to do this.

What I think I'll have to do is write a recursive iterator or a combination of 
asArray() and a custom array_merge function but I wanted to check here if I'm 
missing something and if there is an easier way to accomplish this?

Thanks,

Steve


Re: [fw-general] Re: Do we really need Zend::exception()?

2006-12-22 Thread Arnaud Limbourg

+1

This new usage 'throw Zend::exception()' does not make any sense. The 
rationale sounds like premature optimisation.


Here is an excerpt from lukas simth blog on bytecode caches[1]

" does autoload have a performance impact when using apc ?
 it is slow both with and without apc
 but yes, moreso with apc because anything that is autoloaded 
is pushed down into the executor

 so nothing can be cached
 the script itself is cached of course, but no functions or classes
 Well, there is no way around that
 autoload is runtime dependent
 we have no idea if any autoloaded class should be loaded until 
the script is executed

 top-level clean deps would speed things up a lot
 it's not just autoload
 it is any sort of class or function declaration that depends 
on some runtime context

 if(cond) function foo...
 if(cond) include file
 where file has functions and classes
 or heaven forbid: function foo() { class bar { } }"

The original question was in regard with autoload but mentions the 
conditional includes as being a sub-optimal solution.


Conditional includes do not seem to be a good idea.

[1]http://pooteeweet.org/blog/538

Bill Karwin wrote:
I appreciate everyone's input on this discussion.  I'd like to reach 
closure on what we do with Zend::exception().  I will summarize my 
viewpoint on this issue, and then give my proposed resolution:


- Calling Zend::exception() is nonstandard PHP usage.  This is an 
education issue for developers using the Zend Framework.


- The stack trace generated from an exception is also nonstandard, 
holding the location of the call to Zend::exception() is the second 
line, instead of the first.  So knowing how to read a stack trace from 
Zend Framework is also an education issue for developers.
- This affects usage of IDE tools, which may provide clickable stack 
trace output.  Developers will be confused that clicking on the stack 
trace always opens the source of Zend::exception().


- Zend::exception() sets the file and line of the exception 
instantiation, not the place where it's thrown.  This means the file and 
line is always set to Zend.php line 227.  Accounting for this requires 
additional code to set the file and line to the place that calls 
Zend::exception, but that still wouldn't fix the stack trace.


- Lazy-loading exceptions can be achieved in a traditional manner by 
putting require_once() inside the code-block that creates an exception.


- Lazy-loading may be unnecessary in an environment that uses a bytecode 
cache.  I assume that any application that prioritizes performance 
enough to be affected by the overhead of loading exception classes 
should be running a bytecode cache.


So I propose the following resolution:

- Remove instances of Zend::exception() throughout the ZF tree, 
replacing them with traditional "throw new" usage.

- Mark the Zend::exception() function as deprecated in 0.7.0.
- Remove the Zend::exception() function from the Zend class in 0.8.0.
- Continue to implement each exception in a separate file.  Not all 
exception classes are no-op extensions to Zend_Exception; some do 
contain custom methods.
- Individual component authors may implement lazy-loading by putting the 
require_once() into each code block before instantiating an exception 
class.  But I don't think this should be required; it's fine to 
require_once() exception classes once per file, at the top of the PHP 
file, and rely on bytecode caching for performance improvement.


I grepped, and found we currently have 358 instances of using 
Zend::exception(), and 652 instances of traditional usage ("throw new 
Foo_Exception;") in the tree.  So we are using Zend::exception() in only 
one-third of the cases of throwing an exception.

Comments?  Tomatoes?

Regards,
Bill Karwin

PS: I'm volunteering to make the edits to replace usage of 
Zend::exception() with traditional exception usage.




Re: [fw-general] Router problem in 0.6.0

2006-12-22 Thread Matthias Zitzmann
I used the rewrite without RewriteBase before. This worked only on my 
development machine (Windows XP), neither on the test machine at Windows 
2000 nor on the productive system (Gentoo Linux). This is also not the 
solution.



Andris Paikens schrieb:

Hi Matthias,

maybe You should remove RewriteBase from Your htaccess file?
Got this idea, because in previous versions there was need for
$router->setRewriteBase('/');

Now it is not needed anymore. Maybe that is reason.

Andris

On 22/12/06, Matthias Zitzmann <[EMAIL PROTECTED]> wrote:

Hi folks,

yesterday I moved my application from a patched 0.1.5 to 0.6.0. There
were a few changes I need to do in my View-Class (I'm using __get and
__set, if I extend Zend_View_Abstract, this won't work any longer). This
changes were done in about three hours. The bigger problem is, that the
routing doesn't work any more. I also used the RewriteRouter before
that, here is some code:

$routes= array(
'form'=> new Zend_Controller_Router_Route('form/:action/*', 
array('controller' => 'form', 'action' => 'index')),
'files'=> new Zend_Controller_Router_Route('files/view/*', 
array('controller' => 'files', 'action' => 'view')),
'page'=> new Zend_Controller_Router_Route(':page/*', 
array('controller' => 'index', 'action' => 'index'))

);

$controller = Zend_Controller_Front::getInstance();
$router = new Zend_Controller_RewriteRouter();

$controller->setRouter($router);
$router->removeDefaultRoutes();
$router->addRoutes($routes);
$controller->setControllerDirectory('app/control');
$controller->dispatch();


The most curious thing is, that now anything is redirected to the
'indexAction' of the 'indexController' - 'files' and 'form', too. Here
is my .htaccess:

RewriteEngine on
RewriteBase /
RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php


Does anybody get an idea? It drives me crazy ...



Greets and thanks

Matthias






[fw-general] Problem after upgrading to 0.6.0

2006-12-22 Thread Marc Lindemann
Hello,

 

I have to problems after upgrading to 0.6.0:

 

-Fatal error: Call to a member function getParam() on a non-object
in /var/www/entwicklung/trunk/library/Zend/Controller/Action.php on line 302

 

Source Code:

 $zielgruppe_id = $this->_getParam('id');

 

 

-The Main Page (like http://localhost/) is always routing to
/noroute.. Always.. I removed the /noroute action from my index controller
but this won´t change anything.. I saw that the routing changed a lot, I
think there is my main problem. 

 

I looked at
http://framework.zend.com/manual/en/zend.controller.migration.html but i
don´t see the “hint” to solve my two problems..

 

 

Thanks,

Marc