Tutorial by Examples: and

Swift's C interoperability allows you to use functions and types from the C standard library. On Linux, the C standard library is exposed via the Glibc module; on Apple platforms it's called Darwin. #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) import Darwin #elseif os(Linux) import Glibc...
Background TypeScript is a typed superset of JavaScript that compiles directly to JavaScript code. TypeScript files commonly use the .ts extension. Many IDEs support TypeScript without any other setup required, but TypeScript can also be compiled with the TypeScript Node.JS package from the command...
In this example, we illustrate string manipulation in MATLAB MEX. We will create a MEX-function that accepts a string as input from MATLAB, copy the data into C-string, modify it and convert it back to mxArray returned to the MATLAB side. The main objective of this example is to show how strings ca...
arc4random_uniform(someNumber: UInt32) -> UInt32 This gives you random integers in the range 0 to someNumber - 1. The maximum value for UInt32 is 4,294,967,295 (that is, 2^32 - 1). Examples: Coin flip let flip = arc4random_uniform(2) // 0 or 1 Dice roll let roll = arc4random_...
Installing Visual Studio If you do not have Visual Studio installed, you can download the free Visual Studio Community Edition here. If you already have it installed, you can proceed to the next step. Creating an ASP.NET Core MVC Application. Open Visual Studio. Select File > New Project. ...
By default, all the methods declared in a protocol are required. This means that any class that conforms to this protocol must implement those methods. It is also possible to declare optional methods. These method can be implemented only if needed. You mark optional methods with the @optional dire...
Chef Scollector Cookbook: https://github.com/alexmbird/chef-scollector Chef Bosun Cookbook: https://github.com/ptqa/chef-bosun Puppet scollector module: https://github.com/axibase/axibase-puppet-modules Bosun Ansible/Vagrant example: https://github.com/gnosek/bosun-deploy
// Create a block with an asynchronous action var block = new ActionBlock<string>(async hostName => { IPAddress[] ipAddresses = await Dns.GetHostAddressesAsync(hostName); Console.WriteLine(ipAddresses[0]); }); block.Post("google.com"); // Post items to the block's ...
There are two Dockerfile directives to specify what command to run by default in built images. If you only specify CMD then docker will run that command using the default ENTRYPOINT, which is /bin/sh -c. You can override either or both the entrypoint and/or the command when you start up the built im...
HandleFunc registers the handler function for the given pattern in the server mux (router). You can pass define an anonymous function, as we have seen in the basic Hello World example: http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, "Hello, w...
In Go errors can be returned from a function call. The convention is that if a method can fail, the last returned argument is an error. func DoAndReturnSomething() (string, error) { if os.Getenv("ERROR") == "1" { return "", errors.New("The method fai...
/// <summary> /// This interface can do Foo /// </summary> public interface ICanDoFoo { // ... } /// <summary> /// This Bar class implements ICanDoFoo interface /// </summary> public class Bar : ICanDoFoo { // ... } Result Interface summary Clas...
Let's take an example of adding a value to a range (as it could be done in a loop for example): 3+1:5 Gives: [1] 4 5 6 7 8 This is because the range operator : has higher precedence than addition operator +. What happens during evaluation is as follows: 3+1:5 3+c(1, 2, 3, 4, 5) expansio...
To show all staged and unstaged changes, use: git diff HEAD NOTE: You can also use the following command: git status -vv The difference being that the output of the latter will actually tell you which changes are staged for commit and which are not.
Prerequisites and Requirements for Magento Community Edition 1.9 Hosting Apache 2.x ( with mod_rewrite ) or Nginx 1.7.x Due to the demands of processing Magento operations, it is recommended that you install Magento on a server with at least 2 GB of RAM. This will ensure that all of the s...
Functions can take inputs in form of variables that can be used and assigned inside their own scope. The following function takes two numeric values and returns their sum: function addition (argument1, argument2){ return argument1 + argument2; } console.log(addition(2, 3)); // -> 5 ...
x = [5, 5, 1, 3] y = [5, 2, 4, 3] Union (|) contains elements from both arrays, with duplicates removed: x | y => [5, 1, 3, 2, 4] Intersection (&) contains elements which are present both in first and second array: x & y => [5, 3] Difference (-) contains elements which ar...
The following examples show two main methods for installing Erlang/OTP on Ubuntu. Method 1 - Pre-built Binary Package Simply run this command and it will download and install the latest stable Erlang release from Erlang Solutions. $ sudo apt-get install erlang Method 2 - Build and Install from...
Option 1: Leiningen Requires JDK 6 or newer. The easiest way to get started with Clojure is to download and install Leiningen, the de facto standard tool to manage Clojure projects, then run lein repl to open a REPL. Linux curl https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/l...
Errors thrown from promises are handled by the second parameter (reject) passed to then or by the handler passed to catch: throwErrorAsync() .then(null, error => { /* handle error here */ }); // or throwErrorAsync() .catch(error => { /* handle error here */ }); Chaining If you hav...

Page 13 of 153