Skip to main content

Posts

Showing posts from 2016

I Love Books

I like reading books since I was a kid. Thanks to my parents that let me bought any books and embraced me to read. Bookstore becomes one of my favorite places. I like to learn any topics, not only about science or IT stuffs. For me, reading a book isn't always intended to have possession in the topic, but it's for my personal pleasure and building an insight of something. some of them There're many things around us that we don't understand really well. If we try to figure it out by ourselves, we will waste most of our precious time. So, it's better to learn from the expert who has studied it well and then considering it with our common sense and logic. I grow up, many affairs had occurred, and shit happens. I realize that I have forgotten a lot of things. I likely tend to be aware of fewer things. So let me open a cupboard full of books which I've collected since a long time ago.

Master Slave Replication to Automatically Backup Your MySQL Database

We can make backup for some databases by periodically running a kind of dump query, like mysqldump in MySQL. That's the simplest method but it can drain our server resources and it's not suitable for large databases. MySQL comes up with master-slave features that allow you to replicate your database to another location (slave). This mechanism enables MySQL to generate a log file which records any action performed to the database. Then, that action will be run in slave database too. For example, we have two database servers with IP address 192.168.0.1 (Master) and 192.168.0.2 (Slave). 1) Configure my.cnf in master server # Master Settings # locate where the changes record will be stored log-bin = /var/log/mysql/mysql-bin.log # set unique ID for master database in master-slave network (up to you) server-id = 111 innodb_flush_log_at_trx_commit = 1 sync_binlog = 1 # select database which will be replicated # by default system will log all databases binlog-do-db = ...

Zurmo CRM wtih Nginx and PHP 7

Zurmo is one of open source CRM application based on PHP. Current application isn't supported for PHP 7 environment because some application scripts still implement unsupported (obsolete) PHP function such as mysql_connect , mysql_fetch_array , etc. First, we must change some scripts which still implement unsupported PHP 7 functions. The scripts are: app\protected\commands\tests\unit\DatabaseCommandTest.php app\protected\core\tests\unit\DatabaseCompatibilityUtilTest.php app\protected\core\utils\DatabaseCompatibilityUtil.php You can download the scripts from HERE . Second, if we run Nginx server, we can use this following configuration. server {         listen 443 ssl;         root /path/to/zurmo ;         index index.php index.html;         server_name yourdomain.com ;         ssl_certificate /pat/to/yourdomain.crt ;         ssl_certifi...

Generate .SQLITE File from .SQL File in Windows

You can generate .SQLite file from .SQL file by using SQLite-CLI. For that purpose, you need to prepare some gears as the following. 1. Sqlite 32-bit DLL 2. Sqlite Tool for Windows (Command Line Tools) You can download all needs from here . After you download the items, you need to extract them into a directory for example "C:\\sqlite". Now, in you directory, you will have sqldiff.exe, sqlite3.def, sqlite3.dll, sqlite3.exe, and sqlite3_analyzer.eze. Next, you should add "C:\\sqlite" or your own location into PATH data in Windows environment variable so you can access "sqlite3.exe" from command prompt without full path declaration. In command prompt you can type sqlite3 then the following messages will appear. SQLite Messages Now, you are in SQLite command terminal. First, you need to open the SQL file. Your opened file will be assigned into an in-memory database. Then you can save that in-memory database into a SQLite file. Before you open...

Upgrading PHP 5 to PHP 7 in Ubuntu

PHP 7 comes with a new version of the Zend Engine, numerous improvements and new features such as: Improved performance: PHP 7 is up to twice as fast as PHP 5.6 Significantly reduced memory usage Abstract Syntax Tree Consistent 64-bit support Improved Exception hierarchy Many fatal errors converted to Exceptions Secure random number generator Removed old and unsupported SAPIs and extensions The null coalescing operator Return and Scalar Type Declarations Anonymous Classes Zero cost asserts Today (12 April 2016), latest Ubuntu release doesn't include PHP 7. You can install PHP 7 from third-party repository such as PPA. PPAs are not bound by the release schedules or policies of Ubuntu so they are free to change versions more frequently, among other things. Ondrey PPA is a popular way of staying more up to date with PHP. Ondrey is the official owner of the PHP tree in Debian, which is upstream from Ubuntu. To install PHP 7 in Ubuntu you can do the following: ...

Setting Up SSL Certificate

Nowadays, an SSL certificate which is usually used for HTTPS connections become pretty important. Even Google starts to give a ranking boost to secure HTTPS/SSL sites . There are several cheap certificates that you can buy like Comodo PositiveSSL. I usually buy cheap certificates from Namecheap.com  which provides SSL certificates as low as $4/year. After you buy the certificate, you need to set up your server. Here are the steps to set up an SSL certificate on your server. 1. Purchase the certificate You can buy the certificate from Namecheap.com . After you buy it, you need to activate your certificate by providing your generated CSR file. 2. Generate private key and CSR file In a Linux server, you can run the following command on the terminal to generate a private key and CSR file. $ openssl req -new -newkey rsa:2048 -nodes -keyout mydomain.com.key -out mydoain.com.csr   When you run the command, you will be asked for Country ID, domain name, registrant...