Re: hasOne load time x4

2013-11-04 Thread Ashish Mahana

HI Aurelian,
There is not any problem when you use containable, its good to use that 
feature.

Coming to the problem part, 
1. First thing what i guess is that you have not set the index properly for 
tables that are related so that you are also delaying the result in the 
second association ($hasMany) 
2. Second thing is that if u have *A $hasOne B* association then cake 
expects one-one relationship with respect to the primaryKey and foreignKey 
as it find violation of 
referential integrity it causes slow record fetching.

if you have any doubt you are welcome to ask.


On Friday, November 1, 2013 9:42:55 PM UTC+5:30, Aurelian Apostol wrote:

 I am using two tables items and products, item hasOne product.
 When making a containable pagination on Item it loads 1200 rows in 13s, 
 when moving Product in hasMany it loads in 3,2s. With no other changes on 
 the models or any other place as that matters.

 Any ideas? 


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


CakePHP themed + cache + gzip enabled + Avast AV + Chrome == Problem

2013-11-04 Thread Salines
Hi people,

I have a problem, wich I can not solve.

on page www.detas.ba I have enabled cache and gzip. Views, css, js, are in 
the themed folder. (App/View/Themed/Detas/...)

On my computer I use Chrome browser and Avast antivirus program.

When I access a page on eg http://detas.ba/sat/792-Casio_LTP_1230D_1CDF and 
click quickly to any link (button) on the side, my browser sometimes 
Download .gz file, instead of displaying the page.

If I leave out any part of the heading combinations (CakePHP themed + cache 
+ gzip enabled +  Avast AV + Chrome), this problem does not occur.

For example, if:

CakePHP themed + cache + gzip enabled + Avast AV +* Firefox* *!=* Problem
CakePHP themed + cache + gzip enabled + *disabled Avast AV* + Chrome *!=*Problem
CakePHP themed + cache + *gzip disabled* + Avast AV + Chrome *!=* Problem
*C**akePHP without themed layou*t + cache + gzip enabled + Avast AV + 
Chrome *!=* Problem

In bootstrap.php I have the following:

CakePlugin::loadAll();
Cache::config('default', array('engine' = 'File'));
 if (Configure::read('debug')  2) {
@ob_start ('ob_gzhandler');
header('Content-Type: text/html; charset: UTF-8');
header('Cache-Control: must-revalidate');
header(Expires:  . gmdate('D, d M Y H:i:s', time() - 1) . ' GMT');
}

in .htaccess

IfModule mod_rewrite.c
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
/IfModule

#Gzip/deflate
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css 
application/x-javascript text/javascript application/javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent

# BEGIN EXPIRES
IfModule mod_expires.c
ExpiresActive On
ExpiresDefault access plus 10 days
ExpiresByType text/css access plus 1 week
ExpiresByType text/plain access plus 1 month
ExpiresByType image/gif access plus 1 month
ExpiresByType image/png access plus 1 month
ExpiresByType image/jpeg access plus 1 month
ExpiresByType application/x-javascript access plus 1 month
ExpiresByType application/javascript access plus 1 week
ExpiresByType application/x-icon access plus 1 year
/IfModule
# END EXPIRES

Does anyone have similar problems, similar experience and solution?

Thank you,

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: CakePHP themed + cache + gzip enabled + Avast AV + Chrome == Problem

2013-11-04 Thread Salines
I forgot to write that I use the latest version of CakePHP Framework 2.4.2

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: CakePHP themed + cache + gzip enabled + Avast AV + Chrome == Problem

2013-11-04 Thread José Lorenzo
This is not how you should setup the request compression in CakePHP, please 
read about CakeRequest::compress(). Even though there is a way to do in php 
I strongly recommend no to, gzip compression should be done in the webserver

On Monday, November 4, 2013 10:58:19 AM UTC+1, Salines wrote:

 Hi people,

 I have a problem, wich I can not solve.

 on page www.detas.ba I have enabled cache and gzip. Views, css, js, are 
 in the themed folder. (App/View/Themed/Detas/...)

 On my computer I use Chrome browser and Avast antivirus program.

 When I access a page on eg http://detas.ba/sat/792-Casio_LTP_1230D_1CDFand 
 click quickly to any link (button) on the side, my browser sometimes 
 Download .gz file, instead of displaying the page.

 If I leave out any part of the heading combinations (CakePHP themed + 
 cache + gzip enabled +  Avast AV + Chrome), this problem does not occur.

 For example, if:

 CakePHP themed + cache + gzip enabled + Avast AV +* Firefox* *!=* Problem
 CakePHP themed + cache + gzip enabled + *disabled Avast AV* + Chrome 
 *!=*Problem
 CakePHP themed + cache + *gzip disabled* + Avast AV + Chrome *!=* Problem
 *C**akePHP without themed layou*t + cache + gzip enabled + Avast AV + 
 Chrome *!=* Problem

 In bootstrap.php I have the following:

 CakePlugin::loadAll();
 Cache::config('default', array('engine' = 'File'));
  if (Configure::read('debug')  2) {
 @ob_start ('ob_gzhandler');
 header('Content-Type: text/html; charset: UTF-8');
 header('Cache-Control: must-revalidate');
 header(Expires:  . gmdate('D, d M Y H:i:s', time() - 1) . ' GMT');
 }

 in .htaccess

 IfModule mod_rewrite.c
 RewriteEngine On
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
 /IfModule

 #Gzip/deflate
 AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css 
 application/x-javascript text/javascript application/javascript
 BrowserMatch ^Mozilla/4 gzip-only-text/html
 BrowserMatch ^Mozilla/4\.0[678] no-gzip
 BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
 Header append Vary User-Agent

 # BEGIN EXPIRES
 IfModule mod_expires.c
 ExpiresActive On
 ExpiresDefault access plus 10 days
 ExpiresByType text/css access plus 1 week
 ExpiresByType text/plain access plus 1 month
 ExpiresByType image/gif access plus 1 month
 ExpiresByType image/png access plus 1 month
 ExpiresByType image/jpeg access plus 1 month
 ExpiresByType application/x-javascript access plus 1 month
 ExpiresByType application/javascript access plus 1 week
 ExpiresByType application/x-icon access plus 1 year
 /IfModule
 # END EXPIRES

 Does anyone have similar problems, similar experience and solution?

 Thank you,



-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: CakePHP themed + cache + gzip enabled + Avast AV + Chrome == Problem

2013-11-04 Thread Salines
Hi, José Lorenzo

thanks for your reply.

I removed my code from bootstrap.php and .htaccess file
and put in the app controller following:

---
public function beforeRender(){
$this-response-compress();
 }
---

Website is now working correctly, and the server delivers gzipped html. How 
to enable the same for css and js?

Thank you again,
Best Regards

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.