Re: [fw-general] Problems with custom routes - possibly bug ?

2007-08-10 Thread Martel Valgoerad

Cristian Bichis wrote:


Loading of routes is simple:

$router = $frontController->getRouter();
$router->removeDefaultRoutes();
$router->addConfig($config, 'routes');


AddConfig calls getInstance method on route object, so you need to override 
this one as well. Get a closer look at a first line of your output:



Zend_Controller_Router_Route Object
(
[_urlVariable:protected] => :


Do you see the class name? GetInstance instantiates incorrect object type.

--
Martel Valgoerad aka Michal Minicki | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell


Re: [fw-general] reroute post requests

2007-06-09 Thread Martel Valgoerad

Bryce Lohr wrote:

I'd second a feature request to add REQUEST_METHOD to the existing Router & 
Route classes.


I'll probably make this change you have proposed some time ago, Bryce. But I'm 
not sure now is a good time with 1.0 being just around the corner.


http://framework.zend.com/issues/browse/ZF-777

Expect it rather post 1.0 unless some higher power tells me to implement it as 
quickly as possible :)



Bryce Lohr


--
Martel Valgoerad aka Michal Minicki | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell


Re: [fw-general] reroute post requests

2007-06-08 Thread Martel Valgoerad

Jens Ruben wrote:


Here’s my code but I think there should be a much better solution for this task.


Can't you just subclass Zend_Controller_Action and point your forms at a 
specified method like execute?


abstract class My_Form_Action extends Zend_Controller_Action {

   abstract protected showForm();
   abstract protected submitForm();
   abstract protected validateForm();

   public function execute()
   {
  if(!$request->isPost()) {
 $this->showForm();
  }

  if ($this->validateForm()) {
 $this->submitForm();
  } else {
 $this->showForm();
  }
   }
}

And then you create your forms by extending above class while providing 
missing abstract methods:


class My_Login extends My_Form_Action {

   protected showForm() {
  ...
   }

   ...
}


Jens


--
Martel Valgoerad aka Michal Minicki | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell


Re: [fw-general] Multilpe routes per module

2007-05-31 Thread Martel Valgoerad

Jur Jean wrote:

I'm probably missing something here - I seem to be the only one who 
wants more than 1 route for a module.

$router->addRoute('projects', new Zend_Controller_Router_Route('/projects/:action/:id', 
array('module'=>'projects', 'controller'=>'index', 'action'=>'index', 'id'=>'')));
$router->addRoute('projects', new 
Zend_Controller_Router_Route('/projects/info/:action/:id', array('module'=>'projects', 
'controller'=>'info', 'action'=>'index', 'id'=>'')));


The first parameter is a route name which is just an associative array key 
internally. So by adding two routes with the same name you basically are 
overwriting former with the latter.



How can I solve this problem?


Just name the routes a bit differently. Like:

$router->addRoute('project', ...
$router->addRoute('project-details', ...

--
Martel Valgoerad aka Michal Minicki | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell


Re: [fw-general] .js module routes

2007-05-06 Thread Martel Valgoerad

Maurice Fonk wrote:


new Zend_Controller_Router_Route('js/:file',
array(
'module' => 'jscsscompressor',
'controller' => 'index',
'action' => 'compress')
)


which works fine, as long as the javascript file I'm trying to request 
isn't in a subdirectory of the js directory. If that is the case, I get:


If you add a slash it's like you would be adding another part to the URL, so 
your route won't match that. Use Regex Route for your purpose:


new Zend_Controller_Router_Route_Regex('js/(.+)',
  array(
   'module' => 'jscsscompressor',
   'controller' => 'index',
   'action' => 'compress')
   ),
  array(
1 => 'file'
  ),
  'js/%s'
);

--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"In a mad world only the mad are sane." -- Akira Kurosawa


Re: [fw-general] Wiki manual updated - request for XSLT help

2007-05-06 Thread Martel Valgoerad

Andries Seutens wrote:


Hey Martel,
Thanks a lot, this works really nice! A lot better than a mix of regular 
expressions and XSLT :)!


No problem. Glad I could help.

The tricky part is that this "space stripping" shouldnt be done in all 
nodes. 


Okay, I don't have time on me to test this today but first thing I would try 
is to use strip-space or preserve-space elements (whichever is more 
comfortable for you):





http://www.w3schools.com/xsl/el_preserve-space.asp

Or, if it does not work as you would expect it to, then you may try to use 
functions like normalize-space(string) or replace(string1,string2,string3). 
Replace looks as a worst solution but it may be the one that actually works. 
New lines are 
 and 
 (being chr(13) and chr(10) or carriage return 
and a line feed).


http://www.w3schools.com/xpath/xpath_functions.asp#string


Andriesss


--
Martel Valgoerad aka Michal Minicki | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell


Re: [fw-general] Routes missing parameters

2007-05-06 Thread Martel Valgoerad

Andrew Yager wrote:

If I have a route with the path /foo/:var1/:var2 - the only time it  
will be matched is when a URL is received in the form '/foo/bar/lah'.


I can set a 'default' value for :var1 and :var2 when creating the  
route, so I would like to be able to request the URL '/foo' and  
have :var1 and :var2 automatically set from the default values.


Is this possible?


Yes, as Sebastian already mentioned, you can set the defaults and they will 
work just like you would like them too. Read the manual.



Problem No 2:

I have occasion to want to be able to call /foo/:var1 where var1 is  
an arbitary string containing text and the '/' character - e.g. /foo/ 
lah/de/dah and have it match, and then the controller break :var1 up.


Is this possible? I haven't been able to get it to match again.


One solution (again Sebastian's) is to urlencode a slash and it will be 
decoded automatically by the router. The other is to use a different type of 
route for this one problem - eg. a Zend_Controller_Router_Route_Regex. 
Remember you can mix and match different kind of routes.



Andrew


--
Martel Valgoerad aka Michal Minicki | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell


Re: [fw-general] Wiki manual updated - request for XSLT help

2007-05-05 Thread Martel Valgoerad

Andries Seutens wrote:

Okay, my first issue is that i need to convert docbook tables to wiki 
tables.


It's not so hard. Remember XSLT is a declarative language (as opposed to 
imperative), so everything you need is to declare templates for each element 
parser is going to find.







