Tutorial by Examples

R contains a Date class, which is created with as.Date(), which takes a string or vector of strings, and if the date is not in ISO 8601 date format YYYY-MM-DD, a formatting string of strptime-style tokens. as.Date('2016-08-01') # in ISO format, so does not require formatting string ## [1] &quot...
Sometimes you will create classes that won't be used in their own right, rather only be extended inside other rule sets. This means that the compiled CSS file will be larger than it needs to be. Placeholder selectors solve this problem. Placeholder selectors are similar to class selectors, but th...
The most important thing for speeding up a query on any non-tiny table is to have a suitable index. WHERE a = 12 --> INDEX(a) WHERE a > 12 --> INDEX(a) WHERE a = 12 AND b > 78 --> INDEX(a,b) is more useful than INDEX(b,a) WHERE a > 12 AND b > 78 --> INDEX(a) or INDE...
A common mistake is to hide an indexed column inside a function call. For example, this can't be helped by an index: WHERE DATE(dt) = '2000-01-01' Instead, given INDEX(dt) then these may use the index: WHERE dt = '2000-01-01' -- if `dt` is datatype `DATE` This works for DATE, DATETIME, TIM...

OR

In general OR kills optimization. WHERE a = 12 OR b = 78 cannot use INDEX(a,b), and may or may not use INDEX(a), INDEX(b) via "index merge". Index merge is better than nothing, but only barely. WHERE x = 3 OR x = 5 is turned into WHERE x IN (3, 5) which may use an index with x...
Subqueries come in several flavors, and they have different optimization potential. First, note that subqueries can be either "correlated" or "uncorrelated". Correlated means that they depend on some value from outside the subquery. This generally implies that the subquery mus...
A common problem that leads to an inefficient query goes something like this: SELECT ... FROM a JOIN b ON ... WHERE ... GROUP BY a.id First, the JOIN expands the number of rows; then the GROUP BY whittles it back down the the number of rows in a. There may not be any good c...
Create a testing class in the src/test/scala directory, in a file named HelloWorldSpec.scala. Put this inside the file: import org.scalatest.{FlatSpec, Matchers} class HelloWorldSpec extends FlatSpec with Matchers { "Hello World" should "not be an empty String" in { ...
Detailed instructions on getting cloudkit set up or installed.
import { NgModule } from '@angular/core'; @NgModule({ declarations: [], // components your module owns. imports: [], // other modules your module needs. providers: [], // providers available to your module. bootstrap: [] // bootstrap this root component. }) export class MyModule {} ...
// app.module.ts import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { HttpModule } from '@angular/http'; import { MyRootComponent } from './app.component'; @NgModule({ declarations: [MyRootComponent], imports: [BrowserModule, Ht...
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { MyModule } from './app.module'; platformBrowserDynamic().bootstrapModule( MyModule ); In this example, MyModule is the module containing your root component. By bootstrapping MyModule your Angul...
This example has two parts - some boilerplate steps for adding Castle Windsor to your WCF service, and then a simple, concrete example to show how we configure and use Windsor's container. That makes the example a little bit long. If you already understand using a DI container then you likely only ...
Prototype: aggregate(zeroValue, seqOp, combOp) Description: aggregate() lets you take an RDD and generate a single value that is of a different type than what was stored in the original RDD. Parameters: zeroValue: The initialization value, for your result, in the desired format. seqOp: ...
Helper yii\helpers\Url provides a set of static methods for managing URLs. This helper may used in views/controllers code. URL to a route: echo Url::to(['post/index']); URL to a route with parameters: echo Url::to(['post/view', 'id' => 100]); anchored URL: echo Url::to(['post/view', 'id...
/** * Checks if a resource exists by sending a HEAD-Request. * @param url The url of a resource which has to be checked. * @return true if the response code is 200 OK. */ public static final boolean checkIfResourceExists(URL url) throws IOException { HttpURLConnection conn = (HttpURLCo...
Let's say you're working on an app called MyTasks, and you want to allow inbound URLs to create a new task with a title and a body. The URL you're designing might look something like this: mytasks://create?title=hello&body=world (Of course, the text and body parameters are used to populate our...
Sometimes we need to perform basic operations like hide/show view based on single value, for that single variable we cannot create model or it is not good practice to create model for that. DataBinding supports basic datatypes to perform those oprations. <layout xmlns:android="http://schema...
First Initialize FirebaseDatabase: FirebaseDatabase database = FirebaseDatabase.getInstance(); Write to your database: // Write a message to the database FirebaseDatabase database = FirebaseDatabase.getInstance(); DatabaseReference myRef = database.getReference("message"); myRef....
ACCEPT variable. ACCEPT variable FROM CONSOLE. ACCEPT variable FROM ENVIRONMENT "path". ACCEPT variable FROM COMMAND-LINE. ACCEPT variable FROM ARGUMENT-NUMBER ACCEPT variable FROM ARGUMENT-VALUE ACCEPT variable AT 0101. ACCEPT screen-variable. ACCEPT today FROM DATE. ACCE...

Page 769 of 1336