Tutorial by Examples

An Akka MessageDispatcher is what makes Akka Actors "tick", it is the engine of the machine so to speak. All MessageDispatcher implementations are also an ExecutionContext, which means that they can be used to execute arbitrary code, for instance Futures. Every ActorSystem will have a def...
So in case you want to give your Actor a different dispatcher than the default, you need to do two things, of which the first is to configure the dispatcher in your application.conf: my-dispatcher { # Dispatcher is the name of the event-based dispatcher type = Dispatcher # What kind of Exe...
Using docker-machine is the best method to install Docker on a machine. It will automatically apply the best security settings available, including generating a unique pair of SSL certificates for mutual authentication and SSH keys. To create a local machine using Virtualbox: docker-machine create...
Listing docker-machines will return the state, address and version of Docker of each docker machines. docker-machine ls Will print something like: NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS docker-machine-1 - ovh Running ...
Upgrading a docker machine implies a downtime and may require planing. To upgrade a docker machine, run: docker-machine upgrade docker-machine-name This command does not have options
In Common Lisp, if is the simplest conditional construct. It has the form (if test then [else]) and is evaluated to then if test is true and else otherwise. The else part can be omitted. (if (> 3 2) "Three is bigger!" "Two is bigger!") ;;=> "Three is bigger...
Tagging an image is useful for keeping track of different image versions: docker tag ubuntu:latest registry.example.com/username/ubuntu:latest Another example of tagging: docker tag myApp:1.4.2 myApp:latest docker tag myApp:1.4.2 registry.example.com/company/myApp:1.4.2
docker save -o ubuntu.latest.tar ubuntu:latest This command will save the ubuntu:latest image as a tarball archive in the current directory with the name ubuntu.latest.tar. This tarball archive can then be moved to another host, for example using rsync, or archived in storage. Once the tarball h...
While attached to a running container with a pty assigned (docker run -it ...), you can press ControlP - ControlQ to detach.
Use the lazy_static crate to create global immutable variables which are initialized at runtime. We use HashMap as a demonstration. In Cargo.toml: [dependencies] lazy_static = "0.1.*" In main.rs: #[macro_use] extern crate lazy_static; lazy_static! { static ref HASHMAP: Hash...
Docker is just a fancy way to run a process, not a virtual machine. Therefore, debugging a process "in a container" is also possible "on the host" by simply examining the running container process as a user with the appropriate permissions to inspect those processes on the host (...
Mobile platforms like iOS automatically recognize phone numbers and turn them into tel: links. While the feature is very practical, the system sometimes detects ISBN codes and other numbers as telephone numbers. For mobile Safari and some other WebKit-based mobile browsers to turn off automatic pho...
docker-compose run service-name command If, for example, you wanted to run rake db:create in your web service, you'd use the following command: docker-compose run web rake db:create
Install Docker Engine. If you get a Permission denied error, Run sudo -i before the two commands below, then exit. Pull Docker Compose to /usr/local/bin/docker-compose. curl -L https://github.com/docker/compose/releases/download/1.7.1/docker-compose-`uname -s`-`uname -m` > /usr/loc...
With benchmark tests you can test and measure the speed of the code, however benchmark tests are still unstable. To enable benchmarks in your cargo project you need nightly rust, put your integration benchmark tests to the benches/ folder in the root of your Cargo project, and run cargo bench. Exam...
Orders Table CustomerIdProductIdQuantityPrice12510013220014150021450356700 When grouping by a specific column, only unique values of this column are returned. SELECT customerId FROM orders GROUP BY customerId; Return value: customerId123 Aggregate functions like count() apply to each group...
Numeric CSS properties can be incremented and decremented with the += and -= syntax, respectively, using the .css() method: // Increment using the += syntax $("#target-element").css("font-size", "+=10"); // You can also specify the unit to increment by $...
Unlike the loops in nearly every other programming language in use today, the LOOP in Common Lisp can be used as an expression: (let ((doubled (loop for x from 1 to 10 collect (* 2 x)))) doubled) ;; ==> (2 4 6 8 10 12 14 16 18 20) (loop for x from 1 to 10 sum x) ...
LOOP has its own IF statement that can control how the clauses are executed: (loop repeat 1000 for x = (random 100) if (evenp x) collect x into evens else collect x into odds finally (return (values evens odds))) Combining multiple clauses in an IF ...
Although it is very tempting to use BETWEEN ... AND ... for a date range, it is problematical. Instead, this pattern avoids most problems: WHERE x >= '2016-02-25' AND x < '2016-02-25' + INTERVAL 5 DAY Advantages: BETWEEN is 'inclusive' thereby including the final date or second. 2...

Page 424 of 1336