Tutorial by Examples: and

curl -XGET 'http://www.example.com:9200/myIndexName/_count?pretty' Output: { "count" : 90, "_shards" : { "total" : 6, "successful" : 6, "failed" : 0 } } The index has 90 documents within it. Reference Link: Here
Before you compile your app and run it on your device, you'll need create some icons and splash screens, and add a mobile-config.js file to your app. App.icons({ // iOS 'iphone': 'resources/icons/icon-60x60.png', 'iphone_2x': 'resources/icons/[email protected]', 'ipad': 'resources/icons...
Mongo supports database-to-database copying, which is useful if you have large databases on a staging database that you want to copy into a local development instance. // run mongod so we can create a staging database // note that this is a separate instance from the meteor mongo and minimongo ins...
db.posts.find().forEach(function(doc){ if(doc.commenters){ var firstCommenter = db.users.findOne({'_id': doc.commenters[0]._id }); db.clients.update({_id: doc._id}, {$set:{'firstPost': firstCommenter }}, false, true); var firstCommenter = db.users.findOne({'_id': do...
AndroidManifest.xml: <activity android:name="com.example.MainActivity" > <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <categ...
AndroidManifest.xml: <activity android:name="com.example.MainActivity" > <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <categ...
For programs with a single source file, using gcc is simple. /* File name is hello_world.c */ #include <stdio.h> int main(void) { int i; printf("Hello world!\n"); } To compile the file hello_world.c from the command line: gcc hello_world.c gcc will then compil...
If you are inside a folder of a git repository it might be nice to show the current branch you are on. In ~/.bashrc or /etc/bashrc add the following (git is required for this to work): function prompt_command { # Check if we are inside a git repository if git status > /dev/null 2>&a...
There are many cases when one has created an NSDate from only an hour and minute format, i.e: 08:12 The downside for this situation is that your NSDate is almost completely "naked" and what you need to do is to create: day, month, year, second and time zone in order to this object to &quo...
Sometimes you need to call a Tcl command from your expression. For example, supposing you need the length of a string in it. To do that, you just use a [...] sequence in the expression: set halfTheStringLength [expr { [string length $theString] / 2 }] You can call any Tcl command this way, but i...
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...
//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...
The current release version of Jetty is 9.4. Support is still provided for Jetty 9.2 and 9.3, and maintenance releases are provided for Jetty 7 and Jetty 8 when needed. The most up-to-date distributions can be found on the Jetty Downloads page. It is worth noting that current releases of Jetty requ...
Objects come in their own class, so a simple example would be a car (detailed explanations below): public class Car { //Variables describing the characteristics of an individual car, varies per object private int milesPerGallon; private String name; private String color; ...
When a page is part of a series of articles, for instance, one can use prev and next to point to pages that are coming before and after. <link rel="prev" href="http://stackoverflow.com/documentation/java/topics"> <link rel="next" href="http://stackover...
# Process substitution with paste command is common # To compare the contents of two directories paste <( ls /path/to/directory1 ) <( ls /path/to/directory1 )
To write data to a file using Channel we need to have the following steps: First, we need to get an object of FileOutputStream Acquire FileChannel calling the getChannel() method from the FileOutputStream Create a ByteBuffer and then fill it with data Then we have to call the flip() method of ...
We can use org.apache.commons.lang3.RandomUtils to generate random numbers using a single line. int x = RandomUtils.nextInt(1, 1000); The method nextInt(int startInclusive, int endExclusive) takes a range. Apart from int, we can generate random long, double, float and bytes using this class. R...
One Button Swift class ViewController: UIViewController { @IBAction func showAlertButtonTapped(sender: UIButton) { // create the alert let alert = UIAlertController(title: "My Title", message: "This is my message.", preferredStyle: UIAlertCo...
Testing without installing For new users who wish to start testing Coq without installing it on their machine, there is an online IDE called JsCoq (presentation here). The package sub-window allows testing various well-known additional packages. Installation The download page contains installers ...

Page 55 of 153