Skip to content

Instantly share code, notes, and snippets.

View DamianSuess's full-sized avatar
👍
Enjoying every day

Damian DamianSuess

👍
Enjoying every day
View GitHub Profile
@DamianSuess
DamianSuess / osx_uninstall_mysql_install_mariadb_homebrew.md
Created March 18, 2016 14:56 — forked from brandonsimpson/osx_uninstall_mysql_install_mariadb_homebrew.md
OSX How To: Uninstall native MySQL and install MariaDB via Homebrew

OSX How To: Uninstall native MySQL and install MariaDB via Homebrew

This is a short overview on how to completely remove any old mysql server installs in OSX and upgrade to MariaDB without conflicts. Things can get a bit weird when you have various old installs of MySQL server floating around, and utilizing homebrew to install and upgrade MariaDB as a drop in replacement for MySQL has worked well, especially if you're used to managing MySQL installs via yum in linux.

First: Backup Your Data!

Backup all of your current databases with mysqldump

This isn't a tutorial on backups, and there are many ways to do it. You should know how to backup your data anyway. For this example, we'll do a full backup of our InnoDB databases.

@DamianSuess
DamianSuess / MainActivity.cs
Last active September 9, 2016 17:17
Android - Remove Title and Notification bars
namespace TestApp.Droid
{
[Activity(Label = "myApp",
MainLauncher = true,
Icon = "@drawable/Icon",
ScreenOrientation = ScreenOrientation.Landscape)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle bundle)
{
@DamianSuess
DamianSuess / MainActivity.cs
Created September 9, 2016 17:14
Android - Enforce Screen Orientation
namespace TestApp.Droid
{
[Activity(Label = "TestApp",
Icon = "@drawable/icon",
Theme = "@style/MyTheme",
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation,
NoHistory = true)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle bundle)
@DamianSuess
DamianSuess / DroidBluetoothConnectAsync.cs
Last active September 12, 2016 00:43
Android connect to Bluetooth device asynchronously
/*
Source:
https://forums.xamarin.com/discussion/30055/connecting-to-a-bluetooth-scanner-with-xamarin-android#Comment_94845
The problem relates to device.GetUuids. You are assuming the Uuid is what you
want with ElementAt(0). What you need is a loop inside your foreach, like in
the following testing, that the device supports the Bluetooth Serial Port Profile
*/
ParcelUuid[] uuids = device.GetUuids();
@DamianSuess
DamianSuess / DroidTelephonySimInfo.cs
Last active January 28, 2022 22:02
Get Android's SIM ICC Id and device's IMEI number
// Requires the following permission in your AndroidManifest.xml
// <uses-permission android:name="android.permission.READ_PHONE_STATE" />
using System.Collections.Generic;
using Android.Telephony;
// ...
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
@DamianSuess
DamianSuess / ThreadBgWorker.cs
Created October 22, 2016 20:26
Thread Background Worker
namespace XI.Template
{
using System.ComponentModel;
class ThreadTest
{
#region Constructor and attributes
private System.ComponentModel.BackgroundWorker _thread;
@DamianSuess
DamianSuess / CombinedGuid.cs
Created October 24, 2016 19:24
Db-CombinedGuid
//
// Used to create a Combined GUID for database Primary Keys
//
public Guid GenerateComb()
{
// T-SQL Equivalent
// DECLARE @guid UNIQUEIDENTIFIER;
// SET @guid = CAST(CAST(NEWID() AS BINARY(10)) + CAST(GETDATE() AS BINARY(6)) AS UNIQUEIDENTIFIER);
// SELECT @guid;
@DamianSuess
DamianSuess / IniFile.cs
Last active January 7, 2019 03:21
INI File usage and implementation for .NET
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
namespace Xeno.Tools
{
class IniFile
{
private const string INI_EXT = ".ini";
@DamianSuess
DamianSuess / Benchmark.cs
Created June 2, 2017 16:28
C# Benchmark
using System.Diagnostics;
// ...
Stopwatch sw = new Stopwatch();
sw.Start();
// ...
sw.Stop();
Console.WriteLine("Elapsed={0}", sw.Elapsed);
@DamianSuess
DamianSuess / MartialString.cpp
Created June 13, 2017 21:47
Managed C++, convert String^ to std::string
/// ----------------------------------------------------------------------------
/// <summary>Convert from String^ to std::string</summary>
System::Void TestClass::MarshalString(String ^ strIn, string& strOut)
{
using namespace Runtime::InteropServices;
const char* chars = (const char*)(Marshal::StringToHGlobalAnsi(strIn)).ToPointer();
strOut = chars;
Marshal::FreeHGlobal(IntPtr((void*)chars));
}