Re: Data validation doesn't work when on live server

2010-02-18 Thread jperras
1) You're probably running CentOS on your production server.
2) CentOS ships with broken PCRE UTF-8 libraries.
3) A few of the validation rules in CakePHP use multibyte flags (e.g.
for alphanumeric validation)

Combine the above, and you get the problem you've described.

Solutions:

1) Ditch CentOS. It's a piece of shit for PHP web development. It
ships with PHP 5.1.6 (4 years old), an ancient version of Apache,
OpenSSL 3.x (which is currently at a 5.x release), and more. Using
CentOS is just going to cause pain and trouble.

2) Stick with the shit that is CentOS, and fix the RPMs:
http://gaarai.com/2009/01/31/unicode-support-on-centos-52-with-php-and-pcre/

3) Write your own custom validation rules for any built-in rules that
use multibyte flags in the regular expressions.

There aren't really any other options.
-jperras

On Feb 17, 3:43 pm, Atti  wrote:
> Hi all,
> Just a quick question, I managed to get my data validation working
> perfectly on my local apache (XAMPP) web server, but as soon as I
> uploaded the site to the internet the validation flag seems to be
> always true, ie, there is not validation going on, so it seems. What
> settings on my live server would allow this to happen, the page im
> talking about is:http://www.findworkabroad.com/signup
>
> any help grately appreciated
>
> Thanks
> Atti

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: SSL and https

2010-02-18 Thread jperras
http://github.com/plank/secured

-jperras.

On Feb 17, 12:54 am, Jeremy Burns  wrote:
> Any takers on this please?
>
> Jeremy Burns
> jeremybu...@me.com
>
> On 12 Feb 2010, at 05:00, Jeremy Burns wrote:
>
>
>
> > I am using the security component from app_controller. In some
> > controllers I have this in my beforeFilter:
>
> >    if (in_array($this->params['action'], $action)):
> >            $this->Security->blackHoleCallback = 'forceSSL';
> >            $this->Security->requireSecure();
> >    else:
> >            $this->Security->blackHoleCallback = 'unforceSSL';
> >    endif;
>
> > I have these two functions in app_controller:
>
> >    function forceSSL() {
>
> >            $this->redirect('https://' . env('SERVER_NAME') . $this->here);
>
> >    }
>
> >    function unforceSSL() {
>
> >            $this->redirect('http://' . env('SERVER_NAME') . $this->here);
>
> >    }
>
> > This is working in the sense that the right actions in the right
> > controllers are being redirected to https. But once I am in https, I
> > stay there.
>
> > My question is: how do I get the site to go back to http for those
> > controller actions that do not require https?
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Help Getting Model name

2009-11-08 Thread jperras

Look up what `array_keys()` does.

-jperras.

On Nov 8, 12:26 pm, "Dave"  wrote:
> Is there a simple way to get the model name from something like this?
>
> This is the data that's sent to cake.
>
> data[Contact][email] t...@something.com
> data[Account][email] te...@fake.com
>
> Debug will get me
> Array(
>     [Contact] => array(
>                    [Email] => t...@something.com
>                         )
> )
>
> Where I simply need 'Contact' or 'Account'
>
> Thanks
>
> Dave
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Last retrieved data accessible in model?..

2009-11-08 Thread jperras

How would you get it to persist between requests?

`var $cacheQueries = true;` will cache the results of model queries in
memory, which might be what you're looking for. If you're looking for
something that can persist the last accessed data across requests, I'd
implement what you're describing by implementing a Model::afterFind()
in your app_model which caches the results.

-jperras.

On Nov 7, 4:06 am, jayarjo  wrote:
> I wonder whether data retrieved by last query (as a result of Model-
>
> >find() for example) is accessible in some internal Model variable?
>
> I'm trying to build custom datasource and one of the ideas was to
> store last retrieved data in there somewhere, but I'm not sure whether
> this is established practice.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CakePHP + Python's scipy/numpy/matolab/etc?

2009-11-04 Thread jperras

http://stackoverflow.com/questions/166944/calling-python-in-php
http://www.csh.rit.edu/~jon/projects/pip/

It's not the simplest thing, but it's doable.
-j.

On Nov 2, 1:43 am, Josh  wrote:
> Hello,
>
> I've got a question about mixing languages in a project:
>
> I am using Cake on an App and it is going quite well. However, I now
> need to do some statistical analysis/curve fitting/advanced plotting/
> matrix manipulation/object difference calc/etc. In retrospect, I
> should have done this project in a python framework from the
> beginning, but I like Cake so I stuck with it. Now I am looking to get
> the functionality of scipy/numpy/matolab/etc APIs/modules. At this
> point, how best should I integrate these? Would it be easiest to make
> a bare bones API that returns the data/NLR formulas in perhaps a json
> or xml format?  I was thinking of using a python framework such as
> Django so as to be able to use its serializer and other tools. Any
> suggestions? Has anyone had to integrate code libraries from other
> languages in this way before?
>
> Please let me know if I'm wrong about PHP and if I've over looked
> libraries with functionality and stability that rival the python
> libraries I mentioned.
>
> Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: caching Media View

2009-10-31 Thread jperras

Setting the 'cache' option will send the Cache-Control: max-
age=, Expires= and Pragma: cache headers. It
does not change the response HTTP 1.1 code to 304, nor does it set the
If-Modified-Since header.

-j.

On Oct 31, 2:17 am, tol  wrote:
> Can someone tell me how caching in media views is supposed to work?
>
> example:
>         $this->view = 'Media';
>         $params = array(
>               'id' => $id,
>               'cache' => 10,
>               'download' => false,
>               'extension' => 'jpg',
>               'path' => 'restricted' . DS . 'uservideo' . DS
>
>        );
>        $this->set($params);
>
> Works fine but I get the feeling its not caching. The headers of the
> images are 200 OK not 304
> Am I doing something wrong? Or am I misunderstanding / overlooking
> something?
> 'cache'=>true does not change anything either...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Before render being called twice?

2009-10-23 Thread jperras

It's called once for rendering the layout, and a second time for
rendering the view that gets inserted into $content_for_layout.

-jperras.

On Oct 21, 9:09 am, Amit Rawat  wrote:
> Hello friends,
>
>  I am having a problem my before render function in app controller is being
> called twice. can anyone tell me why is this happening?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Possible bug relative to use of memcache

2009-10-07 Thread jperras

Memcache being used as a cache configuration and Sessions have pretty
much nothing in common, unless you've set your session save handler
(in app/core.php) to be cache-based, which is usually not a good idea
unless you know what you're doing.

-j.

On Oct 6, 5:19 pm, "marco.rizze...@gmail.com"
 wrote:
