Tutorial by Examples: ci

db.posts.find().forEach(function(doc){ if(!doc.foo){ db.posts.update({_id: doc._id}, {$set:{'foo':'bar'}}, false, true); } });
db.posts.find().forEach(function(doc){ if(doc.foo === 'bar'){ db.posts.remove({_id: doc._id}); } });
db.posts.find().forEach(function(doc){ if(doc.foo === 'bar'){ db.posts.update({_id: doc._id}, {$set:{'foo':'squee'}}, false, true); } });
db.posts.find().forEach(function(doc){ if(doc.oldfield){ // the false, true at the end refers to $upsert, and $multi, respectively db.accounts.update({_id: doc._id}, {$unset: {'oldfield': "" }}, false, true); } });
There are three ways to set the classpath. It can be set using the CLASSPATH environment variable : set CLASSPATH=... # Windows and csh export CLASSPATH=... # Unix ksh/bash It can be set on the command line as follows java -classpath ... javac -classpath ... Note ...
NSAttributedString (and its mutable sibling NSMutableAttributedString) allows you to create strings that are complex in their appearance to the user. A common application is to use this to display a string and adding custom kerning / letter-spacing. This would be achieved as follows (where label ...
$ git show dae86e1950b1277e545cee180551750029cfe735 $ git show dae86e19 You can specify revision (or in truth any object: tag, tree i.e. directory contents, blob i.e. file contents) using SHA-1 object name, either full 40-byte hexadecimal string, or a substring that is unique to the repository. ...
In some cases the behavior of a command depends on whether it is given branch name, tag name, or an arbitrary revision. You can use "de-referencing" syntax if you need the latter. A suffix ^ followed by an object type name (tag, commit, tree, blob) enclosed in brace pair (for example v0.9...
Suppose the following generic interface has been declared: public interface MyGenericInterface<T> { public void foo(T t); } Below are listed the possible ways to implement it. Non-generic class implementation with a specific type Choose a specific type to replace the formal type ...
Plain lists are useful for representing a sequence of elements, but sometimes it is more helpful to represent a kind of key to value mapping. Common Lisp provides several ways to do this, including genuine hash tables (see 18.1 Hash Table Concepts). There are two primary ways or representing key t...
//Creates a Random instance with a seed of 12345. Random random = new Random(12345L); //Gets a ThreadLocalRandom instance ThreadLocalRandom tlr = ThreadLocalRandom.current(); //Set the instance's seed. tlr.setSeed(12345L); Using the same seed to generate random numbers will return the sa...
Any project that targets netstandard1.X can be packed into a NuGet package by running: dotnet pack The resulting package can be uploaded to NuGet, MyGet, or hosted in a local package source.
ACID tables are supported since hive 0.14 version. Below table supports UPDATE/DELETE/INSERT Below configuration changes required in hive-site.xml. hive.support.concurrency = true hive.enforce.bucketing = true hive.exec.dynamic.partition.mode = nonstrict hive.txn.manager =org.apache.hadoop...
Dim Value As Variant Value = CDec(1.234) 'Set Value to the smallest possible Decimal value Value = CDec("0.0000000000000000000000000001") The Decimal data-type is only available as a sub-type of Variant, so you must declare any variable that needs to contain a Decimal as a Variant ...
The var keyword allows a programmer to implicitly type a variable at compile time. var declarations have the same type as explicitly declared variables. var squaredNumber = 10 * 10; var squaredNumberDouble = 10.0 * 10.0; var builder = new StringBuilder(); var anonymousObject = new { One =...
To check whether a value is a character use the is.character() function. To coerce a variable to a character use the as.character() function. x <- "The quick brown fox jumps over the lazy dog" class(x) [1] "character" is.character(x) [1] TRUE Note that numerics can be ...
Strings in a Series can be sliced using .str.slice() method, or more conveniently, using brackets (.str[]). In [1]: ser = pd.Series(['Lorem ipsum', 'dolor sit amet', 'consectetur adipiscing elit']) In [2]: ser Out[2]: 0 Lorem ipsum 1 dolor sit amet 2 cons...
So you want to deploy your app to multiple sites? and your project has too many dependencies to install them one-by-one? Npm has a solution just issue the following command: npm init In the project's root folder then follow the instructions on screen (type in the desired value then press enter) ...
For Facebook config.omniauth :facebook, facebook_app_id, facebook_secret_key, :display => "popup", :scope => 'email,publish_actions', info_fields: 'email,name' For Twitter config.omniauth :twitter, twitter_app_id, twitter_secret_key, :display => "popup", :scope =&gt...

Page 17 of 42