Categories
Business and Marketing

Harness the power of exponential growth

All successful entrepreneurs, wealthy people and academic geniuses agree that exponential growth is what it takes to be where they stand.

What is exponential growth? Mathematically, it’s just a way of describing how something not only grows over time but the rate of growing itself increases in the process, reaching unbelievable mark at the end.

Population grows at exponential rates, both human and animals. So do epidemic diseases extending themselves – the more the infected, the faster the disease spreads. As opposed to linear growth such as 1, 2, 3, 4, 5, 6… which is forever growing by a constant increase of 1, exponential growth such as 1, 2, 4, 8, 16, 32 easily overpasses it at the 3rd round, makes it twice as much in the 4th round and over 5 times in just the 6th round!

That’s astounding. And this is how billionaires are made. They are made of exponential growths.

Consider what you do now, as an online freelancer, a programmer in a corporate giant or a common office staff. You work for others, supplying your time in exchange for a monthly wage. You are a great worker, smart, creative, efficient and obedient, thus getting paid $100,000 a year – a rather high paying job that is. But after 10 years graduating from Harvard, you are still doing the same job, settled for just $100,000 a year, thinking great, I’d be able to retire at the age of 45 because then I’d have one million dollars! Yes, you probably would, but that’s it.

You get it. This guy is doomed with linear growth.

Let’s look again at how billionaires are made. They make use of every dollar they have at any time. Money works for them rather than the other way around.

What if I don’t have that much money in the first place? You would ask. Focus on the idea instead of the way billionaires are made. You don’t have money but you do have time at your own disposal. How you are going to spend them is just like the problem of how to effectively spend money and make them work for you.

Extend your thoughts into the future. Is how you spent the last minute wise and does it work into the future?

Part 2: What can you do?

Categories
Linux Server Administration Tips SQL / MySQL Tips and Tutorials

Backup and recover a MySQL database under command line

Yes you can log into phpmyadmin, backup your database by simply using Export and recover it by using Import. However all lamp servers come with a max upload file size, limited by the smaller of upload_max_filesize and post_max_size while also restricted by php.ini configurations such as memory_limit and max_input_time. What if you’ve got a huge database of hundreds of thousands of records taking up a few dozens of megabytes or even more?

Use MySQL command line to fulfill the same task.

Backup a database to sqlfile.sql:

mysqldump -h localhost -u username -p dbname > sqlfile.sql

After dumping it as a SQL text file, you may want to first zip it using the following command:

tar zcf sqlfile.sql.tar.gz sqlfile.sql

And download it to your local computer to be kept safe. When an emergency occurs, upload sqlfile.sql.tar.gz to your web server and unzip it:

tar zxf sqlfile.sql.tar.gz

Now that you have sqlfile.sql, you may proceed to restore it back into database, using the command below.

Recover a database from sqlfile.sql:

mysql -h localhost -u username -p dbname < sqlfile.sql

Beware of the less than / greater than mark that’s representing operation directions.

Change localhost to your own mysql server address, username to your own mysql account username and dbname to the name of the database to be backed up or recovered. Straight enough.

Also notice that MySQL user password is not specified in the command line but you will be prompted to enter it after hitting enter.

Categories
PHP Tips & Tutorials XML Tips and FAQ

How to delete / remove nodes in SimpleXML

The other day I was testing and playing with SimpleXML to process some XML documents when I came to a problem – I realized that I needed to delete a node before dumping the XML object to text. However if you are familiar with SimpleXML, it doesn’t come with a down right way to remove nodes like DOMDocument does.

A few searches on Google neither helped – people were just saying how simple SimpleXML was and it simply could not fulfill a task like this.

You know what I did? Yes, just ‘unset‘ the node.

$str = <<<STR
<a>
  <b>
    <c>
    </c>
  </b>
</a>
STR;

$xml = simplexml_load_string($str);
unset($xml –> a –> b –> c); // this would remove node c
echo $xml –> asXML(); // xml document string without node c

There you go!