Tutorial by Examples

Another way of doing aggregations is by using the Mongo.Collection#rawCollection() This can only be run on the Server. Here is an example you can use in Meteor 1.3 and higher: Meteor.methods({ 'aggregateUsers'(someId) { const collection = MyCollection.rawCollection() const aggre...
The x64 architecture is the evolution of the older x86 architecture, it kept compatibility with its predecessor (x86 registers are still available) but it also introduced new features: Registers have now a capacity of 64 bits; There are 8 more general-purpose registers; Segment registers are fo...
Example: Customers who can create a post. Each customer can create multiple posts. As soon as customer creates the post, post will be under administrators review. Now we have to fetch the customers list who have all active posts by using sub-query. Note: If a customer has 5 post, among 5 posts if h...
Logs are very important. Recreate an error context can be sometimes very painful due to the lack of information about how and when the error occurred. This example shows: How to add user's data in the error logs How to add post parameters sent when an error occurred How to use WebPr...
Java Code import org.opencv.core.Mat; import org.opencv.core.MatOfRect; import org.opencv.core.Point; import org.opencv.core.Rect; import org.opencv.core.Scalar; import org.opencv.highgui.Highgui; import org.opencv.highgui.VideoCapture; import org.opencv.objdetect.CascadeClassifier; publ...
Use Nuget to install the Nancy and Nancy.Hosting.Self packages into the project. Instantiate a new NancyHost object and pass in the relevant URL using( var host = new NancyHost( hostConfiguration, new Uri( "http://localhost:1234" ) ) ) { host.Start(); Console.WriteLine( "Running o...
When you want to work with the data entries in arrays you first need to unwind the array. The unwind operation creates a document for each entry in the array. When you have lot's of documents with large arrays you will see an explosion in number of documents. { "_id" : 1, "item"...
_refreshControl(){ return ( <RefreshControl refreshing={this.state.refreshing} onRefresh={()=>this._refreshListView()} /> ) } refreshing: is the state of the spinner (true, false). onRefresh: this function will invoke when refresh the ListView/Scr...
_refreshListView(){ //Start Rendering Spinner this.setState({refreshing:true}) this.state.cars.push( {name:'Fusion',color:'Black'}, {name:'Yaris',color:'Blue'} ) //Updating the dataSource with new data this.setState({ dataSource: this.state.data...
RefreshControl is used inside a ScrollView or ListView to add pull to refresh functionality. at this example we will use it with ListView 'use strict' import React, { Component } from 'react'; import { StyleSheet, View, ListView, RefreshControl, Text } from 'react-native' class RefreshContr...
//Before: antipattern 3 global variables var setActivePage = function () {}; var getPage = function() {}; var redirectPage = function() {}; //After: just 1 global variable, no function collision and more meaningful function names var NavigationNs = NavigationNs || {}; N...
When multiple modules are involved, avoid proliferating global names by creating a single global namespace. From there, any sub-modules can be added to the global namespace. (Further nesting will slow down performance and add unnecessary complexity.) Longer names can be used if name clashes are an i...
Let us assume we have the following two DataFrames: In [7]: df1 Out[7]: A B 0 a1 b1 1 a2 b2 In [8]: df2 Out[8]: B C 0 b1 c1 The two DataFrames are not required to have the same set of columns. The append method does not change either of the original DataFrames. Inst...
You can quickly determine if a text includes a specific pattern using Regex. There are multiple ways to work with Regex in PowerShell. #Sample text $text = @" This is (a) sample text, this is a (sample text) "@ #Sample pattern: Content wrapped in () $pattern = '\(.*?\)' Using ...
A common task for regex is to replace text that matches a pattern with a new value. #Sample text $text = @" This is (a) sample text, this is a (sample text) "@ #Sample pattern: Text wrapped in () $pattern = '\(.*?\)' #Replace matches with: $newvalue = 'test' Using -Replace...
Sometimes you need to replace a value matching a pattern with a new value that's based on that specific match, making it impossible to predict the new value. For these types of scenarios, a MatchEvaluator can be very useful. In PowerShell, a MatchEvaluator is as simple as a scriptblock with a singl...
A regex-pattern uses many special characters to describe a pattern. Ex., . means "any character", + is "one or more" etc. To use these characters, as a .,+ etc., in a pattern, you need to escape them to remove their special meaning. This is done by using the escape character whi...
There are multiple ways to find all matches for a pattern in a text. #Sample text $text = @" This is (a) sample text, this is a (sample text) "@ #Sample pattern: Content wrapped in () $pattern = '\(.*?\)' Using Select-String You can find all matches (global match) by adding t...
You can delete existing snapshots of database using DELETE DATABASE statement: DROP DATABASE Mydatabase_morning In this statement you should reference name of the database snapshot.
Tuples are immutable ordered collections of arbitrary distinct objects, either of the same type or of different types. Typically, tuples are constructed using the (x, y) syntax. julia> tup = (1, 1.0, "Hello, World!") (1,1.0,"Hello, World!") The individual objects of a tup...

Page 909 of 1336