Tutorial by Examples: ci

Recall that every transaction contains multiple sublists of data. Now that we can show only sublist data using Main Line, we can further refine our search results to specific sublist data. Most of the sublists included in Transaction results have a corresponding search filter to toggle whether they...
Recoding missing values Regularly, missing data isn't coded as NA in datasets. In SPSS for example, missing values are often represented by the value 99. num.vec <- c(1, 2, 3, 99, 5) num.vec ## [1] 1 2 3 99 5 It is possible to directly assign NA using subsetting num.vec[num.vec == 99]...
To coerce a variable to a logical use the as.logical() function. > x <- 2 > z <- x > 4 > z [1] FALSE > class(x) [1] "numeric" > as.logical(2) [1] TRUE When applying as.numeric() to a logical, a double will be returned. NA is a logical value and a logical ...
The BigDecimal class contains an internal cache of frequently used numbers e.g. 0 to 10. The BigDecimal.valueOf() methods are provided in preference to constructors with similar type parameters i.e. in the below example a is preferred to b. BigDecimal a = BigDecimal.valueOf(10L); //Returns cached O...
BigDecimal provides static properties for the numbers zero, one and ten. It's good practise to use these instead of using the actual numbers: BigDecimal.ZERO BigDecimal.ONE BigDecimal.TEN By using the static properties, you avoid an unnecessary instantiation, also you've got a literal in you...
If you have the following data file cat data.csv 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 maybe you need to read the fourth column of the third line, this would be "24" awk 'NR==3 ...
Consider the following code to copy one file to another: import java.io.*; public class FileCopy { public static void main(String[] args) throws Exception { try (InputStream is = new FileInputStream(args[0]); OutputStream os = new FileOutputStream(args[1])) { ...
Now that you have the providers for your different models, you need to request them. Just as Vehicle needs Motor, you have to add the @Inject annotation in the Vehicle constructor as follows: @Inject public Vehicle(Motor motor){ this.motor = motor; } You can use the @Inject annotation to ...
This example uses the asyncio SSE library: https://github.com/brutasse/asyncio-sse import asyncio import sse class Handler(sse.Handler): @asyncio.coroutine def handle_request(self): yield from asyncio.sleep(2) self.send('foo') yield from asyncio.sleep(2) ...
Assume we need to add an NSString object to SomeClass (we cant subclass). In this example we not only create an associated object but also wrap it in a computed property in a category for extra neatness #import <objc/runtime.h> @interface SomeClass (MyCategory) // This is the property wr...
This example echoes the special character ! into a file. This would only work when DelayedExpansion is disabled. When delayed expansion in enabled, you will need to use three carets and an exclamation mark like this: @echo off setlocal enabledelayedexpansion echo ^^^!>file echo ^>>&...
g + geom_bar(aes(x = cut, fill = color), position = "fill") + guides(fill = guide_legend(title = NULL))
var foo = new uint8[12]; var bar = foo; assert (foo != bar); In this example, the both foo and bar possess a strong reference, but since uint8[] only support single ownership, a copy is made.
Main Component File: //our root app component import {Component, NgModule, ViewChild, ViewContainerRef, ComponentFactoryResolver, ComponentRef} from '@angular/core' import {BrowserModule} from '@angular/platform-browser' import {ChildComponent} from './childComp.ts' @Component({ selector: ...
To play a sound of with a specific tone,we first have to create a sine wave sound.This is done in the following way. final int duration = 10; // duration of sound final int sampleRate = 22050; // Hz (maximum frequency is 7902.13Hz (B8)) final int numSamples = duration * sampleRate; final double ...
import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; class test_webdriver{ public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); driver.get("http://stackoverflow.com/"); driver.close(); } }...
As of Jekyll 3.2, you can use the filter where_exp to filter a collection by any of its properties. Say you have the following collection item in an "albums" collection: --- title: My Amazing Album --- ... You can combine the where_exp and first filters to grab just that one item: ...
If you want to replace parts of your website, ajax is an easy way to do it. The website.html where you want to replace the content based on the selected value: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"> ...
/* * This design have some major issues * For each new shape added the unit testing * of the GraphicEditor should be redone * When a new type of shape is added the time * for adding it will be high since the developer * who add it should understand the logic * of the Gr...
/* * For each new shape added the unit testing * of the GraphicEditor should not be redone * No need to understand the sourcecode * from GraphicEditor. * Since the drawing code is moved to the * concrete shape classes, it's a reduced risk * to affect old functionallity when new * functionall...

Page 37 of 42