> Hi
> I have installed memcache on my system.
> I have setted CakePHP to use memcache.
> I have setted the       Configure::write('Security.level', 'medium');
> All seems to work but sometimes I lost the session. In particular I
> note this when I do a sequence of ajax call.
> A simple example to show this error is:
>
> /*My Controller*/
>
> ..
>         function test($show=0){
>                 if ($show==1){
>                         $this->layout='ajax';
>                         echo "";
>                         
> print_r($this->Session->read($this->Auth->sessionKey));
>                         echo "";
>                         die();
>                 }
>         }
> ...
>
> /*My Test View*/
>  echo $ajax->link(
>     'test',
>     array( 'controller' => 'my_controller', 'action' => 'test','1'),
>     array(
>         'update' => 'test_1',
>         'after' => $ajax->remoteFunction(
>                 array(
>                    'url' => array(
>                        'controller' => 'my_controller', 'action' =>
> 'test','1'),
>                        'update' => 'test_2',
>                    )
>                ),
>         ),
>     null,false
> );
> ?>
> 
> 
>
> I hope someone can help me about this.
> Many Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to add a random number while including a css file ?

2009-10-07 Thread jperras

Uncomment the configure directive of Asset.timestamp in app/config/
core.php. If set to true, it will add a timestamp querystring
parameter to your CSS and Javascript files when in production mode
(debug = 0).

-j.

On Oct 7, 6:05 am, Abhishek  wrote:
> Hi,
> I was facing some caching related issues .. so i thought including a
> random value might help solve the problem ..
>
> This is what i added while including a css file
>
> css("style"."?cb=".time());?>
>
> which worked fine on my local apache server ..  but when i uploaded it
> to the production server (which is also running apache ) .. it
> failed .. the css file was not getting included ..
>
> Any clue wht went wrong ..
>
> Regards
> Abhishek Jain
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: textmate snippets not working

2009-09-03 Thread jperras

This is the official textmate bundle: http://thechaw.com/cakephp_tmbundle
(the one you link to is a fork of the official one on github).
The one currently in the textmate subversion repository was
unofficial, and was for a much earlier version of CakePHP.

-jperras.

On Sep 3, 12:39 am, mikeottinger  wrote:
> Hi All,
>
>    So I ditched the bundle and went searching for another source. Lo
> and behold I found this:
>
>    http://www.etoxified.com/cakephp-bundle-for-textmate
>
>    It requires git, but I downloaded it refreshed my bundles and
> voila, it worked. I'm running textmate 1.5.8, I'm wondering if there
> are compatibility issues with this and version of the CakePHP bundle
> available through the svn url above. Sort of a shot in the dark in
> terms of explanation, but I'm at a loss as to why I couldn't get it
> working before. Hopefully this is helpful to others.
>
> Thanks.
>
> On Sep 2, 7:47 am, mikeottinger  wrote:
>
> > Thanks for the help. Yes, there's one bundle, it was a typo. And I
> > removed it and reinstalled it within /Library/Application Support/
> > TextMate/Bundles like this:
>
> > svn cohttp://svn.textmate.org/trunk/Review/Bundles/PHP%20Cake.tmbundle/
>
> > I then fired up TextMate, but alas, still no luck. I went into the
> > bundle's Snippet directory and listed the permissions there:
>
> > -rw-r--r--
>
> > Don't these need to be executable?
>
> > Thanks again.
>
> > On Sep 2, 3:36 am, Martin Westin  wrote:
>
> > > Bundles? Unless that's a typo, you might need to stick with one bundle
> > > for CakePHP or you might get some conflict.
>
> > > I have this 
> > > onehttp://svn.textmate.org/trunk/Review/Bundles/PHP%20Cake.tmbundle
> > > installed in ~/Library/Application Support/TextMate/Bundles/
>
> > > It works as it should for me. "dat" will expand to "$this->data['…']"
> > > for example.
>
> > > I have a vague memory of some bundle causing me problems because of
> > > file permissions. Try chmodding your bundle (which is one of these
> > > Apple faux-directories) to make sure Textmate can do it's thing. If
> > > you check it out using subversion they should be ok but you never
> > > know.
>
> > > On Sep 2, 8:15 am, mikeottinger  wrote:
>
> > > > Hi All, I've scoured the web and had no luck, I've installed the
> > > > bundles for cakephp, I've set the file type for my php file to HTML
> > > > (PHP Cake), yet none of the snippets work for me. For instance, I try
> > > > typing dat then hitting tab and nothing happens. Is there something
> > > > else I'm missing perhaps? Is this not a fully supported bundle
> > > > anymore?
>
> > > > Thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CakePHP + PHP5.3 = ?

2009-08-31 Thread jperras

Coffee, and very understanding girlfriends/boyfriends/husbands/
wives ;-).

On Aug 31, 12:08 pm, d  wrote:
> how do you guys find the time? seriously. you people are awesome.
>
> On Aug 31, 7:19 am, jperras  wrote:
>
> > Alright guys, it seems like you're all a bit confused.
>
> > If you only read one line of this entire post, read this: CakePHP 1.3 !
> > = Cake3
>
> > Now, while this may seem obvious to many, you guys have made the same
> > mistake that I've seen a few times on the #cakephp channel. The first
> > is a branch in the cakephp 1.x project, and the last is a completely
> > different beast altogether.
>
> > CakePHP 1.2 supports PHP4 and PHP5.2, inclusively. PHP 5.3 introduced
> > a few changes to the error handler flags, which we have accounted for
> > in CakePHP 1.3-dev and will be accounting for in all subsequent
> > releases.
>
> > The reason we are not including PHP 5.3 compatibility in CakePHP 1.2.x
> > is that we want people to move forward to CakePHP 1.3 & up when they
> > become stable. If you're willing to update the php *language* to a new
> > point release and not willing to update your application to a new
> > framework point release, I think you have a slight disconnect. If you
> > want, you could always apply the patches that we have committed to 1.3-
> > dev to a local git branch, and continue on your merry way by merging
> > in upstream changes from 1.2.x into your local branch.
>
> > CakePHP 1.2.x and 1.3.x are in *the same project*, 
> > athttp://code.cakephp.org/cakephp
> > . 1.2 and 1.3-dev are simply different branches.
>
> > CakePHP 2.0, a *different project*, is *also* being worked on, which
> > will be PHP 5.2 and up *only*, meaning we're dropping support for
> > PHP4. Seehttp://code.cakephp.org/cakephp2tofollow along the
> > development of this project. The goal of this release is to be a
> > nearly transparent upgrade for anyone running CakePHP 1.3 stable
> > (whenever that is released), meaning that the two should be pretty
> > much 100% API compatible.
>
> > Finally Cake3 is a *different project*, found 
> > athttp://code.cakephp.org/cake3.
> > This is an experimental project which is a complete rewrite of the
> > CakePHP framework from the ground up, and will *only* support PHP 5.3
> > and up.
>
> > I hope this clears up some of the confusion.
> > -jperras.
>
> > On Aug 30, 2:45 pm, Miles J  wrote:
>
> > > Yeah im pretty positive it wont be interchangeable. It uses a whole
> > > new model setup and also uses namespaces.
>
> > > The most you can do is interchange between 1.3/2.0.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CakePHP + PHP5.3 = ?