- 









etc.

I'm attaching two files - one with your XML and the other with a XSLT solution.

I have more outstanding issues, but let's start with this one, as it has 
been bugging me for a long time :).


I guess that with this little help I provided, you will probably be able to 
solve every other problem on your own ;)



Andriesss


--
Martel Valgoerad aka Michal Minicki | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell

http://www.w3.org/1999/XSL/Transform"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns:fn="http://www.w3.org/2005/xpath-functions";>
	

	
		
	

	
		- 
		
		
	

	
		
		
	

	
		
			||
		
	
	
	
		
			|
		
	

	
		
		
			
		
		
		
	
	
	
		
		
		 
		
		 
	





	
		Date Parts
		
			

	Column 1
	Column 2

			
			

	foo
	bar


	foo2
	bar2

			
		
	



Re: [fw-general] Wiki manual updated - request for XSLT help

2007-05-05 Thread Martel Valgoerad

Andries Seutens wrote:

PS: I am looking for some people with "good" knowledge of XSLT, to help 
me with some minor issues in the wikifized manual. If you're interested 
to help out, *please* send me an e-mail and I will provide you with 
further details.


Please describe your issues, Andries. I might be able to help but I honestly 
don't know if I will have time to do some lengthy work. But I will probably be 
able to at least give you some pointers should I know how to solve the problem.



Andries Seutens


--
Martel Valgoerad aka Michal Minicki | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell


Re: [fw-general] route problem

2007-04-18 Thread Martel Valgoerad

Jacky Chen wrote:


Hi all,
I want to specify a url such as 
http://localhost/index.php?controller=index&action=view 
<http://localhost/index.php?controller=index&action=view> and have it 
dispatch properly,how?


It should work out of the box. You just have to tell the request of your 
request base url if you use any routes:


require_once 'Zend/Controller/Request/Http.php';
$request = new Zend_Controller_Request_Http();
$request->setBaseUrl('index.php');
$controller->setRequest($request);

AND/OR make sure you don't have any routes (in order not to waste resources):

require_once 'Zend/Controller/Router/Rewrite.php';
$router = new Zend_Controller_Router_Rewrite();
$router->removeDefaultRoutes();
$controller->setRouter($router);

I suppose there should be some method for disabling the router altogether, like:

$controller->disableRouter();

For now disabling the router is very hard. Even if you are determined enough to 
extend the dispatcher. And the router is designed as a filter to request so it 
is optional.


--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Make sure you have finished speaking before your audience has finished
listening." -- Dorothy Sarnoff


Re: [fw-general] OT: Duplicate mails?

2007-04-13 Thread Martel Valgoerad

Markus Wolff wrote:


Hey there,
am I the only one getting almost every mail multiple times? 


I'm getting duplicate mails from fw-svn list. And only few mails are getting 
duplicated. The problem is, those are the mails that are bigger than 5 MB. And 
they get duplicated like 5-6 times in a course of a day for a week or so.


I don't know where the problem lies. It may be a problem with listserv, it may 
be the Zend's MTA or even my ISPs. But since I have created a server side 
filter deleting any big fw-svn mail, it's not "my" problem anymore. And I just 
wouldn't want to waste time on such a small nuissance ;)


No other duplicates than that. You're sure you're not subscribed to fw-all and 
all the other lists simultaneously? To echo after Andries.



  Markus


--
Martel Valgoerad aka Michal Minicki | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell


Re: [fw-general] Wildcards routes and reset parameter

2007-03-22 Thread Martel Valgoerad

Olivier Sirven wrote:

(...)

I have tried to add the "reset" parameter to true but then I don't have any 
parameter at all, just "/":

echo $this->url(array('key1' => 'newvalue'), 'root', true);

Is it a bug or a feature? 


It's more a bug than a feature. Fixed with commit 4715. Good catch, thanks :)

If this is a feature, is there a way to assemble a wildcard route without 
taking into account the current parameters?


There is another way to reset parameters. You can leave $reset as false but 
pass 'var' => null to assemble if you wish to reset specific url variables only.


--
Martel Valgoerad aka Michal Minicki | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell


Re: [fw-general] Zend_View, reference inside helpers

2007-03-12 Thread Martel Valgoerad

Art Hundiak wrote:


Be nice if we could just extend the view class and tweak it but someone
went 'private' happy when they wrote the code.


Actually private variables are there for a reason. And it's pretty clever.
They're protecting internal properties from being accessed directly form the 
view scripts. But it makes subclassing a hell at the same time.


--
Martel Valgoerad aka Michal Minicki | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell


Re: [fw-general] Zend_Auth - OpenID and Typekey services for a full ZF centric adapter?

2007-02-20 Thread Martel Valgoerad

Pádraic Brady wrote:

Whew! If anyone is still with me after this long email, the thoughts and 
comments of folk are always appreciated.


I was going to get into this stuff myself but since you're going to do it 
anyway, I'll just choose a soft option and wait for your classes, Padraic :)


I simply wanted to give you some encouragement here, so: you're doing great 
and you're going in the right direction. Well... as far as I can tell, I guess :)



Best regards, Pádraic


--
Martel Valgoerad aka Michal Minicki | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell



Re: [fw-general] Consistency in naming

2007-02-19 Thread Martel Valgoerad

Matthew Ratzloff wrote:

Consistency means predictability, which means being able to recall names 
without having to check the manual every time.  


Seconded.

-Matt 


--
Martel Valgoerad aka Michal Minicki | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell


Re: [fw-general] Code optimizations

2007-02-13 Thread Martel Valgoerad

David Koblas wrote:

Another follow on to optimizations, I noticed that the framework make 
some very minimal assumptions about what extensions are available, while 
that's good for broad compatability it creates big performance worries.


One case in particular:
Zend_Json_Encode / Zend_Json_Decode.

With php now making json_encode() and json_decode() fairly standard the 
performance hit of not calling these when available is quite substantial 
-- in one application it was 1.3seconds of decode time vs. 0.02 seconds 
for the builtin version. 


There are some differences between native php implementation and Zend_Json.
Take a peek:

