Data dodania Pytanie
2017-04-22 16:04 compilation nap - How can I make sbt to ring a bell when compilation is ready? »
How can I make sbt to ring a bell (or play a sound, or execute some system command, a shell command) when compilation is ready ? Compilation usually ...
(3) odpowiedzi
2017-04-22 10:04 How to sort on multiple columns using takeOrdered? »
How to sort by 2 or multiple columns using the takeOrdered(4)(Ordering[Int]) approach in Spark-Scala. I can achieve this using the sortBy like this :...
(2) odpowiedzi
2017-04-22 07:04 Scala - Sealed trait grand child »
While experimenting with sealed traits, I found (to my surprise) that if in one file, I have this code sealed trait Sealed trait SealedChild extends...
(1) odpowiedzi
2017-04-21 19:04 Shut down Akka HTTP app »
I have a running Akka HTTP application and I want to shut it down. Pressing Ctrl+ C in SBT does not work for me (my shell is currently Git Bash for W...
(1) odpowiedzi
2017-04-21 16:04 Why Spark ML ALS algorithm print RMSE = NaN? »
I use ALS to predict rating, this is my code: val als = new ALS() .setMaxIter(5) .setRegParam(0.01) .setUserCol("user_id") .setItemCol("busin...
(1) odpowiedzi
2017-04-21 07:04 Why does a recursive lazy list blow the stack in Scala? »
I saw this snippet of Haskell in this answer by proud haskeller on Meta PPCG: x=2:x I thought, "wait, I can do that in Scala!" So I tried: lazy va...
(2) odpowiedzi
2017-04-21 02:04 ScalaTest: Marking a scenario test as an expected failure »
When working through testing with FeatureSpec and using scenario, I have part of my code that sends a "failure" case class (i.e. ApplesNotAllowed) and...
(3) odpowiedzi
2017-04-20 18:04 Scala: buggy type inference? »
The following is a simplified version of my original code to make things simpler (sorry it's still a bit complicated): trait BuilderBase trait Messag...
(2) odpowiedzi
2017-04-20 18:04 In parboiled2, how should I report an error in a parser action? »
What's the best way to report an error in a parser action in parboiled2 (I'm using v 2.1.4)? For example, say I want to read an integer value and rep...
(1) odpowiedzi
2017-04-20 16:04 Scala - create case class with all fields from 2 other case classes »
Say I have 2 case classes: case class Basic(id: String, name) extends SomeBasicTrait case class Info (age: Int, country: String, many other fields..)...
(0) odpowiedzi
2017-04-20 04:04 Scala/functional/without libs - check if string permutation of other »
How could you check to see if one string is a permutation of another using scala/functional programming with out complex pre-built functions like sort...
(2) odpowiedzi
2017-04-19 20:04 Are there any back compat guidelines for scala? »
For example, in Java its pretty well known that adding a method to an interface is backwards compatible as long as signatures are not removed. Same w...
(0) odpowiedzi
2017-04-19 13:04 Scala variable with multiple types »
There is Either in scala which allow a variable to have 2 types value. val x: Either[String, Int] = Left("apple") However, I want to have more than...
(3) odpowiedzi
2017-04-19 07:04 How is lazy interpreted in recursive context? »
Here's the code from FPIS object test2 { //a naive IO monad sealed trait IO[A] { self => def run: A def map[B](f: A => B): IO[B] =...
(3) odpowiedzi
2017-04-18 22:04 Why does spark-shell print thousands lines of code after count on DataFrame with 3000 columns? What's JaninoRuntimeException and 64 KB? »
(With spark-2.1.0-bin-hadoop2.7 version from the official website on local machine) When I executed a simple spark command in spark-shell, it starts ...
(0) odpowiedzi
2017-04-18 15:04 how to define upper bounds for scala method »
how do you define a Scala method such that it would take in the subclass of any type A without throwing a compilation error? trait A case class B ext...
(2) odpowiedzi
2017-04-18 04:04 Spark: sum over list containing None and Some()? »
I already understand that I can sum over a list easily using List.sum: var mylist = List(1,2,3,4,5) mylist.sum // res387: Int = 15 However, I have...
(4) odpowiedzi
2017-04-17 17:04 Scala split a multi line string by lines that contain all hyphens »
I have a multiline string that contains: this is line 1 ------------------------------ this is line 2 +++++++++++++++++++++++++ this is line 3 ...
(1) odpowiedzi
2017-04-17 10:04 Scala avoid using null »
I hava a project on github that is analysed by codacy . The analysis suggest to "Avoid using null" for the following line of code: def doSomethingWit...
(4) odpowiedzi
2017-04-17 10:04 Higher Kinded Types in Scala »
I'm reading through the Functional Programming in Scala book and in the Monoids chapter, they talk about a Monoid interface that looks like this: tra...
(1) odpowiedzi
2017-04-16 20:04 Pattern matching on a simple Shapeless HLIST »
I wrote this simple code using the shapeless library import shapeless.LabelledGeneric case class Icecream(name: String, numberOfCherries: Int, inCone...
(1) odpowiedzi
2017-04-16 02:04 Is it a good habit to omit dot and parentheses when writing Scala code? »
I am always wondering why Scala is designed to be able to omit dot and parentheses. This confuses me. For example, "hello".length() can be written a...
(3) odpowiedzi
2017-04-16 01:04 Scala - understand class definition with Bounds »
I am learning Scala and I've seen some classes constructed with a template: Like: class Name[+S <: State](val name: String) class User[S <: ...
(1) odpowiedzi
2017-04-15 11:04 How to use foldM of Foldable? »
I am trying to understand foldM of Foldable in cats trying a simple example: suppose I need to sum up the numbers in a list while the running sum is p...
(2) odpowiedzi
2017-04-15 02:04 Scala immutable Map vs List of tuples »
What's the difference between an immutable Map and a List of tuples in Scala? When should I use each of them? Which one is preferable if both are poss...
(2) odpowiedzi
2017-04-15 02:04 Type Parameter in Case Class Using Trait w/ Implicits »
Let's say we have a trait: trait ThingToThing[-A, +B] { def apply(a: A): B } and its companion object: object ThingToThing { implicit object Str...
(1) odpowiedzi
2017-04-14 08:04 Load a file from SFTP server into spark RDD »
How can I load a file from SFTP server into spark RDD. After loading this file I need to perform some filtering on the data. Also the file is csv file...
(1) odpowiedzi
2017-04-14 06:04 Scala Free Monads with Coproduct and monad transformer »
I'm trying to start using free monads in my project and I'm struggling to make it elegant. Let's say I have two contexts (in reality I have more) - Re...
(1) odpowiedzi
2017-04-14 01:04 Implicit conversion is not applied if a method has type parameter »
The question is based on the discussion here. This is the setup: implicit def CToC2(obj: C1): C2 = { new C2() } class C1() { def f[U](f: (Int, I...
(0) odpowiedzi
2017-04-13 16:04 Scalameta: Identify particular annotations »
I want to auto-generate REST API models in Scala using scalameta annotation macros. Specifically, given: @Resource case class User( @get ...
(1) odpowiedzi
2017-04-13 14:04 Type parameter declaration in Scala »
I am newbie and learning Scala programming. I am struggling with following code. if I tried to replace "(Double, Double)" in "def combine" function wi...
(2) odpowiedzi
2017-04-13 14:04 Scala: abstracting over a path-dependent type in impilicit parameter »
Let's say I have a class: abstract class NumericCombine[A:Numeric,B:Numeric]{ type AB <: AnyVal } I want to define a function that r...
(3) odpowiedzi
2017-04-13 11:04 facebook Auth using restapi:Getting java.lang.IllegalArgumentException »
i am using the following code to login with facebook callback url got invoked and i got the access code but when i try to get the access token followi...
(0) odpowiedzi
2017-04-13 03:04 Scala: generic weighted average function »
I want to implement a generic weighted average function which relaxes the requirement on the values and the weights being of the same type. ie, I want...
(1) odpowiedzi
2017-04-12 23:04 Control A Representation in Python/Scala »
In Python "^A" is represented by chr(1). This is what I use as a separator in myfiles. What is the equivalent in Scala.I am reading the file using sca...
(1) odpowiedzi