Monday, March 21, 2016

Symfony 2 How To Disable CSRF on a Per Form Basis

Here are two ways to disable the CSRF in Symfony 2 Forms:
public function getDefaultOptions(array $options)
   {
       return array(
           'data_class'      => 'Acme\TaskBundle\Entity\Task',
           'csrf_protection' => false,  // <---- set this to false on a per Form Type basis
           //'csrf_field_name' => '_token',
           // a unique key to help generate the secret token
           //'intention'       => 'task_item',
       );
   }
And while creating the form:
$form = $this->createFormBuilder($users, array(
    'csrf_protection' => false,  // <---- set this to false on a per Form Instance basis
))->add(...)
;
If this has been helpful please donate, thanks!
http://www.craftitonline.com/2011/08/symfony-2-how-to-disable-csrf-on-a-per-form-basis/

Supprimer les accents en Javascript

String.prototype.sansAccent = function(){
    var accent = [
        /[\300-\306]/g, /[\340-\346]/g, // A, a
        /[\310-\313]/g, /[\350-\353]/g, // E, e
        /[\314-\317]/g, /[\354-\357]/g, // I, i
        /[\322-\330]/g, /[\362-\370]/g, // O, o
        /[\331-\334]/g, /[\371-\374]/g, // U, u
        /[\321]/g, /[\361]/g, // N, n
        /[\307]/g, /[\347]/g, // C, c
    ];
    var noaccent = ['A','a','E','e','I','i','O','o','U','u','N','n','C','c'];
     
    var str = this;
    for(var i = 0; i < accent.length; i++){
        str = str.replace(accent[i], noaccent[i]);
    }
     
    return str;
}

http://www.finalclap.com/faq/257-javascript-supprimer-remplacer-accent

Friday, March 18, 2016

PPM - PHP Process Manager

PHP-PM is a process manager, supercharger and load balancer for PHP applications.
It's based on ReactPHP and works best with applications that use request-response frameworks like Symfony's HTTPKernel. The approach of this is to kill the expensive bootstrap of PHP (declaring symbols, loading/parsing files) and the bootstrap of feature-rich frameworks. See Performance section for a quick hint. PHP-PM basically spawns several PHP instances as worker bootstraping your application (eg. the whole Symfony Kernel) and hold it in the memory to be prepared for every incoming request: This is why PHP-PM makes your application so fast.
More information can be found in the article: Bring High Performance Into Your PHP App (with ReactPHP)

Features

  • Performance boost of over 15x (compared to PHP-FPM, Symfony applications).
  • Integrated load balancer.
  • Hot-Code reload (when PHP files changes).
  • Static file serving for easy development procedures.
  • Support for HttpKernel (Symfony/Laravel), Drupal, Zend.
Check this out
https://github.com/php-pm/php-pm

which version php_apcu for php 5.5 windows

Check this out :
http://pecl.php.net/package/APCu/4.0.6/windows

Interesting thred : https://openclassrooms.com/forum/sujet/symfony2-quel-apc-pour-apache-2-4-9-et-php-5-5-12


Tuesday, March 8, 2016

Disable ProFTP on CentOS

Check this out : http://www.howtogeek.com/howto/linux/disable-proftp-on-centos/

I realize this is probably only relevant to about 3 of the readers, but I’m posting this so I don’t forget how to do it myself! In my efforts to ban the completely insecure FTP protocol from my life entirely, I’ve decided to disable the FTP service running on the How-To Geek server, which is running the CentOS operating system.
For whatever reason, I couldn’t find a place in plesk to do this, and I just despise everything about plesk anyway… so I took the manual approach.
First, look in your /etc/xinetd.d/ directory and see if there’s a file named psa_ftp in there. If not, you might have to make this change in your /etc/xinetd.conf file.
Open up the file as root, and look for the following section:
service ftp
{
        disable         = yes
        socket_type     = stream
        protocol        = tcp
        wait            = no
        user            = root
        instances       = UNLIMITED
        server          = /usr/sbin/in.proftpd
        server_args     = -c /etc/proftpd.conf
}
Change the disable = no line to disable = yes as shown above.
Run the following command to restart xinetd
/etc/init.d/xinetd restart

Monday, February 29, 2016

Lever et activer les contraintes d'un schéma Oracle

Désactivation

BEGIN FOR c IN (SELECT c.owner, c.table_name, c.constraint_name FROM user_constraints c, user_tables t WHERE c.table_name = t.table_name AND c.status = 'ENABLED' ORDER BY c.constraint_type DESC) LOOP dbms_utility.exec_ddl_statement('alter table ' || c.owner || '.' || c.table_name || ' disable constraint ' || c.constraint_name); END LOOP; END; 

Activation

BEGIN FOR c IN (SELECT c.owner, c.table_name, c.constraint_name FROM user_constraints c, user_tables t WHERE c.table_name = t.table_name AND c.status = 'DISABLED' ORDER BY c.constraint_type) LOOP dbms_utility.exec_ddl_statement('alter table ' || c.owner || '.' || c.table_name || ' enable constraint ' || c.constraint_name); END LOOP; END;

Source : http://www.silverlake.fr/index.php?post/2010/12/11/Lever-et-activer-les-contraintes-Oracle

LF will be replaced by CRLF in git - What is that and is it important