Posts

Showing posts from March, 2019

How To Synchronize Database Using Navicat

Image
Navicat is a database management tool provided by Premium Soft. I like Navicat so much, it is cool, easy to use and really fast in performance, i mean if i compare with like for example Workbench, it is outperformed it. And Navicat has lot of cool features, one that i really like much is the tool which we can synchronize the database from our local development computer to our server production, when you don't need to manually like for example changing or adding your database structure.

There are 2 different synchronizing tools, the one is for synchronizing the structure, second is for synchronizing the data.

1. To synchronize your database, the first thing you need to do is connect both your localhost and your server.
2. Go to Tools menu and select either Data synchronization or Structure synchronization
3. On Source section choose your most updated database, and on target choose the database that you want to update


4. Click next, then compare, wait until it finish the process, th…

How To HTML Parsing With PHP Xpath Query

Image
I am doing a lot of PHP programming, it is easier than any other language, you don't need any setup to get started with PHP, in Windows there's program called XAMPP, and just about all you need to start a PHP programming. Because the simplicity, I've created many projects using PHP, and it's fun for creating small projects. Enough for the intro, here's some handy tips when you want to do some HTML parsing.

1. To get start, using file_get_contents function to get the HTML content of the page you want to parse, save it in a variable call $contents, whatever you name it.

$contents = file_get_contents("https://example.com/the-page");

2. Declare the DOMDocument class, name the variable $dochtml, again whatever you want.

$dochtml = new DOMDocument();

3. Call the loadHTML, pass the contents from file_get_contents to its parameter.

$dochtml->loadHTML($contents);

4. Declare DOMXpath, pass a dom object to it's constructor.

$xpath = new DOMXpath($dochtml);

5. Le…

MySQL Allow Remote Connection

Image
MySQL is undoubtedly one of the best database server exists, it is widely used by many of companies or even for just personal project around the world, because it is free and yet capable of doing something bigger.

For this tutorial we will discuss about how you can allow your MySQL server to be managed by local computer. The reason sometimes, especially for me for doing this approach is, when we want to use an advanced database management tools on our local computer, let's say we have Navicat or Workbench.

Without further ado, these are steps how you can do that. My server is Ubuntu and my local computer is Windows, but it think there's no much different.

1. Change bind address on MySQL configuration from localhost to your server IP. Login ssh to your server, and you can use vim for editing "mysqld.cnf" file.

sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf

# Replace xxx with your IP Address 
bind-address        = xxx.xxx.xxx.xxx

Restart MySQL.
sudo /etc/init.d/mysql start
sud…