2009-08-31 Thread jperras

Alright guys, it seems like you're all a bit confused.

If you only read one line of this entire post, read this: CakePHP 1.3 !
= Cake3

Now, while this may seem obvious to many, you guys have made the same
mistake that I've seen a few times on the #cakephp channel. The first
is a branch in the cakephp 1.x project, and the last is a completely
different beast altogether.

CakePHP 1.2 supports PHP4 and PHP5.2, inclusively. PHP 5.3 introduced
a few changes to the error handler flags, which we have accounted for
in CakePHP 1.3-dev and will be accounting for in all subsequent
releases.

The reason we are not including PHP 5.3 compatibility in CakePHP 1.2.x
is that we want people to move forward to CakePHP 1.3 & up when they
become stable. If you're willing to update the php *language* to a new
point release and not willing to update your application to a new
framework point release, I think you have a slight disconnect. If you
want, you could always apply the patches that we have committed to 1.3-
dev to a local git branch, and continue on your merry way by merging
in upstream changes from 1.2.x into your local branch.

CakePHP 1.2.x and 1.3.x are in *the same project*, at 
http://code.cakephp.org/cakephp
. 1.2 and 1.3-dev are simply different branches.

CakePHP 2.0, a *different project*, is *also* being worked on, which
will be PHP 5.2 and up *only*, meaning we're dropping support for
PHP4. See http://code.cakephp.org/cakephp2 to follow along the
development of this project. The goal of this release is to be a
nearly transparent upgrade for anyone running CakePHP 1.3 stable
(whenever that is released), meaning that the two should be pretty
much 100% API compatible.

Finally Cake3 is a *different project*, found at http://code.cakephp.org/cake3.
This is an experimental project which is a complete rewrite of the
CakePHP framework from the ground up, and will *only* support PHP 5.3
and up.

I hope this clears up some of the confusion.
-jperras.

On Aug 30, 2:45 pm, Miles J  wrote:
> Yeah im pretty positive it wont be interchangeable. It uses a whole
> new model setup and also uses namespaces.
>
> The most you can do is interchange between 1.3/2.0.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CakePHP + PHP5.3 = ?

2009-08-31 Thread jperras

Alright guys, it seems like you're all a bit confused.

If you only read one line of this entire post, read this: CakePHP 1.3 !
= Cake3

Now, while this may seem obvious to many, you guys have made the same
mistake that I've seen a few times on the #cakephp channel. The first
is a branch in the cakephp 1.x project, and the last is a completely
different beast altogether.

CakePHP 1.2 supports PHP4 and PHP5.2, inclusively. PHP 5.3 introduced
a few changes to the error handler flags, which we have accounted for
in CakePHP 1.3-dev and will be accounting for in all subsequent
releases.

The reason we are not including PHP 5.3 compatibility in CakePHP 1.2.x
is that we want people to move forward to CakePHP 1.3 & up when they
become stable. If you're willing to update the php *language* to a new
point release and not willing to update your application to a new
framework point release, I think you have a slight disconnect. If you
want, you could always apply the patches that we have committed to 1.3-
dev to a local git branch, and continue on your merry way by merging
in upstream changes from 1.2.x into your local branch.

CakePHP 1.2.x and 1.3.x are in *the same project*, at 
http://code.cakephp.org/cakephp
. 1.2 and 1.3-dev are simply different branches.

CakePHP 2.0, a *different project*, is *also* being worked on, which
will be PHP 5.2 and up *only*, meaning we're dropping support for
PHP4. See http://code.cakephp.org/cakephp2 to follow along the
development of this project. The goal of this release is to be a
nearly transparent upgrade for anyone running CakePHP 1.3 stable
(whenever that is released), meaning that the two should be pretty
much 100% API compatible.

Finally Cake3 is a *different project*, found at http://code.cakephp.org/cake3.
This is an experimental project which is a complete rewrite of the
CakePHP framework from the ground up, and will *only* support PHP 5.3
and up.

I hope this clears up some of the confusion.
-jperras.

On Aug 30, 2:45 pm, Miles J  wrote:
> Yeah im pretty positive it wont be interchangeable. It uses a whole
> new model setup and also uses namespaces.
>
> The most you can do is interchange between 1.3/2.0.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Model validation on unit testing

2009-07-23 Thread jperras

Look up the difference between the 'required' rule and the 'notempty'
rule.

http://book.cakephp.org/view/129/required

-jperras.

On Jun 7, 9:14 am, williamn  wrote:
> Hi all,
>
> I have a simple model like below
>
> class Department extends AppModel {
>
>         var $name = 'Department';
>         var $validate = array(
>                 'code' => array('notempty'),
>                 'name' => array('notempty'),
>                 'abbreviation' => array('notempty'),
>                 'phone_num' => array('notempty')
>         );
>
> }
>
> and create a simple test like this
>
> function testInvalidCreate() {
>         $this->Department->create();
>         $this->assertFalse($this->Department->save());
>
> }
>
> correct me if I'm wrong, $this->Department->save() should return false
> right? but in my case it returning an array.
>
> Any suggestion?
>
> Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: javascript -> link in element doesnt work

2009-07-23 Thread jperras

You can't use JavascriptHelper::link from an element to insert scripts
into the header; this is a fundamental constraint imposed by the two-
step render engine ( http://martinfowler.com/eaaCatalog/twoStepView.html
).

There are some ways around this using the class registry, but that's
mostly meant for use in custom helpers that need to insert scripts
into the header.

-jperras.

On Jul 23, 2:46 am, Yannis  wrote:
> Thanks guys,
> The thing is that scripts_for_layouts is in an element that I include
> in the layout.
> And this is for the simple reason that the head elements of the page
> are included there.
>
> I will try and include the scripts_for_layouts outside the head of the
> html page.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: A Search Behavior

2009-07-10 Thread jperras

It's already implemented & being used on the cookbook as a plugin:

http://thechaw.com/cakebook/source/plugins/searchable

It uses Lucene & the adapter from ZendFramework, and works well
enough.

-j.

On Jul 10, 11:29 pm, Stinkbug  wrote:
> I've done a little searching around on the web for search features for
> CakePHP.  I've found a couple of different Searchable Behaviors out
> there.  However, they all seem a bit basic.  I have a few ideas for a
> more advanced Search feature.  First, I believe a Behavior would
> probably the way to go, right?
>
> Second there are several features I would like to implement into a
> search, such as keyworks, like:
>
> yesterday (not sure)
> today (not sure)
> NOT
> OR
> AND
>
> I would also like to have a shell/task that could be used to create an
> index for faster searching.  I have a data model in mind already and
> some ideas for rules.
>
> Anyone up for helping with the challenge?  I'm up for writing most of
> it myself, but it would be great to have some outside input and
> someone who could check my code and make suggestions.  But if someone
> wants to help write some of the code, that's good too.
>
> I know search can be a complicated thing and this won't be Google or
> anything like that, but the bottom line for me is that it works fairly
> well and it's simple to use and implement.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: marketplace app, prevent users from buying their own stuff

