Tutorial by Examples: cm

An Anaphoric Macro is a macro that introduces a variable (often IT) that captures the result of a user-supplied form. A common example is the Anaphoric If, which is like a regular IF, but also defines the variable IT to refer to the result of the test-form. (defmacro aif (test-form then-form &o...
Suppose you have a Dockerfile ending with ENTRYPOINT [ "nethogs"] CMD ["wlan0"] if you build this image with a docker built -t inspector . launch the image built with such a Dockerfile with a command such as docker run -it --net=host --rm inspector ,nethogs will monitor the...
Head over to CMake download page and get a binary for your operating system, e.g. Windows, Linux, or Mac OS X. On Windows double click the binary to install. On Linux run the binary from a terminal. On Linux, you can also install the packages from the distribution's package manager. On Ubuntu 16.0...
The function map() from the package maps provides a simple starting point for creating maps with R. A basic world map can be drawn as follows: require(maps) map() The color of the outline can be changed by setting the color parameter, col, to either the character name or hex value of a color...
Django manger is an interface through which the django model queries the database. The objects field used in most django queries is actually the default manager created for us by django (this is only created if we don't define custom managers). Why would we define a custom manager/queryset? To avo...
Travis CI has CMake 2.8.7 pre-installed. A minimal .travis.yml script for an out-of source build language: cpp compiler: - gcc before_script: # create a build folder for the out-of-source build - mkdir build # switch to build directory - cd build # run cmake; here we assume...
The CMake version preinstalled on Travis is very old. You can use the official Linux binaries to build with a newer version. Here is an example .travis.yml: language: cpp compiler: - gcc # the install step will take care of deploying a newer cmake version install: # first we creat...
This is how to create a basic method that logs 'Hello World" to the console: - (void)hello { NSLog(@"Hello World"); } The - at the beginning denotes this method as an instance method. The (void) denotes the return type. This method doesn't return anything, so you enter void. ...
Abstract classes are classes that are meant to be inherited but avoid implementing specific methods, leaving behind only method signatures that subclasses must implement. Abstract classes are useful for defining and enforcing class abstractions at a high level, similar to the concept of interfaces ...
In this example we aim to accomplish one of the most common tasks: I have a small DC motor laying around, how do I use my Arduino to control it? Easy, with PWM and serial communication, using the function analogWrite() and the Serial library. The basics Pulse Width Modulation or PWM for short is a...
Remarks Every motion can be used after an operator command, so the command operates on the text comprised by the movement's reach. Just like operator commands, motions can include a count, so you can move by 2words, for example. Arrows In Vim, normal arrow/cursor keys (←↓↑→) work as expected...
Fortran 2003 introduced intrinsic modules which provide access to special named constants, derived types and module procedures. There are now five standard intrinsic modules: ISO_C_Binding; supporting C interoperability; ISO_Fortran_env; detailing the Fortran environment; IEEE_Exceptions, IEEE_...
In Python 3 the cmp built-in function was removed, together with the __cmp__ special method. From the documentation: The cmp() function should be treated as gone, and the __cmp__() special method is no longer supported. Use __lt__() for sorting, __eq__() with __hash__(), and other rich compariso...
A minimal CMake project file that uses Qt5 can be: cmake_minimum_required(VERSION 2.8.11) project(myproject) find_package(Qt5 5.7.0 REQUIRED COMPONENTS Core ) set(CMAKE_AUTOMOC ON) add_executable(${PROJECT_NAME} main.cpp ) target_link_libraries(${PROJECT_NAME} Qt5::C...
Constructor overloading is not available in As3. In order to provide a different way to retrieve an instance of a class, a public static method can be provided to serve as an alternative "constructor". An example for that is flash.geom.Point, which represents a 2D point object. The coor...
This is an example of how to use the generic type TFood inside Eat method on the class Animal public interface IFood { void EatenBy(Animal animal); } public class Grass: IFood { public void EatenBy(Animal animal) { Console.WriteLine("Grass was eaten by: {0}",...
A static member function is just like an ordinary C/C++ function, except with scope: It is inside a class, so it needs its name decorated with the class name; It has accessibility, with public, protected or private. So, if you have access to the static member function and decorate it correctl...
A static member variable is just like an ordinary C/C++ variable, except with scope: It is inside a class, so it needs its name decorated with the class name; It has accessibility, with public, protected or private. So, if you have access to the static member variable and decorate it correctl...
Numbers are monoidal in two ways: addition with 0 as the unit, and multiplication with 1 as the unit. Both are equally valid and useful in different circumstances. So rather than choose a preferred instance for numbers, there are two newtypes, Sum and Product to tag them for the different functional...
The following example encrypts data by using a hybrid cryptosystem consisting of AES GCM and OAEP, using their default parameter sizes and an AES key size of 128 bits. OAEP is less vulnerable to padding oracle attacks than PKCS#1 v1.5 padding. GCM is also protected against padding oracle attacks. ...

Page 2 of 8