name: main-template layout: true class: left, top, inverse --- class: center
# What's new in Scala 2.13?
### © 2019 Hermann Hueck
https://github.com/hermannhueck/new-in-scala213 ---
# Abstract
This presentation shows the feature updates from Scala 2.12 to 2.13. The list of features is not comprehensive, but it is my personal selection of favorites. I will focus on those which IMO impact/ease the programmers live most. I will look at 5 feature areas: compiler, standard library, language changes, Future and finally the most important change the redesigned collections library. I will not only show the new features of 2.13. In many cases I will show how the new features of 2.13 can be backported to 2.12 und be used in mostly the same way as in 2.13. Finally I'll give some guide lines for the migration from 2.12 to 2.13 and for a cross version project which compiles a code base with both compiler versions. ---
# Agenda
1. [Release Summary](#release_summary) 1. [Compiler](#compiler) 1. [sbt Setup for Cross Compilation](#sbt_setup) 1. [Standard Library](#standard_library) 1. [Concurrency / Future](#concurrency_future) 1. [Language Changes](#language_changes) 1. [Collections](#collections) 1. [Architecture of Collections](#architecture_collections) 1. [Migration](#migration) 1. [Resources](#resources) --- class: middle, center name: release_summary # 1. Release Summary
---
## Release Summary
Release 2.13 improves Scala in the following areas: -
Collections
: Standard library collections have been overhauled for simplicity, performance, and safety. This is the centerpiece of the release. -- -
Future
: is faster and more robust. -- -
Standard library
: New classes have been added and new methods enhance existing classes. But also some deprecations. -- -
Language
: Literal types, partial unification is default, by-name implicits, more. -- -
Compiler
: 5-10% faster, deterministic output, improved optimizer. -- .footnote[ Scala 2.13.0: https://github.com/scala/scala/releases/tag/v2.13.0 ] .footnote2[ Scala 2.13.1: https://github.com/scala/scala/releases/tag/v2.13.1 ] --- class: middle, center name: compiler # 2. Compiler
---
## Compiler
- ###Performance improved - ###Some improvments already flew back into 2.12.8, 2.12.9, 2.12.10. - ###Deterministic, reproducible compilation - ###Optimizer improvements (collections, arrays, inlining) ---
## Macro Annotations
- ### There is no more "macro paradise" compiler plugin for 2.13. - ### Instead, macro annotations are handled directly by the compiler. - ### Macro annotations are enabled with the -Ymacro-annotations flag. - ### Macro annotations remain experimental. --- class: middle, center name: sbt_setup # 3. sbt Setup for Cross Compilation
--- ## Cross compile with sbt
```scala // build.sbt inThisBuild( Seq( scalaVersion := "2.13.1", crossScalaVersions := List("2.12.10", "2.13.1"), ... ) ) ``` -- ```scala scalacOptions ++= { CrossVersion.partialVersion(scalaVersion.value) match { case Some((2, minor)) if minor >= 13 => Seq.empty case _ => Seq( "-Ypartial-unification", // (removed in scala 2.13) allow the Compiler to // unify type constructors of different arities "-language:higherKinds", // (not required since scala 2.13.1) suppress // warnings when using higher kinded types ) } } ``` --- class: middle, center name: standard_library # 3. Standard Library
---
## Smaller Footprint
###No longer included in the stdlib: - ###*scala-parallel-collections* - ###*scala-xml* - ###*scala-parser-combinators* - ###*scala-swing*
These become libraries of their own. ---
## Integrated Java Interop
- The old *scala-java8-compat* module is now part of the standard library. - This provides converters for options, function types and Java streams. - *scala.collection.JavaConversions* removed (already deprecated in 2.12). --- ## Chaining: *pipe* and *tap*
```scala import scala.util.chaining._ val x: Int = 5 tap println val y: Int = 5 pipe (_ * x) tap println List(1, 2, 3) pipe (ys => println("debug: " + ys.toString)) val times6 = (_: Int) * 6 (1 - 2 - 3) .tap(v => println(s"initial: $v")) .pipe(times6) .tap(v => println(s"after times6: $v")) .pipe(scala.math.abs) .pipe(v => println(s"after scala.math.abs: $v")) ``` --
*x pipe f* is a replacement for *f(x)*, where f is a *Function1[A => B]*. *x tap f* is a replacement for *x => { f(x)*; x }, where f is a side-effecting *Function1[A => Unit]*. *tap* performs the side effect in *f(x)* and returns *x* unchanged. ---
## Backport to 2.12: *pipe* and *tap*
- My 2.12 backport library uses the same package name as in 2.13 stdlib: *scala.util.chaining* ```scala package scala.util package object chaining { implicit class ChainingOps[A](private val a: A) { @inline def pipe[B](f: A => B): B = f(a) @inline def tap[B](f: A => Unit): A = { f(a); a } } } ``` --
With this backport he same code runs without friction under 2.12 and 2.13. ---
## Either: *Right.withLeft* and *Left.withRight*
- *Right.apply* leaves the left type unspecified.
- *Left.apply* leaves the right type unspecified. - *Right.withLeft* and *Left.withRight* let you specity the unspecified type. -- ```html sbt:New in Scala 2.13> ++2.13.0 console ... Welcome to Scala 2.13.0 ... scala> Right(5) res0: scala.util.Right[Nothing,Int] = Right(5) scala> Right(5).withLeft[String] res1: scala.util.Either[String,Int] = Right(5) scala> Left("some error") res2: scala.util.Left[String,Nothing] = Left(some error) scala> Left("some error").withRight[Int] res3: scala.util.Either[String,Int] = Left(some error) ``` ---
## Backport to 2.12:
*Right.withLeft* and *Left.withRight*
```scala package compat213 package object either { implicit class RightOps[L, R](private val right: Right[L, R]) { @inline def withLeft[LL >: L]: Either[LL, R] = right } implicit class LeftOps[L, R](private val left: Left[L, R]) { @inline def withRight[RR >: R]: Either[L, RR] = left } } ``` --- ## *Either#flatten*
- available since 2.13 - *Either#flatten* is equivalent to *Either#flatMap(x => x)* -- .left-column-50[ ### Scala 2.12 ```scala val rr = Right(Right(42)) rr.flatMap(x => x) //=> Right(42) val rl = Right(Left("Error RL")) rl.flatMap(x => x) //=> Left("Error RL") val l = Left("Error L") l.flatMap(x => x) //=> Left("Error L") val ll = Left(Left("Error LL")) ll.flatMap(x => x) //=> Left(Left("Error LL")) ``` ] .right-column-50[ ### Scala 2.13 ```scala val rr = Right(Right(42)) rr.flatten //=> Right(42) val rl = Right(Left("Error RL")) rl.flatten //=> Left("Error RL") val l = Left("Error L") l.flatten //=> Left("Error L") val ll = Left(Left("Error LL")) ll.flatten //=> Left(Left("Error LL")) ``` ] .footnote2[ [scaladoc: Either](https://www.scala-lang.org/api/current/scala/util/Either.html) ] ---
## Backport to 2.12: *Either#flatten*
```scala package compat213 package object either { implicit class EitherOps[+L, +R](private val either: Either[L, R]) { @inline def flatten[L1 >: L, RR]( implicit ev: R <:< Either[L1, RR] ): Either[L1, RR] = either.flatMap(x => x) } } ``` ---
## String Operations: *toIntOption* etc.
- convert *String* literals to *Int*, *Double*, *Boolean* without throwing exceptions - return *Some(value)* if the conversion succeeds, *None* if it fails. --
```html sbt:New in Scala 2.13> ++2.13.0 console ... Welcome to Scala 2.13.0 ... scala> "42".toIntOption res0: Option[Int] = Some(42) scala> "42.0".toIntOption res1: Option[Int] = None scala> "42.0".toDoubleOption res2: Option[Double] = Some(42.0) scala> "true".toBooleanOption res3: Option[Boolean] = Some(true) ``` ---
## Backport to 2.12: String Operations
```scala package compat213 package object string { implicit class StringOps(private val s: String) { import scala.util.Try @inline def toIntOption: Option[Int] = Try(s.toInt).toOption @inline def toDoubleOption: Option[Double] = Try(s.toDouble).toOption @inline def toBooleanOption: Option[Boolean] = Try(s.toBoolean).toOption } } ``` --- ## *scala.util.Using.apply* for resource management
Similar to *try ... catch ... finally*,
but guarantees to release/close the used resource. --
```scala def bufferedReader(fileName: String): BufferedReader = new BufferedReader(new FileReader(fileName)) def readLines(reader: BufferedReader): Seq[String] = ??? // some impl def tryLines(fileName: String): Try[Seq[String]] = Using(bufferedReader(fileName)) { reader => readLines(reader) } def catFile(fileName: String): Unit = tryLines(fileName) match { case Failure(exception) => exception.toString pipe println case Success(lines) => lines foreach println } catFile("README.md") ``` --- ## *scala.util.Using.resource*
returns an *A*, not a *Try[A]* -- ```scala package scala.util object Using { // simplified def apply[R, A](resource: => R)(f: R => A): Try[A] def resource[R, A](resource: => R)(f: R => A): A ... } ``` --
```scala def bufferedReader(fileName: String): BufferedReader = ??? def readLines(reader: BufferedReader): Seq[String] = ??? def lines(fileName: String): Seq[String] = Using.resource(bufferedReader(fileName))(readLines) def catFile2(fileName: String): Unit = { // might throw an exception lines(fileName) foreach println } catFile2("README.md") ``` --- ## Backport to 2.12: *Using*
```scala package compat213 import scala.util.Try import scala.language.reflectiveCalls object Using { type Closable = { def close(): Unit } def apply[A, R <: Closable](resrc: R)(use: R => A): Try[A] = Try(resource(resrc)(use)) def resource[A, R <: Closable](resrc: R)(use: R => A): A = try { use(resrc) } finally { resrc.close() } } ``` --
This impl is a bit simplistic, but should work for resources which provide a method *close*. ---
## s-Interpolator in Pattern matches
```scala val dateString = "11-June-2019" val s"$day-$month-$year" = dateString year pipe println month pipe println day pipe println ``` --- ## Named Product Elements ### *Product*s (i.e. case classes and Tuples) now have methods *productElementNames* and *productElementName*. --
```scala sealed trait Gender extends Product with Serializable case object Male extends Gender case object Female extends Gender case class Person(name: String, age: Int, gender: Gender, email: String) { def tupled: (String, Int, Gender, String) = Person.unapply(this).get } val johndoe = Person("John Doe", 42, Male<EMAIL_ADDRESS>``` --
```scala johndoe.productElementNames foreach println johndoe.productElementName(0) pipe (name => print(s"$name: ")) johndoe.productElement(0) pipe println johndoe.productElementName(1) pipe (name => print(s"$name: ")) johndoe.productElement(1) pipe println ``` --- ## Named Product Elements
### Naive JSON Serialization ```scala def pairToJson(name: String, value: Any): String = s"""{ "$name": $value }""" def productElementToJson(p: Product, index: Int): String = pairToJson(p.productElementName(index), p.productElement(index)) def productToJson(product: Product): String = (0 until product.productArity) .toList .map { index => productElementToJson(product, index) } .mkString("{ ", ", ", " }") implicit class ProductOps(private val product: Product) { def toJsonString: String = productToJson(product) } johndoe.toJsonString pipe println // { { "name": John Doe }, { "age": 42 }, { "gender": Male }, { "email"<EMAIL_ADDRESS>} } johndoe.tupled.toJsonString pipe println // { { "_1": John Doe }, { "_2": 42 }, { "_3": Male }, { "_4"<EMAIL_ADDRESS>} } ``` --- class: middle, center name: concurrency_future # 4. Concurrency / Future
---
## *Future* + *ExecutionContext* Changes Overview
- API nearly unchanged - Massive performance improvements under the hood (*Future*, *Promise*, *ExecutionContext*) - Improved handling of failures (*InterruptedException, RejectedExecutionException*) - Made the global *ExecutionContext* “batched” - Added synchronous ("parasitic") *ExecutionContext* (releases you from writing your own synchronous *ExecutionContext*) .footnote[ For more details on the internals of the improved implementation see Viktor Klang's talk at Scala Days 2019: Making Our Future Better ] .footnote2[ https://www.youtube.com/watch?v=5FTJUUoT6y4 ] ---
## *Future* : Minor API Changes
- *removed *onSuccess* and *onFailure* (already deprecated in 2.12) - *Future.delegate* - new factory method ---
## *Future.delegate*
```scala object Future { def apply[T](body: => T)(implicit executor: ExecutionContext): Future[T] def delegate[T](body: => Future[T])(implicit executor: ExecutionContext): Future[T] ... } ``` --
The following expressions are semantically equivalent: ```scala def expr[T]: Future[T] = ??? val f1 = Future.delegate(expr) val f2 = Future.apply(expr).flatten val f3 = Future.unit.flatMap(_ => expr) ``` ---
## *Future.delegate* - Example
```scala import scala.concurrent._ import scala.concurrent.duration._ import scala.util.chaining._ implicit lazy val ec: ExecutionContext = ExecutionContext.global def plus17(x: Int): Int = x + 17 def squaredAsync(value: Int) = Future { value * value } val f1: Future[Int] = Future.apply { squaredAsync(5) }.flatten map plus17 val f2: Future[Int] = Future.unit.flatMap { _ => squaredAsync(5) } map plus17 val f3: Future[Int] = Future.delegate { squaredAsync(5) } map plus17 Await.result(f1, 3.seconds) pipe println //=> 42 Await.result(f2, 3.seconds) pipe println //=> 42 Await.result(f3, 3.seconds) pipe println //=> 42 ``` --- class: middle, center name: language_changes # 5. Language Changes
--- ## Language Changes Overview - Literal types: Literals (for strings, integers etc.) now have associated literal types. - Partial unification: enabled by default - By-name implicit parameters: enable implicit search to construct recursive values. - Underscores in numeric literals - Procedure syntax deprecated:
Deprecated: *def m() { ... }* Use instead: *def m(): Unit = { ... }* - View bounds deprecated:
Deprecated: *A <% B* Use instead: *(implicit ev: A => B)* - Symbol literals deprecated:
Deprecated: *'foo* Use instead: *Symbol("foo")* - New Tuple2 arrow syntax in pattern match:
2.12 and 2.13: *case (x, y) => ...*
2.13 only : *case x -> y => ...* ---
## Underscores in Number Literals
```scala val int0: Int = 1000000 val int1: Int = 1_000_000 val int2: Int = 1_0_0_0_0_0_0 // val int3: Int = 1_0_0_0_0_0_0_ // compile error: trailing separator is not allowed val long: Long = 1_000_000_000L val float: Float = 1_000.99f val double: Double = 1_000_000.999_999 ``` --- ## Partial unification
- Partial unification is enabled by default in 2.13. - The compiler no longer accepts *-Ypartial-unification*. - The following code compiles in 2.12 only with *-Ypartial-unification*. --
```scala // import scala.language.higherKinds // redundant since 2.13.1 def foo[F[_], A](fa: F[A]): String = fa.toString val either: Either[String, Int] = Right(42).withLeft[String] foo { either } val intToInt: Function1[Int, Int] = x => x * 2 foo { intToInt } ``` --
Detailed explanation of partial unification here:
https://gist.github.com/djspiewak/7a81a395c461fd3a09a6941d4cd040f2 ---
### *scalacOptions* in *build.sbt* for cross compilation
```scala scalacOptions ++= { CrossVersion.partialVersion(scalaVersion.value) match { case Some((2, minor)) if minor >= 13 => Seq.empty case _ => Seq( "-Ypartial-unification", // (removed in scala 2.13) allow the Compiler to // unify type constructors of different arities "-language:higherKinds" // (not required since scala 2.13.1) suppress // warnings when using higher kinded types ) } } ``` ---
## Literal Types
- Literals (for strings, integers etc.) now have associated literal types. - The compiler will provide instances of a new typeclass *scala.ValueOf\[T]* for all singleton types *T*. - The value of a singleton type can be accessed by calling method *valueOf[T]*. --
```scala val wahr: true = true val foo: "foo" = "foo" val one: 1 = 1 val other_one: one.type = one implicitly[other_one.type =:= 1] val x1: Int = valueOf[42] // valueOf[42] yields an Int and is the same as ... val x2: Int = new scala.ValueOf(42).value ``` ---
## By-name Implicit Parameters
- were not allowed in 2.12. - They enable implicit search to construct recursive values. - The following code will not compile
if you remove the *=>* in *(implicit rec: => Foo)* . --
```scala trait Foo { def next: Foo } object Foo { // wouldn't compile, if rec were a call by value parameter // remove the => and try to compile ... implicit def foo(implicit rec: => Foo): Foo = new Foo { def next = rec } } val foo = implicitly[Foo] assert(foo eq foo.next) ``` --- class: middle, center name: collections # 6. Collections
---
## Principles of the Collections Redesign
-
simplicity
- better error messages - easier to implement your own collection (but still complex) -
performance
-
type safety
, better
type inference
-
smaller footprint
: parallel collections moved to a module of it's own, etc. -
source code compatibility
- as much as possible
Most ordinary code that used the old collections will continue to work as-is. But of course ... there are
breaking changes
. ---
## Simpler Method Signatures
- No more *CanBuildFrom* - Without *CanBuildFrom* method signatures became much simpler. -- ### *List#map* in 2.12 ```scala trait List[+A] extends ... { def map[B, That](f: A => B)(implicit bf: CanBuildFrom[List[A], B, That]): That = ??? } ``` ### *List#map* in 2.13 ```scala trait List[+A] extends ... { def map[B](f: A => B): List[B] = ??? } ``` ---
## Simpler Type Hierarchy
- No more *Traversable* and *TraversableOnce*. - They remain only as deprecated aliases for *Iterable* and *IterableOnce*.
- Parallel collections are now a separate module. - As a result, *GenSeq*, *GenTraversableOnce*, et al. are gone. ---
## New, Faster HashMap/Set Implementations
- Both immutable and mutable versions were completely replaced. - They substantially outperform the old implementations in most scenarios. - The mutable versions now perform on par with the Java standard library's implementations. ---
## Immutable *scala.Seq* and *scala.IndexedSeq*
- *Seq* is now an alias for *collection.immutable.Seq*. - Before, it was an alias for the possibly-mutable *collection.Seq*. - *IndexedSeq* is now an alias for *collection.immutable.IndexedSeq*. - Before, it was an alias for the possibly-mutable *collection.IndexedSeq*. - This also changes the type of varargs in methods and pattern matches. - Arrays passed as varargs are defensively copied. ---
## *Seq* is immutable in 2.13 (not in 2.12)
```scala trait Order trait Food def orderFood(order: Seq[Order]): Seq[Food] = { Seq(new Food{}) } ``` --
### Passing a mutable *ArrayBuffer* ... ```scala // We can NOT pass a mutable ArrayBuffer where an immutable Seq is expected. val food1 = orderFood(ArrayBuffer(new Order{})) // DOES NOT COMPILE! // [error] found : scala.collection.mutable.ArrayBuffer[Order] // [error] required: Seq[Order] ``` ---
### Passing a mutable *Array* ...
We can pass a mutable *Array* where an immutable *Seq* is expected.
*Array* (unlike *ArrayBuffer*) is implicitly converted (and copied).
But the compiler spits out a warning. ```scala val orderArray = Array(new Order {}) val food2 = orderFood(orderArray) // COMPILES WITH WARNING! // [warn] Implicit conversions from Array to immutable.IndexedSeq // [warn] are implemented by copying; Use the more efficient non-copying // [warn] ArraySeq.unsafeWrapArray or an explicit toIndexedSeq call. ``` --
*toSeq* (or *toIndexedSeq*) wraps the mutable *Array* in an immutable *Seq*. ```scala val food3 = orderFood(orderArray.toSeq) // COMPILES! val food4 = orderFood(orderArray.toIndexedSeq) // COMPILES! ``` ---
### Passing a immutable *ArraySeq* ...
- *ArraySeq* is a new collection of Scala 2.13. - *ArraySeq* is an immutable array with efficient indexed access and a small memory footprint. - *mutable.ArraySeq* is also available in the new collections library. - For Scala 2.12 an *ArraySeq* backport is provided in the *scala-collection-compat* library. - *ArraySeq.unsafeWrapArray* wraps an *Array* in an *ArraySeq*.
```scala val food5 = orderFood(ArraySeq(new Order{})) val food6 = orderFood(ArraySeq.unsafeWrapArray(Array(new Order{}))) ``` ---
## Cross-compiling *Seq* for 2.12 and 2.13
### Seq Recap - *scala.collection.Seq* is a base class for *scala.collection.immutable.Seq* and *scala.collection.mutable.Seq* in Scala 2.12 and 2.13. - *scala.Seq* is an alias for *scala.collection.Seq* in Scala 2.12. - *scala.Seq* is an alias for *scala.collection.immutable.Seq* in Scala 2.13. --
To make your 2.12 code cross-compilable for 2.12 and 2.13 you have ### 3 Options described below ... --- ## Cross-compiling *Seq* (1st option)
### Explicitly use *scala.collection.Seq* in method parameters and return types. ```scala import scala.collection def orderFood(order: collection.Seq[Order]): collection.Seq[Food] = ??? ``` --
- You don't force your code into immutable semantics. - *orderFood* accepts mutable and immutable *Seq*s. - mutability / immutability is unspecified for the return type. - Caller must call *.toSeq* if she only needs an immutable result. (*.toSeq* only copies elements if the result is not yet immutable.) ### Simplest migration strategy! ### No changes at the call site! --- ## Cross-compiling *Seq* (2nd option)
### Explicitly use *scala.collection.Seq* in parameters and *scala.collection.immutable.Seq* in return types. ```scala import scala.collection import scala.collection.immutable def orderFood(order: collection.Seq[Order]): immutable.Seq[Food] = ??? ``` --
- You force your code into immutable semantics only for return types. - *orderFood* accepts mutable and immutable *Seq*s. - immutability is fixed for the return type. ### Still simple migration strategy! ### Mostly no changes at the call site! --- ## Cross-compiling *Seq* (3rd option)
### Use *scala.immutable.collection.Seq* in method parameters and return types. ```scala import scala.collection.immutable def orderFood(order: immutable.Seq[Order]): immutable.Seq[Food] = ??? ``` --
- You force your code into immutable semantics. - *orderFood* accepts only immutable *Seq*s. - immutability is also fixed for the return type. ### Possibly many changes at the call site to make the arguments immutable! ### Use Scalafix to automate this rewrite for a large code base. ---
## Simplified Views that Work
- Views have been vastly simplified and should now work reliably. - *scala.collection.View* has two sub classes: *scala.collection.SeqView* and *scala.collection.MapView* - Views are lazy. They record the operations (like *filter*, *map* etc.) and do not execute them before invoking a terminal operation (*foreach*, *toSeq*, *toMap* etc.). --- ## *Map#mapValues* and *Map#filterKeys* - *Map#mapValues* and *Map#filterKeys* in 2.13 return *MapView*, not *Map*. - These methods are also deprecated. - Prefer using *MapView#mapValues* and *MapView#filterKeys* -- ```scala val kvs = Map("one" -> 1, "two" -> 2, "three" -> 3) def flip[A, B](t: (A, B)): (B, A) = t match { case (fst, snd) => (snd, fst) } val kvsFlipped: Map[Int, String] = kvs.toList.map(flip).toMap ``` .left-column-50[ ### Scala 2.12 ```scala val mappedValues: Map[String, Int] = kvs.mapValues(_ + 10) val keysFiltered: Map[Int, String] = kvsFlipped.filterKeys(_ %2 != 0) ``` ] .right-column-50[ ### Scala 2.13 ```scala val mapView: MapView[String, Int] = kvs.view.mapValues(_ + 10) val mappedValues: Map[String, Int] = mapView.toMap val mapView2: MapView[Int, String] = kvsFlipped.view.filterKeys(_ %2 != 0) val keysFiltered: Map[Int, String] = mapView2.toMap ``` ] --- ## *LazyList* replaces *Stream*
- *Stream* is lazy in it's tail, but eager in it's head.  - *Stream* is deprecated in 2.13.
.left-column-50[ ### Scala 2.12 ```scala val stream: Stream[(Int, Int)] = Stream .continually(42) .take(10) .zipWithIndex .map { case (value, index) => index -> value } ``` ] .right-column-50[ ### Scala 2.13 ```scala val ll: LazyList[(Int, Int)] = LazyList .continually(42) .take(10) .zipWithIndex .map { case value -> index => index -> value } ``` ] --- ## New Abtract and Concrete Collections
- *immutable.LazyList* replaces *immutable.Stream*. - *immutable.ArraySeq* is an immutable wrapper for an array; there is also a mutable version. - *mutable.CollisionProofHashMap* guards against denial-of-service attacks. - *mutable.ArrayDeque* is a double-ended queue that internally uses a resizable circular buffer. - *mutable.Stack* was reimplemented (and undeprecated), *immutable.Stack* was removed. - *immutable.SeqMap* (abstract) provides immutable maps which maintain insertion order. - Implementations: *VectorMap* and *TreeSeqMap* (in addition to the already existing *ListMap*) --- ## *Coll#to* converts one collection to another one.
- *Coll#to* in 2.12 received the target type in square brackets. - *Coll#to* in 2.13 receives the target type's companion in parens. - The *scala-collection-compat* library provides the new behaviour in 2.12.
```scala val map = Map("one" -> 1, "two" -> 2, "three" -> 3) ``` .left-column-50[ ### Scala 2.12 ```scala val l1 = map.toList val l2 = map.to[List] import scala.collection.compat._ val l3 = map.to(List) ``` ] .right-column-50[ ### Scala 2.13 ```scala val l1 = map.toList val l2 = map.to(List) // ``` ] ---
## Added *.lengthIs / .sizeIs* and *.sizeCompare*
- Allow fluent size comparisons without traversing the whole collection. --
```scala val xs = List.fill(5000)(scala.util.Random.nextInt) // lenghtIs or sizeIs traverse no more than 101 element if (xs.lengthIs > 100) { new IllegalArgumentException("Too many elements!") pipe println } else { s"The list has ${xs.length} elements." pipe println } ``` ---
## New *.tapEach* method for side-effects
- Allows inserting side-effects in a chain of method calls on a collection or view. --
```scala val doubledAndSquared = List(1, 2, 3) .tapEach(x => println(s"value: $x")) .map(x => x * 2) .tapEach(x => println(s"doubled: $x")) .map(x => x * x) .tapEach(x => println(s"squared: $x")) ``` ---
## New method *List.unfold* or *Iterator.unfold*
- This allows constructing a collection or iterator from an initial element and a repeated *Option*-returning operation, terminating on *None*. - This was added to collection companion objects and to *Iterator*. --
```scala val unfoldFunction: Int => Option[(Int, Int)] = { case 0 => None case s => Some(((s * s), (s - 1))) } List.unfold(10)(unfoldFunction) pipe println //=> List(100, 81, 64, 49, 36, 25, 16, 9, 4, 1) ``` ---
## Read Lines with *Iterator.unfold*
```scala def bufferedReader(fileName: String) = new BufferedReader(new FileReader(fileName)) def readLines(reader: BufferedReader) = Iterator.unfold(())(_ => Option(reader.readLine()).map(_ -> ())).toList def readLines_dissected(reader: BufferedReader): List[String] = { val initialState: Unit = () val iterator: Iterator[String] = Iterator.unfold(initialState) { _ => val maybeLine: Option[String] = Option(reader.readLine()) val maybeLineState: Option[(String, Unit)] = maybeLine.map(_ -> ()) maybeLineState } iterator.toList } val lines: Seq[String] = Using.resource(bufferedReader("README.md"))(readLines) lines foreach println ``` ---
## Backport to 2.12: *List.unfold*
```scala def unfoldToStream[A, B](init: A)(f: A => Option[(B, A)]): Stream[B] = f(init) .map { case (b, a) => b #:: unfoldToStream(a)(f) } .getOrElse(Stream.empty) def unfoldToList[A, B](init: A)(f: A => Option[(B, A)]): List[B] = unfoldToStream(init)(f).toList implicit class ListCompanionOps(private val self: List.type) extends AnyVal { @inline def unfold[A, B](init: A)(f: A => Option[(B, A)]): List[B] = unfoldToList(init)(f) } ``` --- ## Removed *collection.breakOut* - *collection.breakOut* in 2.12 inferred the return type of a collection operation from the expected result type. - It was based on *CanBuildFrom* which is gone in 2.13. - To avoid constructing intermediate collections, use *.view* and *.to(Collection)* instead. -- ```scala val list = List(1, 2, 3) tap println val toPair: Int => (Int, Int) = x => x -> x ``` ```scala // Scala 2.12 - type annotations required to infer the result type of list.map val indexedSeq = list.map(toPair)(collection.breakOut) val array : Array[(Int, Int)] = list.map(toPair)(collection.breakOut) val seq : Seq[(Int, Int)] = list.map(toPair)(collection.breakOut) val set : Set[(Int, Int)] = list.map(toPair)(collection.breakOut) val map : Map[Int, Int] = list.map(toPair)(collection.breakOut) ``` ```scala // Scala 2.13 - type annotations not required val list2 = list.view.map(toPair).to(List) val array = list.view.map(toPair).to(Array) val seq = list.view.map(toPair).to(Seq) val set = list.view.map(toPair).to(Set) val map = list.view.map(toPair).to(Map) ``` ---
## Two overloaded *Map#map* operations! Why ???
```scala def map[K2, V2](f: ((K, V)) => (K2, V2)): Map[K2, V2] ``` ```scala def map[B](f: ((K, V)) => B): Iterable[B] ``` --
- If the mapping function *f* transforms a key value pair *(K, V)* into another key value pair *(K2, V2)*, *map* returns a *Map[K2, V2]*. - OTOH if the mapping function *f* transforms a key value pair *(K, V)* into some other value *B*, *map* returns a *Iterable[B]*. - Roughly the same holds for the two *Map#flatMap* operations. - To understand this we have to take a glimpse into the collections' architecture. --- class: middle, center name: architecture_collections # 7. Architecture of Collections
.footnote[ See also: ] .footnote2[ https://docs.scala-lang.org/overviews/core/architecture-of-scala-213-collections.html ] --- ## Problem to solve ### Define the return type of a collection operation in a generic way? - This is not a problem for operations, which do not return a collection, but a single value like *isEmpty*, *length*, *find*, *foldLeft*, *sum*, *exists*, *forall* etc. - This is difficult for operations that return a collection like *filter*, *take*, *drop*, *map*, *flatMap*, *flatten* etc. --
A Non-solution with simple inheritance: ```scala trait Iterable[A] { def filter(f: A => Boolean): Iterable[A] def map[B](f: A => B): Iterable[B] } ``` ```scala trait List[A] extends Iterable[A] { ... } trait Vector[A] extends Iterable[A] { ... } ``` The inherited methods would return an *Iterable*, not a *List* or *Vector*. ---
## What we need ... ```scala trait List[A] extends MagicBaseTrait[???, ???, ???] { def filter(f: A => Boolean): List[A] def map[B](f: A => B): List[B] } trait Vector[A] extends MagicBaseTrait[???, ???, ???] { def filter(f: A => Boolean): Vector[A] def map[B](f: A => B): Vector[B] } trait Map[K, V] extends MagicBaseTrait[???, ???, ???] { def filter(f: (K, V) => Boolean): List[A] def map[K2, V2](f: (K, V) => (K2, V2)): Map[K2, V2] def map[B](f: (K, V) => B): Iterable[B] } ``` ... without being forced to reimplement the operations in every collection. -- ### In the old collection implementation (up to 2.12) this problem has been solved with *CanBuildFrom*. ---
## Selections and Transformations
-
Selection operations
(*filter*, *take*, *drop* etc.) do not change the elements. - The target type of the operation is exactly the same as the source type,
e.g. *filter* on a *List[A]* returns a *List[A]*. - We must abstract over the source collection type (*List[A]*) in this case) to generalize this. -
Transformation operations
(*map*, *flatMap* etc.) do change the elements and in some cases (*Map* and some others) also the collection type. - The target type of the operation must be derived from the type constructor of the required result collection type. --- ## *IterableOps*
```scala trait IterableOps[+A, +CC[_], +C] { def filter(p: A => Boolean): C = ??? def map[B](f: A => B): CC[B] = ??? } ``` ```scala trait List[+A] extends Iterable[A] with IterableOps[A, List, List[A]] {...} trait Vector[+A] extends Iterable[A] with IterableOps[A, Vector, Vector[A]] {...} ``` -- - *IterableOps* is the MagicBaseTrait we are looking for. - *IterableOps* is called a template trait. - *IterableOps* has 3 type parameters, one for the element type (*A*), one for the collection type (*C*) and one for the collection's type constructor type (*CC*). - Leaf collection types with one type parameter (*List*, *Vector*) extend *IterableOps*. - This does not work for collections like *Map* with two type parameters. --- ## *MapOps*
```scala trait MapOps[K, +V, +CC[_, _], +C] extends IterableOps[(K, V), Iterable, C] { def map[K2, V2](f: ((K, V)) => (K2, V2)): CC[K2, V2] = ??? } ``` ```scala trait Map[K, V] extends Iterable[(K, V)] with MapOps[K, V, Map, Map[K, V]] ``` --
- *MapOps* extends *IterableOps* and hence inherits all its operations. - *MapOps* instantiates the collection's type constructor *CC* with *Iterable*. - *MapOps* inherits a *map* operation from *IterableOps* returning *Iterable[B]*. - *MapOps* defines another *map* operation overload returning *Map[K2, V2]*. - *Map* inherits both *map* operations. --- ## Which *map* is chosen ... ... when you invoke *Map#map* at the call site?
```scala // from IterableOps def map[B](f: ((K, V)) => B): Iterable[B] // from MapOps def map[K2, V2](f: ((K, V)) => (K2, V2)): Map[K2, V2] ```
- *map* from *MapOps* is more specific by the rules of overloading resolution. - It will be chosen, if the *map* operation returns a pair of values. - Otherwise the operation from *IterableOps* applies. --
“same-result-type” principle
:
Wherever possible a transformation method on a collection
yields a collection of the same type. --- class: middle, center name: migration # 8. Migration
.footnote[ See also: ] .footnote2[ https://docs.scala-lang.org/overviews/core/collections-migration-213.html ] ---
## When to Migrate?
- ### when all *libraryDependencies* are availabe for 2.13. - ### when all transitive dependencies are availabe for 2.13. --- #### Scala 2.13 Library support (2019-09-19)
Library
Since
Current
scalatest
3.0.8
3.0.8
scalacheck
???
1.14.1-RC1
specs2
4.6.0
4.7.1
akka-*
2.5.23
2.5.25
akka-http
10.1.8
10.1.9
play
2.7.3
2.7.3
slick
3.3.2
3.3.2
lagom
???
1.6.0-M5
kind-projector
0.10.3
0.10.3
shapeless
2.3.3
2.3.3
cats
2.0.0
2.0.0
cats-effect
2.0.0
2.0.0
fs2
2.0.0
2.0.0
http4s
???
0.21.0-M4
circe
0.12.0
0.12.1
scalaz
7.2.27
7.2.28
zio
???
1.0.0-RC12-1
apache-spark
???
2.4.4 (only for 2.13)
---
## Before You Migrate ...
- Upgrade your project to the latest 2.12.x version. - Remove all deprecation warnings. Turn warnings into errors: *scalacOptions += -Xfatal-warnings* - Scalafix them if there are many. (Turn off *-Xfatal-warnings* while running scalafix. This option let's scalafix fail.) - Upgrade your sbt *libraryDependencies* to versions which are available in both binary versions: 2.12 and 2.13. ---
## Migrate an Application to 2.13
(This project **must not cross compile**.)
- Use *scalafix* to automate as much as possible! - Rewrite the rest by hand. - Use new features of 2.13. - You loose backward compatibility to 2.12. ---
## Migrate a Library to a Cross Compatible Version
(This project **must cross compile**.)
- Keep source compatibility as much as possible without using the new features of 2.13. - Use version specific source folders: *src/main/scala-2.12* and *src/main/scala-2.13* - Use *scala-collection-compat* library which backports many parts of the collection API to 2.12. - Use *scalafix* to automate as much as possible! - Rewrite the rest by hand. ---
## Migration Automation with Scalafix (Setup)
-- Add scalafix plugin ```scala // project/plugins.sbt addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.7") ``` -- Change *build.sbt* ```scala // build.sbt scalafixDependencies += "org.scala-lang.modules" %% "scala-collection-migrations" % "2.1.2" // scala-collection-compat needed only for cross compilation libraryDependencies += "org.scala-lang.modules" %% "scala-collection-compat" % "2.1.2" scalacOptions -= "-Xfatal-warnings" // let's scalafix fail scalacOptions ++= List("-Yrangepos", "-P:semanticdb:synthetics:on") ``` ---
## Migration Automation with Scalafix (Run)
Run scalafix in sbt shell (for upgrade to 2.13) ```scala > ;test:scalafix Collection213Upgrade ;scalafix Collection213Upgrade ``` Run scalafix in sbt shell (for cross compilation with 2.12 and 2.13) ```scala > ;test:scalafix Collection213CrossCompat ;scalafix Collection213CrossCompat ``` .footnote[ Scala 2.13 Collection Compatibility Library and Migration Tool: ] .footnote2[ https://github.com/scala/scala-collection-compat ] --- class: middle, center name: resources # 21. Resources
--- ## Resources - Code and Slides of this Talk:
https://github.com/hermannhueck/new-in-scala213 - Official Release Description
https://github.com/scala/scala/releases/tag/v2.13.0 - Making Our Future Better
Viktor Klang's talk at Scala Days 2019
https://www.youtube.com/watch?v=5FTJUUoT6y4 --- ## Scala 2.13 Collection Related Links - Implementing the Scala 2.13 collections
Stefan Zeiger's talk at Scala Days 2019 in Lausanne
https://www.youtube.com/watch?v=L1lxZ1LBuGI - The Architecture of Scala 2.13's Collections
https://docs.scala-lang.org/overviews/core/architecture-of-scala-213-collections.html - Migrating a project to Scala 2.13's Collections
https://docs.scala-lang.org/overviews/core/collections-migration-213.html - Scala 2.13 Collection Compatibility Library
https://github.com/scala/scala-collection-compat - Let them be Lazy
Julien Richard Foy's blog on the lazy collection (Views and LazyList)
https://www.scala-lang.org/blog/2017/11/28/view-based-collections.html - Scala 2.13's Collections Rework
Stefan Zeiger's blog on the collections rework
https://www.scala-lang.org/blog/2017/02/28/collections-rework.html --- class: middle, center # Thank You
# Q & A
https://github.com/hermannhueck/new-in-scala213


- 5 c. Mochiko rice flour
- 2 c. water
- 1 box brown sugar
- 1 can coconut milk
- 1 tsp. baking soda
- 1/4 can sweet red beans (optional)
- Sesame seeds, toasted
- Ti leaves
This is my grandmother's original version of Chinese Nian Gao, a dessert traditionally served for Chinese New Years. While gao is usually steamed, this is her recipe for a baked version, and it also uses Hawaiian Ti leaves to line the pan and add flavor.


Home
About
Welcome!
My (User)Name Is DLWAwesome
I like pi and (pumpkin) pie
I wass born in 2099, but traveled back in time.


A game can be removed from Count It by selecting it from the main window and then selecting "Game" > "Remove Game" from the main menu. Alternatively, right-click the game from the main window and select "Remove Game".
Note: If you have any recordings saved for a game, they will be deleted when the game is removed from Count It.


There was a problem with granting access to the Gmail API. Please create new credentials and try again.
=$value?>


The International Image Interoperability Framework® (IIIF, pronounced “Triple-Eye-Eff”) describes an API to ask for images thumbnails, sub regions, etc. Here is an implementation of that API powered by Go and libvips.
If you have any questions, ping me.
Pick an existing picture:
or Image (Public URL):
Show


GET IN TOUCH
Use the form below to drop us an e-mail. Old-fashioned phone calls work too ~<PHONE_NUMBER>4
GIVE US A CALL
You’re not going to hit a ridiculously long phone menu when you call us. Your email isn’t going to the inbox abyss, never to be seen or heard from again. At The Webplant, we provide the exceptional service we’d want to experience ourselves!


John Hernandez
I am studying better code @Microverse. My passions are web development, mob programming, and being a husband and father. See my works below and @connect with me.
Be a Ninja [A person with perserverance, patience, and skill]
My Portfolio
GET IN TOUCH
- Managua, Nicaragua
- +505 7880-8479
- john at writecode.ninja


{% extends "layouts/base.html" %} {% block title %} Customers {% endblock %} {% block stylesheets %}{% endblock stylesheets %} {% block content %} Customer Analytics Overall Customers Filters Dimension selection {% for d in filters['dimensions'] %} {% if d == 'There is no available report. Please execute Schedule Data Process' %} {{ d }} {% endif %} {% if d != 'There is no available report. Please execute Schedule Data Process' %} {{ d }} {% endif %} {% endfor %} Apply Infos Payment Amount Distribution X Axis is the purchase amount values with bins. Y Axis is number of Unique Customer count related to their average purchase amounts. This Distribution allows us the see how much customers are willing to pay for a purchase. Total Number Customer Breakdown with Purchased Order Count X Axis is Order Counts staring with 1. Y Axis is number of Unique Customer count related to their order counts. This Distribution allows us the see overall potential of your business. RFM X Axis represents 'recency'. Y Axis represents 'monetary'. Z Axis represents 'frequency'. Recency metric is a time difference between customers of last purchase transaction date to recent date. Monetary metric is average purchase amount per customer. Frequency metric is average time difference per between purchase date of each order per customer. There is a colored dots. These are represents the segmented customers according to their RFM values. Download to First Order Cohort If there isn`t any downloaded date, you may assign any date which is related to customers of first event with your business. This cohort of date column represent download date. If it is Weekly Cohort it will represent the mondays of each week. Otherwise it will represent days. Each Numeric column from 0 to 15 are the day differences after the downloaded date. For instance, if date columns is 2021-05-06, and numeric column is 10 and value is 100, this refers that there are 100 customers who have downloads in 2021-05-06 and have first orders 10 days later. Daily Funnel X Axis represents days that are stored in ElasticSearch. Y Axis represents number of transactions such as order count, session count, add product the basket transaction count per day. In order to show actions such as add product the basket transaction count except order count, session count, these actions must be added to actions label while creating Sessions data source (For more information pls. check Create Data Source - Sessions & Customers) Payment Amount Distribution {% if data_type['purchase_amount_distribution'] == False %} sample data {% endif %} Total Number Customer Breakdown with Purchased Order Count {% if data_type['user_counts_per_order_seq'] == False %} sample data {% endif %} RFM {% if data_type['rfm'] == False %} sample data {% endif %} CLV Prediction - Daily {% if data_type['daily_clv'] == False %} sample data {% endif %} Download to First Order Cohorts {% if data_type['weekly_cohort_downloads'] == False %} sample data {% endif %} Daily Funnel {% if data_type['daily_funnel'] == False %} sample data {% endif %} {% endblock content %} {% block javascripts %} {% endblock javascripts %}


With the `blockAccess: true` configurations, the user is blocked from using the website before accepting the cookie configuration.
blockAccess: true


DOJ Terrorist Attack Information
About DOJ
Publications
Press Room
Employment
Doing Business with DOJ
Grants
Fugitives and Missing Persons
Justice for Kids and Youth
Archive
Other Federal Sites
Last Updated: 04/13/04


BedArt Traditional Print Patch Work Collection 100% Cotton King Size Bed Sheets
Product Details:
- Material: 100% Cotton
- Fabric Count: 185 TC
- Bed Sheet Size: (228 cm X 275 cm) or (90 inch X 108 inch)
- Pillow Size: (43 cm X 69 cm) Or (17 inch X 27 inch)
Features:
- 100% Premium quality Cotton Bed sheet at affordable price
- This Bed sheet is soft and give smooth feel touch
- Well finished from edges, stitched from all side
- It will give your room Patch Work Traditional Print look
- Fade-resistant and wrinkle resistant
- These sheets are made of high strength 100% Cotton
- Fast and vibrant colors which will say for long
What's Included:
One (1) Bedsheet
Two (2) Standard Sized Pillowcases
Payment is accepted by Paisa Pay only. Paisa Pay is the Safest mode of Payment.
We ship anywhere in India within 2 to 3 days after receiving payment.
If you have any query feel free to contact us
on PH:-<PHONE_NUMBER> (11 AM to 8 PM)
OR
e-mail us on:-<EMAIL_ADDRESS>OR
can contact me through eBay by
" Ask Seller A Question"
Thank You.


WITNESS LIST Government Reform Committee March 11, 2003-8:30A HB 906 For: Bowles, Chris (Experio Solutions, Inc.) On: Biles, Susan (Comptroller of Public Accounts) Calem, William (Small State Agency Task Force) Henricks, Michele (Court Reporters Certification Board) Homer, Andrew (Texas Public Employees Association) Hosley, Stephen (Applied Materials) Vito, Kelli (State Auditor's Office) HB 1318 For: Bowles, Chris (Experio Solutions, Inc.) On: Biles, Susan (Comptroller of Public Accounts) Bowman, Glenna Rhea (Office of Court Administration) Homer, Andrew (Texas Public Employees Association) Vito, Kelli (State Auditor's Office) Williams, Cathy (TxDOT)


Style Guide
Forms
Forms
Standard Form
Legend
Required fields are marked
*
Text Input
*
Note about this field
Go!
Password
*
Note about this field
Email Address
*
Note about this field
Web Address
*
Note about this field
Select
*
Option One
Option Two
Option Three
Note about this selection
Checkbox
*
Choice A
Choice B
Choice C
Note about these options
Radio
*
Option 1
Option 2
Option 3
Note about these options
Textarea
*
Note about this field
Single checkbox
Note about this field
Cancel
Standard Form
Legend
Required fields are marked
*
Text Input
*
Note about this field
Password
*
Note about this field
Email Address
*
Note about this field
Web Address
*
Note about this field
Select
*
Option One
Option Two
Option Three
Note about this selection
Checkbox
*
Choice A
Choice B
Choice C
Note about these options
Radio
*
Option 1
Option 2
Option 3
Note about these options
Textarea
*
Note about this field
Single checkbox
Note about this field
Cancel


This guide will help you add a new map to the go-cart.io website. This guide assumes that you have already set up the website code for local testing and development.
To add a map, you will need the following files, information, and software:
The first step in adding a map is to prepare your data. Follow the steps at https://github.com/bbkc22113/geojson-to-csv-cartogram-web to generate a GeoJSON file and a CSV file for your map. Then, copy the GeoJSON file for the conventional map into CARTOGRAM_DATA_DIR
(the folder where the C code lives).
The first step in adding a map is to prepare your data. Follow the steps at https://github.com/bbkc22113/geojson-to-csv to generate a GeoJSON file and a CSV file for your map. Then, copy the GeoJSON file for the conventional map into CARTOGRAM_DATA_DIR
(the folder where the C code lives).
Now, you should edit the CSV file. Insert an example dataset under the 'Region Data' column, and ensure that there is a filled 'Region Abbreviation' column (you may need to create it). Do not use population for your example dataset. You will add population data for your map later in this process. A good choice for the example dataset is GDP by region.
Some region names may contain accent marks or other unicode characters. Please use only ASCII characters in your CSV file. You can see an example of a completed CSV file below:
Important: Before you finish, you should make sure that all of the region names are spelled correctly before you finish. If you notice that a region's name is misspelled, simply correct its spelling. Please note that after you initialize your map in the next step, you cannot correct spelling errors. Please double check the spelling of all the map region names before moving on to the next step.
When you're finished creating your CSV file, you should save it in CARTOGRAM_DATA_DIR
.
Before creating a new map, you should create a Git branch to contain your work. Open a Terminal window and navigate to the internal/
directory of the repository.
You should never add maps or make other changes on the default master
branch! You can confirm the branch you are currently on by running git status
.
From here on, you will be making use of the Add Map Wizard. Before you can use this wizard to initialize your new map, you must enter the Python virtual environment used by the go-cart.io website code. To do this, run
$ source ./setupenv.sh
Your command prompt should change to indicate the you are in the virtual environment:
(venv) $
Now you can run the Add Map Wizard. You will need to pick a name for your map to be used by the website code (this is different from the user-friendly name seen by website users). This name must not include spaces, hyphens, underscores, or any punctuation. Below are some example names for your reference:
Map | Code Name
United States | usa
Mainland China & Taiwan | china
Germany | germany
This code name must be unique. The Add Map Wizard will let you know if your choice of code name has already been taken.
Once you have chosen a code name, you can run the Add Map Wizard:
(venv) $ python addmap.py init your-code-name
The wizard will then ask you a series of questions about your map, and generate files needed to complete the map addition process.
(venv) $ python addmap.py init france
Welcome to the Add Map Wizard!
Enter a user friendly name for this map: France
Now I need to know where the .json and .csv files for this map are located. These files should be located in the CARTOGRAM_DATA_DIR directory. You should supply me with a path relative to CARTOGRAM_DATA_DIR.
E.G: The .json file for this map is located at CARTOGRAM_DATA_DIR/map.json. Enter "map.json".
Enter the location of the .gen file for this map: france.json
Enter the location of the .dat file for this map: france.csv
What are the regions of this map called (e.g. State, Province)? Department
What is the name of the dataset in the .dat file (e.g. GDP)? GDP
Writing handlers/france.py...
Writing static/cartdata/france/config.json...
Writing static/cartdata/france/abbreviations.json...
Writing static/cartdata/france/colors.json...
Writing static/cartdata/france/template.csv...
I will now create france.svg. You should edit this file to specify the default color and add labels for each region.
DO NOT RESIZE OR RESCALE THE CONTENTS OF THIS FILE! Accurate label placement depends on the scale calculated by this wizard.
Writing france.svg...
Writing static/cartdata/france/labels.json...
I will now create france-landarea.csv and france-population.csv. You should edit these files to specify the land area (in square kilometers) and population of each region.
DO NOT ALTER THE COLOR INFORMATION IN THESE FILES! You should specify the color for each region by editing france.svg
Writing france-landarea.csv...
Writing france-population.csv...
I will now modify web.py to add your new map. Before I do this, I will back up the current version of web.py to web.py.bak.
Backing up web.py...
Editing web.py...
All done!
If there is a problem, the wizard will print an error message, clean up, and exit. If an error occurs while the wizard is editing web.py
, and this file becomes corrupted, you will need to restore the backup manually. You can do this by running:
(venv) $ cp web.py.bak web.py
At this point, the Add Map Wizard has produced several files in the internal/
directory that you'll need to edit to complete the map addition process. First, you should edit your-map-landarea.csv
and your-map-population.csv
to add the population and land area information for each map region. You can edit these manually, using a text editor, or with a spreadsheet program like LibreOffice Calc or Microsoft Excel.
Now, by editing your-map.svg
using Inkscape, you will set the default color for each map region and add labels for the conventional map.
The go-cart.io website uses the same color scheme for all maps. The six colors you should use can be seen by going to the color scheme page on ColorBrewer. To make the coloring process easier, you should download the ColorBrewer color palette file and import it into Inkscape (you only need to do this once).
First, download the color palette file at http://colorbrewer2.org/export/gpl/Dark2_6.gpl.
If you are using Linux, you should place the downloaded Dark2_6.gpl
file into the folder ~/.config/inkscape/palettes
. Restart Inkscape.
If you are using Mac OS, you should navigate to the Applications folder. Find and right click on the Inkscape icon, and select 'Show Package Contents'. Navigate to 'Contents', 'Resources', and finally 'palettes'. You should copy the Dark2_6.gpl
file into the 'palettes' folder. Restart Inkscape.
Open your-map.svg
in Inkscape. You should see a rendered version of your conventional map, with each region shaded with a light-gray.
First, ensure that the ColorBrewer color palette is selected. To do this, click the left-pointing arrow at the bottom right corner of the Inkscape window. Then, select the 'CBqualDark2_6' palette.
The coloring process is straightforward. Left click on each region you want to color, and then left click on the color in the palette bar you want to apply to that region. Color the map as you wish while keeping in mind the following constraints:
Important: Some of your map regions may include many small polygons that are hard to spot in Inkscape. You don't have to color each one. The Add Map Wizard only requires that you color one polygon per map region (usually it is easiest if you color the largest one).
When you are done coloring each region, you should save your SVG file by going to File -> Save
.
The go-cart.io website displays labels on the conventional map, which consist of text for region abbreviations, and lines. You can use Inkscape to add these labels. Open your-map.svg
in Inkscape.
First, we'll add a text label. Click the text tool on the toolbar, left click on the map where you want to place the text label, and type the text you want to appear in the label.
After you've added the text label, go to Text -> Convert to Text
in the menubar (if you don't do this, then the text label won't be detected by the Add Map Wizard). Then, adjust the font size to 14 so that the label text appears as it would on the website. The font size of the labels in Inkscape does not affect their appearance on the website, but setting it appropriately will make it easier for you to place them correctly.
Now, go to Object -> Object Properties...
. Set the 'Label' field to gocartlabel
, and click 'Set'. This will help the Add Map Wizard find your text labels in the SVG document.
If a region is too small to contain a text label, you can place the text label outside the map (but still within the bounding box), and include a line pointing from the label to the region. Click the line tool on the toolbar. Then, left click once on the image where you want the line to start. Left click again where you want the line to end, and right click to finish.
Again, go to Object -> Object Properties...
. Set the 'Label' field to gocartlabel
, and click 'Set'.
Tip: Once you have created one text label or line, you can create additional labels or lines much quicker. Simply select a finished text label or line, and press CTRL-D
(or, right click on the text label or line and select 'Duplicate') to create a copy. You can then move around the duplicated label or line and edit its text or line path to create additional labels.
Once you have finished adding all of your labels, you should save your SVG file by going to File -> Save
.
At this point, you're now ready to finish the map addition process. Open a Terminal window and navigate to the internal/
directory of the repository. Then, run
$ source ./setupenv.sh
Your command prompt should change to indicate the you are in the virtual environment:
(venv) $
Now you can run the Add Map Wizard again:
(venv) $ python addmap.py data your-code-name
You should commit your changes to your Git branch, and push these changes to GitHub.
$ git add handlers
$ git add static
$ git commit -a -m "added map New Map Name"
$ git push origin add-my-map-name
Then, revert back to the master branch:
$ git checkout master
You should also create a pull request on GitHub to let me know that you have finished adding the new map, so I can deploy it to the website. Navigate to https://github.com/jansky/cartogram-web/compare/, select your branch, and click 'Create pull request'.


JavaScript debugging tools can help to troubleshoot issues with your Earth API application. There are a number of such tools available, some of which are listed below.
For additional help, refer to the links listed in the Other resources section.
JavaScript debuggers are invaluable in the development of your Earth Plugin application.
In addition to the applications listed below, Apple's Safari browser, Google Chrome, and Microsoft Internet Explorer 8 include JavaScript debuggers and other developer tools.
| Application | Description | Operating systems / browsers |
|---|---|---|
| Firebug | An integrated debugger for Firefox 3.x | Firefox 3.x on Windows and OS X |
| Firebug Lite | A script to place the Firebug console in your web page | All browsers / operating systems |
| Microsoft Script Editor | Included with Microsoft Office 2000+. Activate it from IE's View > Script Debugger. You may need to deselect Disable Script Debugging from IE's Tools > Internet Options > Advanced menu. |
Internet Explorer on Windows |
| Microsoft Script Debugger | A free, lightweight script debugger. Once installed, activate it from IE's View > Script Debugger. You may need to deselect Disable Script Debugging from IE's Tools > Internet Options > Advanced menu. |
Internet Explorer on Windows |
| Venkman | The code name for Mozilla's JavaScript Debugger. An add-on for Firefox. | Firefox 3.x on Windows and OS X |
There are plenty of JavaScript debugging resources available on the web.


%include templates/parts/head.html
%include templates/parts/navBar.htmlWhen possible we will release solutions alongside the problems. This resource will much much more useful for you if you work on the problems as if they were exam problems and only look at the solutions when you are finished.
Official Practice Exam
Approximately the same difficulty and length as the final.
Written by TA Casey Haaland
Some of these problems are quite hard.


{% extends "withoutnav_template.html" %} {% from "components/sub-navigation.html" import sub_navigation %} {% block per_page_title %} Using Notify {% endblock %} {% block maincolumn_content %}
The information on this page has moved.
Find out more about:


React Router Examples
Animations
Async Data
Auth Flow
Data Flow
Dynamic Segments
Master Detail
Partial App Loading
Query Params
Reactive Extensions
Shared Root
Sidebar
Simple Master Detail
Transitions


Wanted Pages
This is a list of pages that are linked to by other pages in this wiki, but which don't exist.
{%if wanted_pages%}-
{%for p in wanted_pages%}
- {{p.title}} {%if p.wanted_by%} (wanted by {{p.wanted_by.title}}) {%endif%} {%endfor%}
No wanted pages!
{%endif%}


Experimental
The information below is written for an experimental feature. Reach out to Armory if you are interested in using this! Your feedback will help shape the development of this feature.
Do not use this experimental feature in a production instance of Spinnaker.


Meet the Cliqur team - a highly driven group with a shared passion for changing up the education scene
Cliqur started out as a project for a hackathon at Princeton University. The original intention of building this platform was inspired from our own experiences. We as student understand how difficult it is communicate with the professor when there's more than thirty people sitting in the room, let alone 100+. We built the foundation of Cliqur on this central problem, and it has grown ever since.
We wanted to elimate the need for iClickers, which are used in schools all across the world. These days, everyone has access to either a laptop, tablet or smartphone practically all the time, which we used to our advantage. We redefined the clicker into something sleek , efficient and convenient, while also providing countless more features which can streamline the communication process.
Cliqur allows instructors to create virtual sessions and invite students to participate by joining with a session ID. Students are able to ask questions, input multiple choice responses and visualize the results of the classroom performance. On the other hand, instructors can take advantage of our neat attendance verification system, which lets the instructors print out a pre-formatted attendance sheet with accurate record of attendance for that session.
Since it's creation, our team has been driven to make Cliqur into what we know it can be. Stay tuned for many new features and thanks for stopping by!
- The Cliqur Team ☺


factory_pipeline_r.Rd
Prepare and fit a text classification pipeline with
Scikit-learn
.
factory_pipeline_r( x, y, tknz = "spacy", ordinal = FALSE, metric = "class_balance_accuracy_score", cv = 5, n_iter = 2, n_jobs = 1, verbose = 3, learners = c("SGDClassifier", "RidgeClassifier", "Perceptron", "PassiveAggressiveClassifier", "BernoulliNB", "ComplementNB", "MultinomialNB", "RandomForestClassifier"), theme = NULL )
| x | Data frame. The text feature. |
|---|---|
| y | Vector. The response variable. |
| tknz | Tokenizer to use ("spacy" or "wordnet"). |
| ordinal | Whether to fit an ordinal classification model. The ordinal model is the implementation of Frank and Hall (2001) that can use any standard classification model that calculates probabilities. |
| metric | String. Scorer to use during pipeline tuning ("accuracy_score", "balanced_accuracy_score", "matthews_corrcoef", "class_balance_accuracy_score"). |
| cv | Number of cross-validation folds. |
| n_iter | Number of parameter settings that are sampled (see
|
| n_jobs | Number of jobs to run in parallel (see |
| verbose | Controls the verbosity (see |
| learners | Vector. |
| theme | String. For internal use by Nottinghamshire Healthcare NHS
Foundation Trust or other trusts that use theme labels ("Access",
"Environment/ facilities" etc.). The column name of the theme variable.
Defaults to |
A fitted Scikit-learn
pipeline containing a number of objects that
can be accessed with the $
sign (see examples). For a partial list see
"Atributes" in sklearn.model_selection.RandomizedSearchCV
.
Do not be surprised if more objects are in the pipeline than those in the
aforementioned "Attributes" list. Python objects can contain several
objects, from numeric results (e.g. the pipeline's accuracy),
to methods (i.e. functions in the R lingo) and classes. In Python,
these are normally accessed with object.<whatever>
, but in R the
command is object$<whatever>
. For instance, one can access method
predict()
to make predictions on unseen data. See Examples.
The pipeline's parameter grid switches between two approaches to text classification: Bag-of-Words and Embeddings. For the former, both TF-IDF and raw counts are tried out.
The pipeline does the following:
Feature engineering:
Converts text into TF-IDFs or GloVe
word vectors with spaCy
.
Creates a new feature that is the length of the text in each record.
Performs sentiment analysis on the text feature and creates
new features that are all scores/indicators produced by
TextBlob
and vaderSentiment
.
Applies sklearn.preprocessing.KBinsDiscretizer
to the text length and sentiment indicator features, and
sklearn.preprocessing.StandardScaler
to the embeddings (word vectors).
Up-sampling of rare classes: uses imblearn.over_sampling.RandomOverSampler
to up-sample rare classes. Currently the threshold to consider a
class as rare and the up-balancing values are fixed and cannot be
user-defined.
Tokenization and lemmatization of the text feature: uses spaCy
(default) or NLTK
. It also strips
punctuation, excess spaces, and metacharacters "r" and "n" from the
text. It converts emojis into "__text__"
(where "text" is the emoji
name), and NA/NULL values into "__notext__"
(the pipeline does get
rid of records with no text, but this conversion at least deals with
any escaping ones).
Feature selection: Uses sklearn.feature_selection.SelectPercentile
with sklearn.feature_selection.chi2
for TF-IDFs or sklearn.feature_selection.f_classif
for embeddings.
Fitting and benchmarking of user-supplied Scikit-learn
estimators.
The numeric values in the grid are currently lists/tuples (Python objects) of
values that are defined either empirically or are based on the published
literature (e.g. for Random Forest, see Probst et al. 2019
).
Values may be replaced by appropriate distributions in a future release.
The pipeline uses the tokenizers of Python
library pxtextmining
.
Any warnings from Scikit-learn
like UserWarning: The parameter 'token_pattern' will not be used since 'tokenizer' is not None'
can
therefore be safely ignored.
Also, any warnings about over-sampling can also be safely ignored. These
warnings are simply a result of an internal check in the over-sampler of
imblearn
.
Frank E. & Hall M. (2001). A Simple Approach to Ordinal Classification. Machine Learning: ECML 2001 145--156.
Pedregosa F., Varoquaux G., Gramfort A., Michel V., Thirion B., Grisel O., Blondel M., Prettenhofer P., Weiss R., Dubourg V., Vanderplas J., Passos A., Cournapeau D., Brucher M., Perrot M. & Duchesnay E. (2011), Scikit-learn: Machine Learning in Python. Journal of Machine Learning Research 12:2825–-2830.
Probst P., Bischl B. & Boulesteix A-L (2018). Tunability: Importance of Hyperparameters of Machine Learning Algorithms. https://arxiv.org/abs/1802.09596
# Prepare training and test sets data_splits <- pxtextmineR::factory_data_load_and_split_r( filename = pxtextmineR::text_data, target = "label", predictor = "feedback", test_size = 0.90) # Make a small training set for a faster run in this example # Let's take a look at the returned list str(data_splits)#> List of 6 #> $ x_train :'data.frame': 1033 obs. of 1 variable: #> ..$ predictor: chr [1:1033] "Nothing to add all fine." "The ward need to look at putting a room somewhere on the ward, for very noisy patients as I've had no sleep for"| __truncated__ "The taps in patient toilets (Burns unit) could be improved to MIXER taps. Hot water v hot n cold water v cold, "| __truncated__ "Fans to keep me cooler and more comfortable." ... #> ..- attr(*, "pandas.index")=Int64Index([ 9817, 614, 10189, 8331, 6249, 5726, 8261, 1387, 2850, #> 2640, #> ... #> 5018, 705, 8383, 6074, 8943, 2585, 1543, 9558, 2067, #> 7593], #> dtype='int64', length=1033) #> $ x_test :'data.frame': 9301 obs. of 1 variable: #> ..$ predictor: chr [1:9301] "Treatment could have been ready, have had to wait each time and son in law is sat waiting outside." "You are already the best, everyone. Thank you. " "The noise and chatter was awful, staff stood leaning up against the reception desk talking and laughing and not"| __truncated__ "Nothing springs to mind as I have been treated well. " ... #> ..- attr(*, "pandas.index")=Int64Index([10235, 346, 7554, 775, 2435, 4563, 8110, 8056, 5850, #> 2816, #> ... #> 3958, 4858, 3207, 2398, 5502, 8079, 2797, 7283, 8837, #> 1766], #> dtype='int64', length=9301) #> $ y_train : chr [1:1033(1d)] "Couldn't be improved" "Environment/ facilities" "Communication" "Environment/ facilities" ... #> ..- attr(*, "dimnames")=List of 1 #> .. ..$ : chr [1:1033] "9817" "614" "10189" "8331" ... #> $ y_test : chr [1:9301(1d)] "Access" "Couldn't be improved" "Staff" "Couldn't be improved" ... #> ..- attr(*, "dimnames")=List of 1 #> .. ..$ : chr [1:9301] "10235" "346" "7554" "775" ... #> $ index_training_data: int [1:1033] 9817 614 10189 8331 6249 5726 8261 1387 2850 2640 ... #> $ index_test_data : int [1:9301] 10235 346 7554 775 2435 4563 8110 8056 5850 2816 ...# Fit the pipeline pipe <- pxtextmineR::factory_pipeline_r( x = data_splits$x_train, y = data_splits$y_train, tknz = "spacy", ordinal = FALSE, metric = "accuracy_score", cv = 2, n_iter = 1, n_jobs = 1, verbose = 3, learners = "SGDClassifier" ) # Mean cross-validated score of the best_estimator pipe$best_score_#> [1] 0.5314651# Best parameters during tuning pipe$best_params_#> $sampling__kw_args #> $sampling__kw_args$up_balancing_counts #> [1] 300 #> #> #> $preprocessor__texttr__text__transformer__use_idf #> [1] FALSE #> #> $preprocessor__texttr__text__transformer__tokenizer #> <pxtextmining.helpers.tokenization.LemmaTokenizer> #> #> $preprocessor__texttr__text__transformer__preprocessor #> <function text_preprocessor at 0x00000000645663A0> #> #> $preprocessor__texttr__text__transformer__norm #> [1] "l2" #> #> $preprocessor__texttr__text__transformer__ngram_range #> $preprocessor__texttr__text__transformer__ngram_range[[1]] #> [1] 1 #> #> $preprocessor__texttr__text__transformer__ngram_range[[2]] #> [1] 3 #> #> #> $preprocessor__texttr__text__transformer__min_df #> [1] 3 #> #> $preprocessor__texttr__text__transformer__max_df #> [1] 0.95 #> #> $preprocessor__texttr__text__transformer #> TfidfVectorizer(max_df=0.95, min_df=3, ngram_range=(1, 3), #> preprocessor=<function text_preprocessor at 0x00000000645663A0>, #> tokenizer=<pxtextmining.helpers.tokenization.LemmaTokenizer>, #> use_idf=False) #> #> $preprocessor__sentimenttr__scaler__scaler__n_bins #> [1] 8 #> #> $preprocessor__sentimenttr__scaler__scaler #> KBinsDiscretizer(n_bins=8, strategy='kmeans') #> #> $preprocessor__lengthtr__scaler__scaler #> KBinsDiscretizer(n_bins=3, strategy='kmeans') #> #> $featsel__selector__score_func #> <function chi2 at 0x000000006454E4C0> #> #> $featsel__selector__percentile #> [1] 100 #> #> $featsel__selector #> SelectPercentile(percentile=100, #> score_func=<function chi2 at 0x000000006454E4C0>) #> #> $clf__estimator__penalty #> [1] "elasticnet" #> #> $clf__estimator__max_iter #> [1] 10000 #> #> $clf__estimator__loss #> [1] "log" #> #> $clf__estimator__class_weight #> [1] "balanced" #> #> $clf__estimator #> SGDClassifier(class_weight='balanced', loss='log', max_iter=10000, #> penalty='elasticnet') #># Is the best model a linear SVM (loss = "hinge") or logistic regression (loss = "log)? pipe$best_params_$clf__estimator__loss#> [1] "log"#> [1] "Care received" "Care received" "Staff" "Care received" #> [5] "Care received" "Staff"# Performance on test set # # Can be done using the pipe's score() method pipe$score(data_splits$x_test, data_splits$y_test)#> [1] 0.5902591# Or using dplyr data_splits$y_test %>% data.frame() %>% dplyr::rename(true = '.') %>% dplyr::mutate( pred = preds, check = true == preds, check = sum(check) / nrow(.) ) %>% dplyr::pull(check) %>% unique#> [1] 0.5902591# We can also use other metrics, such as the Class Balance Accuracy score pxtextmineR::class_balance_accuracy_score_r( data_splits$y_test, preds )#> [1] 0.3913339


Suyog Jadhav
This is Suyog Jadhav from Kopargaon, India. I am pursuing my B. Tech. in Information Technology from Sanjivani College Of Engineering, Kopargaon. In July 2015 I completed my Diploma in Computer Technology from KBP Polytechnic
Designed with ♥ by Suyog Jadhav
© 2020 All rights reserved.


This tutorial focuses on the boto interface to the Relational Database Service from Amazon Web Services. This tutorial assumes that you have boto already downloaded and installed, and that you wish to setup a MySQL instance in RDS.
Warning
This tutorial covers the ORIGINAL module for RDS. It has since been supplanted by a second major version & an updated API complete with all service operations. The documentation for the new version of boto’s support for RDS is at RDS v2.
The first step in accessing RDS is to create a connection to the service. The recommended method of doing this is as follows:
>>> import boto.rds
>>> conn = boto.rds.connect_to_region(
... "us-west-2",
... aws_access_key_id='<aws access key'>,
... aws_secret_access_key='<aws secret key>')
At this point the variable conn will point to an RDSConnection object in the US-WEST-2 region. Bear in mind that just as any other AWS service, RDS is region-specific. In this example, the AWS access key and AWS secret key are passed in to the method explicitely. Alternatively, you can set the environment variables:
and then simply call:
>>> import boto.rds
>>> conn = boto.rds.connect_to_region("us-west-2")
In either case, conn will point to an RDSConnection object which we will use throughout the remainder of this tutorial.
Creating a DB instance is easy. You can do so as follows:
>>> db = conn.create_dbinstance("db-master-1", 10, 'db.m1.small', 'root', 'hunter2')
This example would create a DB identified as db-master-1 with 10GB of storage. This instance would be running on db.m1.small type, with the login name being root, and the password hunter2.
To check on the status of your RDS instance, you will have to query the RDS connection again:
>>> instances = conn.get_all_dbinstances("db-master-1")
>>> instances
[DBInstance:db-master-1]
>>> db = instances[0]
>>> db.status
u'available'
>>> db.endpoint
(u'db-master-1.aaaaaaaaaa.us-west-2.rds.amazonaws.com', 3306)
Before you can actually connect to this RDS service, you must first create a security group. You can add a CIDR range or an EC2 security group to your DB security group
>>> sg = conn.create_dbsecurity_group('web_servers', 'Web front-ends')
>>> sg.authorize(cidr_ip='<IP_ADDRESS>/32')
True
You can then associate this security group with your RDS instance:
>>> db.modify(security_groups=[sg])
Once you have reached this step, you can connect to your RDS instance as you would with any other MySQL instance:
>>> db.endpoint
(u'db-master-1.aaaaaaaaaa.us-west-2.rds.amazonaws.com', 3306)
% mysql -h db-master-1.aaaaaaaaaa.us-west-2.rds.amazonaws.com -u root -phunter2
mysql>
You can also create snapshots of your database very easily:
>>> db.snapshot('db-master-1-2013-02-05')
DBSnapshot:db-master-1-2013-02-05
Once this snapshot is complete, you can create a new database instance from it:
>>> db2 = conn.restore_dbinstance_from_dbsnapshot(
... 'db-master-1-2013-02-05',
... 'db-restored-1',
... 'db.m1.small',
... 'us-west-2')


Functions
The following functions are available globally.
-
Send data as text. Send functions do not signal the completion or the success of the send. They only verify the input data and signal if the send process was started. Errors will trigger a notification event to handle in the websocket run. Notification about successful sends can optionally be enabled with the notifyComplete option for each socket.
For example an error is signaled when the rate of outgoing messages to a client is high and the transfer rate is too low to make room in the clients send buffer.
See also
Socket.notifyComplete
Declaration
Swift
public func sendText(_ data : Any?, _ targets : ContiguousArray<Socket>) -> Bool
Parameters
data
The data to send.
targets
The socket(s) to send the data to.
-
Send data as text.
Declaration
Swift
public func sendText(_ data : Any?, _ targets : Socket...) -> Bool
Parameters
data
The data to send.
targets
The socket(s) to send the data to.
-
Broadcast data as text.
Declaration
Swift
public func bcText(_ data : Any?, _ exclude : ContiguousArray<Socket>) -> Bool
Parameters
data
The data to broadcast.
exclude
The socket(s) NOT to broadcast the data to.
-
Broadcast data as text.
Declaration
Swift
public func bcText(_ data : Any?, _ exclude : Socket...) -> Bool
Parameters
data
The data to broadcast.
exclude
The socket(s) NOT to broadcast the data to.
-
Send data as bytes.
Declaration
Swift
public func sendBytes(_ data : Any?, _ targets : ContiguousArray<Socket>) -> Bool
Parameters
data
The data to send.
targets
The socket(s) to send the data to.
-
Send data as bytes.
Declaration
Swift
public func sendBytes(_ data : Any?, _ targets : Socket...) -> Bool
Parameters
data
The data to send.
targets
The socket(s) to send the data to.
-
Broadcast data as bytes.
Declaration
Swift
public func bcBytes(_ data : Any?, _ exclude : ContiguousArray<Socket>) -> Bool
Parameters
data
The data to broadcast.
exclude
The socket(s) NOT to broadcast the data to.
-
Broadcast data as bytes.
Declaration
Swift
public func bcBytes(_ data : Any?, _ exclude : Socket...) -> Bool
Parameters
data
The data to broadcast.
exclude
The socket(s) NOT to broadcast the data to.


Together, over 50,000 Americans have come together to kickstart fundamental reform. Join us.
{{ctrl.moneyString()}}
{{ctrl.daysLeftMsg}}


I am a div with three children div inside of me: yellow, red, and blue. I have a line break after my text. This is to tell my children that they should appear under my text. You can say that I have three sections.
I am the first child-div floating to the left.
I am the second child-div floating to the left.
I am the third and the last child-div floating to the right.
 You can say that I have two sections.
I am a div floating to the left.
I am a div with a difference, I am not floating.


%- include("head.html") %>
Map size: (default 32)
Tile size: (default 8)
FPS:
Pause when window is deselected (saves CPU)
Movement speed: (default 0.2)


|
libgpif
0.1
|
Public library interface. More...
Data Structures | |
| struct | gpif_session |
Macros | |
| #define | EGPIFOK (1) /* Success */ |
| #define | EGPIFERR (-1) /* General error */ |
| #define | EGPIFINVAL (-2) /* Invalid argument */ |
Functions | |
| int | gpif_init (gpif_session *session, char *const argv[]) |
| int | gpif_close (gpif_session *session) |
| int | gpif_write (gpif_session *session, const char *buf, size_t *count) |
| int | gpif_read (gpif_session *session, void *buf, size_t *count) |
Public library interface.
| int gpif_init | ( | gpif_session * | session, |
| char *const | argv[] | ||
| ) |
Create a gnuplot session.
A call to this function will fork/exec a gnuplot child process, set up pipes to it's STDIN/STDOUT accoringly and populate the supplied session with the necesary information.
| session | Session to be initialized |
| argv | First item: name of the gnuplot binary, will usually be 'gnuplot' Any successive items: gnuplot arguments The last item must always be NULL |
| int gpif_close | ( | gpif_session * | session | ) |
Destroy a gnuplot session
This will automatically send a 'quit' command to gnuplot and do some cleanup.
| session | Session to be destroyed |
| int gpif_write | ( | gpif_session * | session, |
| const char * | buf, | ||
| size_t * | count | ||
| ) |
Write to gnuplot's STDIN
count will be modified by this function to reflect the number of bytes actually written.
| session | gnuplot session to be used |
| buf | Write buffer |
| count | Number of bytes to write / Number of bytes written (in / out) |
| int gpif_read | ( | gpif_session * | session, |
| void * | buf, | ||
| size_t * | count | ||
| ) |
Read from gnuplot's STDOUT
Try to read up to count bytes from gnuplot's STDOUT. Count will be manipulated by this function call to reflect the actual number of bytes read.
| session | gnuplot session to be used |
| buf | Read buffer |
| count | Number of bytes to read / Number of bytes read (in / out) |


WQMY
Hurst Warne | Commercial Property | Local Expertise & Regional ...
We service some of the largest property related businesses in the UK as well as many regional companies and private individuals. Read more » .
http://www.hurstwarne.co.uk/
| e-machine t2824 motherboard fuse location/seattle festivals in july/ knights of the rising sun jefferson |
|
|---|---|
| gourmet dutch oven recipes | Williamsport |
| Branding | MyNetworkTV comercial premises and surrey |
| shon cook muskegon mi | utah murray edger dealers: 29 (mdc kendall environmental center organic gardening) & greater new brunswick day care center-DT 45.3 (UHF) |
| lemons contaminated sickness restaurants | see article |
| Owner | New Age Media, LLC Surrey County Council - Vacant commercial properties |
| First air date | December 30, 1988 |
| pantiless pictures of britany spears | MYNetworkTV |
| keith stevens rochester area band | WOLF-TV, sky tv broadband phone |
| hard wood turning blanks english sycamore | WILF (1988-2006) |
| Former channel number(s) | For Lease - Macdonald Commercial |
| making chicken cordon bleu | time off request update (1988-1998) top rated lasik eye surgeons / morocco carnival splendor karaoke (1998-2006) |
| mini lights no end plug | 50 home everything appliance store 420 kW (WOLF-DT3) |
| home | 243 m 488 m (WOLF-DT3) |
| what's my budda made of | 52075 73375 (WOLF-DT3) |
| Transmitter coordinates | word before oscar or orloff driveclone pro 7 serial (WOLF-DT3) |
Find commercial property for sale in Surrey - Rightmove
Find commercial property for sale in Surrey. Search over 900000 properties for sale from the top estate agents and developers in the UK - Rightmove.
http://www.rightmove.co.uk/commercial-property-for-sale/Surrey.html
Surrey commercial property. Find commercial property to let in Surrey
Find commercial property to let in Surrey. Search over 250000 properties to rent from the top lettings agents in the UK - Rightmove.
http://www.rightmove.co.uk/commercial-property-to-let/Surrey.html
Contents |
[mann blinded by the light] History
UK COMMERCIAL PROPERTY, RENT AND BUY COMMERCIAL ...
The Commercial Property Register website is the occupiers essential guide to . Valley and Heathrow, the South Coast and the Kent, Surrey and Sussex.
http://www.compropregister.com/
Sutton Commercial Property | Sutton Offices to let | Industrial ...
Centro Plc. is the Commercial and Industrial Property Agency .
http://www.centro.plc.uk/sutton-commercial-property.php
Sutton and Croydon Estate Agency | Commercial & Residential ...
Residential and commercial property agent for Sutton and Croydon in Surrey. Property Agents in Sutton; Property Agents in Surrey; Estate Agents in Sutton .
http://www.centro.plc.uk/
Commercial Property Agents Martin Campbell Kingston and ...
Commercial property estate agents, Offices, Retail, Industrial, Warehouse, for rent , for sale london, kingston, Richmond, surrey, south east england.
http://www.martincampbell.co.uk/
Commercial Property for Sale in Surrey Buy Sell in Surrey | RightBiz ...
Business for Sale in Surrey UK - Commercial Property for Sale .
http://www.rightbiz.co.uk/surrey/4_commercial_property/all.html
Robinsons: Commercial Property Management in Reigate and ...
Robinsons are a chartered surveying partnership providing commercial property management services in Reigate and Redhill, Surrey including lettings and .
http://www.robinsonsuk.co.uk/
Franklin Commercial: Commercial estate agents and business ...
Commercial estate agents handling the letting / sale of commercial property and businesses in the South East including Surrey, Middlesex and London.
http://www.franklincommercial.com/
London Borough of Sutton - Commercial property
Sutton is able to offer high quality premises at competitive levels of rent, and development sites with considerable potential.
http://www.sutton.gov.uk/index.aspx?articleid=216
Property to rent in Surrey - Flats & houses to rent in Surrey - Zoopla
Results 1 - 25 of 5689 . Zoopla > Smarter Property Search > Find property to rent in Surrey with the UK's leading online property market resource.
http://www.zoopla.co.uk/to-rent/property/surrey/
Gildersleve & Payne: Commercial Property Surrey | Commercial ...
Surrey based Gildersleve & Payne is a company of professional and experienced commercial property agents with offices in Oxted and Croydon.
http://www.gpcommercial.co.uk/
Find commercial property to let in Sutton, Surrey - Rightmove
Find commercial property to let in Sutton, Surrey. Search over 250000 properties to rent from the top lettings agents in the UK - Rightmove.
http://www.rightmove.co.uk/commercial-property-to-let/Sutton.html
[trnsmission adpaters for plymouth 218 motor] Digital channels
| Channel | Name | glass beading intake manifold | 4930 state road cleveland ohio 44134 | Programming |
|---|---|---|---|---|
| 53.1 | comercial premises and surrey DT | citybuilding games powered by vbulletin | bella bridesmaid in nashville tn | Main comercial premises and surrey programming / MyNetworkTV |
| 53.2 | WOLF DT | massey pasquotank quakers north carolina | the ford plantation ga | Simulcast of mann blinded by the light |
| 53.3 | WSWB DT | 480i | 4:3 | Simulcast of filter records in report access |
Chartered Surveyors & Commercial Property Agents | Bucks | Berks ...
Chartered Surveyors & Commercial Property Agents providing professional services to clients in Bucks, Berks, Surrey & London.
http://www.kemptoncarr.co.uk/
[building 1 1250 diorama] References
[cat litter dust free] External links
- swimming costume size 20
- what wrong me tired irritable
- day larine movie actress
- glass beading intake manifold
- joanne alleyn npr radio
- cal mart grocery store san francisco
|
|


In this section, the following kinds of factorial designs will be described:
Hint
All available designs can be accessed after a simple import statement:
>>> from pyDOE import *
This kind of design offers full flexibility as to the number of discrete levels for each factor in the design. Its usage is simple:
>>> fullfact(levels)
where levels is an array of integers, like:
>>> fullfact([2, 3])
array([[ 0., 0.],
[ 1., 0.],
[ 0., 1.],
[ 1., 1.],
[ 0., 2.],
[ 1., 2.]])
As can be seen in the output, the design matrix has as many columns as items in the input array.
This function is a convenience wrapper to fullfact that forces all the factors to have two levels each, you simple tell it how many factors to create a design for:
>>> ff2n(3)
array([[-1., -1., -1.],
[ 1., -1., -1.],
[-1., 1., -1.],
[ 1., 1., -1.],
[-1., -1., 1.],
[ 1., -1., 1.],
[-1., 1., 1.],
[ 1., 1., 1.]])
This function requires a little more knowledge of how the confounding will be allowed (this means that some factor effects get muddled with other interaction effects, so it’s harder to distinguish between them).
Let’s assume that we just can’t afford (for whatever reason) the number of runs in a full-factorial design. We can systematically decide on a fraction of the full-factorial by allowing some of the factor main effects to be confounded with other factor interaction effects. This is done by defining an alias structure that defines, symbolically, these interactions. These alias structures are written like “C = AB” or “I = ABC”, or “AB = CD”, etc. These define how one column is related to the others.
For example, the alias “C = AB” or “I = ABC” indicate that there are three factors (A, B, and C) and that the main effect of factor C is confounded with the interaction effect of the product AB, and by extension, A is confounded with BC and B is confounded with AC. A full- factorial design with these three factors results in a design matrix with 8 runs, but we will assume that we can only afford 4 of those runs. To create this fractional design, we need a matrix with three columns, one for A, B, and C, only now where the levels in the C column is created by the product of the A and B columns.
The input to fracfact is a generator string of symbolic characters (lowercase or uppercase, but not both) separated by spaces, like:
>>> gen = 'a b ab'
This design would result in a 3-column matrix, where the third column is implicitly defined as "c = ab". This means that the factor in the third column is confounded with the interaction of the factors in the first two columns. The design ends up looking like this:
>>> fracfact('a b ab')
array([[-1., -1., 1.],
[ 1., -1., -1.],
[-1., 1., -1.],
[ 1., 1., 1.]])
Fractional factorial designs are usually specified using the notation 2^(k-p), where k is the number of columns and p is the number of effects that are confounded. In terms of resolution level, higher is “better”. The above design would be considered a 2^(3-1) fractional factorial design, a 1/2-fraction design, or a Resolution III design (since the smallest alias “I=ABC” has three terms on the right-hand side). Another common design is a Resolution III, 2^(7-4) fractional factorial and would be created using the following string generator:
>>> fracfact('a b ab c ac bc abc')
array([[-1., -1., 1., -1., 1., 1., -1.],
[ 1., -1., -1., -1., -1., 1., 1.],
[-1., 1., -1., -1., 1., -1., 1.],
[ 1., 1., 1., -1., -1., -1., -1.],
[-1., -1., 1., 1., -1., -1., 1.],
[ 1., -1., -1., 1., 1., -1., -1.],
[-1., 1., -1., 1., -1., 1., -1.],
[ 1., 1., 1., 1., 1., 1., 1.]])
More sophisticated generator strings can be created using the “+” and “-” operators. The “-” operator swaps the levels of that column like this:
>>> fracfact('a b -ab')
array([[-1., -1., -1.],
[ 1., -1., 1.],
[-1., 1., 1.],
[ 1., 1., -1.]])
In order to reduce confounding, we can utilize the fold function:
>>> m = fracfact('a b ab')
>>> fold(m)
array([[-1., -1., 1.],
[ 1., -1., -1.],
[-1., 1., -1.],
[ 1., 1., 1.],
[ 1., 1., -1.],
[-1., 1., 1.],
[ 1., -1., 1.],
[-1., -1., -1.]])
Applying the fold to all columns in the design breaks the alias chains between every main factor and two-factor interactions. This means that we can then estimate all the main effects clear of any two-factor interactions. Typically, when all columns are folded, this “upgrades” the resolution of the design.
By default, fold applies the level swapping to all columns, but we can fold specific columns (first column = 0), if desired, by supplying an array to the keyword columns:
>>> fold(m, columns=[2])
array([[-1., -1., 1.],
[ 1., -1., -1.],
[-1., 1., -1.],
[ 1., 1., 1.],
[-1., -1., -1.],
[ 1., -1., 1.],
[-1., 1., 1.],
[ 1., 1., -1.]])
Note
Care should be taken to decide the appropriate alias structure for your design and the effects that folding has on it.
Another way to generate fractional-factorial designs is through the use of Plackett-Burman designs. These designs are unique in that the number of trial conditions (rows) expands by multiples of four (e.g. 4, 8, 12, etc.). The max number of columns allowed before a design increases the number of rows is always one less than the next higher multiple of four.
For example, I can use up to 3 factors in a design with 4 rows:
>>> pbdesign(3)
array([[-1., -1., 1.],
[ 1., -1., -1.],
[-1., 1., -1.],
[ 1., 1., 1.]])
But if I want to do 4 factors, the design needs to increase the number of rows up to the next multiple of four (8 in this case):
>>> pbdesign(4)
array([[-1., -1., 1., -1.],
[ 1., -1., -1., -1.],
[-1., 1., -1., -1.],
[ 1., 1., 1., -1.],
[-1., -1., 1., 1.],
[ 1., -1., -1., 1.],
[-1., 1., -1., 1.],
[ 1., 1., 1., 1.]])
Thus, an 8-run Plackett-Burman design can handle up to (8 - 1) = 7 factors.
As a side note, It just so happens that the Plackett-Burman and 2^(7-4) fractional factorial design are identical:
>>> np.all(pbdesign(7)==fracfact('a b ab c ac bc abc'))
True
If the user needs more information about appropriate designs, please consult the following articles on Wikipedia:
There is also a wealth of information on the NIST website about the various design matrices that can be created as well as detailed information about designing/setting-up/running experiments in general.
Any questions, comments, bug-fixes, etc. can be forwarded to the author.


An arbitrary amount (0, 1, 2, ...) of regular Neutron ports with segmentation details (ie. type and ID). May be provided when the trunk is created. Also may be attached or detached later during the trunk's (and the instance's) life.
Inside the instance a particular subport's network will be presented as tagged frames transmitted and received on the vNIC belonging to the parent port. The cloud user may control the tagging by setting the segmentation type and segmentation ID of the subport.
Networks of subports may become available later than the moment of bootup. But they will be available after the trunk reached the ACTIVE status.
The segmentation type and ID are decoupled (and therefore independent) from Neutron's network virtualization implementation. Different segmentation types will be remapped as frames leave/enter the instance.
For ports on provider networks you may choose the special segmentation type inherit. Then the subport's segmentation type and ID will be automagically inherited from the provider network's segmentation type and ID. This is useful when the switch is incapable of remapping (tag pop-push) for example as usual for Ironic instances.
The segmentation type, ID tuples of subports must be unique (in the scope of a trunk), otherwise networks of subports could not be distinguished inside the instance.
Note that most guest operating systems will not automatically configure and bring up the VLAN subinterfaces belonging to subports. You may have to do that yourself. For example:
# eth0 belongs to the parent port # VLAN 101 was chosen for the subport sudo ip link add link eth0 \ name eth0.101 \ address "$subport_mac" \ type vlan id 101 sudo dhclient eth0.101
This can be simplified by reusing the parent's MAC address for all subports of the trunk earlier at port creation. Eg.:
sudo ip link add link eth0 \ name eth0.101 \ type vlan id 101 sudo dhclient eth0.101
Also note that segmentation details may be mandatory or optional depending on the backend. Notably Ironic may provide segmentation details instead of the user.
No subport can be the parent or a subport of any other trunks.


ITALIAN
BALLETS
Our favorite flats step it up with special details (think crisp stripes, mirrored metallics and crystal-encrusted bows) that will charm you out of your heels.
SHOP ALL SHOES >
Please add<EMAIL_ADDRESS>to your address book to ensure our emails reach your inbox. If you received this email from a friend and would like to subscribe to our email list, please go to the following web address -<EMAIL_ADDRESS>To unsubscribe from the email list, please go to the following web address -<EMAIL_ADDRESS>J.Crew Customer Relations | One Ivy Crescent | Lynchburg, VA 24513-1001


Team QFX
Team QFX is sponsored by Airkix windtunnels, Boogieman skydiving suits, Cookie Composites helmets, CYPRES 2 and the BPA (British Parachute Association).
Please contact us via<EMAIL_ADDRESS>if you are intersted in entering into a partnership with Team QFX.
© 2013 Company, Inc. · Privacy · Terms


The Netflix website is a good example of affordance because of the buttons allowing function,
the magnifying glass can be easily interpreted as search and hovering over the other controls
changes the fonts color letting the user know what they are about to click on.
The D2L website is a bad example of affordance because of the login button, just last week I
had problems logging back into my account after I had someone else use my laptop and log
into theirs. There is no "sign in as a different user" button anywhere to be found and the
need login help link does not help either.
Project free tv has an example of good mapping because of the the main control layout at the
top of the page that allows the user to identify where they need to go.
But the website also has bad mapping because it contains too many play buttons and download
buttons confusing the user on which button plays the video below it.
Unlike facebook's site where there are advertisements everywhere, amazon doesn't have many ads
all over the site making it a good example of signal-to-noise ratio.
Facebook is always changing the layout of their timeline, lately they have had more and more
ads either on the side or even mixed into your news feed as you are scrolling down. Too
much ad content distracts the user with their main goal.
The rolling stone's magazine website is a good example of the rule of thirds being applied
because of the layout of the page lying on the invisble intersections the rule of thirds grid
makes up.
This course website, I believe does not use the rule of thirds to design their website and
therefore makes it unpleasant to look at. Instead, everything lies on the side and does not use
the rule of thirds.
Twitter is a good example of using the golden ratio to design their website. The design layout
follows the principle which can be placed neatly inside a rectangle that obeys the ratio.
I came across this website earlier this summer searching for places to book a room, the site
is ugly to look at though since it doesn't apply the golden ratio principle and has lots of
white space off to the side of the page.


{% extends "zachsite/auth_base.html" %} {% block content %} If you're email is in the database you will receive an email. {% endblock %}
If you're email is in the database you will receive an email.