2009-07-10 Thread jperras

And how are you going to prevent people from registering with a
different username/id & just buying their products from that account?

On Jul 8, 11:47 pm, Jacob Everist  wrote:
> I have question on the best way of applying rules to types of actions
> on certain models with ownership properties.  The application I'm
> building is a type of market place application where users are selling
> many items and others can bid on them and buy them.
>
> I understand that ACL is best for giving permission for request
> objects to access control objects.
>
> Where and how is the best way to implement the rule such that I can
> buy anyone's stuff but my own?  Does ACL have support for complex
> rules on access?
>
> The models look like this:
> User hasMany Item
> Item belongsTo User
>
> --
> Jacob Everist
>
> cell:  310-425-9732
> email:  jacob.ever...@gmail.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Automated Functional Testing

2009-07-10 Thread jperras

Also, while the information you provide is great, it can be done
without the blatant spam for your "Software Testing Training". If
people want to attend a training, they can find one easily enough.

On Jul 9, 8:05 am, Software Testing Training 
wrote:
> Automated Functional Testing
>
> By Bhrigu Malhotra (http://www.qacampus.com)
>
> First of all let me make you all aware that I’m a developer and what
> you are going to read further is a developer’s account, so it may
> sound to you like a layman tester. But what I’m going to share is
> something which has been very helpful to me to ‘functionally’ test the
> web application our team has been building and I thought this may help
> you as well. So even if you are a tester, try to think the way
> developer’s think for some time, I’m sure this would be useful to you
> too.
>
> Before I go ahead, I think we all understand that Functional Testing
> is testing the functionality of our application which means you’d
> probably be going through a login using some credentials, clicking
> some links, verifying some outputs - in simplest terms. Now just give
> it a thought that if you can automate these i.e. invest some time for
> once and then while you are sipping a cup of coffee, someone is
> testing what you coded. Change your code 10 times and run your test 10
> times to ensure nothing breaks, so easy. Not just this if you have
> continuous integration server setup which runs your tests, you’d come
> to know immediately if and when someone else broke your code. Believe
> me ones who have used it, feel it is fantastic.
>
> There are a variety of tools available for this over internet each
> with pros/cons but I’m going to share some info here about one which I
> liked very much and have been using for a while now. I’d also share
> why I preferred it over others.
>
> Ok, no longer prolonging the suspense the tool I’m talking about is
> called Canoo WebTest (webtest.canoo.com) which is a free Open Source
> tool for automated testing of web applications in a very effective
> way. The primary reason why I liked it is that it is FAST; very fast …
> most of the test cases that I’ve written are executed in less than a
> minute and that too over remote applications deployed on servers on
> the other side of globe. Second reason for liking it so much is the
> ease of writing; very quickly you can build up your tests. Though they
> have released a WebTest recorder plug-in which when installed in
> Mozilla Firefox can record the script for you, but believe me the more
> you start writing there test cases, the less reliant you will become
> on the recorder. Third thing is these tests do not use a browser so
> that completely eliminated browser-specific issues which some tools
> are plagued with.
>
> Now some things about WebTest which some people don’t like is you
> actually do not see the tests being executed i.e. loading of a browser
> window, automatic clicking on buttons and errors on the screen (if
> any). But that I feel that it is so by design …. Doing all this takes
> time and then browser issues too creep in, so I’m happy like this way
> only. I agree they can improve on reporting of errors but again the
> objective of this tool is to test and just to test, if you want to
> report issues manual intervention is needed.
>
> At last I’ll just say go give it a try, I’m sure once past initial
> hiccups, you’ll start liking it the way I am.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Automated Functional Testing

2009-07-10 Thread jperras

Selenium is quite well suited for functional testing, and has a huge
amount of features, and doesn't require you to write tests in XML
(*shudder*) or in Groovy (dying language).
You can even get distributed testing up & running quickly enough,
which offsets the test time & allows you to test as many browsers as
you have access to.

http://seleniumhq.org/
http://selenium-grid.seleniumhq.org/

-j.


On Jul 9, 8:05 am, Software Testing Training 
wrote:
> Automated Functional Testing
>
> By Bhrigu Malhotra (http://www.qacampus.com)
>
> First of all let me make you all aware that I’m a developer and what
> you are going to read further is a developer’s account, so it may
> sound to you like a layman tester. But what I’m going to share is
> something which has been very helpful to me to ‘functionally’ test the
> web application our team has been building and I thought this may help
> you as well. So even if you are a tester, try to think the way
> developer’s think for some time, I’m sure this would be useful to you
> too.
>
> Before I go ahead, I think we all understand that Functional Testing
> is testing the functionality of our application which means you’d
> probably be going through a login using some credentials, clicking
> some links, verifying some outputs - in simplest terms. Now just give
> it a thought that if you can automate these i.e. invest some time for
> once and then while you are sipping a cup of coffee, someone is
> testing what you coded. Change your code 10 times and run your test 10
> times to ensure nothing breaks, so easy. Not just this if you have
> continuous integration server setup which runs your tests, you’d come
> to know immediately if and when someone else broke your code. Believe
> me ones who have used it, feel it is fantastic.
>
> There are a variety of tools available for this over internet each
> with pros/cons but I’m going to share some info here about one which I
> liked very much and have been using for a while now. I’d also share
> why I preferred it over others.
>
> Ok, no longer prolonging the suspense the tool I’m talking about is
> called Canoo WebTest (webtest.canoo.com) which is a free Open Source
> tool for automated testing of web applications in a very effective
> way. The primary reason why I liked it is that it is FAST; very fast …
> most of the test cases that I’ve written are executed in less than a
> minute and that too over remote applications deployed on servers on
> the other side of globe. Second reason for liking it so much is the
> ease of writing; very quickly you can build up your tests. Though they
> have released a WebTest recorder plug-in which when installed in
> Mozilla Firefox can record the script for you, but believe me the more
> you start writing there test cases, the less reliant you will become
> on the recorder. Third thing is these tests do not use a browser so
> that completely eliminated browser-specific issues which some tools
> are plagued with.
>
> Now some things about WebTest which some people don’t like is you
> actually do not see the tests being executed i.e. loading of a browser
> window, automatic clicking on buttons and errors on the screen (if
> any). But that I feel that it is so by design …. Doing all this takes
> time and then browser issues too creep in, so I’m happy like this way
> only. I agree they can improve on reporting of errors but again the
> objective of this tool is to test and just to test, if you want to
> report issues manual intervention is needed.
>
> At last I’ll just say go give it a try, I’m sure once past initial
> hiccups, you’ll start liking it the way I am.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Official forum for CakePHP

2009-07-10 Thread jperras

You can do all of this already.

Use http://bin.cakephp.org (or any other online bin of your choice),
and paste the link here.
With the Google Groups, you don't need categorization. Google is
pretty damn good at searching & indexing the groups.

A forum would only duplicate functionality, and would split
information across two separate services/domains, making it *harder*
to find things; The group already has several years of data, and it's
not something easy to migrate.

-j.

On Jul 10, 1:00 am, saidbakr  wrote:
> Hello,
> I wonder about CakePHP does not have an official forum. I think it
> will be very important and useful action for support. I don't feel
> comfort with Groups, it does not allow to format code examples and
> loose categorization.
>
> I think that forums.cakephp.org will be an essential factor for
> spreading CakePHP and supporting its application's developers.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Form Validation: Opposite of EqualTo (NotEqualTo, Does Not Equal)

2009-07-04 Thread jperras

http://book.cakephp.org/view/139/comparison

-j.

On Jul 2, 5:13 pm, hoyos  wrote:
> Hey,
>
> Simple question, is there a built-in form validation function to
> validate that a field DOES NOT EQUAL a certain value?
>
> For example: 'password' => array( 'rule' => array('notEqualTo',
> 'password'), 'message'=>'Please choose a more unique password.');
>
> Thanks,
> Andy
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Component in view

2009-07-02 Thread jperras

You don't. Get the data you need from your component in the
controller, and set it to the view using Controller::set, (e.g. $this-
>set('mydata', $this->MyAwesomeComponent->getAwesomeValue()); )

-j.

On Jul 2, 9:04 am, Ragnis  wrote:
> How can i use my component inside views?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Connecting to web services

2009-06-26 Thread jperras

Use a custom datasource & HttpSocket.

On Jun 26, 12:09 am, Turgs  wrote:
> Hello
>
> Within a few different controllers, I need to connect to a web service
> using a URL similar to:
> http://api.example.com/?command=Subscriber.Add&data...@test.com
>
> What's the appropriate "cake way" to do this in a way it can be called
> from different controllers?
> I don't think it should be in it's own model, but I don't know know
> else.
>
> Kind regards
> Turgs
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: New Behavior not 'attaching' on live server...

2009-06-25 Thread jperras

Try naming it 'datetime.php' instead of 'Datetime.php'. Some operating
systems are more case sensitive than others, and PHP itself has a few
odd casing rules for method names & object instances.

Also, lowercase filenames are the convention.

-J.

On Jun 24, 12:35 pm, SCM  wrote:
> Thanks for the reply Brian...
>
> ... yes, all files present, and all files and directories 755
> permissions (assuming behaviors do not need group and public 'write'
> permissions). All files, on all 3 servers, come from the same source.
> The 'Datetime' Behavior resides in "server(s)/app/models/behaviors/
> Datetime.php". There are slight variations in the PHP servers, but
> they're all 5.2.x.
>
> These were the first items I checked (and double-checked (and just
> checked again ) ), as I'm going on the assumption that it's some type
> of user error (me, in this case).
>
> I've also moved the $actAs class variable from the app_model to one of
> the other models, which produces the same results as above (works
> locally, does NOT work on the production sites).
>
> Pretty well stumped at this point...
>
> SCM
>
> On Jun 24, 8:52 am, brian  wrote:
>
>
>
> > Someone has to ask: is the behavior file present on all servers? Check
> > the permissions, also.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: cakephp project scaling, load balancing problem by using xampp linux on centos

2009-06-25 Thread jperras

Would it be possible to use database session storage in your
application instead? There are two configuration changes that need to
be made in your app/core.php file, and one table that needs to be
created in your database. The rest should happen automagically.

I've found that with load-balanced app servers, database storage for
sessions causes less headaches than whatever HAProxy/Apache Proxy +
sticky sessions can offer at the cost of a few additional SQL queries.
However, it the benefits would largely be dependent on your
application structure & current bottlenecks.

-J.

On Jun 24, 12:18 pm, wangchao  wrote:
> Hi all,
>
> I am not sure whether this problem is quite related to cakephp. But I
> think here is a good place to ask for help. So I am very appreciate if
> anyone could help me or give me any advices. If anyone met similar
> problem, I will be very glad if we can discuss together.
>
> Ok. Just breifly talk about my objective. I have a web app which is
> built based on cakephp. Due to some reasons, I would like to add
> another web server which will be running an identical web app and a
> load balancer to dispatch the requests.
>
> Environment:
> All the things are running on different virtual machines
> CentOS 5.3
> XAMPP - Linux 1.7.1
>   - only run apache on two web servers
>   - only run mysql on database server
>   - only run apache on load balancer
>
> Next is the configurations:
> IP address:
>   - web server 1 : 10.10.77.222
>   - web server 2 : 10.10.77.223
>   - db server : 10.10.77.226
>   - load balancer: 10.10.77.123
>
> And I modified the httpd.conf on the load balancer. I add the
> following configurations:
>
> 
>   ProxyRequests Off
>   
>     AddDefaultCharset off
>     Order deny,allow
>     Allow from all
>   
>
>   ProxyVia On
> 
>
> 
>   SetHandler balancer-manager
>   Order deny,allow
>   Deny from all
>   Allow from 10.10
> 
>
> 
>   SetHandler server-status
>   Order deny,allow
>   Deny from all
>   Allow from 10.10
> 
>
> 
>   # cluster member 1
>   BalancerMemberhttp://10.10.77.222:80route=ws1
>   # cluster member 2
>   BalancerMemberhttp://10.10.77.223:80route=ws2
>
> 
> ProxyPass /balancer !
> ProxyPass /status !
> ProxyPass / balancer://mycluster/ lbmethod=byrequests
> # I am not using sticky session here because the sessions are stored
> in the database.
>
> ProxyPassReverse /http://10.10.77.222/
> ProxyPassReverse /http://10.10.77.223/
>
> ExtendedStatus On
>
> After that, I start apaches, type in the load balancer's ip address in
> my browser. The main page shows up and it works well. But there is
> something wrong. I cannot login to the app anymore. I think there
> maybe something wrong with the session but i am not sure.
>
> I also tried with a sticky session, but it seems like the same
> problem. I just add a RewriteRule on each web server. It looks like
> RewriteRule .* - [CO=PHPSESSID:balancer.ws1:10.10.77.123]. It is
> possible that I have a wrong configuration. I will be very glad if
> anyone can correct me.
>
> The tutorials I referred are:
>   - Apache mod_proxy balancing with PHP sticky sessions
> (http://www.markround.com/archives/33-Apache-mod_proxy-balancing-with-
> PHP-sticky-sessions.html)
>
>   - scaling drupal step two - sticky load balancing with apache
> mod_proxy
> (http://74.125.153.132/search?
> q=cache:UKApdy_DQMgJ:www.johnandcailin.com/blog/john/scaling-drupal-
> step-two-sticky-load-balancing-apache-modproxy+apache+load+balancer
> +configuration&cd=10&hl=en&ct=clnk&gl=sg)
>
> If anyone needs some more information, pls feel free to ask. Much
> appreciate you helps.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Change the content-type

2009-06-23 Thread jperras

If you believe the behavior is not as you would expect, write a test
case & submit a bug report to http://trac.cakephp.org

If you don't know what a unit test is, please take a look at
http://mark-story.com/files/unit_testing.pdf . It's a big PDF, but
explains the concept quite well.

Thanks!
-J.

On Jun 19, 1:23 am, lapinski  wrote:
> I can confirm that Miles J was correct.
>
> I just added this to my controller:
>
> $this->RequestHandler->respondAs("text/xml")
>
> but on the client side, responseXML is null (in prototype.js Ajax onSuccess
> callback).
>
> But if I added this to my controller as Miles J suggested:
>
> $this->header('Content-Type: text/xml');
>
> I got an XML object in my responseXML.
>
> Are we missing something?  Or the requesthandler is not working as wished?
>
> Lapinski
>
>
>
>
>
> jperras wrote:
>
> > Use the RequestHandlerComponent::respondAs method. This should set the
> > appropriate content-type headers based on the $type that you give it.
>
> >http://api.cakephp.org/class/request-handler-component#method-Request...
>
> > -j.
>
> > On Jun 15, 4:15 pm, Miles J  wrote:
> >> But it doesn't work. Even if you use the Request Handler to output as
> >> XML, it is not XML.
>
> >> On Jun 15, 7:50 am, jperras  wrote:
>
> >> > You should be using the RequestHandler Component for content-type
> >> > setting/detection of your views and actions.
>
> >> >http://api.cakephp.org/class/request-handler-component
>
> >> > -j.
>
> >> > On Jun 14, 5:56 pm, Peter  wrote:
>
> >> > > thanks, that's what i neededalthough i moved it to the top of the
> >> > > default xml-layoutfile i use.
>
> >> > > On 14 jun, 23:44, Miles J  wrote:
>
> >> > > > I usually put this at the end of my controller actions:
>
> >> > > > $this->header('Content-Type: text/xml');
>
> >> > > > On Jun 14, 10:26 am, Peter  wrote:
>
> >> > > > > how can i change the content-type of a view? i have an xml-view
> >> which
> >> > > > > renders just fine, but my browser sees it as text/html.
>
> --
> View this message in 
> context:http://www.nabble.com/Change-the-content-type-tp24024660p24105688.html
> Sent from the CakePHP mailing list archive at Nabble.com.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Change the content-type

2009-06-16 Thread jperras

Use the RequestHandlerComponent::respondAs method. This should set the
appropriate content-type headers based on the $type that you give it.

http://api.cakephp.org/class/request-handler-component#method-RequestHandlerComponentrespondAs

-j.

On Jun 15, 4:15 pm, Miles J  wrote:
> But it doesn't work. Even if you use the Request Handler to output as
> XML, it is not XML.
>
> On Jun 15, 7:50 am, jperras  wrote:
>
> > You should be using the RequestHandler Component for content-type
> > setting/detection of your views and actions.
>
> >http://api.cakephp.org/class/request-handler-component
>
> > -j.
>
> > On Jun 14, 5:56 pm, Peter  wrote:
>
> > > thanks, that's what i neededalthough i moved it to the top of the
> > > default xml-layoutfile i use.
>
> > > On 14 jun, 23:44, Miles J  wrote:
>
> > > > I usually put this at the end of my controller actions:
>
> > > > $this->header('Content-Type: text/xml');
>
> > > > On Jun 14, 10:26 am, Peter  wrote:
>
> > > > > how can i change the content-type of a view? i have an xml-view which
> > > > > renders just fine, but my browser sees it as text/html.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Change the content-type

2009-06-15 Thread jperras

You should be using the RequestHandler Component for content-type
setting/detection of your views and actions.

http://api.cakephp.org/class/request-handler-component

-j.

On Jun 14, 5:56 pm, Peter  wrote:
> thanks, that's what i neededalthough i moved it to the top of the
> default xml-layoutfile i use.
>
> On 14 jun, 23:44, Miles J  wrote:
>
> > I usually put this at the end of my controller actions:
>
> > $this->header('Content-Type: text/xml');
>
> > On Jun 14, 10:26 am, Peter  wrote:
>
> > > how can i change the content-type of a view? i have an xml-view which
> > > renders just fine, but my browser sees it as text/html.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Persistent model to true -> Fatal error

2009-06-07 Thread jperras

$persistModel will not work if you are loading models using the
ClassRegistry or manually importing & creating models with
App::import; try using Controller::loadModel instead.

On Jun 4, 4:25 pm, pauloamgomes  wrote:
> Using ClassRegistry and CakePHP 1.2.2.8120.
>
> Regards.
>
> On Jun 2, 3:57 pm, jperras  wrote:
>
> > Are you using the ClassRegistry or manually importing classes
> > (specifically Models) using App::import anywhere ?
>
> > What version of CakePHP are you running?
>
> > -j.
>
> > pauloamgomes wrote:
> > > Hi all,
>
> > > when i activate persistent model to true in my application, it breaks
> > > my models, I'm getting the following fatal errors:
>
> > > Fatal error: PhotosController::index() [photoscontroller.index]: The script tried
> > > to execute a method or access a property of an incomplete object.
> > > Please ensure that the class definition "Albuns" of the
> > > object you are trying to operate on was loaded _before_ unserialize()
> > > gets called or provide a __autoload() function to load the class
> > > definition in /Volumes/Data/paulogomes/www/pg/controllers/
> > > photos_controller.php on line 32
> > > ---
> > > Fatal error: BehaviorCollection::trigger() [behaviorcollection.trigger]: The
> > > script tried to execute a method or access a property of an incomplete
> > > object. Please ensure that the class definition
> > > "ExtendAssociationsBehavior" of the object you are trying to
> > > operate on was loaded _before_ unserialize() gets called or provide a
> > > __autoload() function to load the class definition in /Volumes/Data/
> > > paulogomes/www/cake/libs/model/behavior.php on line 456
> > > ---
> > > Fatal error: ResourcesController::index() [resourcescontroller.index]: The script
> > > tried to execute a method or access a property of an incomplete
> > > object. Please ensure that the class definition "Types" of
> > > the object you are trying to operate on was loaded _before_ unserialize
> > > () gets called or provide a __autoload() function to load the class
> > > definition in /Volumes/Data/paulogomes/www/pg/controllers/
> > > resources_controller.php on line 29
>
> > > the error only occurs on second call of controller, after persistent
> > > cache files created on tmp.
> > > I'm using cakephp 1.2 running on leopard with php 5.2.6.
>
> > > Any ideas?
>
> > > Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



On Tickets & The Core Team: Why some tickets get tagged as 'wontfix' or 'invalid'

2009-06-03 Thread jperras

(for context, please read the comments for ticket #5145:
https://trac.cakephp.org/ticket/5145 . I chose continue this
discussion in the google group because it is a more appropriate venue
for this type of discourse).

First, let me state that neither myself or *anyone* on the CakePHP
core team gets their jollies from closing tickets as 'wontfix' or
'invalid'. We all appreciate the time & effort that is spent in
writing a ticket, and are grateful that people are attempting to make
CakePHP a better framework.

Alright, I'm going to take the time to explain the reasoning behind
the 'wontfix' tag that was attributed to ticket 
https://trac.cakephp.org/ticket/5145
and perhaps offer some insight in the thought processes that go on
behind the scenes that are not usually explained, for the simple
reason that writing a small novella for each ticket would consume all
the free time that any of us has.

First, you must note that CakePHP is an ''opinionated'' framework; we
enforce certain conventions and (what we consider to be) best
practices. This also translates to any code that is included in the
core; if we believe that certain enhancements/features would go
against accepted best-practices of development, then it has no place
in the official codebase. Being conscious of the limitations of the
real world, however, we have endeavoured to allow users of the
framework to customize & extend the base functionality to accommodate
a wide variety of edge case uses, an example of which is the topic of
this ticket: Validation rules. The rules that are provided in the core
are present for one of two reasons: 1) the rule is quite common and
used in many different applications (e.g. notEmpty, numeric) or 2) the
implementation of the rule is quite complex, and we feel it best to
provide that functionality so that people need not re-invent the wheel
(e.g. credit cards, date and time). The alphanumeric+ whitespace
+whitelist_of_valid_characters rule which you have proposed does not
fall within either of the above two categories.

