Showing posts with label Databases. Show all posts
Showing posts with label Databases. Show all posts

Automatic MySQL Backup using Batch File on Windows

Backup of your database are important. You can do the backup manually but automatic backup with regular time interval are good and time saving. In this post I am specifically talking about Mysql. Unfortunately there is no free solution for auto Backup. SoThere is a simple workaround available on windows platform to make MySQL backup automatically and freely. For this reason, you require a batch file and you have to write a batch script. And here are the steps for Mysql Database auto Backup:

1. Create a backup.bat file
2. Open the file in notepad and add this

echo off 
start "" "C:\wamp\bin\mysql\mysql5.6.12\bin\mysqldump.exe(your my sql dump address)" --user root --password=(provide your db password here) databaseNameHere --result-file="D:\database backup location SqlFileName.sql" --database databaseNameHere


Now let's break down the string we have mentioned in the above file:

store image in database or path which better?

There are different pros and cons of saving images file into database.

Saving Image file in Database

Pros:

If you want to save and secure sensitive/confidential Images like employee face images.
Deleting the file will delete the image too.
Database backup will automatically backup the images too.

Cons:

Slow access to the image and require more resources on the server.
The database grows quickly consequently database backup will require more time.

Saving Image  in File System


Pros:

Enable quick access to the image, Webserver easily/quickly provide the file.
Easily viewable on the server through image viewer/browse.

Cons:

Deleting the record will require to delete the file separately.
Low security of image

Ref:


  1. https://teamtreehouse.com/community/storing-image-in-database-compare-with-storing-at-the-folder-server
  2. https://www.quora.com/Difference-in-storing-image-in-database-table-vs-storing-image-in-folder-and-save-its-path-in-database-Which-is-better-and-why-PHP
  3. https://habiletechnologies.com/blog/better-saving-files-database-file-system/

Data Saving Techniques for Unity3d Application

Data is one of the integral element in modern applications of Games, VR/AR or gamification. Unity3d, the most famous and most widely use game-engine provide you different options to save your game data in different ways. Once on a forum, a programmer asks the question that how to save data in unity3d?? and I  answered him with different options. I guess it is necessary to share the detail of the answer for future users. So, here is the list of different options for saving data for unity application. (we will like to update this article to add more techniques if you know anyone).



1. Platform-independent:

One way of saving data in Unity3D in a Platform-independent way is to use the PlayerPrefs class.


Here is the example to set a string and later get it through PlayerPrefs class.


Where the Data Store? Here is the chart:
Platform
Data stored at
Windows
Registry under HKCU\Software\[company name]\[product name] key
macOS
~/Library/Preferences folder, in a file named unity.[company name].[product name].plist, 
Win Phone 8
 application's local folder
WebGL
browser's IndexedDB
Linux
~/.config/unity3d/[CompanyName]/[ProductName]
Android
/data/data/pkg-name/shared_prefs/pkg-name.xml



* company and product names are the names set up in Project Settings

Reference Links:

·         PlayerPrefas Documentation

·   Tutorial PERSISTENCE - SAVING AND LOADING DATA using DontDestroyOnLoad, PlayerPrefs, and data serialization Video Tutorial by unity.

2. Server Side:

You can also use a Server for saving data (like a combination of PHP and MySQL Database). You can use it to save Score Data, user profile, etc., Learn More From Unity Wiki
You can also use third party solution like back4App and firebase.



3. Embedded Database:

SQLite (an embedded database for your app) is another great option for you get the Free Package, it is simple and easy (and my favorite) if you know SQL.