Tutorial by Examples

A declaration introduces an identifier and describes its type, be it a type, object, or function. A declaration is what the compiler needs to accept references to that identifier. These are declarations: extern int bar; extern int g(int, int); double f(int, double); /* extern can be omitted for f...
The following embeds an untrusted web page with all restrictions enabled <iframe sandbox src="http://example.com/"></iframe> To allow the page to run scripts and submit forms, add allow-scripts and allow-forms to the sandbox attribute. <iframe sandbox="allow-script...
NetLogo is available for Windows, Mac, and Linux machines, downloadable from the project homepage. Windows Installer: NetLogo runs on Windows 10, Windows 8, Windows 7 and Vista. NetLogo 5.2.1 was the last version to support Windows XP and Windows 2000. Mac: Mac OS X 10.8.3 or newer is requ...
When writing a copy assignment operator, it is very important that it be able to work in the event of self-assignment. That is, it has to allow this: SomeType t = ...; t = t; Self-assignment usually doesn't happen in such an obvious way. It typically happens via a circuitous route through vario...
import std.stdio; void main() { auto s = "hello world"; auto a = [1, 2, 3, 4]; foreach (c; s) { write(c, "!"); // h!e!l!l!o! !w!o!r!l!d! } writeln(); foreach (x; a) { write(x * x, ", "); // 1, 4, 9, 16, } } ...
The InputRange concept has three functions, example: struct InputRange(T) { @property bool empty(); @property T front(); void popFront(); } In short, a way to check if the range is empty get the current element move to the next element To make our own type a InputRange, w...
A data race or race condition is a problem that can occur when a multithreaded program is not properly synchronized. If two or more threads access the same memory without synchronization, and at least one of the accesses is a 'write' operation, a data race occurs. This leads to platform dependent, p...
To create a build target producing an executable, one should use the add_executable command: add_executable(my_exe main.cpp utilities.cpp) This creates a build target, e.g. make my_exe for GNU make, with the appropriate invocations of the configured compiler to pr...
To create an build target that creates an library, use the add_library command: add_library(my_lib lib.cpp) The CMake variable BUILD_SHARED_LIBS controls whenever to build an static (OFF) or an shared (ON) library, using for example cmake .. -DBUILD_SHARED_LIBS=ON. However, you can explicitly se...
In this example will render five <li> tags <ul id="render-sample"> <li v-for="n in 5"> Hello Loop </li> </ul>
The =~ operator attempts to match a regular expression (set apart by /) to a string: my $str = "hello world"; print "Hi, yourself!\n" if $str =~ /^hello/; /^hello/ is the actual regular expression. The ^ is a special character that tells the regular expression to start with ...
(Collects 2-3 inputs and combines them into a Tuple) Like BatchBlock, JoinBlock<T1, T2, …> is able to group data from multiple data sources. In fact, that’s JoinBlock<T1, T2, …>’s primary purpose. For example, a JoinBlock<string, double, int> is an ISourceBlock<Tuple<strin...
(Copy an item and send the copies to every block that it’s linked to) Unlike BufferBlock, BroadcastBlock’s mission in life is to enable all targets linked from the block to get a copy of every element published, continually overwriting the “current” value with those propagated to it. Additionally,...
(Readonly variable: Memorizes its first data item and passes out copies of it as its output. Ignores all other data items) If BufferBlock is the most fundamental block in TPL Dataflow, WriteOnceBlock is the simplest. It stores at most one value, and once that value has been set, it will never be r...
(Collects a certain number of total items from 2-3 inputs and groups them into a Tuple of collections of data items) BatchedJoinBlock<T1, T2,…> is in a sense a combination of BatchBlock and JoinBlock<T1, T2,…>. Whereas JoinBlock<T1, T2,…> is used to aggregate one input from each ...
(Select, one-to-one) As with ActionBlock, TransformBlock<TInput, TOutput> enables the execution of a delegate to perform some action for each input datum; unlike with ActionBlock, this processing has an output. This delegate can be a Func<TInput, TOutput>, in which case processing of t...
(foreach) This class can be thought of logically as a buffer for data to be processed combined with tasks for processing that data, with the “dataflow block” managing both. In its most basic usage, we can instantiate an ActionBlock and “post” data to it; the delegate provided at the ActionBlock’s c...
(SelectMany, 1-m: The results of this mapping are “flattened”, just like LINQ’s SelectMany) TransformManyBlock<TInput, TOutput> is very similar to TransformBlock<TInput, TOutput>. The key difference is that whereas a TransformBlock<TInput, TOutput> produces one and only one outpu...
(Groups a certain number of sequential data items into collections of data items) BatchBlock combines N single items into one batch item, represented as an array of elements. An instance is created with a specific batch size, and the block then creates a batch as soon as it’s received that number o...
(FIFO Queue: The data that comes in is the data that goes out) In short, BufferBlock provides an unbounded or bounded buffer for storing instances of T. You can “post” instances of T to the block, which cause the data being posted to be stored in a first-in-first-out (FIFO) order by the block. Yo...

Page 404 of 1336