How to change MySQL data directory?

Stop MySQL using the following command: sudo /etc/init.d/mysql stop Copy the existing data directory (default located in /var/lib/mysql) using the following command: sudo cp -R -p /var/lib/mysql /newpath edit the MySQL configuration file with the following command: sudo gedit /etc/mysql/my.cnf # or perhaps /etc/mysql/mysql.conf.d/mysqld.cnf Look for the entry for datadir, and change the path (which … Read more

How can I make Sublime Text the default editor for Git?

Windows Sublime Text 2 (Build 2181) The latest Build 2181 just added support for the -w (wait) command line argument. The following configuration will allow ST2 to work as your default git editor on Windows. This will allow git to open ST2 for commit messages and such. git config –global core.editor “‘c:/program files/sublime text 2/sublime_text.exe’ … Read more

Reset CSS display property to default value

A browser’s default styles are defined in its user agent stylesheet, the sources of which you can find here. Unfortunately, the Cascading and Inheritance level 3 spec does not appear to propose a way to reset a style property to its browser default. However there are plans to reintroduce a keyword for this in Cascading … Read more

Programmatic equivalent of default(Type)

In case of a value type use Activator.CreateInstance and it should work fine. When using reference type just return null public static object GetDefault(Type type) { if(type.IsValueType) { return Activator.CreateInstance(type); } return null; } In the newer version of .net such as .net standard, type.IsValueType needs to be written as type.GetTypeInfo().IsValueType