Tutorial by Examples: n

Example for updating all documents where name is equal to "John": $filter = ['name' => 'John']; $document = ['name' => 'Mike']; $bulk = new \MongoDB\Driver\BulkWrite; $bulk->update( $filter, $document, ['multi' => true] ); $result = $manager->executeBu...
Example for deleting all documents where name is equal to "Peter": $bulk = new \MongoDB\Driver\BulkWrite; $filter = ['name' => 'Peter']; $bulk->delete($filter); $result = $manager->executeBulkWrite('database_name.collection_name', $bulk);
Navigation Drawers are used to navigate to top-level destinations in an app. Make sure that you have added design support library in your build.gradle file under dependencies: dependencies { // ... compile 'com.android.support:design:25.3.1' } Next, add the DrawerLayout and Navigati...
Comments are used to explain code when the basic code itself isn't clear. Python ignores comments, and so will not execute code in there, or raise syntax errors for plain english sentences. Single-line comments begin with the hash character (#) and are terminated by the end of line. Single lin...
auto can also cause problems where expression templates come into play: auto mult(int c) { return c * std::valarray<int>{1}; } auto v = mult(3); std::cout << v[0]; // some value that could be, but almost certainly is not, 3. The reason is that operator* on valarray gives yo...
Transact-SQL supports two forms of comment writing. Comments are ignored by the database engine, and are meant for people to read. Comments are preceded by -- and are ignored until a new line is encountered: -- This is a comment SELECT * FROM MyTable -- This is another comment WHERE Id = 1; ...
Using range-base loops, you can loop over a sub-part of a given container or other range by generating a proxy object that qualifies for range-based for loops. template<class Iterator, class Sentinel=Iterator> struct range_t { Iterator b; Sentinel e; Iterator begin() const { return ...
Given a local directory with the following contents: └── dir1 ├── subdir1 └── subdir2 We want to create the same subdir1, subdir2 under a new directory dir2, which does not exist yet. import os os.makedirs("./dir2/subdir1") os.makedirs("./dir2/subdir2") R...
select * from sys.dm_resource_governor_workload_groups select * from sys.dm_resource_governor_resource_pools
Detailed instructions on getting mule set up or installed. Before going to start with mule we have to insure that java home is set. Mule CE runtime don't need installation. We have to just unzip the downloaded file and go to bin directory of mule runtime. In MS windows Operating system we have...
Given the following XML document: <documentation> <tags> <tag name="Java"> <topic name="Regular expressions"> <example>Matching groups</example> <example>Escaping metacharacter...
Sometimes specific instances of data should be used. Recreation is not desired and referencing static data would have a code smell. It is possible to specify a XmlAdapter instance the Unmarshaller should use, which allows the user to use XmlAdapters with no zero-arg constructor and/or pass data to ...
1 - Include the CoreLocation.framework in your project; this is accomplished by clicking on: root directory -> build phases -> Link Binary With Libraries Click on the (+) button, look for CoreLocation.framework and click add. 2- Modify the info.plist file to ask for permission to use user...
ARC can be disabled for individual files by adding the -fno-objc-arc compiler flag for each file. Conversely it can be added in Targets ▸ Build Phases ▸ Compile Sources
Repeated Timer event Swift class ViewController: UIViewController { var timer = NSTimer() override func viewDidLoad() { NSTimer.scheduledTimerWithTimeInterval(1.0, target: self, selector: Selector(self.timerMethod()), userInfo: nil, repeats: true) } func tim...
All parameters specified after the first asterisk in the function signature are keyword-only. def f(*a, b): pass f(1, 2, 3) # TypeError: f() missing 1 required keyword-only argument: 'b' In Python 3 it's possible to put a single asterisk in the function signature to ensure that the rema...
Detailed instructions on getting windows-phone-8 set up or installed.
Prolog categorizes everything into: Atoms - Any sequence of characters that do not start with an uppercase alphabet. Eg - a, b, okay Numbers - There is no special syntax for numbers, no declaration is required. Eg 1, 22, 35.8 Variables - A string which starts with an uppercase character or unde...
Usually grep prints only matching lines. In the example below seq 9 generates a list of numbers from 1 to 9, one per line, and grep prints a single matching line: seq 9 | grep 5 # 5 The -C n option (or --context=n in long form) prints n lines before and after each matching line, in addition to ...
In this example, a private static instance of the class is declared at its beginning. The value of a static field is shared between instances, so if a new instance of this class gets created the if will find a reference to the first Singleton object, destroying the new instance (or its game object)...

Page 455 of 1088