Tutorial by Examples: ect

You can iterate over a std::vector in several ways. For each of the following sections, v is defined as follows: std::vector<int> v; Iterating in the Forward Direction C++11 // Range based for for(const auto& value: v) { std::cout << value << "\n"; } /...
There are several ways to use a std::vector as a C array (for example, for compatibility with C libraries). This is possible because the elements in a vector are stored contiguously. C++11 std::vector<int> v{ 1, 2, 3 }; int* p = v.data(); In contrast to solutions based on previous C++ st...
String html = "<!DOCTYPE html>" + "<html>" + "<head>" + "<title>Hello world!</title>" + "</head>" + "<body>" + ...
Standard Collections Java Collections framework A simple way to construct a List from individual data values is to use java.utils.Arrays method Arrays.asList: List<String> data = Arrays.asList("ab", "bc", "cd", "ab", "bc", "cd"); ...
In order to compare the equality of custom classes, you can override == and != by defining __eq__ and __ne__ methods. You can also override __lt__ (<), __le__ (<=), __gt__ (>), and __ge__ (>). Note that you only need to override two comparison methods, and Python can handle the rest (== ...
This method can be used to convert a formatted string representation of a date into a Date object. /** * Parses the date using the given format. * * @param formattedDate the formatted date string * @param dateFormat the date format which was used to create the string. ...
CASE's shorthand variant evaluates an expression (usually a column) against a series of values. This variant is a bit shorter, and saves repeating the evaluated expression over and over again. The ELSE clause can still be used, though: SELECT Id, ItemId, Price, CASE Price WHEN 5 THEN 'CHEAP' ...
The datetime module contains three primary types of objects - date, time, and datetime. import datetime # Date object today = datetime.date.today() new_year = datetime.date(2017, 01, 01) #datetime.date(2017, 1, 1) # Time object noon = datetime.time(12, 0, 0) #datetime.time(12, 0) # Curr...
In JavaScript, any object can be the prototype of another. When an object is created as a prototype of another, it will inherit all of its parent's properties. var proto = { foo: "foo", bar: () => this.foo }; var obj = Object.create(proto); console.log(obj.foo); console.log(obj....
Setting a filter applies to all channels that you will subscribe to from that particular client. This client filter excludes messages that have this subscriber's UUID set at the sender's UUID: NSString *expression = [NSString stringWithFormat:@"(uuid != '%@'", se...
Constructor injection is the safest way of injecting dependencies that a whole class depends upon. Such dependencies are often referred to as invariants, since an instance of the class cannot be created without supplying them. By requiring the dependency to be injected at construction, it is guara...
Property injection allows a classes dependencies to be updated after it has been created. This can be useful if you want to simplify object creation, but still allow the dependencies to be overridden by your tests with test doubles. Consider a class that needs to write to a log file in an error co...
Method injection is a fine grained way of injecting dependencies into processing. Consider a method that does some processing based on the current date. The current date is hard to change from a test, so it is much easier to pass a date into the method that you want to test. public void ProcessRe...
Overview Attribute selectors can be used with various types of operators that change the selection criteria accordingly. They select an element using the presence of a given attribute or attribute value. Selector(1)Matched elementSelects elements...CSS Version[attr]<div attr>With attribute a...
import shutil source='//192.168.1.2/Daily Reports' destination='D:\\Reports\\Today' shutil.copytree(source, destination) The destination directory must not exist already.
When an API is marked with NS_REFINED_FOR_SWIFT, it will be prefixed with two underscores (__) when imported to Swift: @interface MyClass : NSObject - (NSInteger)indexOfObject:(id)obj NS_REFINED_FOR_SWIFT; @end The generated interface looks like this: public class MyClass : NSObject { publ...
PM> Uninstall-Package -ProjectName MyProjectB EntityFramework
In jQuery you can select elements in a page using many various properties of the element, including: Type Class ID Possession of Attribute Attribute Value Indexed Selector Pseudo-state If you know CSS selectors you will notice selectors in jQuery are the same (with minor exceptions). Ta...
SELECT your_columns, COUNT(*) OVER() as Ttl_Rows FROM your_data_set idnameTtl_Rows1example52foo53bar54baz55quux5 Instead of using two queries to get a count then the line, you can use an aggregate as a window function and use the full result set as the window. This can be used as a base for fur...
Branching in Subversion is very simple. In the simplest form, creating a new branch requires you to run the command against the remote repository's URLs. For example, let's create a new branch out of the mainline trunk: svn copy https://svn.example.com/svn/MyRepo/MyProject/trunk https://svn.example...

Page 5 of 99