Backup all MySQL Databases of a User

The following script can be used to backup all MySQL-Databases of a user each in it’s own compressed. sql file inside a folder with todays date: #!/bin/bash DBASELIST=`mktemp` mysqlshow -uusername -ppassword | awk ‘{print $2}’ | grep -v Databases | sort >$DBASELIST cd /backuplocation mkdir -p `date +%Y%m%d` cd `date +%Y%m%d` for x in `cat […]

Using SSH to copy files between systems

Copy something from this system to some other system: scp /path/to/local/file username@hostname:/path/to/remote/file Copy something from some system to some other system: scp username1@hostname1:/path/to/file username2@hostname2:/path/to/other/file Copy something from another system to this system: scp username@hostname:/path/to/remote/file /path/to/local/file Source: Stackoverflow: how-to-download-a-file-from-server-using-ssh

Oracle Log Script Errors

Table to Hold the script errors create table script_error_log ( error_timestamp TIMESTAMP(9), script_name VARCHAR2(255), error_number NUMBER, error_message VARCHAR2(255), error_stack VARCHAR2(2000)); Method to call from within the script create or replace procedure log_script_error (scriptname VARCHAR2) is errornumber NUMBER; errormessage VARCHAR2(250); errorstack VARCHAR2(2000); PRAGMA AUTONOMOUS_TRANSACTION; begin errornumber := sqlcode; errormessage := sqlerrm; errorstack := substr(dbms_utility.format_error_stack,1,2000); INSERT INTO […]

Backup a DVD

The following command can be used to backup/rip a DVD. All files are decrypted and stored in a folder (with the name of the DVD). dvdbackup -i /dev/dvd -o ./ -M If you want to create an iso file from those decrypted files you can use the following command: mkisofs -dvd-video -udf -o ./dvd.iso ./movie_name

How to properly deprecate methods

If you work with a C# class that has many deprecated methods in they clutter intellisense and you cannot see the useful methods anymore. To avoid this you can add the Annotation EditorBrowsable and disable intellisense: [EditorBrowsable(EditorBrowsableState.Never)] [System.Obsolete(“use new method abc instead”)] public void OldMethodThatShouldNotBeUsedAnymore() { // Do some stuff }

Find out how wpf is being rendered

WPF applications can render in three modes: everything in software, partial hardware rendering or full hardware rendering. The rendering mode may have a big effect to the application performance. This it is important to know which mode is active: Console.WriteLine(“WPF Rendering ” + GetStringForRenderCapabilityTier(RenderCapability.Tier)); RenderCapability.TierChanged += (sender, args) => Console.WriteLine(“WPF Rendering changed to ” + […]