It is not a rule which many people require, simply because if you are
allowing non alphanumeric characters, you need to either provide a
whitelist or a blacklist of additional characters. Neither of these
options is maintainable in the long-term; you will be eternally adding
characters to your (white|black)list to comply with varying & changing
requirements from your application.

However, I do understand that the real-world sometimes does not
coincide with the ivory tower that comprises best practices of
software design & implementation patterns. This is where the
extensibility of the framework comes into play. The above validation
rule that you both desire can be very easily implemented in a variety
of places: 1) in a model, for domain-specific validation that need not
be available to the rest of your application. 2) at the AppModel
level, so that all your models in a given application may use it. 3)
In a behavior, so that you can pick & choose which models will have
the custom validation rules available to them. In addition, this also
allows you to make the rules portable; you could even package it up in
a plugin along with some test cases, thus utilizing the full extent of
CakePHP's extensibility.

Furthermore, every line of code that is added to the CakePHP codebase
is a line of code that the core team needs to maintain. What might
seem like a simple validation rule addition actually encompasses the
validation rule itself, a new test case with at least a dozen new
assertions, possible modification of bake templates for models to
include the new validation rule, integration tests for the new
validation rule and its interaction with the FormHelper, in addition
to whatever new functionality gets added in future versions. As a
result, what seems like a simple addition of a few lines of code
snowballs into several hundred lines and countless hours of work. Thus
you can imagine why we shy away from adding new 'features' that
introduce infinitesimally new functionality, especially when such
functionality is actually best implemented with your own application
logic in mind. This is not to say that we never plan on adding new and
awesome things to CakePHP; you need only visit the development branch
for 1.3 on http://thechaw.com/cakephp/source/branches/1.3 to see for
yourself.

