Posts tagged with note

  • Laravel unit testing in workbench note

    Just want to note down my experiences when doing unit testing with Laravel.

    Mockery

    Use Mockery to mock all the dependencies if possible to save time when executing the tests.

    Database Testing with Sqlite (in memory)

    If the tests involve a very complex SQL query/database, then should first try to do the testing using SQLite in memory. This will speed up execution time a lot as the database will be destroyed and re-created every time a single method runs. A database running in memory will speed up the process.

    However, there are some...

    Read More
  • Node.js deployment in production settings

    While node.js is exciting, it is clear that it is not a solution for everything. In particular, it would be a very bad idea to use node.js for content management systems. It would take too much efforts to write a CMS based in Node.js from scratch comparing to other mature CMS in PHP/Java/.Net/Python. Personally, I also feel Node.js is not suited for the standard CRUD apps yet. There is no big frameworks built on top of Node.js which give you features such as ORM for multiple databases, code generation, security handling, user management and...

    Read More
  • Centos Apache SSL setup note

    Further instructions can be found here:

    http://library.linode.com/web-servers/apache/ssl-guides/centos

    Key steps:

    # instal Apache mod ssl
    $ yum install mod_ssl
    
    # create folder for certs
    $ mkdir /etc/httpd/ssl
    
    # generate cert signing request
    # take note of the Common Name. It must be the domain name e.g. www.ngo-hung.com
    $ sudo openssl req -new -days 365 -nodes -keyout www.ngo-hung.com.key -out www.ngo-hung.com.csr
    
    # either self signed the cert or send to CA authority
    
    # update ssl.conf under conf.d about the cert files locations
        ...
    Read More
  • PHP extensions installation in Centos 6

    Below is my note on installing the common extensions (assuming php-pear has been yum installed):

    ImageMagick

    $ yum install gcc
    $ yum -y install php-devel
    
    # install imagemagick binary
    $ yum install ImageMagick
    $ yum install ImageMagick-devel
    
    # install php extension
    $ pecl install imagick
    
    # update configuration file
    $ echo "extension=imagick.so" > /etc/php.d/imagick.ini
    
    # restart httpd 
    $ sudo service httpd restart
    

    MCrypt

    # install Epel repo for yum
    $ sudo rpm -ivh...
    Read More
  • Centos 6 LAMP setup

    This is to document the whole setup process.

    Apache

    # update yum
    $ yum update
    
    # install httpd
    $ yum install httpd
    
    # start httpd at system start
    $ /sbin/chkconfig --levels 235 httpd on
    
    # start Apache
    $ service httpd start
    

    MySQL

    # install mysql
    $ yum install mysql-server
    
    # start mysql on system startup
    $ /sbin/chkconfig --levels 235 mysqld on
    
    # start mysql service
    $ service mysqld start
    
    # run secure installation to setup root password, remove test database and user
    $ mysql_secure_installation
    

    PHP

    # install php and pear package
    $...
    Read More