Tutorial by Examples

Used by awk to separate fields output by the print statement. For example: echo "a b c d e f" | awk 'BEGIN {OFS="-"} {print $2, $3}' produces: b-c e-f The default value is , a string consisting of a single space.
Used by awk to separate records and is output at the end of every print statement. For example: echo "a b c d e f" | awk 'BEGIN {ORS="|"} {print $2, $3}' produces: b c|e f The default value is \n (newline character).
Command line arguments passed to awk are stored in the internal array ARGV of ARGC elements. The first element of the array is the program name. For example: awk 'BEGIN { for (i = 0; i < ARGC; ++i) { printf "ARGV[%d]=\"%s\"\n", i, ARGV[i] } }' arg1 arg2 arg3 ...
Authenticate user with Plus login onCreate GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestIdToken(getString(R.string.default_web_client_id)) .requestScopes(new Scope(Scopes.PLUS_LOGIN)) .requestEmail() .build(); mGoogleApiClient...
Client.java import java.io.*; import java.net.*; public class Client{ public static void main(String [] args) throws IOException{ DatagramSocket clientSocket = new DatagramSocket(); InetAddress address = InetAddress.getByName(args[0]); String ex = "He...
Starting out: HTML <table id='my-table' width='960' height='500'></table> JS var data = [ { type: "Name", content: "John Doe" }, { type: "Birthdate", content: "01/01/1970" }, { type: "Salary", content: "$40,000,0...
The most flexible base R function for reshaping data is reshape. See ?reshape for its syntax. # create unbalanced longitudinal (panel) data set set.seed(1234) df <- data.frame(identifier=rep(1:5, each=3), location=rep(c("up", "down", "left", &quo...
Build.VERSION_CODES is an enumeration of the currently known SDK version codes. In order to conditionally run code based on the device's Android version, use the TargetApi annotation to avoid Lint errors, and check the build version before running the code specific to the API level. Here is an exa...
In the build.gradle file of your Android app module add next dependencies: dependencies { // Android JUnit Runner androidTestCompile 'com.android.support.test:runner:0.5' // JUnit4 Rules androidTestCompile 'com.android.support.test:rules:0.5' // Espresso core a...
Place next java class in src/androidTest/java and run it. public class UITest { @Test public void Simple_Test() { onView(withId(R.id.my_view)) // withId(R.id.my_view) is a ViewMatcher .perform(click()) // click() is a ViewAction .check(matches(isDi...
public final class DrawerLayoutTest { @Test public void Open_Close_Drawer_Layout() { onView(withId(R.id.drawer_layout)).perform(actionOpenDrawer()); onView(withId(R.id.drawer_layout)).perform(actionCloseDrawer()); } public static ViewAction actionOpenDrawer() { return ne...
var directories = [ {name: 'users' , parent : null }, {name: 'distalx' , parent : 'users' }, {name: 'guest' , parent : 'users' }, {name: 'shared' , parent : 'users' }, {name: 'documents' , parent : 'distalx' }, {name: 'music' , parent : 'distalx' }, {name: 'desktop' , parent : '...
Aside from destructuring objects into function arguments, you can use them inside variable declarations as follows: const person = { name: 'John Doe', age: 45, location: 'Paris, France', }; let { name, age, location } = person; console.log('I am ' + name + ', aged ' + age + ' and li...
If you ever need an array that consists of extra arguments that you may or may not expect to have, apart from the ones you specifically declared, you can use the array rest parameter inside the arguments declaration as follows: Example 1, optional arguments into an array: function printArgs(arg1, ...
First, install Mongoose with: npm install mongoose Then, add it to server.js as dependencies: var mongoose = require('mongoose'); var Schema = mongoose.Schema; Next, create the database schema and the name of the collection: var schemaName = new Schema({ request: String, time: Nu...
Setup First, install the necessary packages with: npm install express cors mongoose Code Then, add dependencies to your server.js file, create the database schema and the name of the collection, create an Express.js server, and connect to MongoDB: var express = require('express'); var cors =...
Setup First, install the necessary packages with: npm install express cors mongoose Code Then, add dependencies to server.js, create the database schema and the name of the collection, create an Express.js server, and connect to MongoDB: var express = require('express'); var cors = require('...
Adding a Fragment Statically File: activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <fragment android:id=&qu...
There is currently a proposal (not yet part of the ECMAScript standard) to add a finally callback to promises that will be executed regardless of whether the promise is fulfilled or rejected. Semantically, this is similar to the finally clause of the try block. You would usually use this functional...
Protocols enable polymorphism in Elixir. Define protocols with defprotocol: defprotocol Log do def log(value, opts) end Implement a protocol with defimpl: require Logger # User and Post are custom structs defimpl Log, for: User do def log(user, _opts) do Logger.info "User: ...

Page 463 of 1336