Tutorial by Examples: 7

Sometimes the number of types you are mapping exceeds the 7 provided by the Func<> that does the construction. Instead of using the Query<> with the generic type argument inputs, we will provide the types to map to as an array, followed by the mapping function. Other than the initial ma...
// Java: Stream.of(1.0, 2.0, 3.0) .mapToInt(Double::intValue) .mapToObj(i -> "a" + i) .forEach(System.out::println); // a1 // a2 // a3 // Kotlin: sequenceOf(1.0, 2.0, 3.0).map(Double::toInt).map { "a$it" }.forEach(::println)
// Java (verbose): Collector<Person, StringJoiner, String> personNameCollector = Collector.of( () -> new StringJoiner(" | "), // supplier (j, p) -> j.add(p.name.toUpperCase()), // accumulator (j1, j2) -> j1.merge(j2), // c...
// Java: IntSummaryStatistics ageSummary = persons.stream() .collect(Collectors.summarizingInt(p -> p.age)); System.out.println(ageSummary); // IntSummaryStatistics{count=4, sum=76, min=12, average=19.000000, max=23} // Kotlin: // something to hold the stats... da...
This error appears while trying to update or delete records without including the WHERE clause that uses the KEY column. To execute the delete or update anyway - type: SET SQL_SAFE_UPDATES = 0; To enable the safe mode again - type: SET SQL_SAFE_UPDATES = 1;
The static method Date.now returns the number of milliseconds that have elapsed since 1 January 1970 00:00:00 UTC. To get the number of milliseconds that have elapsed since that time using an instance of a Date object, use its getTime method. // get milliseconds using static method now of Date co...
1) Use ng-repeat sparingly Using ng-repeat in views generally results in poor performance, particularly when there are nested ng-repeat's. This is super slow! <div ng-repeat="user in userCollection"> <div ng-repeat="details in user"> {{details}} </div...
A common use case for extension methods is to improve an existing API. Here are examples of adding exist, notExists and deleteRecursively to the Java 7+ Path class: fun Path.exists(): Boolean = Files.exists(this) fun Path.notExists(): Boolean = !this.exists() fun Path.deleteRecursively(): Bool...
To send an immediate message with data to JavaScript, you have to trigger an action from your init. init : ( Model, Cmd Msg ) init = ( Model 0, send SendOutgoing ) send : msg -> Cmd msg send msg = Task.perform identity identity (Task.succeed msg)
These examples assume that you already know what Java 7's NIO is in general, and you are used to writing code using java.io.File. Use these examples as a means to quickly find more NIO-centric documentation for migrating. There is much more to Java 7's NIO such as memory-mapped files or opening a Z...
This is an example of what a simple Arduino sketch looks like after being imported into Atmel Studio. Atmel Studio added the auto generated sections at the top. The rest is identical to the original Arduino code. If you expand the ArduinoCore project that was created and look in the src -> cor...
set myVariable [expr { $myVariable * 17 }] This shows how you can use a simple expression to update a variable. The expr command does not update the variable for you; you need to take its result and write it to the variable with set. Note that newlines are not important in the little language un...
This will only install PHP. If you wish to serve a PHP file to the web you will also need to install a web-server such as Apache, Nginx, or use PHP's built in web-server (php version 5.4+). If you are in a Ubuntu version below 16.04 and want to use PHP 7 anyway, you can add Ondrej's PPA repo...
Browser support for ES6 is growing, but to be sure your code will work on environments that dont fully support it, you can use Babel, the ES6/7 to ES5 transpiler, try it out! If you would like to use ES6/7 in your projects without having to worry about compatibility, you can use Node and Babel CLI ...
Note: Following instructions are written for Python 2.7 (unless specified): instructions for Python 3.x are similar. WINDOWS First, download the latest version of Python 2.7 from the official Website (https://www.python.org/downloads/). Version is provided as an MSI package. To install it manu...
As a privileged user (root or sudo): Create scollector directory: mkdir /opt/scollector In the /opt/scollector directory, download the latest binary build from the bosun/scollector site, [http://bosun.org/scollector/][1] wget https://github.com/bosun-monitor/bosun/releases/download/"version...
To target Internet Explorer 6 and Internet Explorer 7, start your properties with *: .hide-on-ie6-and-ie7 { *display : none; // This line is processed only on IE6 and IE7 } Non-alphanumeric prefixes (other than hyphens and underscores) are ignored in IE6 and IE7, so this hack works for any...
1067 This is probably related to TIMESTAMP defaults, which have changed over time. See TIMESTAMP defaults in the Dates & Times page. (which does not exist yet) 1292/1366 DOUBLE/Integer Check for letters or other syntax errors. Check that the columns align; perhaps you think you are putting i...
When you try access the records from MySQL database, you may get these error messages. These error messages occurred due to corruption in MySQL database. Following are the types MySQL error code 126 = Index file is crashed MySQL error code 127 = Record-file is crashed MySQL error code 134 = Recor...
The C++17 standard is feature complete and has been proposed for standardization. In compilers with experimental support for these features, it is usually referred to as C++1z. Language Extensions Fold Expressions declaring non-type template arguments with auto Guaranteed copy elision Templat...

Page 1 of 3