-
C# Modifier async / await
Modifier: async / await Used to mark a method as being asynchronous and to await results from the asynchronous processing. Available from .NET 4.5 (C# 5). Example: using System; using System.Net.Http; using System.Threading.Tasks; using System.Windows; namespace Examples { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow…
-
C# Modifier: abstract
Modifier: abstract Used to declare an incomplete implementation of a class, method, property, indexer or event. By declaring a class abstract, it can be used as a template when creating other classes. In the example below, the abstract class A forces any classes that are derived from it to include a ‘Test’ method. Failure to…
-
C# Operator ‘is’
Operators: is Used to check whether a cast from type A to type B. It is often more efficient to do the cast using ‘as’ as it will return the casted content instead of just telling you that it would work if you tried. Example: If(lotus is Car) System.Console.WriteLine(“A Lotus is a Car”);
-
C# Operator ‘as’
Operators: as Used to cast without triggering an exception. More efficient than using the ‘is’ operator as the cast value is returned if the operation is successful while the ‘is’ operator only returns a bool to denote success or failure. Example: Car c = lotus as Car; If(c != null) System.Console.WriteLine(“Cast worked”);…
-
iOS “Process launch failed: failed to get the task for process nnn”
Best explanation I have for this one is that it’s caused by using an Adhoc provisioning profile to launch a build from XCode. The Adhoc profile is seen as a distribution build so Apple won’t allow you to debug it directly. You are still able to send the build to the device and launch on…
-
OSX “You do not have permission to open the application…”
I got this message (again) this morning and needed to open the application anyway. Unfortunately, “System Preferences->Security & Privacy” has the “Anywhere” option removed by default in El Capitan, Sierra and High Sierra (and above I assume). To get it back, just do this from a terminal: – sudo spctl –master-disable This will re-enable the…
-
Generating a Public/Private key for use with ssh (OSX)
Quick note so I don’t forget this for next time… ssh-keygen -f ~/.ssh/[keyname] e.g. ssh-keygen -f ~/.ssh/myuser This will generate two files: – myuser.pub <- public key myuser <- private key The latter of the two files is your…
-
Normalization by Standard Deviation
Originally found at “http://www.d.umn.edu/~deoka001/Normalization.html” Normalization by Standard Deviation We normalize the attribute values by using standard deviation. For Example: Consider 5 instances which has attribute A with the following values: {-5, 6, 9, 2, 4} First we calculate the mean as follows: Mean = (-5+6+9+2+4) / 5 = 3.2 Second, we subtract the mean from…
-
Remote connection to a Mac (OSX)
Open a bash window in Windows 10 (Start + “bash”) Connect to the Mac using ssh [username]@[ipaddress] e.g. “ssh jenkins@192.168.1.100” If you get an error saying “Connection refused” then you’ll need to go to “System Preferences ->Sharing” on the Mac and enable “Remote Login” for the user you want to connect as Type your password…
-
“The item you requested is not available for purchase.”
If you’re working on Android IAP (GooPlay) and get the message “The item you requested is not available for purchase”, the problem will be one of the following: – Ensure you’ve uploaded a build to GooPlay Make sure the IAP name you’re requesting has been set up in GooPlay (under “In-app products” in the Google…
