Tutorial by Examples: ant

<target name="compile" description="Compiles report designs specified using the 'srcdir' in the <jrc> tag." depends="prepare-compile-classpath"> <mkdir dir="./build/reports"/> <taskdef name="jrc" classname=&quot...
Constant is available both in configuration and run phases. angular.module('app',[]) .constant('endpoint', 'http://some.rest.endpoint') // define .config(function(endpoint) { // do something with endpoint // available in both config- and run phases }) .controller('MainCtrl', ...
If you have a greedy match as the first quantifier, the whole RE will be greedy, If you have non-greedy match as the first quantifier, the whole RE will be non-greedy. set mydata { Device widget1: port: 156 alias: input2 Device widget2: alias: input1 Device widget3: port: 238 alias...
Phantom types are useful for dealing with data, that has identical representations but isn't logically of the same type. A good example is dealing with currencies. If you work with currencies you absolutely never want to e.g. add two amounts of different currencies. What would the result currency o...
When we attach the !important keyword to a mixin call, the Less compiler will automatically add the !important to all properties that are present within the mixin. For example, consider the below mixin: .set-default-props() { margin: 4px; padding: 4px; border: 1px solid black; font-wei...
This creates a variant (a tagged union) that can store either an int or a string. std::variant< int, std::string > var; We can store one of either type in it: var = "hello"s; And we can access the contents via std::visit: // Prints "hello\n": visit( [](auto&&a...
This does not cover allocators. struct A {}; struct B { B()=default; B(B const&)=default; B(int){}; }; struct C { C()=delete; C(int) {}; C(C const&)=default; }; struct D { D( std::initializer_list<int> ) {}; D(D const&)=default; D()=default; }; std::variant<A,B> var_ab...
Documenting your work Remember what you've done and retain long outputs which can't be kept in WinDbg's buffer. It's always good to have a log available for reproducing debugging steps, e.g. to ask questions on Stack Overflow. CommandPurpose.logopencreate a log file.logcloseclose the log file.dump...
The std::nth_element algorithm takes three iterators: an iterator to the beginning, nth position, and end. Once the function returns, the nth element (by order) will be the nth smallest element. (The function has more elaborate overloads, e.g., some taking comparison functors; see the above link for...
To change a text file is not easy because its content must be moved around. For small files easiest method is to read its content in memory and then write back modified text. In this example we read all lines from a file and drop all blank lines then we write back to original path: File.WriteAllLi...
// 1. Base example not using language support for covariance, dynamic type checking. class Top { public: virtual Top* clone() const = 0; virtual ~Top() = default; // Necessary for `delete` via Top*. }; class D : public Top { public: Top* clone() const override ...
// 2. Covariant result version of the base example, static type checking. class Top { public: virtual Top* clone() const = 0; virtual ~Top() = default; // Necessary for `delete` via Top*. }; class D : public Top { public: D* /* ← Covariant return */ clone() const over...
// 3. Covariant smart pointer result (automated cleanup). #include <memory> using std::unique_ptr; template< class Type > auto up( Type* p ) { return unique_ptr<Type>( p ); } class Top { private: virtual Top* virtual_clone() const = 0; public: unique_ptr&l...
This basic example shows how an application can instantiate a classloader and use it to dynamically load a class. URL[] urls = new URL[] {new URL("file:/home/me/extras.jar")}; Classloader loader = new URLClassLoader(urls); Class<?> myObjectClass = loader.findClass("com.exampl...
Enumeration types can also be declared without giving them a name: enum { buffersize = 256, }; static unsigned char buffer [buffersize] = { 0 }; This enables us to define compile time constants of type int that can as in this example be used as array length.
This function return the standart gravity constant in the specified acceleration units (1 for cm/s², 2 for ft/s², 3 for m/s²) /** * Returns the standard gravity constant in the specified acceleration units * Values taken from https://en.wikipedia.org/wiki/Standard_gravity on July 24, 2016. ...
GRANT SELECT, UPDATE ON Employees TO User1, User2; Grant User1 and User2 permission to perform SELECT and UPDATE operations on table Employees. REVOKE SELECT, UPDATE ON Employees FROM User1, User2; Revoke from User1 and User2 the permission to perform SELECT and UPDATE operations on tab...
Possessive quantifiers are another class of quantifiers in many regex flavours that allow backtracking to, effectively, be disabled for a given token. This can help improve performance, as well as preventing matches in certain cases. The class of possessive quantifiers can be distinguished from laz...
.server - create a debugging server .clients - list debugging clients connected to the server .endsrv - end a debugging server .servers - list debugging server connections .remote - start a remote.exe server .noshell - prevent shell commands

Page 8 of 11