Monday, October 24, 2016

PHP - Detect Facebook user agent

    print "Facebook User-Agent detected!";

Monday, October 17, 2016

How to fix : Cannot login MySQL without sudo command (Ubuntu)

1. Log MySQL with sudo command
sudo mysql -u root

2. Drop current [email protected] account
mysql> DROP USER 'root'@'localhost';

3. Recreate your user *without password
mysql> CREATE USER 'root'@'%' IDENTIFIED BY '';

4. Give all database and table permissions to your root user then flush privileges
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';

Done! Now you can use MySQL without sudo command. I suggested you to restart MySQL services after this work around. bye!

Tuesday, October 11, 2016

PHP Fatal error: Call to undefined function bccomp() - Ondřej PHP PPA

I am using PPA from Ondřej for my PHP project, seem the default installation does't came with bcmath library.
Stack trace:
1. {main}() /var/www/html/
Fatal error:  Call to undefined function bccomp() in /var/www/html/

Fix it by enter this command :
$ sudo apt install php5.6-bcmath
$ sudo apt install php7.0-bcmath
$ sudo apt install php-bcmath
Ref :

How to - Convert MkDocs to PDF

I has been requested to create website that will use as Term of Services and Privacy Policy on our services, I am dealing with future changes and I want people get alert and know what has been modified soon. I found out creating simple static page are more convinince. I'am using MkDocs - Project documentation with Markdown as the platform which is quite simple. This documentation site are using markdown and python. I recorded any changes using our private git as tracker. Simply just install Python and PIP then pull mkdocs via pip command. The problem is, MkDocs does't have any built in PDF converter so we need to install pandoc, mkdocs-pandoc and few Tex library to compile the documentation into PDF.

$ sudo pip install pandoc
$ sudo pip install mkdocs-pandoc
$ sudo apt-get install texlive-full

To convert written MkDocs into PDF just type this command :
$ mkdocs2pandoc > myFile.pd
$ pandoc --toc -f markdown+grid_tables+table_captions -o myFile.pdf myFile.pd

That all, Adios!