Re: Discussion on optimizing-cakes-performance

2008-06-23 Thread Daniel.S

Or, you could use the now built-in (1.2) Containable behaviour. I used
to use a lot of unbindModel calls, but on a recent project started
using Containable and it's much cleaner and easier.

On Jun 11, 7:09 pm, RichardAtHome [EMAIL PROTECTED] wrote:
 The biggest performance improvement I've found so far is:

 Unbind unused models! Simple, but very effective.

 For example, a few pages in a project I'm working on needed deep
 recursion (recursive = 3), which resulted in 4000+ queries O.o

 The pages were timing out.

 A few unbinds later and its down to 40+ queries.

 Unbinding also has the added benefit of using less memory per request
 too meaning your apps are the little bit more scalable.

 On Jun 11, 9:56 am, Dr. Tarique Sani [EMAIL PROTECTED] wrote:

  On Wed, Jun 11, 2008 at 1:54 PM, Marcin Domanski [EMAIL PROTECTED] wrote:
   From my benchamrks it's not really worth caching the results but
   cookbook doesn't have such a big dataset... so im not yet sure if i'll
   add caching.

  Caching in most cases will not be needed... Lucene was meant to be very fast

   Tarigue did you use Lucene as a crawler or as db search ?

  crawler

  Tarique

  --
  =
  Cheesecake-Photoblog:http://cheesecake-photoblog.org
  PHP for E-Biz:http://sanisoft.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Sanitized text in select boxes

2007-06-17 Thread Daniel.S

Is there a way of getting sanitized text to render normally inside a
HTML Select? I.E. Not showing the character codes?

Thanks,

Daniel


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: saving sensitive data with md5

2007-03-18 Thread Daniel.S

No need to jump up and down proclaiming the original message poster to
be incompetant while trumpeting CakePHP's virtues. Why don't you learn
from Mariano and provide a solution. You've done it in a few message
threads today, and it's not productive at all.

On Mar 19, 5:30 am, Walker Hamilton [EMAIL PROTECTED] wrote:
 This is not a cakePHP problem so much as a programming issue. If you
 learn how to hash md5's using php, you'll be able to do them in cake.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: saving sensitive data with md5

2007-03-18 Thread Daniel.S

Will that re-hash the MD5'ed password field when editing and then
saving again?

I do this at the moment:

In model:
function beforeSave() {
$password = isset($this-data['User']['password'])?$this-data['User']
['password']:;
if (!preg_match(VALID_MD5,$password) {
 $this-data['User']['password'] = md5($this-data['User']
['password']);
}
return true;
}

In bootstrap:
define('VALID_MD5','/^[a-fA-F0-9]{32}$/i');



On Mar 19, 6:40 am, Mariano Iglesias [EMAIL PROTECTED]
wrote:
 Sure, use the beforeSave and beforeFind on the model side.

 class User extends AppModel {
 // ...
 function beforeSave() {

 if (isset($this-data[$this-name]['password'])) {
 $this-data[$this-name]['password'] =
 md5($this-data[$this-name]['password']);
 }

 return parent::beforeSave();
 }

 function beforeFind($queryData) {
 if (isset($queryData[$this-name]['password'])) {
 $queryData[$this-name]['password'] =
 md5($this-data[$this-name]['password']);
 }

 return $queryData;
 }

 }

 This way when from your controller you are saving the model having the
 password field set, it will automatically hash it:

 $data = array(
 'User' = array('user' = 'mariano', 'password' = 'password')
 );

 $this-User-save($data);

 The same way when you are looking for a record if you set the password field
 as part of the data to be searched for, it will hash it:

 $conditions = array(
 'User' = array('user' = 'mariano', 'password' = 'password')
 );

 $result = $this-User-find($conditions);

 -MI

 ---

 Remember, smart coders answer ten questions for every question they ask.
 So be smart, be cool, and share your knowledge.

 BAKE ON!

 blog:http://www.MarianoIglesias.com.ar

 -Mensaje original-
 De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
 de billybob
 Enviado el: Domingo, 18 de Marzo de 2007 02:12 p.m.
 Para: Cake PHP
 Asunto: saving sensitive data with md5

 I'm using cake's MVC approach which works really great.  I like the
 ability to use the MVC and save from the controller; it makes things
 nice and is very easy.  I did run into a problem which I can't figure
 out, however.  Let's say I want to save sensitive information like a
 password in the database.  Currently, it appears cake will only let
 you save in clear text (won't let you hash) in the default MVC
 approach.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to use Two tables in one model/controller

2007-03-14 Thread Daniel.S

Are the tables linked?

On Mar 15, 2:27 pm, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
 hi all, i am new to cakephp. and finding it very interesting and easy
 to work with it. I want to know how can we use multiple tables in one
 model/controller

 Thanks in advance


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---