Archive for the 'Non classé' Category

eZ Publish, Cache and Performance

sept 05 2010 Published by admin under Non classé

eZ Publish is not the fastest CMS I’ve seen. It is flexible (you can define your own classes (type of content), and the fields that define your class. But it seems like « more flexible != fast ». Just take a look at the number of queries on a page that has object relations fields, and you will understand why: it can reach more than 100 queries on a page!

If your eZ Publish is slow (actually even if it’s not slow!!), you should activate eZ Publish caching mechanism. I was looking for some info about eZ Publish, and here is what I found.

Links and notes about Ez Publish caching

  1. http://share.ez.no/articles/ez-publish/ez-publish-performance-optimization-part-3-of-3-practical-cache-and-template-solutions/%28page%29/2
    • This article explains the different cache mechanism (template cache, view cache, preview cache), and the {cache-block} template function
  2. http://ez.no/doc/ez_publish/technical_manual/4_x/features/view_caching/configuring_the_view_cache
    • It explains how to deactivate the view cache on specific pages, by adding the following code at the beginning of the related template:
      {set-block scope=global variable=cache_ttl}0{/set-block}
    • This tip is really useful when you have user session related pages, like a profile page, a cart page…

deactivate eZ Publish cache on ou development environment

These are the settings I usually add to the frontend siteaccesses to deactivate the cache mechanism. Remember to remov them on your staging/test and live environments.

[ContentSettings]
#...(other settings in that section)
#dev only
ViewCaching=disabled
#dev only
PreViewCache=disabled

[TemplateSettings]
#... (other settings in that section)
#dev only
TemplateCache=enabled

[OverrideSettings]
#... (other settings in that section)
#dev only
Cache=disabled

Oh, and also deactivate template caching (in TemplateSettings), your integrators will hate you if you don’t: they would have to clear eZ Publish cache everytime they change a template – using the following command:

php bin/php/ezcache --clear-all --purge

No responses yet

Notes: Apache, MAMP

août 29 2010 Published by admin under Non classé

Because I don’t want to loose time with those things the next time I setup MAMP, I decided to write it down. I hope it will help you too!

mod_rewrite doesn’t work?

Make sure mod_rewrite is enabled:

LoadModule rewrite_module modules/mod_rewrite.so

Check you httpd.conf (or apache.conf) settings, specially the following setting: AllowOverride

AllowOverride All

You can put inside a Directory block, in a virtual host for example:

<VirtualHost *:8888>
ServerName local.mysite.com
DocumentRoot /path/to/web/root
<Directory "/path/to/web/root">
AllowOverride All
</Directory>
#...

This is valid for any Apache bundle (MAMP, WAMP, XAMP, or Apache itself)

MAMP mySQL – connection problem?

If you’re having trouble connecting to MySQL (using PDO for example), try the following tip:

edit startMySQL.sh in /Applications/MAMP/bin and add the following line at the end:

ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock &

No responses yet

Symfony, project:deploy et cygwin

avr 11 2010 Published by admin under Non classé

Pour tous ceux qui comme moi ne comprenaient pas pourquoi le « sync » de symfony gelait sur leur Windows, avec cygwin, voici l’astuce du jour (trouvé sur le trac de symfony):

Ajouter la ligne suivante dans votre properties.ini (par environnement):

[prod]
host=www.mywebproject.com
port=22
user=USERNAME
dir=/home/path/to/project/on/prod/
parameters="-azvC --force --delete --exclude-from=config/rsync_exclude.txt"

PS.1: j’avais trouvé une autre astuce qui nécessitait de modifier le fichier de la tache projectDeploy de Symfony (en ajoutant un « exec »), mais cette méthode est bien plus propre, merci!

PS.2: j’ai ajouté l’option « v » (=verbose) afin que rsync liste les fichiers qui sont affecté par la synchronisation. C’est à vous de voir!
PS.3: Il m’arrive de devoir changer les permissions des fichiers sur production (plus qu’un simple « symfony project:permissions »), donc histoire à suivre…
PS.4: Suite de l’histoire: Idiot, cygwin utilise les permissions à-la-Unix, il suffisait de mettre les bonnes permissions avec cygwin…

No responses yet

Facebook Connect friend selector jquery plugin – première version!

fév 15 2010 Published by admin under Non classé

Suite à l’article précédent sur mes problèmes pour créer un widget permettant de sélectionner un ami facebook sur un site facebook connect, j’ai finalement créer un plugin jquery.

Vous pouvez downloader le plugin sur github.com.

Des infos (sommaires pour l’instant) sont disponibles ici. J’espère que vous allez apprécier!

One response so far

Traduction fr_FR pour le thème wordpress « Life is Simple »

fév 15 2010 Published by admin under Non classé

J’ai fait une traduction rapide du thème « life is simple » en français (fr_FR) mais certainement plus fr_CA…

Vous pouvez le télécharger ici.

À utiliser/modifier selon vos besoins!!

Ah oui, j’ai utilisé poedit pour créer les fichiers de traductions.

No responses yet

J’aime ça…

fév 12 2010 Published by admin under Non classé

500 error - foursquare

No responses yet

.htpasswd Apache Tips

fév 05 2010 Published by admin under Non classé

To create the file

sudo htpasswd -c  .htpassword.CLIENT.PROJECT USERNAME

To add users to it

sudo htpasswd  .thenameofthefile USERNAME2

to configure a website (vhost) to use that file

 <Directory "/var/www/staging/PATH/TO/CLIENT/PROJECT/web">
        Options -Indexes
        AuthName "TD Staging Server"
        AuthType Basic
        AuthUserFile /var/www/staging/td/.htpassword.CLIENT.PROJECT
        Require valid-user
        AllowOverride All
        Allow from All

    </Directory>

No responses yet

Symfony, forms and widgets tips

fév 03 2010 Published by admin under Non classé

Howto get the user object in a form

Solution to get to user object in an sfForm object: use the 2nd $option parameter while creating the form object and retrieve it.

// In your actions.class.php
$this->form = new myForm(array(), array("currentUser" => $this->getUser()));

// In your form class

// ...
if (!is_object($this->getOption("currentUser")) || !($this->getOption("currentUser") instanceof sfUser))
{
throw new InvalidArgumentException("You must pass a user object as an option to this form!);
}

Source: http://eatmymonkeydust.com/2009/08/symfony-forms-flexible-widgets-based-on-user-credentials/

No responses yet

Flickr, Foursquare, oauth, géolocalisation: notes

jan 25 2010 Published by admin under Non classé

Voici quelques notes en vue de jouer avec la geolocalisation, et quelques API « géolocalisées ».

Flickr:

http://www.flickr.com/services/api/flickr.photos.search.html

  • Nécessite une API key
  • recherche par tags possible, donc possible de rechercher foursquare:venue=XXXX
  • Limite de requêtes (par jour/heures/??): ???

OAuth:

GeoIP:

Foursquare API:

Lastfm:

Google Maps

Mise à jour:

Voici une première version alpha d’un site qui utilise la geolocalisation… http://geo.fruitsoftware.com . Vos commentaires sont les bienvenus sur cet article.

No responses yet

Paging, number of items per page and offset

août 27 2009 Published by admin under Non classé,programmation

  • page: X
  • nb_per_page: Y
  • => OFFSET = (X-1)*Y
  • =>OFFSET = (page-1)*nb_per_page

Easy, no?

2 responses so far