Tutorial by Examples: e

While Runnable provides a means to wrap code to be executed in a different thread, it has a limitation in that it cannot return a result from the execution. The only way to get some return value from the execution of a Runnable is to assign the result to a variable accessible in a scope outside of t...
To make a jar, you need one or more class files. This should have a main method if it is to be run by a double click. For this example, we will use: import javax.swing.*; import java.awt.Container; public class HelloWorld { public static void main(String[] args) { JFrame f = ne...
#include <gtkmm/application.h> #include <gtkmm/applicationwindow.h> #include <gtkmm/button.h> // main window of the application class HelloWorldWindow : public Gtk::ApplicationWindow { // a simple push button Gtk::Button btn; public: HelloWorldWindow() : ...
Starting with the Support Library version 22.2.1, it's possible to show and hide a FloatingActionButton from scrolling behavior using a FloatingActionButton.Behavior sublclass that takes advantage of the show() and hide() methods. Note that this only works with a CoordinatorLayout in conjunction wi...
A keyword denoting one of the two possible values of type bool. bool ok = true; if (!f()) { ok = false; goto end; }
A keyword denoting one of the two possible values of type bool. bool ok = true; if (!f()) { ok = false; goto end; }
A floating point type. Its range includes that of float. When combined with long, denotes the long double floating point type, whose range includes that of double. double area(double radius) { const double pi = 3.141592653589793; return pi*radius*radius; }
A specifier that can be applied to the declaration of a non-static, non-reference data member of a class. A mutable member of a class is not const even when the object is const. class C { int x; mutable int times_accessed; public: C(): x(0), times_accessed(0) { } int get...
In R, data objects are manipulated using named data structures. The names of the objects might be called "variables" although that term does not have a specific meaning in the official R documentation. R names are case sensitive and may contain alphanumeric characters(a-z,A-z,0-9), the dot...
This is a mistake that causes real confusion for Java beginners, at least the first time that they do it. Instead of writing this: if (feeling == HAPPY) System.out.println("Smile"); else System.out.println("Frown"); they accidentally write this: if (feeling == HAP...
const url = 'http://api.stackexchange.com/2.2/questions?site=stackoverflow&tagged=javascript'; const questionList = document.createElement('ul'); document.body.appendChild(questionList); const responseData = fetch(url).then(response => response.json()); responseData.then(({item...
5.6 PHP 5.6 introduced variable-length argument lists (a.k.a. varargs, variadic arguments), using the ... token before the argument name to indicate that the parameter is variadic, i.e. it is an array including all supplied parameters from that one onward. function variadic_func($nonVariadic, ...$...
#include <stdio.h> #define SIZE (10) int main() { size_t i = 0; int *p = NULL; int a[SIZE]; /* Setting up the values to be i*i */ for(i = 0; i < SIZE; ++i) { a[i] = i * i; } /* Reading the values using pointers */ for(p =...
You can define the signing configuration to sign the apk in the build.gradle file. You can define: storeFile : the keystore file storePassword: the keystore password keyAlias: a key alias name keyPassword: A key alias password You have to define the signingConfigs block to create a signin...
You can define the signing configuration in an external file as a signing.properties in the root directory of your project. For example you can define these keys (you can use your favorite names): STORE_FILE=myStoreFileLocation STORE_PASSWORD=myStorePassword KEY_ALIAS=myKeyAlias KEY_PASSWOR...
You can store the signing information setting environment variables. These values can be accessed with System.getenv("<VAR-NAME>") In your build.gradle you can define: signingConfigs { release { storeFile file(System.getenv("KEYSTORE")) storePasswo...
We use the null function to check if a given Map is empty: > Map.null $ Map.fromList [("Alex", 31), ("Bob", 22)] False > Map.null $ Map.empty True
There are many querying operations on maps. member :: Ord k => k -> Map k a -> Bool yields True if the key of type k is in Map k a: > Map.member "Alex" $ Map.singleton "Alex" 31 True > Map.member "Jenny" $ Map.empty False notMember is similar: &g...
Inserting elements is simple: > let m = Map.singleton "Alex" 31 fromList [("Alex",31)] > Map.insert "Bob" 99 m fromList [("Alex",31),("Bob",99)]
> let m = Map.fromList [("Alex", 31), ("Bob", 99)] fromList [("Alex",31),("Bob",99)] > Map.delete "Bob" m fromList [("Alex",31)]

Page 642 of 1191