Given all that I've said, however, I still realize that sometimes
certain problems need dirty solutions. To this end, I've written a
simple example of how you would create an alphanumeric
+whitelist_of_valid_characters rule:


// in either your app_model.php or a model class
public function alnumWhitelist($data, $whitelist = array()) {
$data = array_values($data);
$check = $data[0];
$whitelist = implode($whitelist);
$rule = "/^[\p{Ll}\p{Lm}\p{Lo}\p{Lt}\p{Lu}\p{Nd}{$whitelist}]+
$/mu";

return preg_match($rule, $check);
}


// in your model validation rules
 public $validate = array(
 

Re: is try catch necessary in CAKEPHP!

2009-06-02 Thread jperras

CakePHP is PHP. You can use whatever language constructs that PHP
provides you, including try/catch blocks for operations that could
throw exceptions.

-j.

sharmaji wrote:
> Hi,
> Is there any use of try and catch block in cake php? if yes, please
> suggest me how can i implement that?
> currently i am using php version 5.2
> Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Persistent model to true -> Fatal error

2009-06-02 Thread jperras

Are you using the ClassRegistry or manually importing classes
(specifically Models) using App::import anywhere ?

What version of CakePHP are you running?

-j.

pauloamgomes wrote:
> Hi all,
>
> when i activate persistent model to true in my application, it breaks
> my models, I'm getting the following fatal errors:
>
> Fatal error: PhotosController::index() [photoscontroller.index]: The script tried
> to execute a method or access a property of an incomplete object.
> Please ensure that the class definition "Albuns" of the
> object you are trying to operate on was loaded _before_ unserialize()
> gets called or provide a __autoload() function to load the class
> definition in /Volumes/Data/paulogomes/www/pg/controllers/
> photos_controller.php on line 32
> ---
> Fatal error: BehaviorCollection::trigger() [behaviorcollection.trigger]: The
> script tried to execute a method or access a property of an incomplete
> object. Please ensure that the class definition
> "ExtendAssociationsBehavior" of the object you are trying to
> operate on was loaded _before_ unserialize() gets called or provide a
> __autoload() function to load the class definition in /Volumes/Data/
> paulogomes/www/cake/libs/model/behavior.php on line 456
> ---
> Fatal error: ResourcesController::index() [resourcescontroller.index]: The script
> tried to execute a method or access a property of an incomplete
> object. Please ensure that the class definition "Types" of
> the object you are trying to operate on was loaded _before_ unserialize
> () gets called or provide a __autoload() function to load the class
> definition in /Volumes/Data/paulogomes/www/pg/controllers/
> resources_controller.php on line 29
>
> the error only occurs on second call of controller, after persistent
> cache files created on tmp.
> I'm using cakephp 1.2 running on leopard with php 5.2.6.
>
>
> Any ideas?
>
> Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Determine which database driver is being used

2009-05-29 Thread jperras

> Determine which database driver is being used

http://api.cakephp.org/class/model#method-ModelgetDataSource

As for your custom query, it really depends. Cake does a lot for you,
but sometimes it makes sense to drop down to the bare metal and write
a custom query.

-j.

On May 28, 12:46 pm, blake  wrote:
> Hello,
>
> Not sure if this has been discussed before, but I couldn't find it. As
> much as I hate to do it, I think I may need to use my first custom
> query out of this entire website (either that or use a recursive
> search, which is running thousands of queries instead of just 1).
>
> My biggest issue with a custom query is that for my local development
> machine, I use MySQL and the production server uses MS SQL (not my
> choice). Obviously a custom query won't work when copying code between
> these two, so I wanted to try coding something like:
>
> if ($database_driver == 'mssql') {
>     $query = 'select';}
>
> elseif ($database_driver == 'mysql') {
>     $query = 'select';
>
> }
>
> I'm open to suggestions if there's a way to avoid a custom query here,
> but if not, is there at least a good way I can determine which DB
> driver is being used so I can do something similar to the above?
>
> Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Determine which database driver is being used

2009-05-29 Thread jperras

> Determine which database driver is being used

http://api.cakephp.org/class/model#method-ModelgetDataSource

As for your custom query, it really depends. Cake does a lot for you,
but sometimes it makes sense to drop down to the bare metal and write
a custom query.

-j.

On May 28, 12:46 pm, blake  wrote:
> Hello,
>
> Not sure if this has been discussed before, but I couldn't find it. As
> much as I hate to do it, I think I may need to use my first custom
> query out of this entire website (either that or use a recursive
> search, which is running thousands of queries instead of just 1).
>
> My biggest issue with a custom query is that for my local development
> machine, I use MySQL and the production server uses MS SQL (not my
> choice). Obviously a custom query won't work when copying code between
> these two, so I wanted to try coding something like:
>
> if ($database_driver == 'mssql') {
>     $query = 'select';}
>
> elseif ($database_driver == 'mysql') {
>     $query = 'select';
>
> }
>
> I'm open to suggestions if there's a way to avoid a custom query here,
> but if not, is there at least a good way I can determine which DB
> driver is being used so I can do something similar to the above?
>
> Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Security question

2009-05-21 Thread jperras

If you're not modifying form fields with javascript, AJAX form
submissions should have no impact on the use of the Security component
and it's ability to prevent CSRF attacks.

-j.

On May 20, 11:22 pm, "Dave Maharaj :: WidePixels.com"
 wrote:
> I am trying to break my application.
>
> How can I tell if a logged in user is trying to do the same by using firebug
> and adding a form to a page?
> I don't want to just sanitize and all of that...i want to know and ban that
> specific user. What would be the best approach to determine if a user is
> trying to submit data that should not be submitted.
> For example a page that has no form and someone adds a form and tries to
> submit could I easily check $this->data because there should be none?
>
> if(!empty($this->data))
> {
> ...banuser()..
>
> }
>
> Is there a better method or something already around that can help. Most of
> my requests are AJAX so for pages with forms the Security component is no
> good for me.
> Ideas? Suggestions?
>
> Thanks,
>
> Dave
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: api.cakephp.org still broken

2009-05-17 Thread jperras

@mryellow: Closed without a fix? If that's so, then what are these,
exactly?

fix 1: 
http://thechaw.com/api_generator/commits/view/192582d9a64ff881610b2326d2ba3ad3f3f56d39
fix 2: 
http://thechaw.com/api_generator/commits/view/58d31c777ef7834158d38a1fedc44207878420db

If you'll take note of the timestamps, the issues that you flagged
were fixed within a matter of hours of you posting them (a full two
*days* ago, might I add), and markstory's comment clearly indicates
that "This has been fixed in the head branch and will be updated
soon". Now, what part of that is ambiguous? The part about "fixed", or
the part about "will be updated soon"?

If you had any doubts as to the veracity of his statement,  it would
have taken you all of 35 seconds to saunter over to the api project
page http://thechaw.com/api_generator (which markstory also mentioned
in his first response to your ticket) and see that the project
timeline clearly indicated that the two issues you noticed had been
addressed. Just because you could not see them on the live server does
not immediately mean that your tickets were disregarded; we have
procedures for deploying code to production servers like every one
else.

