Tutorial by Examples: al

There are two commands to change an atom, swap! and reset!. swap! is given commands, and changes the atom based on its current state. reset! changes the atom's value completely, regardless of what the original atom's value was: (swap! counter inc) ; => 1 (reset! counter 0) ; => 0 This e...
Installation CocoaPods CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command: $ gem install cocoapods CocoaPods 1.1.0+ is required to build Alamofire 4.0.0+. To integrate Alamofire into your Xcode project using CocoaPods, specify it in your Po...
A very useful and logical follow-up to histograms and density plots would be the Empirical Cumulative Distribution Function. We can use the function ecdf() for this purpose. A basic plot produced by the command plot(ecdf(rnorm(100)),main="Cumulative distribution",xlab="x") wo...
Aliases are named shortcuts of commands, one can define and use in interactive bash instances. They are held in an associative array named BASH_ALIASES. To use this var in a script, it must be run within an interactive shell #!/bin/bash -li # note the -li above! -l makes this behave like a login s...
To generate samples of cryptographically random data: final byte[] sample = new byte[16]; new SecureRandom().nextBytes(sample); System.out.println("Sample: " + DatatypeConverter.printHexBinary(sample)); Produces output similar to: Sample: E4F14CEA2384F70B706B53A6DF8C5EFE Note...
Performance testing is a subject/process/testing methodology but not a tool to setup. It includes the following core activities: Identify Test Environment Identify Performance Acceptance Criteria Plan and Design Tests Configure Test Environment Implement Test Design Execute Tests Analyze, ...
To compute a signature: final PrivateKey privateKey = keyPair.getPrivate(); final byte[] data = "FOO BAR".getBytes(); final Signature signer = Signature.getInstance("SHA1withRSA"); signer.initSign(privateKey); signer.update(data); final byte[] signature = signer.sign();...
Dim mdArray(2,3) mdArray(0, 0) = "test1" mdArray(0, 1) = "test2" mdArray(0, 2) = "test3" mdArray(0, 3) = "test4" mdArray(1, 0) = "test5" mdArray(1, 1) = "test6" mdArray(1, 2) = "test7" mdArray(1, 3) = "test8" md...
Dim mddArray() ReDim mddArray(0) Dim ti, testinc: testinc = "test": ti = 1 For i = 0 To 4 Dim tmpArray(): ReDim tmpArray(0) For j = 0 To 3 tmpArray(UBound(tmpArray)) = testinc & ti ti = ti + 1 ReDim Preserve tmpArray(UBound(tmpArray) + 1) Ne...
Using async initialization is a recommended way for application development. It uses the OpenCV Manager to access OpenCV libraries externally installed in the target system. Code snippet implementing the async initialization: public class MainActivity extends Activity implements CvCameraViewListen...
According to this approach all OpenCV binaries are included into your application package. It is designed mostly for development and debugging purposes. This approach is deprecated for the production code, async initialization is recommended. If your application project doesn’t have a JNI part, jus...
Due to way that the float type is represented in computer memory, results of operations using this type can be inaccurate - some values are stored as approximations. Good examples of this are monetary calculations. If high precision is necessary, other types should be used. e.g. Java 7 provides Big...
Display a two dimensional (2D) array on the axes. import numpy as np from matplotlib.pyplot import imshow, show, colorbar image = np.random.rand(4,4) imshow(image) colorbar() show()
typealias SuccessHandler = (NSURLSessionDataTask, AnyObject?) -> Void This code block creates a type alias named SuccessHandler, just in the same way var string = "" creates a variable with the name string. Now whenever you use SuccessHandler, for example: func example(_ handler: S...
typealias Handler = () -> Void typealias Handler = () -> () This block creates a type alias that works as a Void to Void function (takes in no parameters and returns nothing). Here is a usage example: var func: Handler? func = {}
typealias Number = NSNumber You can also use a type alias to give a type another name to make it easier to remember, or make your code more elegant. typealias for Tuples typealias PersonTuple = (name: String, age: Int, address: String) And this can be used as: func getPerson(for name: Strin...
import pandas as pd df = pd.DataFrame({'eggs': [1,2,4,8,], 'chickens': [0,1,2,4,]}) df # chickens eggs # 0 0 1 # 1 1 2 # 2 2 4 # 3 4 8 df.shift() # chickens eggs # 0 NaN NaN # 1 0.0 1.0 # 2 1.0 2.0 ...
By default all enum values are resolved to numbers. Let's say if you have something like enum MimeType { JPEG, PNG, PDF } the real value behind e.g. MimeType.PDF will be 2. But some of the time it is important to have the enum resolve to a different type. E.g. you receive the value fr...
Using canvas elements HTML provides the canvas element for building raster-based images. First build a canvas for holding image pixel information. var canvas = document.createElement('canvas'); canvas.width = 500; canvas.height = 250; Then select a context for the canvas, in this case two-di...
Detailed instructions on getting lambda set up or installed.

Page 196 of 269