http://gggeek.altervista.org/sw/article_20061113.html


--koblas


--
Martel Valgoerad aka Michal Minicki | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell


Re: [fw-general] Modular directory structure

2007-01-20 Thread Martel Valgoerad

Philip Iezzi wrote:


We could then set up some static routes to make life a bit easier:
new Zend_Controller_Router_StaticRoute('logout', array('action' => 'logout'));

Instead of calling an ugly "/index/index/logout" URI, we could call "/logout" 
and place the logout action directly in /application/controllers/IndexController.php
I'd rather prefer some regular expression to write one single static route for 
all requests not matching the :module/:controller/:action layout, something 
like:

new Zend_Controller_Router_StaticRoute('!(admin|moderator)', array('module' => 
'index', 'controller' => 'index', 'action' => '$1'));
(totally wrong regex, I know, this is just pseudocode!!)


I'm in the middle of creating new route class called RegexRoute. It will be 
able to accomplish what you're trying to do above. It's constuctor signature is:


   Zend_Controller_Router_RegexRoute($regex, array $defaults, array $map)

Regex and defaults parameters will be compatible with all other route objects 
with one exception => you will be able to define integer indexed defaults in 
order to enable it to work with regex subpatterns.


There will be a third optional parameter named $map, which will hold key-value 
pairs for mapping subpatterns to named parameters. So to achieve what you have 
given example for, you will have to create the route this way:


   new Zend_Controller_Router_RegexRoute('!(admin|moderator)',
  array('module' => 'index', 'controller' => 'index'),
  array(1 => 'action')
   );

Or to make it actually work, we have to use conditional matching (or any other 
way to simulate the negative match) because there is no negative subpattern 
matching mechanism in PHP's PCRE:


   $route = new Zend_Controller_Router_RegexRoute('((?!admin|moderator).+)',
  array('module' => 'index', 'controller' => 'index'),
  array(1 => 'action')
   );

And the code is almost complete and this test already passes with the current 
code:


public function testNegativeMatch()
{

$route = new Aie_Mvc_LiteRegexRoute('((?!admin|moderator).+)',
   array('module' => 'index', 'controller' => 'index'),
   array(1 => 'action')
);

$values = $route->match('users');

$this->assertSame(3, count($values));
$this->assertSame('index', $values['module']);
$this->assertSame('index', $values['controller']);
$this->assertSame('users', $values['action']);
}

I yet have to make assembling work (I guess about 70% work is already done) and 
create a proposal. Then everything will be in the hands of Matthew.



Philip


--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"A paranoid is someone who knows a little of what's going on." -- William S.
Burroughs


Re: [fw-general] issue with Zend_Controller_Router_StaticRoute

2007-01-20 Thread Martel Valgoerad

Philip Iezzi wrote:


please fix...


Fixed in revision 2910.

Thanks, Philip.

--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"You don't stop laughing because you grow old. You grow old because you stop
laughing." -- Michael Pritchard


Re: [fw-general] LDAP support

2007-01-18 Thread Martel Valgoerad

Ralph Schindler wrote:

I think this would be a great interface, but unfortunately, I do not 
know nearly enough about LDAP to be able to presume what an OO api for 
this type of service should look like..


PEAR::Net_LDAP is fairly decent. Latest PEAR package has problems with binary data 
but the CVS version is fixed (and more than slightly refactored).



Would anyone out there be interested in creating Zend_Ldap?


If only I had the time to do it :(


-ralph


--
Martel Valgoerad aka Michal Minicki | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell


Re: [fw-general] CamelCase controller names

2007-01-05 Thread Martel Valgoerad

Kevin McArthur wrote:

I don't fully get why we need a formatted name anyway. Why not just 
normalize the token from the url in a consistent way and call that method in 
a case sensitive way. 


I agree. What's the reasoning behind the strtolower anyway? To make URIs 
case-insensitive? What for?


I vote for case sensitivity here.


Kevin


--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Be careful about reading health books. You may die of a misprint." -- Mark
Twain


Re: [fw-general] apache bombs out on PDO::prepare()

2006-12-29 Thread Martel Valgoerad

Brad Kowalczyk wrote:

I am writing my first ZF based app and wanted to use the Zend_Db PDO 
classes. My problem is that apache is exiting with signal 11 when 
Zend_Db_Adapter_Pdo_Abstract::prepare() tries to return the result of 
$this->_connection->prepare():


Dec 29 16:37:33 localhost kernel: pid 35047 (httpd), uid 65534: exited 
on signal 11


Have you upgraded something on your system after PDO compilation? I mean any 
dependency which may be used by PHP/PDO. Most likely that's newer mysql that's 
causing some trouble. Have you tried recompiling PHP and/or pdo_mysql?



Brad


--
Martel Valgoerad aka Michal Minicki | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell


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] 0.2.0 Migration docs...

2006-12-20 Thread Martel Valgoerad

Kevin McArthur wrote:

Uncaught exception 'Zend_Controller_Exception' with message 
'CatalogController::60221Action() does not exist and was not trapped in 
__call()'


It haven't mached your route and probably hit the default one instead. Your route 
definition looks ok, so there must be some other kind of misbehavior.


Try $ctrl->dispatch() instead of run. I had some issues with this before. But it's a 
wild guess only, so don't expect miracles.


--
Martel Valgoerad aka Michal Minicki | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell


Re: [fw-general] Zend_XMLElement proposal

2006-12-15 Thread Martel Valgoerad

Nico Edtinger wrote:

It's easier to call $doc->createTextNode('body', 'Text of body')  
than to write four lines of code.
Isn't that the same as $doc->addChild('body', 'Text of body'); with  
simplexml? I've tested with:


But where's the CDATA element in this code, Nico? Have you ommited it on 
purpose? :)

But you're missing the point here. There are places in _DOM_ where such convenience 
classes would be justified. That's all I'm saying. The code is pretty irrelevant. I 
have given this sample because we're all more comfortable with code examples, right?


--
Martel Valgoerad aka Michal Minicki | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell


Re: [fw-general] Zend_XMLElement proposal

2006-12-15 Thread Martel Valgoerad

Andi Gutmans wrote:


