What is a Set?
A set is a data structure which contains a set of elements with an important property that no two elements in the set are equal.
Types of Set:
HashSet: A set backed by a hash table (actually a HashMap instance)
Linked HashSet: A Set backed by Hash table and linked list, with pre...
Like many Java objects, all String instances are created on the heap, even literals. When the JVM finds a String literal that has no equivalent reference in the heap, the JVM creates a corresponding String instance on the heap and it also stores a reference to the newly created String instance in th...
+ dictionaryWithCapacity:
Creates and returns a mutable dictionary, initially giving it enough allocated memory to hold a given number of entries.
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity:1];
NSLog(@"%@",dict);
- init
Initializes a newly allocated mut...
- removeObjectForKey:
Removes a given key and its associated value from the dictionary.
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithDictionary:@{@"key1":@"Easy",@"key2": @"Tutorials"}];
[dict removeObjectForKey:@"key1"];
NSLog...
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...
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...
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...
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...