Docker volumes are not automatically removed when a container is stopped. To remove associated volumes when you stop a container:
docker rm -v <container id or name>
If the -v flag is not specified, the volume remains on-disk as a 'dangling volume'. To delete all dangling volumes:
docker ...
Booleans and other values
When dealing with lua it is important to differentiate between the boolean values true and false and values that evaluate to true or false.
There are only two values in lua that evaluate to false: nil and false, while everything else, including the numerical 0 evaluate to...
Conditional contexts in Lua (if, elseif, while, until) do not require a boolean. Like many languages, any Lua value can appear in a condition. The rules for evaluation are simple:
false and nil count as false.
Everything else counts as true.
if 1 then
print("Numbers work.")
...
Declaration
A common misunderstanding, especially beginners, have is read-only property is the one marked with readonly keyword. That's not correct and in fact following is a compile time error:
public readonly string SomeProp { get; set; }
A property is read-only when it only has a getter.
pu...
K&R
void* is a catch all type for pointers to object types. An example of this in use is with the malloc function, which is declared as
void* malloc(size_t);
The pointer-to-void return type means that it is possible to assign the return value from malloc to a pointer to any other type of ob...
Conditional expressions can be done with ~[ and ~]. The clauses of the expression are separated using ~;.
By default, ~[ takes an integer from the argument list, and picks the corresponding clause. The clauses start at zero.
(format t "~@{~[First clause~;Second clause~;Third clause~;Fourth cl...
Schema Statics are methods that can be invoked directly by a Model (unlike Schema Methods, which need to be invoked by an instance of a Mongoose document). You assign a Static to a schema by adding the function to the schema's statics object.
One example use case is for constructing custom queries:...
A Set is a Collection that cannot contain duplicate elements. It models the mathematical set abstraction.
Set have its implementation in various classes like HashSet, TreeSet, LinkedHashSet.
For example:
HashSet:
Set<T> set = new HashSet<T>();
Here T can be String, Integer or any ...
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...
With Clipping and Masking you can make some specified parts of elements transparent or opaque. Both can be applied to any HTML element.
Clipping
Clips are vector paths. Outside of this path the element will be transparent, inside it's opaque. Therefore you can define a clip-path property on elemen...
+ 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...
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...
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...