We currently have both SimpleXML (for simple things) and DOM to do the more
powerful stuff. They can also be used together without duplicating the
underlying DOM tree which they are working on. You'd have to clearly
articulate the benefits of your suggestion to this couple.
From your email it's not clear what your exact idea is and how it would add
value to these.


I don't want to take sides here but I also think standard DOM interface is a bit 
cumbersome. I see some places where such class would make things easier. For example:


$body = $doc->createElement('body');
$content = $doc->createCDATASection($text);
$body->appendChild($content);
$item->appendChild($body);

Which could be encapsulated in a slick method like:

public function createTextNode($element, $text, $cdata = false)
{
$node = $this->_doc->createElement($element);

if ($cdata) {
$content = $this->_doc->createCDATASection($text);
$node->appendChild($conent);
} else {
$node->nodeValue = $text;
}

return $node;
}

It's easier to call $doc->createTextNode('body', 'Text of body') than to write four 
lines of code.


Andi 


--
Martel Valgoerad aka Michal Minicki | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell


Re: [fw-general] CCing across lists

2006-12-04 Thread Martel Valgoerad

Lars Strojny wrote:


No, this is not a good idea. That seems to be an obfuscated way of using
the Reply-To functionality. Is is designed to provide the possibility to
the user, to specify the personal reply to. And, on the other side,
every normal mail client knows a reply to list shortcut, in evolution it
is ctrl+l.


And mutt is using L. But as far as I know Thunderbird lacks this functionality. 
 Or maybe there is some kind of a plugin out there?



Greets, Lars


--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"The incompetent with nothing to do can still make a mess of it."
-- Laurence J. Peter


Re: [fw-general] SVN 2077: Getting parameters from route

2006-12-04 Thread Martel Valgoerad

Nick Lo wrote:

