Tutorial by Examples

Inspecting system resource usage is an efficient way to find misbehaving applications. This example is an equivalent of the traditional top command for containers: docker stats To follow the stats of specific containers, list them on the command line: docker stats 7786807d8084 7786807d8085 D...
Inspecting system resource usage is an efficient way to narrow down a problem on a live running application. This example is an equivalent of the traditional ps command for containers. docker top 7786807d8084 To filter of format the output, add ps options on the command line: docker top 7786807...
'Attaching to a container' is the act of starting a terminal session within the context that the container (and any programs therein) is running. This is primarily used for debugging purposes, but may also be needed if specific data needs to be passed to programs running within the container. The a...
Following the logs is the less intrusive way to debug a live running application. This example reproduces the behavior of the traditional tail -f some-application.log on container 7786807d8084. docker logs --follow --tail 10 7786807d8084 This command basically shows the standard output of the co...
When the last parameter of a function is a closure func loadData(id: String, completion:(result: String) -> ()) { // ... completion(result:"This is the result data") } the function can be invoked using the Trailing Closure Syntax loadData("123") { result in ...
In this example, 2.13.2 is the latest version. We install it via bower, specifying the particular version as ember#2.13.2 and including the save flag to persist it to bower.json. As of writing this post the latest version is 2.13.2. From the command line, in the root of your app's directory, run: ...
Since Ember Data is an Ember CLI add-on we can install it just like any other add-on by using ember install. As of writing this post the latest version is 2.13.1. From the command line, in the root of your app's directory, run: ember install [email protected]
Ember CLI is a normal npm package. To update it we have to uninstall it and then install the version we want. As of writing this post the latest version is 2.13.2. From the command line run: npm uninstall -g ember-cli npm cache clean bower cache clean npm install -g [email protected] To verif...
public class Foo { private IBar _iBar; public IBar iBar { set { _iBar = value; } } public void DoStuff() { _iBar.DoSomething(); } } public interface IBar { void DoSomething(); }
public class Foo { private readonly IBar _iBar; public Foo(IBar iBar) { _iBar = iBar; } public void DoStuff() { _bar.DoSomething(); } } public interface IBar { void DoSomething(); }
We will model the process #Load the forecast package library(forecast) #Generate an AR1 process of length n (from Cowpertwait & Meltcalfe) # Set up variables set.seed(1234) n <- 1000 x <- matrix(0,1000,1) w <- rnorm(n) # loop to create x for (t in 2:n) x[t] <- 0.7...
Sometimes you want to do something with the exception you catch (like write to log or print a warning) and let it bubble up to the upper scope to be handled. To do so, you can rethrow any exception you catch: try { ... // some code here } catch (const SomeException& e) { std::cout &l...
Color state lists can be used as colors, but will change depending on the state of the view they are used for. To define one, create a resource file in res/color/foo.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/ap...
A type that conforms to the SequenceType protocol can iterate through it's elements within a closure: collection.forEach { print($0) } The same could also be done with a named parameter: collection.forEach { item in print(item) } *Note: Control flow statements (such as break or continu...
You can create one table from another by adding a SELECT statement at the end of the CREATE TABLE statement: CREATE TABLE stack ( id_user INT, username VARCHAR(30), password VARCHAR(30) ); Create a table in the same database: -- create a table from another table in the same data...
A static class is lazily initialized on member access and lives for the duration of the application domain. void Main() { Console.WriteLine("Static classes are lazily initialized"); Console.WriteLine("The static constructor is only invoked when the class is first accessed&...
Variables of character type or of a derived type with length parameter may have the length parameter either assumed or deferred. The character variable name character(len=len) name is of length len throughout execution. Conversely the length specifier may be either character(len=*) ... ! Ass...
import pandas as pd import numpy as np np.random.seed(123) x = np.random.standard_normal(4) y = range(4) df = pd.DataFrame({'X':x, 'Y':y}) >>> df X Y 0 -1.085631 0 1 0.997345 1 2 0.282978 2 3 -1.506295 3
If you want to catch all routes, then you could use a regular expression as shown: Route::any('{catchall}', 'CatchAllController@handle')->where('catchall', '.*'); Important: If you have other routes and you don't want for the catch-all to interfere, you should put it in the end. For example: ...
A select case construct conditionally executes one block of constructs or statements depending on the value of a scalar expression in a select case statement. This control construct can be considered as a replacement for computed goto. [name:] SELECT CASE (expr) [CASE (case-value [, case-value] .....

Page 210 of 1336