Tutorial by Examples: at

project/jni/main.c #include <stdio.h> #include <unistd.h> int main(void) { printf("Hello world!\n"); return 0; } project/jni/Android.mk LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := hello_world LOCAL_SRC_FILES := main.c include $(BU...
A C++ namespace is a collection of C++ entities (functions, classes, variables), whose names are prefixed by the name of the namespace. When writing code within a namespace, named entities belonging to that namespace need not be prefixed with the namespace name, but entities outside of it must use t...
Common values from both sets: You can use the intersect(_:) method to create a new set containing all the values common to both sets. let favoriteColors: Set = ["Red", "Blue", "Green"] let newColors: Set = ["Purple", "Orange", "Green"] ...
To create a new branch, while staying on the current branch, use: git branch <name> Generally, the branch name must not contain spaces and is subject to other specifications listed here. To switch to an existing branch : git checkout <name> To create a new branch and switch to it...
The srcdoc attribute can be used (instead of the src attribute) to specify the exact contents of the iframe as a whole HTML document. This will yield an IFrame with the text "IFrames are cool!" <iframe srcdoc="<p>IFrames are cool!</p>"></iframe> If the...
jQuery code is often wrapped in jQuery(function($) { ... }); so that it only runs after the DOM has finished loading. <script type="text/javascript"> jQuery(function($) { // this will set the div's text to "Hello". $("#myDiv").text("Hello"...
When a user subscribes to a channel, you may want to set state for that newly subscribed user. While there is a subscribe with state API, there are some scenarios where this is not the most optimal/reliable technique (like during a disconnect/reconnect situation - the state will be lost and not rein...
CREATE TABLE Employees ( Id int NOT NULL, PRIMARY KEY (Id), ... ); This will create the Employees table with 'Id' as its primary key. The primary key can be used to uniquely identify the rows of a table. Only one primary key is allowed per table. A key can also be composed by one...
This will draw a line at the bottom of every view but the last to act as a separator between items. public class SeparatorDecoration extends RecyclerView.ItemDecoration { private final Paint mPaint; private final int mAlpha; public SeparatorDecoration(@ColorInt int color, float w...
Function overloading is having multiple functions declared in the same scope with the exact same name exist in the same place (known as scope) differing only in their signature, meaning the arguments they accept. Suppose you are writing a series of functions for generalized printing capabilities, b...
You can iterate over a std::vector in several ways. For each of the following sections, v is defined as follows: std::vector<int> v; Iterating in the Forward Direction C++11 // Range based for for(const auto& value: v) { std::cout << value << "\n"; } /...
The jQuery function (usually aliased as $) can be used both to select elements and to create new elements. var myLink = $('<a href="http://stackexchange.com"></a>'); You can optionally pass a second argument with element attributes: var myLink = $('<a>', { 'href': 'h...
Assuming the page includes an HTML element like: <p class="small-paragraph"> This is a small <a href="https://en.wikipedia.org/wiki/Paragraph">paragraph</a> with a <a class="trusted" href="http://stackexchange.com">link</a>...
UIButtons can be initialized in a frame: Swift let button = UIButton(frame: CGRect(x: x, y: y, width: width, height: height) Objective C UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(x, y, width, height)]; A specific type of UIButton can be created like this: Swift let but...
You can use the nil coalescing operator to unwrap a value if it is non-nil, otherwise provide a different value: func fallbackIfNil(str: String?) -> String { return str ?? "Fallback String" } print(fallbackIfNil("Hi")) // Prints "Hi" print(fallbackIfNil(nil)...
The datepicker is used to show an interactive date selector which is tied to a standard form input field. It makes selecting of date for input tasks very easy and also it is also highly configurable. Any input field can be bound with jquery-ui datepicker by the input field's selector (id,class etc....
To determine the color and pixel depths of the screen: var pixelDepth = window.screen.pixelDepth, colorDepth = window.screen.colorDepth;
Standard Collections Java Collections framework A simple way to construct a List from individual data values is to use java.utils.Arrays method Arrays.asList: List<String> data = Arrays.asList("ab", "bc", "cd", "ab", "bc", "cd"); ...
Create password hashes using password_hash() to use the current industry best-practice standard hash or key derivation. At time of writing, the standard is bcrypt, which means, that PASSWORD_DEFAULT contains the same value as PASSWORD_BCRYPT. $options = [ 'cost' => 12, ]; $hashedPasswor...
Spoilers are used to hide text or images that would otherwise negatively impact another user's experience. They can be created using >! >!This is hidden until your cursor hovers on top of it This is hidden until your cursor hovers on top of it Note: This is not part of standard markup...

Page 16 of 442