Tutorial by Examples

/** * The first line in the build configuration applies the Android plugin for * Gradle to this build and makes the android {} block available to specify * Android-specific build options. */ apply plugin: 'com.android.application' /** * The android {} block is where you configure all...
You can define the signing configuration to sign the apk in the build.gradle file using these properties: storeFile : the keystore file storePassword: the keystore password keyAlias: a key alias name keyPassword: A key alias password In many case you may need to avoid this kind of info in ...
In Aurelia all HTML templates are defined inside of opening and closing <template></template> tags. All of your HTML and Aurelia specific logic goes inside of these template tags and cannot exist outside of them. <template> </template>
Looping over an iterable defined inside of your viewmodel or passed through as a bindable (if a Custom Attribute or Custom Element) can be done like so. An array of string values export class MyViewModel { myIterable = ['String 1', 'String 2', 'String 3', 'String 4']; } <template> ...
Make sure to have a file input on your page: <input type="file" id="upload"> Then in JavaScript: document.getElementById('upload').addEventListener('change', readFileAsString) function readFileAsString() { var files = this.files; if (files.length === 0) { ...
Reading the contents of a file within a web application can be accomplished by utilizing the HTML5 File API. First, add an input with type="file" in your HTML: <input type="file" id="upload"> Next, we're going to add a change listener on the file-input. This e...
import pandas as pd import numpy as np np.random.seed(0) rng = pd.date_range('2015-02-24', periods=10, freq='T') df = pd.DataFrame({'Val' : np.random.randn(len(rng))}, index=rng) print (df) Val 2015-02-24 00:00:00 1.764052 2015-02-24 00:01:00 0.400157 2015-02...
Each pair in the dictionary is an instance of KeyValuePair with the same type parameters as the Dictionary. When you loop through the dictionary with For Each, each iteration will give you one of the Key-Value Pairs stored in the dictionary. For Each kvp As KeyValuePair(Of String, String) In curren...
Dim extensions As New Dictionary(Of String, String) _ from { { "txt", "notepad" }, { "bmp", "paint" }, { "doc", "winword" } } This creates a dictionary and immediately fills it with three KeyValuePairs. You can also add new val...
When you want to allow only certain keys in your arrays, especially when the array comes from request parameters, you can use array_intersect_key together with array_flip. $parameters = ['foo' => 'bar', 'bar' => 'baz', 'boo' => 'bam']; $allowedKeys = ['foo', 'bar']; $filteredParameters =...
Tuples are ordered lists of values of any type. (True, "Hello!", 42) It is impossible to change the structure of a Tuple or update the value. Tuples in Elm are considered a primitive data type, which means that you don't need to import any modules to use Tuples. Accessing values Bas...
Dictionaries are implemented in a Dict core library. A dictionary mapping unique keys to values. The keys can be any comparable type. This includes Int, Float, Time, Char, String, and tuples or lists of comparable types. Insert, remove, and query operations all take O(log n) time. Unlike Tu...
Comparable types are primitive types that can be compared using comparison operators from Basics module, like: (<), (>), (<=), (>=), max, min, compare Comparable types in Elm are Int, Float, Time, Char, String, and tuples or lists of comparable types. In documentation or type definitio...
Record is a set of key-value pairs. greeter = { isMorning: True , greeting: "Good morning!" } It is impossible to access a value by an non-existent key. It is impossible to dynamically modify Record's structure. Records only allow you to update values by constant keys....
Get width and height: var width = $('#target-element').width(); var height = $('#target-element').height(); Set width and height: $('#target-element').width(50); $('#target-element').height(100);
Get width and height: var width = $('#target-element').innerWidth(); var height = $('#target-element').innerHeight(); Set width and height: $('#target-element').innerWidth(50); $('#target-element').innerHeight(100);
Get width and height (excluding margin): var width = $('#target-element').outerWidth(); var height = $('#target-element').outerHeight(); Get width and height (including margin): var width = $('#target-element').outerWidth(true); var height = $('#target-element').outerHeight(true); Set widt...
For named (non-anonymous) functions, you can break when the function is executed. debug(functionName); The next time functionName function runs, the debugger will stop on its first line.
This example assumes you've installed OCaml. Compiling OCaml Code Create a new file named hello.ml, with the following contents: print_string "Hello world!\n" ocamlc is the OCaml compiler. To compile and run this script, run $ ocamlc -o hello hello.ml and then execute the resulti...
In Python you can compare a single element using two binary operators--one on either side: if 3.14 < x < 3.142: print("x is near pi") In many (most?) programming languages, this would be evaluated in a way contrary to regular math: (3.14 < x) < 3.142, but in Python it ...

Page 267 of 1336