Tutorial by Examples: sin

How does an RDD gets partitioned? By default a partition is created for each HDFS partition, which by default is 64MB. Read more here. How to balance my data across partitions? First, take a look at the three ways one can repartition his data: Pass a second parameter, the desired min...
import scala.reflect.runtime.universe._ val mirror = runtimeMirror(getClass.getClassLoader) val module = mirror.staticModule("org.data.TempClass")
The Compat.jl package enables using some new Julia features and syntax with older versions of Julia. Its features are documented on its README, but a summary of useful applications is given below. 0.5.0 Unified String type In Julia v0.4, there were many different types of strings. This system was...
For example you want to use surfaceView in ng2-nativescript. As we don't have surfaceView in nativescript we should use placeholder. first we should import the requirements: import {Component} from "@angular/core"; import placeholder = require("ui/placeholder"); let applicat...
app.component.ts: import {Component,OnInit} from "@angular/core"; import placeholder = require("ui/placeholder"); let application= require("application"); @Component({ selector: "my-app", templateUrl: "app.component.html", }) export...
Define the function using the vararg keyword. fun printNumbers(vararg numbers: Int) { for (number in numbers) { println(number) } } Now you can pass as many parameters (of the correct type) into the function as you want. printNumbers(0, 1) // Prints "0&qu...
Arrays can be passed into vararg functions using the Spread Operator, *. Assuming the following function exists... fun printNumbers(vararg numbers: Int) { for (number in numbers) { println(number) } } You can pass an array into the function like so... val numbers = intArray...
The orderBy() method specifies the ORDER BY fragment of a SQL query.For example consider our employee table having fields emp_id, emp_first_name, emp_last_name and emp_salary.Suppose we need to order the result by increasing order of employee salaries.We can do it in sql as given below. Select * fr...
Below are examples of generating 5 random numbers using various probability distributions. Uniform distribution between 0 and 10 runif(5, min=0, max=10) [1] 2.1724399 8.9209930 6.1969249 9.3303321 2.4054102 Normal distribution with 0 mean and standard deviation of 1 rnorm(5, mean=0, sd=1) [1...
When the app is based on more than one criteria, instead of creating a lot of flavors you can define flavor dimensions. The flavor dimensions define the cartesian product that will be used to produce variants. Example: flavorDimensions("dimA", "dimB") productFlavors { ...
Keys Unlike a Scripting.Dictionary, a Collection does not have a method for determining if a given key exists or a way to retrieve keys that are present in the Collection. The only method to determine if a key is present is to use the error handler: Public Function KeyExistsInCollection(ByVal key...
The fork/join framework in Java is ideal for a problem that can be divided into smaller pieces and solved in parallel. The fundamental steps of a fork/join problem are: Divide the problem into multiple pieces Solve each of the pieces in parallel to each other Combine each of the sub-solutions ...
When we query our data, we often need more than one filter to get the exact data set we are looking for. In SQL, we handle this with AND and OR clauses. We can achieve the same thing with collections. To add an AND clause to your query, just simply add another method call. This will append the seco...
This uses the SwiftyDropbox library to upload a file from a NSFileHandle to the Dropbox account using upload sessions, handling every error case: import UIKit import SwiftyDropbox class ViewController: UIViewController { // filled in later in doUpload: var fileHandle : NSFileHandle?...
Use the double negation syntax to check for truthiness of values. All values correspond to a boolean, irrespective of their type. irb(main):001:0> !!1234 => true irb(main):002:0> !!"Hello, world!" (irb):2: warning: string literal in condition => true irb(main):003:0> !...
JSON (JavaScript Object Notation) is a lightweight data interchange format. Many web applications use it to send and receive data. In Ruby you can simply work with JSON. At first you have to require 'json', then you can parse a JSON string via the JSON.parse() command. require 'json' j = '{&q...
You can use JSON together with Ruby symbols. With the option symbolize_names for the parser, the keys in the resulting hash will be symbols instead of strings. json = '{ "a": 1, "b": 2 }' puts JSON.parse(json, symbolize_names: true) >> {:a=>1, :b=>2}
Accessing the array of calendars To access the array of EKCalendars, we use the calendarsForEntityType method: Swift let calendarsArray = eventStore.calendarsForEntityType(EKEntityType.Event) as! [EKCalendar] Iterating through calendars Just use a simple for loop: Swift for calendar in cale...
Applying a filter To access contacts, we should apply a filter of type NSPredicate to our contactStore variable which we defined it in Authorizing Contact Access example. For example, here we want to sort out contacts with name matching with our own: Swift let predicate = CNContact.predicateForCo...
There exist cases in which it is necessary to put data of different types together. In Azure ML for example, it is necessary to pass informations from a R script module to another one exclusively throught dataframes. Suppose we have a dataframe and a number: > df name height team...

Page 98 of 161