Tutorial by Examples

The Never type cannot be constructed (the Basics module hasn't exported its value constructor and hasn't given you any other function that returns Never either). There is no value never : Never or a function createNever : ?? -> Never. This has its benefits: you can encode in a type system a poss...
Instead of var component = <Component foo={this.props.x} bar={this.props.y} />; Where each property needs to be passed as a single prop value you could use the spread operator ... supported for arrays in ES6 to pass down all your values. The component will now look like this. var compon...
See the below transactions collection. > db.transactions.insert({ cr_dr : "D", amount : 100, fee : 2}); > db.transactions.insert({ cr_dr : "C", amount : 100, fee : 2}); > db.transactions.insert({ cr_dr : "C", amount : 10, fee : 2}); > db.transactions.in...
If index name is known, db.collection.dropIndex('name_of_index'); If index name is not known, db.collection.dropIndex( { 'name_of_field' : -1 } );
db.collection.getIndexes(); Output [ { "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "documentation_db.transactions" }, { "v&quo...
db.collection.createIndex( { "user_id": 1 }, { unique: true } ) enforce uniqueness on the defined index (either single or compound). Building the index will fail if the collection already contains duplicate values; the indexing will fail also with multiple entries missing the field (sin...
This solution uses the ora:tokenize XQuery function that is available from Oracle 11. Sample Data: CREATE TABLE table_name ( id, list ) AS SELECT 1, 'a,b,c,d' FROM DUAL UNION ALL -- Multiple items in the list SELECT 2, 'e' FROM DUAL UNION ALL -- Single item in the list SELECT 3, NULL ...
Useful information The very beginning of the text field text: let startPosition: UITextPosition = textField.beginningOfDocument The very end of the text field text: let endPosition: UITextPosition = textField.endOfDocument The currently selected range: let selectedRange: UITextRange? = tex...
Edit /etc/init/docker.conf and update the DOCKER_OPTS variable to the following: DOCKER_OPTS='-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock' Restart Docker deamon service docker restart Verify if Remote API is working curl -X GET http://localhost:4243/images/json
The system_clock can be used to measure the time elapsed during some part of a program's execution. c++11 #include <iostream> #include <chrono> #include <thread> int main() { auto start = std::chrono::system_clock::now(); // This and "end"'s type is std::chron...
This example shows how a function can accept pipelined input, and iterate efficiently. Note, that the begin and end structures of the function are optional when pipelining, but that process is required when using ValueFromPipeline or ValueFromPipelineByPropertyName. function Write-FromPipeline{ ...
This is an example of a function with the simplest possible support for pipelining. Any function with pipeline support must have at least one parameter with the ParameterAttribute ValueFromPipeline or ValueFromPipelineByPropertyName set, as shown below. function Write-FromPipeline { param( ...
Prevent access to your .htaccess file <Files .htaccess> order allow,deny deny from all </Files> # Rename the file AccessFileName thehtfile.ess Prevent URL attacks # Enable rewrites RewriteEngine On # Block <script> tags from executing in the URL RewriteCond %{QUE...
This is a simple example to display read-only data that is tabular in nature using Qt's Model/View Framework. Specifically, the Qt Objects QAbstractTableModel (sub-classed in this example) and QTableView are used. Implementations of the methods rowCount(), columnCount(), data() and headerData() are...
With generics, it's possible to return whatever the caller expects: private Map<String, Object> data; public <T> T get(String key) { return (T) data.get(key); } The method will compile with a warning. The code is actually more safe than it looks because the Java runtime will d...
Use case scenario: A table view consists of different columns with different data format that needs to be transformed with different pipes. table.component.ts ... import { DYNAMIC_PIPES } from '../pipes/dynamic.pipe.ts'; @Component({ ... pipes: [DYNAMIC_PIPES] }) export class Tabl...
Inlining allows you to replace a call to a function with the body of the function. This is sometimes useful for performance reason on critical part of the code. But the counterpart is that your assembly will takes much space since the body of the function is duplicated everywhere a call occurred. Y...
Assuming we have a TravelReview table with City names as column "title" Criteria criteria = session.createCriteria(TravelReview.class); List review = criteria.add(Restrictions.eq("title", "Mumbai")).list(); System.out.println("Using equals: "...
Should we wish to retrieve only a few columns, we can use the Projections class to do so. For example, the following code retrieves the title column // Selecting all title columns List review = session.createCriteria(TravelReview.class) .setProjection(Projections.property("titl...
Destructuring allows you to extract data from various objects into distinct variables. In each example below, each variable is assigned to its own string (a="a", b="b", &c.) TypeExampleValue of data / commentvec(let [[a b c] data ...)["a" "b" "c&quot...

Page 528 of 1336