Tutorial by Examples: al

If you have a moment object you can use add and substract to manipulate it or set any property of the time directly moment("2016-01-01").add(1, 'year').format('YYYY-MM-DD') // -> "2017-01-01" Or use .day(), .month(), .year(), .seconds(), .milliseconds() to set those val...
For multiple databases, you have the database.php file where you can set as many databases as you need. If you want to "switch" a database for a specific model on the fly, use the setDataSource() method. For example, if you have two databases, you can define them in the database.php file...
MyWebView.Navigate(new Uri("ms-appdata:///local/Downloads/index.html"));
Start by downloading the latest stable release from https://hive.apache.org/downloads.html -> Now untar the file with $ tar -xvf hive-2.x.y-bin.tar.gz -> Create a directory in the /usr/local/ with $ sudo mkdir /usr/local/hive -> Move the file to root with $ mv ~/Downloads/hive-2.x.y /...
AppleScript can display dialogs and alerts to the user. Dialogs are for optionally requesting user input. display dialog "Hello World" display alert "Hello World" You can customise the buttons of either using buttons and passing a list of text. display dialog "Hell...
Dependency installation ( https://www.npmjs.com/package/gulp-imagemin ) $ npm install --save-dev gulp-imagemin Usage /* * Your other dependencies. */ var imagemin = require('gulp-imagemin'); /* * `gulp images` - Run lossless compression on all the images. */ gulp.task('images', f...
#lang racket (for ([path (in-directory)] #:when (regexp-match? #rx"[.]rkt$" path)) (printf "source file: ~a\n" path)) The #lang line specifies the programming language of this file. #lang racket we are using the baseline, battery-included Racket programming language. O...
Select * from firm's_address; Select * from "firm's_address";
Create class and add imports to parse information: import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.IgnoreExtraProperties; //Declaration of firebase references private DatabaseReference mDatabase; //Declaration of firebase atributtes public Stri...
To enable a CORS policy across all of your MVC controllers you have to build the policy in the AddCors extension within the ConfigureServices method and then set the policy on the CorsAuthorizationFilterFactory using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Cors.Internal; ... pub...
When publishing Sitecore item programmatically the developer should keep in mind that Sitecore could be configured for several publishing targets, as well that several languages could be defined for item. ID targetDatabaseFieldId = ID.Parse("{39ECFD90-55D2-49D8-B513-99D15573DE41}"); ...
package com.mcf7.spring.domain; import org.springframework.validation.Errors; import org.springframework.validation.Validator; public class BeforeCreateBookValidator implements Validator{ public boolean supports(Class<?> clazz) { return Book.class.equals(clazz); } ...
package com.mcf7.spring.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; import org.springframework.data.rest.core.event.ValidatingRepositoryEventListener; import org...
With Ruby you can modify the structure of the program in execution time. One way to do it, is by defining methods dynamically using the method method_missing. Let's say that we want to be able to test if a number is greater than other number with the syntax 777.is_greater_than_123?. # open Numeric...
The simplest approach to parallel reduction in CUDA is to assign a single block to perform the task: static const int arraySize = 10000; static const int blockSize = 1024; __global__ void sumCommSingleBlock(const int *a, int *out) { int idx = threadIdx.x; int sum = 0; for (int i ...
Doing parallel reduction for a non-commutative operator is a bit more involved, compared to commutative version. In the example we still use a addition over integers for the simplicity sake. It could be replaced, for example, with matrix multiplication which really is non-commutative. Note, when ...
Multi-block approach to parallel reduction in CUDA poses an additional challenge, compared to single-block approach, because blocks are limited in communication. The idea is to let each block compute a part of the input array, and then have one final block to merge all the partial results. To do t...
Multi-block approach to parallel reduction is very similar to the single-block approach. The global input array must be split into sections, each reduced by a single block. When a partial result from each block is obtained, one final block reduces these to obtain the final result. sumNoncommSin...
Sometimes the reduction has to be performed on a very small scale, as a part of a bigger CUDA kernel. Suppose for example, that the input data has exactly 32 elements - the number of threads in a warp. In such scenario a single warp can be assigned to perform the reduction. Given that warp execut...
Sometimes the reduction has to be performed on a very small scale, as a part of a bigger CUDA kernel. Suppose for example, that the input data has exactly 32 elements - the number of threads in a warp. In such scenario a single warp can be assigned to perform the reduction. Given that warp execut...

Page 176 of 269