Tutorial by Examples: o

class ClassWithAReallyLongName { public: class Iterator { /* ... */ }; Iterator end(); }; Defining the member end with a trailing return type: auto ClassWithAReallyLongName::end() -> Iterator { return Iterator(); } Defining the member end without a trailing return type: Clas...
>>> df ID Year Jan_salary Feb_salary Mar_salary 0 1 2016 4500 4200 4700 1 2 2016 3800 3600 4400 2 3 2016 5500 5200 5300 >>> melted_df = pd.melt(df,id_vars=['ID','Year'], v...
Create a MongoDB connection, that later you can query: $manager = new \MongoDB\Driver\Manager('mongodb://localhost:27017'); In the next example, you will learn how to query the connection object. This extension close the connection automatically, it's not necessary to close manually.
Example for searching just one user with a specific id, you should do: $options = ['limit' => 1]; $filter = ['_id' => new \MongoDB\BSON\ObjectID('578ff7c3648c940e008b457a')]; $query = new \MongoDB\Driver\Query($filter, $options); $cursor = $manager->executeQuery('database_name.collect...
Example for searching multiple users with the name "Mike": $filter = ['name' => 'Mike']; $query = new \MongoDB\Driver\Query($filter); $cursor = $manager->executeQuery('database_name.collection_name', $query); foreach ($cursor as $doc) { var_dump($doc); }
Example for adding a document: $document = [ 'name' => 'John', 'active' => true, 'info' => ['genre' => 'male', 'age' => 30] ]; $bulk = new \MongoDB\Driver\BulkWrite; $_id1 = $bulk->insert($document); $result = $manager->executeBulkWrite('database_name.collect...
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; ...
Introduction Unity has a few 'specially named' folders that allows for a variety of uses. One of these folders is called 'Resources' The 'Resources' folder is one of only TWO ways of loading assets at runtime in Unity (The other being AssetBundles (Unity Docs) The 'Resources' folder can reside an...
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...
First create a resource pool besides the default one CREATE RESOURCE POOL [PoolAdhoc] WITH(min_cpu_percent=0, max_cpu_percent=50, min_memory_percent=0, max_memory_percent=50) GO Create the worload group for the pool CREATE WORKLOAD GROUP [AdhocMedium] WITH(importa...
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 ...
Using the Employees Table, below is an example to return the Id, FName and LName columns in (ascending) LName order: SELECT Id, FName, LName FROM Employees ORDER BY LName Returns: IdFNameLName2JohnJohnson1JamesSmith4JohnathonSmith3MichaelWilliams To sort in descending order add the DESC keywo...

Page 424 of 1038