Tutorial by Examples

For clarity and maintainability, it is often recommended to develop a system or schema for naming your Redis keys. Here are some examples of common and maintainable systems for naming your keys: user:10134 user:10134:favorites user:10134:friends user:10134:friends-of-friends user:10134 user:...
You can simply use the native map APIs on each platform with Xamarin Forms. All you need is to download the Xamarin.Forms.Maps package from nuget and install it to each project (including the PCL project). Maps Initialization First of all you have to add this code to your platform-specific project...
IPython has two parts to it: A command line interface that replaces the default python REPL and a way to run Python through the web browser as a graphical user interface. With the latest developments the browser part has been split into the Jupyter project that enables multiple programming language...
Using the System.String.Contains you can find out if a particular string exists within a string. The method returns a boolean, true if the string exists else false. string s = "Hello World"; bool stringExists = s.Contains("ello"); //stringExists =true as the string contains t...
The System.String.Trim method can be used to remove all leading and trailing white-space characters from a string: string s = " String with spaces at both ends "; s = s.Trim(); // s = "String with spaces at both ends" In addition: To remove white-space only fro...
Using the System.String.Replace method, you can replace part of a string with another string. string s = "Hello World"; s = s.Replace("World", "Universe"); // s = "Hello Universe" All the occurrences of the search string are replaced: string s = "He...
Use the System.String.Split method to return a string array that contains substrings of the original string, split based on a specified delimiter: string sentence = "One Two Three Four"; string[] stringArray = sentence.Split(' '); foreach (string word in stringArray) { Console.W...
The System.String.Join method allows to concatenate all elements in a string array, using a specified separator between each element: string[] words = {"One", "Two", "Three", "Four"}; string singleString = String.Join(",", words); // singleString =...
String Concatenation can be done by using the System.String.Concat method, or (much easier) using the + operator: string first = "Hello "; string second = "World"; string concat = first + second; // concat = "Hello World" concat = String.Concat(first, second); // ...
Conventional algebraic datatypes are parametric in their type variables. For example, if we define an ADT like data Expr a = IntLit Int | BoolLit Bool | If (Expr Bool) (Expr a) (Expr a) with the hope that this will statically rule out non-well-typed conditionals, this...
A few most salient variants: Below 100 import Data.List ( (\\) ) ps100 = ((([2..100] \\ [4,6..100]) \\ [6,9..100]) \\ [10,15..100]) \\ [14,21..100] -- = (((2:[3,5..100]) \\ [9,15..100]) \\ [25,35..100]) \\ [49,63..100] -- = (2:[3,5..100]) \\ ([9,15..100] ++ [25,35..100] ++ [49,63..1...
In some cases we need to apply functions to a set of ND-arrays. Let's look at this simple example. A(:,:,1) = [1 2; 4 5]; A(:,:,2) = [11 22; 44 55]; B(:,:,1) = [7 8; 1 2]; B(:,:,2) = [77 88; 11 22]; A = ans(:,:,1) = 1 2 4 5 ans(:,:,2) = 11 22 44 55 >&...
Let's look at a sample of logging which you can see in many programs: public class LoggingComplex { private static final Logger logger = Logger.getLogger(LoggingComplex.class.getName()); private int total = 50, orders = 20; private String username = "Bob";...
In MATLAB, we can set new default custom orders, such as a colour order and a line style order. That means new orders will be applied to any figure that is created after these settings have been applied. The new settings remains until MATLAB session is closed or new settings has been made. Default ...
Add the required network permissions to the application manifest file: <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android....
Add below dependencies to your build.gradle // Facebook login compile 'com.facebook.android:facebook-android-sdk:4.21.1' Add below helper class to your utility package: /** * Created by Andy * An utility for Facebook */ public class FacebookSignInHelper { private static final...
The %s conversion of printf states that the corresponding argument a pointer to the initial element of an array of character type. A null pointer does not point to the initial element of any array of character type, and thus the behavior of the following is undefined: char *foo = NULL; printf(&quo...
Read a file all at once (not recommended for large files): (slurp "./small_file.txt") Write data to a file all at once: (spit "./file.txt" "Ocelots are Awesome!") ; overwrite existing content (spit "./log.txt" "2016-07-26 New entry." :append...
Extension Resources in Azure are resources that extend other resources. This template creates an Azure Key Vault as well as a DiagnosticSettings extension. Things to note: The extension resource is created under the resources attribute of the parent resource It needs to have a dependsOn attrib...
Create interface for clickHandler public interface ClickHandler { public void onButtonClick(View v); } Layout XML <?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/android"> <data> ...

Page 526 of 1336