SVN checkout 2077 seems to have broken the ability to get parameters  
from a rewrite route url (that or I've been doing it all wrong)...


2077 is not related to controller in any way but let's try resolving your 
problem.


In index.php:
$router = new Zend_Controller_RewriteRouter;
$route_config = new Zend_Config( new Zend_Config_Ini( '../application/ 
configuration/routes.ini.php', 'development' ) );

$router->addConfig( $route_config, 'routes' );


I'm using incubator version of Zend_Config which, according to the wiki manual, 
should be instantiated using Zend_Config_Ini alone:


$config = new Zend_Config_Ini(
'../application/configuration/routes.ini.php', 'development');

Old library used to do ZCI::load:

$config = new Zend_Config(Zend_Config_Ini::load(
'../application/configuration/routes.ini.php', 'development'));

Have I missed something in between?

Check if you have any routes loaded after $router->addConfig call.


In controllers/ArticlesController.php:

public function viewAction()
{
 print_r( $this->_request->getParams() );
 echo $this->_getParam( 'ref' );
}


Should work just fine but I'll double check it in a minute... and it works for 
me:

URL:
http://test.localhost/news/2

INI:
routes.newsitem.route = "news/:id"
routes.newsitem.defaults.controller = "news"
routes.newsitem.defaults.action = "show"
routes.newsitem.reqs.id = "\d+"

Controller:
public function showAction()
{
var_dump($this->_request->getParams());
}

Result:
array(3) {
  ["id"]=>
  string(1) "2"
  ["controller"]=>
  string(4) "news"
  ["action"]=>
  string(4) "show"
}


Nick


--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"If you pick up a starving dog and make him prosperous, he will not bite you.
This is the principal difference between a dog and a man." -- Mark Twain


Re: [fw-general] Controllers in subdirectories

2006-12-03 Thread Martel Valgoerad

Shekar C Reddy wrote:


Great! Is there a way to map a subdomain to a module?


With standard dispatcher? No. You will need to extend it and override the part 
of the code which will be getting a module name out of the request. But it 
shouldn't be too hard.


--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Ambition is a poor excuse for not having sense enough to be lazy." -- Edgar
Bergen


Re: [fw-general] Controllers in subdirectories

2006-12-03 Thread Martel Valgoerad

Martel Valgoerad wrote:

I guess there is already another proposal for controllers in 
subdirectories...
Yes, there is. Submitted by Christopher Thompson ages ago. It was submitted 
long before MVC reorganization and uses special characters (in URIs) as 
directory separators:

http://framework.zend.com/wiki/display/ZFPROP/Action+Controller+Directory+Tree+-+Christopher+Thompson


But, as a side note, these solutions can coexist with one another.

--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"To err is human -- and to blame it on a computer is even more so." -- Robert
Orben


Re: [fw-general] Controllers in subdirectories

2006-12-03 Thread Martel Valgoerad

Shekar C Reddy wrote:


Excellent! What's the solution to use the old router (not RewriteRouter)?


Module awareness in the old basic router cannot be accomplished without 
breaking BC - we can't change it's basic mapping of controller and action 
pairs, they still need to be defined as first parameters.


But there is "a hack" which can be used without any changes to the code.

Routers are filters for the Request now, so it's only a matter of specifying a 
parameter named module in the URI. So all we have to do is to add a 
'module/admin' to the wildcard parameters in the router:


Instead of:
http://localhost/test/index.php/news/add

You will have to use:
http://localhost/test/index.php/news/add/module/admin

--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Everyone is born with genius, but most people only keep it a few minutes."
-- Edgard Varese


Re: [fw-general] Controllers in subdirectories

2006-12-03 Thread Martel Valgoerad

Shekar C Reddy wrote:
I guess there is already another proposal for controllers in 
subdirectories...


Yes, there is. Submitted by Christopher Thompson ages ago. It was submitted 
long before MVC reorganization and uses special characters (in URIs) as 
directory separators:


http://framework.zend.com/wiki/display/ZFPROP/Action+Controller+Directory+Tree+-+Christopher+Thompson

I won't go into details here but I think even Christopher will agree that his 
proposed solution has it's drawbacks. And to me - it's just not kosher enough ;)


--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell


[fw-general] Controllers in subdirectories

2006-12-03 Thread Martel Valgoerad


I would like to touch this subject again. I think I have found a solution which 
should suit everybody as it's very easy to manage from a user standpoint and 
also easy to implement.


===
Framework user standpoint

It's a concept of named modules. Let's work on a use case first - let's 
bootstrap our application with additional directories in the standard way:


require_once 'Zend/Controller/Front.php';
$controller = Zend_Controller_Front::getInstance();

$dirs = array(
'default' => '/home/martel/WWW/test/controllers',
'forum'   => '/home/martel/WWW/test/controllers/forum',
'admin'   => '/home/martel/WWW/test/controllers/admin',
'other'   => '/var/www/even/outside/root/dir'
);

$controller->setControllerDirectory($dirs);
echo $controller->dispatch();

As you see, it's a standard and already working way of setting controller dirs. 
Nothing is or needs to be changed up to this point. We can access all the dirs 
the standard framework way:


http://localhost/test/index.php?controller=news&action=add

But what happens when you want a NewsController in default as well as admin 
directories. Former is used to display news to the users and latter to 
administer the site.


So let's assume we have an additional parameter to use named 'module'. And if 
we would like to access the admin module specifically, we would use the 
following URIs:


With standard URL Scheme:
http://localhost/test/index.php?module=admin&controller=news&action=add

Or with RewriteRouter (route: ':module/:controller:/:action'):
http://localhost/test/admin/news/add

This way we can access any directory structure by using named modules. And 
what's moreover, we can have controllers named exactly the same in different 
directiories - something that is not possible with current codebase.


But it's a backwards compatible solution - we can still access the controllers 
without relying on modules. In that case dispatcher would still iterate through 
all the defined controller dirs like it is being done right now.


That's from the users standpoint. Now let's get to the implementation.

===
Framework Code

It's really easy thing to do as setControllerDir is already setting directories 
by the key, so it's only a matter of modifying _getController() method of the 
dispatcher to be aware of modules (new code is marked by pluses):


protected function _getController($request, $module = null, $directories = null)
{
...

$className = $this->formatControllerName($controllerName);

/**
 * Determine if controller is dispatchable
 */
$dispatchable = false;

+if ($module !== null) {
+$dispatchable = = Zend::isReadable($directory[$module]);
+} else {
foreach ($directories as $directory) {
$dispatchable = Zend::isReadable($directory ...);
if ($dispatchable) break;
}
+}

return $dispatchable ? $className : false;
}

And that's pretty much it. Of course we would still have to add 
formatModuleName family of methods (similar to controller and action names), an 
optional module parameter to addControllerDir to make it store directories 
under specified key and finally a delegate methods in Front Controller.


public function addControllerDirectory($path, $module = null)

Finally it would probably be a good idea to move "Determine if controller is 
dispatchable" block out to it's own method. It will allow for easier 
subclassing and will meet Rob's request:


http://www.nabble.com/%24_GET%2C%24_POST-and-Zend_Controller_Request_Http-tf2710146s16154.html

===
Backwards compatibility

This implementation is fully backwards compatible but maybe it would be better 
to drop backwards compatibility in order to clean the code? I mean make one 
default module instead of directory iteration, etc. And we're already shooting 
our foots with parameter ordering (parameters renamed to better show what's on 
my mind):


public function addControllerDirectory($dir, $name)
public function addRoute($name, $route)

--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"To err is human -- and to blame it on a computer is even more so." -- Robert
Orben


Re: [fw-general] Shared server load times

2006-11-30 Thread Martel Valgoerad

Rob Allen wrote:


I'm seeing this on my development machine too. A dead simple app's
first page load is really slow and then all the other pages are quick.
I assumed it was this laptop! I'll start to have a dig around and work
out what it is...


It's probably a disk problem, Rob (is it ATA?). I have been benchmarking the 
MVC code left and right for the last week (using APD and XDebug) and my 
conclusion is that the inclusion of files (require_once) gets the lions share 
of the run time.


I have been testing it on a fairly aged ATA drive and I yet have to test it on 
some newer SATA drive with a bigger cache. The problem is, I have the disk but 
with a different operating system so comparison of these two does not have any 
sense. I have to find some kind of Linux with a SATA now...



Rob...


--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"If you tell the truth you don't have to remember anything." -- Mark Twain


Re: [fw-general] url generation

2006-11-29 Thread Martel Valgoerad

Daniel Kipp wrote:


Unfortunately this one is also outdated! Zend_Controller_Front
isn't singleton any more. this means you can't call getInstance() on it.


But it is. The change was reverted some time ago. Please update your sources.

I'm still looking for an easy, good and router supported way for URL 
creation.

Any ideas?


The URL helper should work.


daniel


--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Generosity is giving more than you can, and pride is taking less than you
need." -- Kahlil Gibran


Re: [fw-general] MVC in incubator - using $request->setBaseUrl();

2006-11-29 Thread Martel Valgoerad

Arnaud Limbourg wrote:

I'm trying out my code under the new MVC component and I noticed there 
is a problem when I use $request->setBaseUrl('http://myapp');. The 
routing falls back to index/index. However if I let the request object 
figure it out by itself it work well.


You should be using a common string from your REQUEST_URI in the setBaseUrl, 
Arnaud. The one that leads to your PHP script.


Matthew, maybe the method name is a bit misleading? Shouldn't it be changed to 
something more closer to it's function? Like setBaseDir for instance. I think 
it's not too late yet since the code still resides in incubator. And later, 
after the 0.6.0 release, it may be harder to do so.



Arnaud.


--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Any fool can write code that a computer can understand. Good programmers
write code that humans can understand." -- Martin Fowler


Re: [fw-general] router problems

2006-11-28 Thread Martel Valgoerad

Stéphane Thomas wrote:


I had the same problem than you, Asger Hallas and Martel Valgoerad. However
if you update line 464 and remove the latest change done in
Zend_Controller_Request_Http (aka removing the minus 1) it's working fine.
So you would have:

Line 464: if ((null !== $baseUrl) && (false === ($pathInfo =
substr($requestUri, strlen($baseUrl) {

But this is just a temporary workaround...


Matthew reverted that change today (changeset 1895), so it's already in svn.


  Stephane


--
Martel Valgoerad aka Michal Minicki | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell


Re: [fw-general] ZF without mod_rewrite

2006-11-28 Thread Martel Valgoerad


And finally the routers should use $request->get/set instead of 
getParams/setParams.

I'm not sure I follow here. Zend_Controller_Router does
$request->setParam() when setting parameters in the request object. Can
you give more context?


Yes, setParam is good enough. Only the get methods would have to be modified 
with this change (my own version). And since Router is not getting anything 
from request directly this paragraph can be scrapped altogether. Sorry.


--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"If you pick up a starving dog and make him prosperous, he will not bite you.
This is the principal difference between a dog and a man." -- Mark Twain


Re: [fw-general] RewriteRouter->addConfig() ini guidelines?

2006-11-28 Thread Martel Valgoerad

Daniel Kipp wrote:

I just discovered the nice possibility to configure all the routing via 
an ini file.

But couldn't find the ini guidelines for an valid configuration.

please point me to them or an short example is also appreciated.


I know it's not exactly the thing you're asking for and it's a bit outdated 
(since Zend_Config changed it's interface for handling pure PHP configs) but I 
think it may be of some use for you.


http://www.ingredients.com.au/nick/2006/07/18/rewriterouter-and-zend_config-play-together/


daniel


--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"A paranoid is someone who knows a little of what's going on." -- William S.
Burroughs


[fw-general] RewriteRouter's performance (was: ZF without mod_rewrite)

2006-11-28 Thread Martel Valgoerad

Martel Valgoerad wrote:

By the way, you may achieve a significant performance boost refusing 
to use the resourse-consumpting RewriteRouter.
Do you have any benchmark data to support that theory? I agree it's doing a lot 
of work compared to the basic router, but even that shouldn't result in 
_significant_ loss of performance.


I have made some profiling using XDebug and KCacheGrind just to be sure.

RewriteRouter's routing takes 1.43% of run time for the whole hello world 
application. Plus 0.31% and 0.55% for inclusion of it's files. Compare it to 
Zend_Controller_Front::getInstance() which takes 1.08% of the time. So let's 
say RewriteRouter takes only two (maybe three!) times more time than simply 
obtaining an instance of the Front Controller. For all it's operations.


Not to mention just LOADING (I mean require_once) of front conroller 
(Front.php) or main Zend (Zend.php) classes which took 9.25% and 7.96% 
respectively.


34 kB cachegrind file is available for everybody. Just ask if you wish to see 
it for yourselves. Tested on a desktop machine with Athlon 2500+ and 512 MB of 
RAM.


--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"A paranoid is someone who knows a little of what's going on." -- William S.
Burroughs


Re: [fw-general] ZF without mod_rewrite

2006-11-28 Thread Martel Valgoerad

Bluejay wrote:


Hey all,
  I have the privilege of working on several different platforms  at 
work, and I'm very excited about including the ZendFramework in a lot of 
my applications.  However, a lot of my production applications are ran 
on Sun Servers running the SunOne webserver utilizing FastCGI.  SunOne, 
does not have support for mod_rewrite, so I've been trying to figure out 
a method that I can migrate my applications from Apache-based servers 
over to our SunOne servers.  This relies mainly on *not* using 
mod_rewrite.  With the latest preview release, what approaches can I use 
to solve my lack of mod_rewritability


I was actively lobbying for support of the standard PHP URL scheme in Front 
controller but this support was dropped along the way to incubator. Yet it's a 
good time to discuss it again.


It's a simple change to the code in the Request_Abstract in getControllerName 
and getActionName methods which instead of getting the names out of Request 
getParams should use plain get:


public function getControllerName()
{
-return $this->getParam($this->getControllerKey());
+return $this->get($this->getControllerKey());
}

This should do the trick for you. So if you want only to run the framework then 
change the line directly in the code since you can't subclass there because 
Zend_Controller_Request_Http extends Abstract.


===

But if we would like to make the whole framework PHP URL scheme aware, then I 
would recommend changing the routers and Request_Http as well.


Any artificially programmer created request parameters (like for example by the 
router or in the application plugins) should override normal user submitted 
ones (GET, POST, etc). I think everybody should agree here. So we make the 
modification to Request Http __get method to include those parameters. Since 
they are supposed to override anything else, we have to place them in the front:


public function __get($key)
{
switch (true) {
+case isset($this->_params[$key]):
+return $this->_params[$key];
case isset($_GET[$key]):
return $_GET[$key];
case isset($_POST[$key]):
return $_POST[$key];
case isset($_COOKIE[$key]):
return $_COOKIE[$key];


And finally the routers should use $request->get/set instead of 
getParams/setParams.


JIRA Issue:
http://framework.zend.com/issues/browse/ZF-604


Jay M. Keith - Zend Certified Engineer


--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Never explain -- your friends do not need it and your enemies will not
believe you anyway." -- Elbert Hubbard


Re: [fw-general] revision 1863 controller front

2006-11-28 Thread Martel Valgoerad

Kevin McArthur wrote:

Please mark the method protected then? The code the gentleman is using 
implies that a default route addition is part of bootstrapping the rewrite 
router. It is not based on your definition and it correctly should not be.


You're absolutely right, Kevin. I must have done an ugly copy and paste and 
must have forgot to change the visibility afterwards.



Kevin


--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Courage is resistance to fear, mastery of fear -- not absence of fear."
-- Mark Twain


Re: [fw-general] ZF without mod_rewrite

2006-11-28 Thread Martel Valgoerad

crocodile2u wrote:

By the way, you may achieve a significant performance boost refusing 

> to use the resourse-consumpting RewriteRouter.

Do you have any benchmark data to support that theory? I agree it's doing a lot 
of work compared to the basic router, but even that shouldn't result in 
_significant_ loss of performance.



Regards, Victor.


--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Dreaming permits each and every one of us to be quietly and safely insane
every night of our lives." -- William Dement


Re: [fw-general] revision 1863 controller front

2006-11-27 Thread Martel Valgoerad

Kevin McArthur wrote:

Instead of an implicit ->addDefaultRoutes whould it not make more sense to 
have the defaults enabled by... default..


But they are, Kevin. Look at the RewriteRouter's constructor - there is a
direct call to addDefaultRoutes.


and instead provide a removeDefaultRoutes() method for those who want to
remove the default functionality?


That's the main reason why I have introduced the removeRoute method lately. But
removeDefaultRoutes is another nice touch so I will probably add with the next
commit.


Im curious what the purpose of addDefaultRoute's very existance is.


I have moved the default route creation into its own method primarily to clean 
the constructor and to make it more readable. And making it easier to override 
the default routes if you choose to subclass the router.



Kevin McArthur


--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"The incompetent with nothing to do can still make a mess of it."
-- Laurence J. Peter


Re: [fw-general] Zend::exception() and Zend::isReadable()

2006-11-23 Thread Martel Valgoerad

Richard Thomas wrote:

Possibly a stupid idea, but since all Zend classes are required to 
follow a specific standard instead of doing

>

require_once 'Zend/Exception.php';

Wouldn't

if(!class_exists('Zend_Exception')) {
require 'Zend/Exception.php';
}

Work and be a lot faster, considering the number of files loaded for a 
simple application ( 32 ) it might make sense.


I think the overhead is actually caused by including the files and not by 
checking if the files were previously loaded (since these were optimized in 
recent php updates). And on top of this, all of those files are in fact 
required so how much will you save? Like 5-10% of all require_once calls?


It's always worth to try but I wouldn't expect any miracles out of this.

Now, on the Paul's benchmarks. I don't know how Solar is like 4 times faster 
but I'll tell you why Symphony is significantly leaner. As far as I know, it's 
based on Mojavi code base and Mojavi used to gather all of it's classes in one 
big cached file on the first run. And while doing so it avoided loading of tons 
of the files in a single request. Loading one big file plus cached user configs 
instead.


Top of config_compile.conf.php:

http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"It is better to keep your mouth closed and let people think you are a fool
than to open it and remove all doubt." -- Mark Twain


Re: [fw-general] Zend::exception() and Zend::isReadable()

2006-11-23 Thread Martel Valgoerad

Richard Thomas wrote:

As to the Zend-Exception stuff, looking throw the changeset it didn't 
look like enough files had been updated yet to make a difference but 
from my earlier tests  there should be a good 8-10% improvement.


Refactoring exceptions won't improve anything. In controller module we're 
avoiding loading like 3-4 Exception files compared to 60 file lookups and 29 
file inclusions on a hello world application:


strace php index.php 2>&1 | grep "^open" | grep "/home/martel/WWW" \
  | grep -v "No such file" | wc -l
60

After whole refactoring (like omitting Reflection calls) the biggest problem 
still lies in inclusions (require_once - 66% of the run time):


pprofp-php5 -v /home/martel/WWW/apd/pprof.07356.5

 Real UserSystem secs/cumm
%Time (excl/cumm)  (excl/cumm)  (excl/cumm) Callscalls/call  Memory 
Usage Name

--
16.7 0.01 0.01  0.00 0.00  0.00 0.00 2  0.   0.0 
Zend_Controller_Request_Http->getBaseUrl
16.7 0.00 0.00  0.00 0.00  0.00 0.00 2  0.   0.0 
Zend_Controller_Dispatcher->setParams
66.7 0.02 0.09  0.02 0.05  0.00 0.0029  0.   0.0 
require_once


Tested on revision 1847 with only with APD running. Without any compiler caches.


Richard Thomas - Code Monkey


--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"A paranoid is someone who knows a little of what's going on." -- William S.
Burroughs


Re: [fw-general] Route with special characters

2006-11-17 Thread Martel Valgoerad

Teemu Valimaki wrote:

Yes, you're absolutely right. The default regex was accepting a limited range 
of characters. I have modified it to use all UTF letters now.

Please, give it a try.

I'm having doubts if I'm using this incorrectly because it still doesn't
work. If I have a router set for /test/:name and call it with /test/ä it
does not work. So I tried to urlencode ä to %C3%A4 but this doesn't work
either, IndexController noRouteAction is called instead.


Are you absolutely sure you're using latest svn _incubator_ version of the 
router? How is your include path set?


This works on my setup:

Bootstrap:
--

$router = new Zend_Controller_RewriteRouter();
$router->removeRoute('compat');
$router->addRoute('utf', new Zend_Controller_Router_Route(':name',
   array('controller'=>'index', 'action' => 'index')));

$controller = Zend_Controller_Front::getInstance();
$controller->setRouter($router);

$request = new Zend_Controller_Request_Http();
$request->setBaseUrl('/test');

$controller->setRequest($request);

$controller->setControllerDirectory('controllers');
$controller->dispatch();


indexAction of IndexController:
---

var_dump($this->getRequest()->getParams());
var_dump($this->_getParam('name') === 'ä');

Result:
---

array(3) {
  ["name"]=>
  string(2) "ä"
  ["controller"]=>
  string(5) "index"
  ["action"]=>
  string(5) "index"
}

bool(true)

--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"If you tell the truth you don't have to remember anything." -- Mark Twain


Re: [fw-general] Route with special characters

2006-11-16 Thread Martel Valgoerad

Teemu Valimaki wrote:

I have added a test for that case. And if there will be no signs of broken code 
or any other faulty behavior in upcoming days, I will also modify the library 
version to cover that.

I downloaded it and the tests that you supply probably do work but what
if I have is /test/:name and if that :name includes problematic
characters or urlencoded it doesn't work. Or then I'm not using it
correctly.


Yes, you're absolutely right. The default regex was accepting a limited range 
of characters. I have modified it to use all UTF letters now.


Please, give it a try.


As a side note, would it be smart to support automatically or by
parameter urldecode with routes (such as :name, is it called route)?


I don't think I get your meaning here correctly. But if you mean if it's smart 
to url decode inside a router then my answer is:


It has to be done somewhere. I think the best place for that would be in the 
Zend_Http_Request itself. Presumably in get* methods because you want to keep 
your original request data intact in case something has to be accessed in raw 
format. But maybe get methods could possibly have a flag for a programmer to 
choose if he wishes to filter the data or not. Like for example:


public function getParam($key, $decode = true) {
   ...
   if ($decode) $value = urldecode($value);
   return $value;
}

But it's actually Matthew's decision here.

--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Tact is the knack of making a point without making an enemy." -- Isaac Newton


Re: [fw-general] Route with special characters

2006-11-16 Thread Martel Valgoerad

Teemu Valimaki wrote:


First I have to thank everybody for such a great work with ZF, it's a
life saver.


Thank you, Teemu.


I have URLs with scandinavian letters so I've translated them with
htmlentities and urlencode however this apparently breaks routes. Below
is a small example here where the first works and two others do not.
What would be the solution to fix this?


Well, the solution is to fix the router actually. What I hopefully just did 
with the _incubator_ version of the router. It should work with international 
web addresses encoded in UTF-8 from now on.


It's changeset 1640. Please, give it a try.

I have added a test for that case. And if there will be no signs of broken code 
or any other faulty behavior in upcoming days, I will also modify the library 
version to cover that.


--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"The reason grandparents and grandchildren get along so well is that they
have a common enemy." -- Sam Levenson


Re: [fw-general] Spamming JIRA

2006-11-13 Thread Martel Valgoerad

Simon Mundy wrote:

It looks as if the JIRA tracker will need to be tightened down some more 
- someone's just posted a porn link via issue #ZF-546


Same goes for ZF-351 and ZF-254.


Simon Mundy | Director | PEPTOLAB


--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"I am not young enough to know everything." -- Oscar Wilde


Re: [fw-general] Router issue?

2006-10-24 Thread Martel Valgoerad

Kevin McArthur wrote:

I'm having a noroute issue with a specific route. Im trying to override 
the default action in the rewrite router to take :action only.
 
$router->addRoute('defaultaction',':action', 
array('controller'=>'index','action' => 'index'));
 
But this throws errors when it hits a non-routeable action, instead of 
calling noRouteAction instead. (ie /nonexistantaction throws


It's not a router issue but an Action functionality. Take a look at the __call 
method in the Zend_Controller_Action.


Matthiew is currently in the middle of preparing a revised Zend_Controller 
module which will probably change the way it is handled.


--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"War is a series of catastrophes that results in a victory." -- Georges
Clemenceau


Re: [fw-general] Re: ZFTestManager available in laboratory

2006-10-18 Thread Martel Valgoerad

Ralph Schindler wrote:

Sebastian Bergmann wrote:

Darby Felton wrote:

http://framework.zend.com/issues/browse/ZF-417

 I do not understand what "Cannot run isolated tests" refers to. Every
 test is run in an isolated environment (fresh object of the test case
 class plus cleaned up $GLOBALS etc.) by PHPUnit.



Given the conventions used in the stock AllTests file, its impossible to 
load and run a specific suite of tests without loading all tests.  This 
leads to one inconvenience and one problem.



[EMAIL PROTECTED] $ cd WWW/ZendFramework/tests/Zend/Controller/
[EMAIL PROTECTED] $ phpunit Zend_Controller_RewriteRouterTest 
RewriteRouterTest.php
PHPUnit 3.0.0alpha17 by Sebastian Bergmann.
 ...

Time: 00:00

OK (23 tests)


-ralph


--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Often it does seem a pity that Noah and his party did not miss the boat." --
Mark Twain


Re: [fw-general] How to be removed from these mailing lists?

2006-10-12 Thread Martel Valgoerad

Alexander Hanhikoski wrote:


Dear Zend framework community,
How can I remove my e-mail address from the mailing lists? There should 
be clear how-tos about this on the website!


Look at the mail headers.

List-Unsubscribe: <mailto:[EMAIL PROTECTED]>


-Alex


--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"In a mad world only the mad are sane." -- Akira Kurosawa


Re: [fw-general] RE: Help with WSDL Schema Validation

2006-10-12 Thread Martel Valgoerad

Davey Shafik wrote:

Can anyone offer some assistance here? I'm starting to think that all 
WSDL's deviate from the schema, because other than the obvious
differences (different/more methods) the Paypal and Google WSDLs are 
identical.


Have you actually tried to validate the Google wsdl with this schema? What's 
the result?


If the result is positive try to strip your wsdl to the only one erroneus 
operation line. Let's find out if it's the one under portType or the ones under 
binding.


Ok, forget that. I have copied and pasted the code to the Eclipse wsdl editor. 
It seems it doesn't like the soap:operation elements under binding operations. 
These two:


http://dummy.php#testFunc2"/>
http://dummy.php#testFunc3"/>

Move them to the front and place them as the first element under the bindings. 
Before inputs and outputs.



- Davye


--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Generosity is giving more than you can, and pride is taking less than you
need." -- Kahlil Gibran


Re: [fw-general] Keeping up with the latest developer code

2006-10-06 Thread Martel Valgoerad

gonyuu wrote:


I've been having some troubles myself with the latest controller. Firstly,
it seems you must provide a RewriteRouter, else an exception will be caught
and a "404" error will display, defaulting to the noRouteAction(). So:

$route = new Zend_Controller_RewriteRouter();
$ctrl = Zend_Controller_Front::getInstance();
$ctrl->setRouter($route);
$ctrl->run('/path/to/controller');


From here, I assumed that RewriteRouter's included 'default' or 'compat'

routes would take care of the basic routing for :controller/:action, but all
of my routes get sent to index/index for whatever URL I supply.

Could someone help us out with this? Or point us to where there is
documentation on the changes that've been committed?


$route = new Zend_Controller_RewriteRouter();

Now provide a rewrite base which was probably incorrectly detected with your setup. 
Set it to a slash '/' if you run from root dir or a '/subdir' if you run your app 
from within a webserver subdirectory:


$route->setRewriteBase('/');

$ctrl = Zend_Controller_Front::getInstance();
$ctrl->setRouter($route);
$ctrl->run('/path/to/controller');

--
Martel Valgoerad aka Michal Minicki | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell


Re: [fw-general] Please Welcome Bill Karwin to our team

2006-10-06 Thread Martel Valgoerad

Ralf Eggert wrote:


Do we really need all documentation files in every language in every
snapshot? What do you and others think?


I would go even further. Do we need the translated manuals in the base svn 
repository? It would be great if they could be kept in another one and synced 
via svn:external.



Ralf


--
Michael Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | 
http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"A paranoid is someone who knows a little of what's going on." -- William S.
Burroughs