Monthly Archives: April 2016

A few months ago we had to find a way to backup our MySQL databases, both remotely and locally. Instead of trying to find a software that did something similar I decided to write a few lines of code that solved our problem. Why spend time and money evaluating software when can create your own solution to the problem with little to no cost, right ?

The snippet below is fairly simple. The $databases variable holds an array of all the databases you want to dump. You will need to specify the database name, the path you wish to save the backup and the backup filename. I took the liberty of commenting the code in order to make it a bit more clear.

Please keep in mind that this solution uses mysqldump. This executable is usually located under C:\Program Files\MySQL\MySQL Server 5.6\bin, assuming you have MySQL server installed. In addition to mysqldump, since all our Windows servers we have WinRAR installed, this snippet uses WinRAR in order to compress the database files. You can always modify the code either skip the compression or to use .NET’s ZipFile class or 7zip.

This solution still needs some tweaking. For example, creating a temporary file with the passwords and passing it as an argument to mysqldump to avoid the “Specifying a password on the command line should be considered insecure” message, as well as some code cleanup and error catching. Until then, you are free to modify this example to better suit your needs.

If you have any questions feel free to post them in the comment section below.

Sometimes you might need to create database tables dynamically, based on new users, products etc. The snippet below allows you to do exactly that, create a new table in your database dynamically, straight from your code.

The first thing you need to do, as mentioned in the article linked above, is that you will need to add a reference to MySQL.Data in your project. After you have done that, you can modify the snippet below to create the table with the columns you want based on your requirements.

Starting April of 2016, Visual Studio now includes Xamarin for free. This is the case for every edition of Visual Studio, including Visual Studio Community Edition, which is free as well.

With Xamarin you can develop and publish native apps for iOS and Android using C# or F# from directly within Visual Studio with no limits on app size.

For developers that are using Mac, Xamarin Studio is now available as a benefit of your Visual Studio Professional or Enterprise subscription. Developers can use the newly-created Xamarin Studio Community Edition for free.

You can visit Xamarin’s store to download Xamarin for free. Keep in mind that, Xamarin, although free, is license restricted for bigger companies. If you want to use Xamarin you will need to comply to one of the following license terms:

Individual license – If you are an individual working on your own applications to sell or for any other purpose, you may use the software to develop and test those applications.

Organization licenses – If you are an organization, your users may use the software as follows:

Any number of your users may use the software to develop and test your applications released under Open Source Initiative (OSI) approved open source software licenses.

Any number of your users may use the software to develop and test extensions to Visual Studio.

Any number of your users may use the software to develop and test your applications as part of online or in person classroom training and education, or for performing academic research.

If none of the above apply, and you are also not an enterprise (defined below), then up to 5 of your individual users can use the software concurrently to develop and test your applications.

If you are an enterprise, your employees and contractors may not use the software to develop or test your applications, except for open source and education purposes as permitted above. An enterprise is any organization and its affiliates who collectively have either (a) more than 250 PCs or users or (b) more than one million US dollars (or the equivalent in other currencies) in annual revenues, and enterprise means those entities that control (via majority ownership), are controlled by, or are under common control with an organization.

Demo use – The uses permitted above include use of the software in demonstrating your applications.