Tutorial by Examples: c

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...
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...
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: ...
Use & to capture functions from other modules. You can use the captured functions directly as function parameters or within anonymous functions. Enum.map(list, fn(x) -> String.capitalize(x) end) Can be made more concise using &: Enum.map(list, &String.capitalize(&1)) Captu...
We often encounter a situation where a property we're trying to extract doesn't exist in the object/array, resulting in a TypeError (while destructuring nested objects) or being set to undefined. While destructuring we can set a default value, which it will fallback to, in case of it not being found...
We are not limited to destructuring an object/array, we can destructure a nested object/array. Nested Object Destructuring var obj = { a: { c: 1, d: 3 }, b: 2 }; var { a: { c: x, d: y }, b: z } = obj; console.log(x, y, z); // 1,3,2 Nested Array ...
\documentclass{article}% or book, report, ... \begin{document} See \cite{citeA} or \cite{citeB} or \cite{citeA, citeB}. \begin{thebibliography}{x} % \bibitem{<biblabel>} <citation> \bibitem{citeA} {\scshape Author, A}, {\itshape A title}, Journal of So-and-So, 2000....
round() tie breaking In Python 2, using round() on a number equally close to two integers will return the one furthest from 0. For example: Python 2.x2.7 round(1.5) # Out: 2.0 round(0.5) # Out: 1.0 round(-0.5) # Out: -1.0 round(-1.5) # Out: -2.0 In Python 3 however, round() will retur...
using System; namespace TypeConversionApplication { class ExplicitConversion { static void Main(string[] args) { double d = 5673.74; int i; // cast double to int. i = (int)d; Console.WriteLine(i); Cons...

Page 286 of 826