Data dodania Pytanie
2016-12-25 15:12 Slick 3.1.1 sql PSQLException: ERROR: syntax error at or near "" + "" »
I have the following simple (and tested in Postgres) query that leads to the above error and I can't find what it is. def findActiveByProviderKeyAndE...
(1) odpowiedzi
2016-12-25 15:12 Variance of function »
sealed trait Sum[+A, +B] { def flatMap[A, C](f: B => Sum[A, C]): Sum[A, C] = this match { case Failure(v) => Failure(v) case S...
(1) odpowiedzi
2016-12-25 14:12 Injecting PlaySlick database connection in ScalaTest »
I have the following DAO that connects to a database using PlaySlick. The class has a method read that I need to test with ScalaTest. My problem is th...
(0) odpowiedzi
2016-12-24 22:12 Cannot preserve state in Scala.js »
I am trying to write a simple scala.js application. The problem I now have is that I can't figure out why I fail to save data which I get from the ser...
(0) odpowiedzi
2016-12-24 12:12 What return type should a Scala method have if it can throw/return errors but has Unit return type? »
So usually when we run a method that can both fail and return a value, we can encode our method return type as Either[SomeErrorType, ReturnType]. But ...
(2) odpowiedzi
2016-12-24 06:12 How to Authorize Myself with Twitter OAuth 1.0 on Scala »
I tried GET https://api.twitter.com/1.1/statuses/user_timeline.json?count=1&user_id=XXX on Scala, but I got an error 401 Authorization required. ...
(0) odpowiedzi
2016-12-23 08:12 Converting functors (F[A] => G[A]) in Scala (cats or scalaz) »
Is there a typeclass in Cats or Scalaz that converts between different container types? For example Option ~> Try Try ~> Future Try ~> Either Opti...
(1) odpowiedzi
2016-12-23 08:12 Akka Http Performance tuning »
I am performing Load testing on Akka-http framework(version: 10.0), I am using wrk tool. wrk command: wrk -t6 -c10000 -d 60s --timeout 10s --latency...
(1) odpowiedzi
2016-12-23 07:12 How does Scala return in function »
I implemented to find max value in the list. I know that in Scala, You don't have to use 'return', just drop it. So I wrote like this, def max(xs: L...
(2) odpowiedzi
2016-12-23 00:12 Value of future depends on whether it has been bound to a variable? »
Code: import scala.concurrent.Future import scala.util.{Failure, Success} import scala.concurrent.ExecutionContext.Implicits.global /** * Created ...
(2) odpowiedzi
2016-12-22 17:12 Method overloading in implicit class »
I'm using a class (that I cannot modify) containing a method which receives a value of type Any as parameter, like the following example: class Foo...
(2) odpowiedzi
2016-12-22 12:12 String Containing Exact Substring from Substring List »
Scala beginner here, I'm trying to find all the tweets text that contain at least one keyword in the list of keywords given. Where a tweet: case cla...
(1) odpowiedzi
2016-12-22 09:12 Scala Value class takes more memory than expected »
I am trying to reduce the memory footprint of my program and want to use scala's Value class in order to define a variable which acts like java primit...
(0) odpowiedzi
2016-12-21 15:12 Relationship between iterable and Array in Spark »
I notice that if I apply a mapPartitions on an RDD, the partitions get an iterable object. Within the mapPartitions function, I then call the toArray ...
(1) odpowiedzi
2016-12-21 12:12 How to use combineByKey? »
I am trying to get the same result of countByKey with combineByKey. scala> ordersMap.take(5).foreach(println) (CLOSED,1) (PENDING_PAYMENT,2) (COMP...
(1) odpowiedzi
2016-12-21 11:12 Unexpected behavior with compound types »
I have 3 traits trait A trait B trait AB extends A with B and a method def collect[E: Manifest](list: List[Any]) = list flatMap { ...
(1) odpowiedzi
2016-12-20 21:12 In Apache Spark, Is it possible to specify partition's preferred location for a shuffled RDD or a cogrouped RDD? »
As for Spark 1.6+, the only API that supports customizing partition location is when the RDD is created: /** Distribute a local Scala collection to...
(0) odpowiedzi
2016-12-20 18:12 Inserting Data Into Cassandra table Using Spark DataFrame »
I'm using Scala Version 2.10.5 Cassandra 3.0 and Spark 1.6. I want to insert data into cassandra so I tried Out basic Example scala> val collectio...
(1) odpowiedzi
2016-12-20 10:12 What special rules does the scala compiler have for the unit type within the type system »
The Unit gets special handling by the compiler when generating byte code because it's analogous to void on the jvm. But conceptually as a type within ...
(3) odpowiedzi
2016-12-20 08:12 Coursera Scala SBT submission issues »
I am a current student at the EPFL functional programming in SCALA course on coursera. I have successfully passed the first course by submitting my as...
(0) odpowiedzi
2016-12-19 23:12 How to force a compile time function's argument to be of a specific type in Scala? »
Is there a way to force setting compile type of a function argument to an expected type defined in a function's signature when we only known that obje...
(1) odpowiedzi
2016-12-19 20:12 How to disable "Slow" tagged Scalatests by default, allow execution with option? »
I want to disable certain automated tests tagged as "Slow" by default but allow the user to enable their execution with a simple command line. I imagi...
(1) odpowiedzi
2016-12-19 08:12 Why is the following scala experimental code not working? »
I'm trying to define a generic add function to numeric values: def add[A](x:A, y:A): A = { x + y } console:16: error: type mismatch; found : ...
(2) odpowiedzi
2016-12-19 05:12 Isn't lambda function also an object with Function1 trait? »
object MyApp { def printValues(f: {def apply(x: Int): Int}, from: Int, to: Int): Unit = { println( (from to to).map(f(_)).mkString(" ") ...
(3) odpowiedzi
2016-12-18 18:12 case insensitive pattern match in Scala »
I want to do pattern matching in Scala but it should be case insensitive. Is there a way I can write the code without using separate 'case' clauses fo...
(2) odpowiedzi
2016-12-18 10:12 how to call separate logic for diff file name in spark »
I have 3 log files in my folders. Like foldera = emplog,deptlog,companylog folderb = emplog,deptlog,companylog folderc = emplog,deptlog,companylog ...
(1) odpowiedzi
2016-12-18 01:12 Handling recursion in scala's scheme interpreter »
I'm giving the following code that implements an interpreter of scheme language from scala. The relevant cases are those that contain a call to update...
(1) odpowiedzi
2016-12-17 22:12 What is a purpose for the type parameter variable in pattern matching »
This question is still unanswered despite of it was marked as duplicate. From http://www.scala-lang.org/files/archive/spec/2.12/08-pattern-matching.h...
(0) odpowiedzi
2016-12-17 18:12 Normalized and immutable data model »
How does Haskell solve the "normalized immutable data structure" problem ? For example, let's consider a data structure representing ex girlfriends/b...
(0) odpowiedzi
2016-12-17 16:12 Scala: Higher order function to return the union of sets »
I am working on the following scala higher order function: def after(M: Set[Expression], n: String): Set[Set[Expression]] = { M.map((expr: Expression...
(1) odpowiedzi
2016-12-17 09:12 Scala Spark rdd combination in a file to match pairs »
I am learning Spark+Scala and I am stuck with this problem. I have two things. One file that contains many words (I show you for example the 2 first l...
(1) odpowiedzi
2016-12-16 23:12 Getting "cat: /release: No such file or directory" when running scala »
I tried installing Scala 2.12.1 on my Mac (El Capitan) via Homebrew and also by downloading the binaries at https://www.scala-lang.org/download/. In ...
(1) odpowiedzi
2016-12-16 17:12 How to transform Either[Future[A], Future[B]] to Future[Either[A, B]] »
I have an instance of Either[Future[A], Future[B]] and I would like to transform it to Future[Either[A, B]]. Since my previous question, cats 0.8.1 ...
(1) odpowiedzi
2016-12-16 12:12 scala properly defining a empty value for a abstract data type »
I have a ADT as follows: sealed trait Tree[A] case object EmptyTree extends Tree[Nothing] case class Leaf[A](value: A) extends Tree[A] case class Nod...
(1) odpowiedzi
2016-12-16 09:12 Scala generic math function for Int and BigInt with @specialized(Int) »
I'm new to scala and I wonder whether it is possible to define generic math function that works with both BigInt and Int and in the case of Int the ar...
(1) odpowiedzi