Tutorial by Examples: er

You can loop over any iterable by using the standard for-loop: val list = listOf("Hello", "World", "!") for(str in list) { print(str) } Lots of things in Kotlin are iterable, like number ranges: for(i in 0..9) { print(i) } If you need an index while...
Polymer prodives a lot of well built elements for you to use in your app. Browse them in their Element Catalog. Let's go through the workflow of using an element by including paper-input (Documentation) Download the Element To Download an element there are two ways: Bower The convinient way is...
Higher-order functions can be used to implement generic algorithms, giving up the responsibility of providing final details to the user. For instance List.sort expects a comparison function, which allows to implement various ways of sorting. Here we implement case-insensitive sorting of strings: le...
Observables are broadly categorised as Hot or Cold, depending on their emission behaviour. A Cold Observable is one which starts emitting upon request(subscription), whereas a Hot Observable is one that emits regardless of subscriptions. Cold Observable /* Demonstration of a Cold Observable */ Ob...
Setting only one style: $('#target-element').css('color', '#000000'); Setting multiple styles at the same time: $('#target-element').css({ 'color': '#000000', 'font-size': '12pt', 'float': 'left', });
To get an element's CSS property you can use the .css(propertyName) method: var color = $('#element').css('color'); var fontSize = $('#element').css('font-size');
Although modules are ideal, if the library you are using is referenced by a global variable (like $ or _), because it was loaded by a script tag, you can create an ambient declaration in order to refer to it: declare const _: any;
A message with important, and usually time-sensitive, information. <div role="alert" aria-live="assertive">Your session will expire in 60 seconds.</div> Note that I've included both role="alert" and aria-live="assertive" at the same time. The...
A type of dialog that contains an alert message, where initial focus goes to an element within the dialog. <div role="alertdialog"> <h1>Warning</h1> <div role="alert">Your session will expire in 60 seconds.</div> </div>
A region that contains mostly site-oriented content, rather than page-specific content. <div role="banner"> <h1>My Site</h1> <ul> <li><a href="/">Home</a></li> <li><a href="/about">About</...
A cell containing header information for a column. <table role="grid"> <thead> <tr> <th role="columnheader">Day 1</th> <th role="columnheader">Day 2</th> <th role="columnheader">Day ...
A cell containing header information for a row in a grid. <table role="grid"> <thead> <!-- etc --> </thead> <tbody> <tr> <th role="rowheader">Day 1</th> <td>65</td> </tr> ...
A user input where the user selects a value from within a given range. <div role="slider" aria-valuemax="100" aria-valuemin="0" aria-valuenow="25"> <div class="sliderhandle"></div> </div>
A type of live region containing a numerical counter which indicates an amount of elapsed time from a start point, or the time remaining until an end point. <p> <span role="timer">60</span> seconds remaining. </p>
import java.nio.charset.StandardCharsets; import java.util.Arrays; public class GetUtf8BytesFromString { public static void main(String[] args) { String str = "Cyrillic symbol Ы"; //StandardCharsets is available since Java 1.7 //for ealier version use ...
When an expression contains multiple operators, it can potentially be read in different ways. For example, the mathematical expression 1 + 2 x 3 could be read in two ways: Add 1 and 2 and multiply the result by 3. This gives the answer 9. If we added parentheses, this would look like ( 1 + 2 )...
In general, it is considered good practice to throw by value (rather than by pointer), but catch by (const) reference. try { // throw new std::runtime_error("Error!"); // Don't do this! // This creates an exception object // on the heap and would require you to catch the ...
Even when all your work is directed at a single worksheet, it's still a very good practice to explicitly specify the worksheet in your code. This habit makes it much easier to expand your code later, or to lift parts (or all) of a Sub or Function to be re-used someplace else. Many developers establi...
DBContract.java //Define the tables and columns of your local database public final class DBContract { /*Content Authority its a name for the content provider, is convenient to use the package app name to be unique on the device */ public static final String CONTENT_AUTHORITY =...
This object, Shape has a property image that depends on numberOfSides and sideWidth. If either one of them is set, than the image has to be recalculated. But recalculation is presumably long, and only needs to be done once if both properties are set, so the Shape provides a way to set both propertie...

Page 112 of 417