Tutorial by Examples

This type of Hook can be used to override core portal (e.g c/portal/login) and portlet struts actions (e.g /login/forgot_password), this actions for Liferay Portal are specified in a struts-config.xml file in its WEB-INF folder.To override an action: in liferay-hook.xml file of your hook plugin u...
type Meter = Double This simple approach has serious drawbacks for unit handling as every other type that is a Double will be compatible with it: type Second = Double var length: Meter = 3 val duration: Second = 1 length = duration length = 0d All of the above compiles, so in this case un...
case class Meter(meters: Double) extends AnyVal case class Gram(grams: Double) extends AnyVal Value classes provide a type-safe way to encode units, even if they require a bit more characters to use them: var length = Meter(3) var weight = Gram(4) //length = weight //type mismatch; found : Gr...
An alternative to forever on Linux is nohup. To start a nohup instance cd to the location of app.js or wwwfolder run nohup nodejs app.js & To kill the process run ps -ef|grep nodejs kill -9 <the process number>
h = 1.0 / n; #pragma omp parallel for private(x) shared(n, h) reduction(+:area) for (i = 1; i <= n; i++) { x = h * (i - 0.5); area += (4.0 / (1.0 + x*x)); } pi = h * area; In this example, each threads execute a subset of the iteration count. Each thread has its local private copy ...
h = 1.0 / n; #pragma omp parallel for private(x) shared(n, h, area) for (i = 1; i <= n; i++) { x = h * (i - 0.5); #pragma omp critical { area += (4.0 / (1.0 + x*x)); } } pi = h * area; In this example, each threads execute a subset of the iteration count and they accumul...
h = 1.0 / n; #pragma omp parallel for private(x) shared(n, h, area) for (i = 1; i <= n; i++) { x = h * (i - 0.5); #pragma atomic area += (4.0 / (1.0 + x*x)); } pi = h * area; In this example, each threads execute a subset of the iteration count and they accumulate atomically int...
h = 1.0 / n; #pragma omp parallel private(x) shared(n, h) { double thread_area = 0; // Private / local variable #pragma omp for for (i = 1; i <= n; i++) { x = h * (i - 0.5); thread_area += (4.0 / (1.0 + x*x)); } #pragma omp atomic ...
Given the following project structure include\ myHeader.h src\ main.cpp CMakeLists.txt the following line in the CMakeLists.txt file include_directories(${PROJECT_SOURCE_DIR}/include) adds the include directory to the include search path of the compiler for all targets defined in thi...
You need Node Package Manager to install the project dependencies. Download node for your operating system from Nodejs.org. Node Package Manager comes with node. You can also use Node Version Manager to better manage your node and npm versions. It is great for testing your project on different node...
Animating Background color of stacklayout on tapping button pages/main.component.ts import {Component, ElementRef, ViewChild} from "@angular/core"; import {Color} from "color"; import {View} from "ui/core/view"; @Component({ selector: "main&quot...
pages/main.component.ts import {Component, ElementRef, ViewChild} from "@angular/core"; import {View} from "ui/core/view"; import {AnimationCurve} from "ui/enums"; @Component({ selector: "main", template: ` <StackLayout> ...
Set the NSFetchRequest property sortDescriptors to determine how data is returned. let fetchRequest = NSFetchRequest(entityName: "NAME_OF_ENTITY") let sortDescriptor = NSSortDescriptor(key: "NAME_OF_ATTRIBUTE", ascending: true) fetchRequest.sortDescriptors = [sortDescriptor] ...
You can also set multiple sort descriptors, to sort by one attribute within another. For example, return all entries ordered by date, and by name within each date: let fetchRequest = NSFetchRequest(entityName: "NAME_OF_ENTITY") let sortDescriptor1 = NSSortDescriptor(key: "name"...
You can set the path to bcomp.exe git config --global difftool.bc3.path 'c:\Program Files (x86)\Beyond Compare 3\bcomp.exe' and configure bc3 as default git config --global diff.tool bc3
The keywords can also create scopes in order to (un)check multiple operations. short m = 32767; short n = 32767; checked { int result1 = (short)(m + n); //will throw an OverflowException } unchecked { int result2 = (short)(m + n); // will return -2 }
If you have code (a routine) you want to execute under a specific (constraint) context, you can use dependency injection. The following example shows the constraint of executing under an open SSL connection. This first part would be in your library or framework, which you won't expose to the client...
Installing software via APT (Advanced Package Tool) also know as 'apt-get'. To install Mozilla Firefox: Open a Terminal (Ctrl+Alt+T) Type sudo apt-get install firefox Hit Enter When it asks to install type 'Y' to confirm. Software will be downloaded and installed.
Consider a communication happening between a Employee and its HR Department. Broadly these are explained in the following six steps when a message is passed to the actor: Employee creates something called an ActorSystem. It uses the ActorSystem to create something called as ActorRef. Th...
set wildmenu to turn on completion suggestions for command line. Execute the following set wildmenu set wildmode=list:longest,full Now if you do say, :colortab, You'll get 256-jungle Benokai BlackSea C64 CandyPaper Chasing_Logic ChocolateLiquor :color 0x7A69_dark

Page 827 of 1336