Backup and restore mysql server

backup command:

mysqldump -h localhost -u username -p database_name > backup_db.sql

restore:

mysql [--verbose] --user=XXXXXXXX --password=XXXXXXXX DB_NAME < /PATH/TO/DUMPFILE.SQL

 

The [–verbose] option will out all the info on the screen. it is NOT recommended!

An easy way to declare a function pointer

Function pointers are little complicated and many people ask about the right way to define this type of pointer.

  1. use typedef
  2. start with a function, then add the *.

lets try it: lets create a function that returns a pointer and receive two variables:

void * myFunction (int x, int y);

Now, to make it a pointer (very easy!) surround the function name with parentheses and right after the opening of the parentheses, put the * sign, like so:

void * (*myFunction) (int x, int y);

Here you go  Рa function pointer. But who wants to type this every time?

So, we are using this:

typedef void * (*myFunction) (int x, int y);

and now, myFunction is a declared type.

Easy, ha?