Tutorial by Examples

While System.Diagnostics.Contracts is included within the .Net Framework. To use Code Contracts you must install the Visual Studio extensions. Under Extensions and Updates search for Code Contracts then install the Code Contracts Tools After the tools are installed you must enable Code Contract...
POST requests are made with the request.post() method. If you need to send a web form request as a POST body, pass in a dictionary with key-value pairs as the data argument; requests will encode these to a application/x-www-form-urlencoded mimetype body: r = requests.post('https://github.com/', d...
Dereferencing happens with the . operator: Object obj = new Object(); String text = obj.toString(); // 'obj' is dereferenced. Dereferencing follows the memory address stored in a reference, to the place in memory where the actual object resides. When an object has been found, the requested meth...
The requests module has top-level functions for most HTTP methods: r = requests.put('https://example.com/', data=put_body) r = requests.delete('https://example.com/') r = requests.head('https://example.com/') r = requests.options('https://example.com/') r = requests.patch('https://example.com/'...
To POST a JSON body, pass in a Python data structure to the json argument; here a dictionary is posted but anything that can be encoded to JSON will do: import requests # Create a dictionary to be sent. json_data = {'foo': ['bar', 'baz'], 'spam': True, 'eggs': 5.5} # Send the data. response...
When a response contains valid JSON, just use the .json() method on the Response object to get the decoded result: response = requests.get('http://example.com/') decoded_result = response.json() However, this does not fail gracefully; it will raise a JSONDecodeError if the response object is no...
To switch the value of two variables you can use tuple unpacking. x = True y = False x, y = y, x x # False y # True
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...

Page 403 of 1336