Thanks for filing those tickets, but next time you can keep the
attitude to yourself.

-jperras.
http://nerderati.com/open-source-is-not-a-democracy


On May 17, 6:31 am, Mr-Yellow  wrote:
> Just remove the overflow attribute from the CSS and the window will no
> longer have a hidden overflow or scrollbar and thus will work.
> The bug is in your CSS not in the api documentation software.
>
> So the tickets are closed... I guess by closing the tickets that
> makes your site work.
>
> Look I can get around this by using 2 browsers, just thought you'd
> like to improve your site for other visitors, I don't care either way.
>
> So.. I'm not going to chase this around to other software vendors
> posting the bugs in the "proper" places.
>
> You have a problem with your site, I wrongly assumed you'd like to fix
> it.
>
> Continue to drive potential users away with a site that doesn't work,
> it doesn't concern me in the slightest if you don't see that as an
> issue.
>
> -Ben
>
> On May 17, 6:43 am, mark_story  wrote:
>
> > Sure, there is an open bug on the firefox bugzilla.
>
> >https://bugzilla.mozilla.org/show_bug.cgi?id=215055
>
> > Which has been open for 6 years.  Firefox uses a 16bit api in windows
> > to render elements with scroll bars.  However the 16bit api runs out
> > of numbers after 16384.  So the rest of the box is not drawn, since
> > windows doesn't know how to address these values with a 16bit space.
> > The bug report at mozilla explains it better than I can though.  I
> > know there are some people who have this issue on linux as well, but
> > it doesn't occur on mac os, and while I originally punted on the first
> > ticket opened as it is a 'browser' bug and kind of out of my hands.
> > I've rethought that course, and am going to do my best to work around
> > the issue.
>
> > -Mark
>
> > On May 15, 2:27 pm, Brendon Kozlowski  wrote:
>
> > > Say what?  LOL.  Sorry Mark, I truly am interested to understand what
> > > the issue was, I just don't think I really understood your
> > > explanation.  Would you be willing to explain it further?  A "nope"
> > > will suffice too, of course.  :)
>
> > > On May 15, 2:21 pm, mark_story  wrote:
>
> > > > The issue with Firefox is bound to Windows only.  Its an issue with
> > > > how windows actually functions.  Because the UI elements are 16bit
> > > > they cannot exceed the pixel dimensions of the 16bit space.  So
> > > > mozilla is bound by shoddy windows widgets, and the Api was bound by
> > > > that implementation.  I'm going to be redesigning the source code
> > > > output to fix this issue.  Seeing as there is a better chance of
> > > > glaciers to destroying my house before Microsoft fixes 16 bit api's.
>
> > > > -Mark
>
> > > > On May 15, 2:03 pm, Matt Curry  wrote:
>
> > > > > I had the same problem with FF cutting off the model page at line
> > > > > 1820.  Disabling Firebug for the API pages fixed it for me.
>
> > > > > -Matthttp://www.pseudocoder.com
>
> > > > > On May 15, 6:27 am, John Andersen  wrote:
>
> > > > > > Hi Burzum
>
> > > > > > Can you open the following location in FF 3.0.10 (which I have), as 
> > > > > > I
> > > > > > do have

Re: Release: 1.2.3.8166

2009-05-04 Thread jperras



On May 4, 6:20 pm, Brett Wilton  wrote:
> Thanks gwoo and all the dev.
>
> To find out about the 1.3 features and to keep up with progress on 1.3
> is thehttp://thechaw.com/cakephp/wiki/1.3wiki the best place to
> follow this ?

yep. That and the aggregate timeline of the master (as well as the
many branches) to see what features are being implemented/refactored
into 1.3.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---