Skip to main content

Questions tagged [scala]

Scala is a general-purpose programming language principally targeting the Java Virtual Machine. Designed to express common programming patterns in a concise, elegant, and type-safe way, it fuses both imperative and functional programming styles. Its key features are: an advanced static type system with type inference; function types; pattern-matching; implicit parameters and conversions; operator overloading; full interoperability with Java; concurrency

23,960 questions with no upvoted or accepted answers
57 votes
0 answers
1k views

Materialize the Value for a Type that has One Inhabitant

Thanks to @MilesSabin's answer I can write a type level Fibonacci sequence: sealed trait Digit case object Zero extends Digit case object One extends Digit sealed trait Dense { type N <: Dense } ...
beefyhalo's user avatar
  • 1,781
17 votes
3 answers
3k views

Problem with compilation for maven project

I have two maven projects - a library and a small program. They are in different folders and use different pom.xml and the library's jar files are included in the small program's pom.xml using the ...
natascha's user avatar
  • 171
14 votes
0 answers
1k views

Integrating Play Framework 2.6 with gRPC and Netty

At the time I write this post, Play Framework is at v2.6.0-M4. The v2.5 version of the framework had difficulties to work with gRPC because of Netty conflicts (see this stackoverflow answer). I'm ...
Jesse's user avatar
  • 889
14 votes
2 answers
2k views

Scaffolding for Play Framework 2

Is there scaffolding generator utility for Play Framework 2 for Scala like Ruby on Rails has? I found some topics about this but didn't figure out which one was most popular or even if there was the ...
Incerteza's user avatar
  • 33.9k
14 votes
2 answers
1k views

Dynamically creating Akka Stream Flows at Runtime

I'm currently trying to dynamically create Akka Stream graph definitions at runtime. The idea being that users will be able to define flows interactively and attach them to existing/running ...
Stephen Woods's user avatar
14 votes
2 answers
1k views

How to override guice modules in Playframework unit tests using ScalaTest

I want to write functional test for my controller in PlayFramework. To do that I want to mock implementation of some classes. I found nice example of how to do that using spec2 here: http://www....
Zygimantas Gatelis's user avatar
13 votes
1 answer
3k views

Best strategy to upload files with unknown size to S3

I have a server-side application that runs through a large number of image URLs and uploads the images from these URLs to S3. The files are served over HTTP. I download them using InputStream I get ...
polo's user avatar
  • 1,412
13 votes
0 answers
3k views

How to choose bucket length in Spark's Bucketed Random Projection?

How should I optimally choose bucket length in Spark's LSH algorithm Bucketed Random Projection? It is this parameter set with .setBucketLength(), e.g. from the Spark documentation: val brp = new ...
Giorgio's user avatar
  • 143
13 votes
2 answers
5k views

akka http throws EntityStreamException: Entity stream truncation

I'm writing a client for a rest API using the akka http library. The library seems very powerful, but it works very unstable for me. Quite often (not always) it throws the following exception when I ...
Sergii Vashchyshchuk's user avatar
13 votes
2 answers
6k views

How to get probabilities corresponding to the class from Spark ML random forest

I've been using org.apache.spark.ml.Pipeline for machine learning tasks. It is particularly important to know the actual probabilities instead of just a predicted label , and I am having difficulties ...
Qing's user avatar
  • 143
12 votes
0 answers
1k views

Calling scala code in pyspark for XSLT transformations

This might be a long shot, but figured it couldn't hurt to ask. I'm attempting to use Elsevier's open-sourced spark-xml-utils package in pyspark to transform some XML records with XSLT. I've had a ...
ghukill's user avatar
  • 1,194
12 votes
1 answer
788 views

How can I use http request headers for content negotiation in a Mashaller?

My app supports protobuf and JSON serialzation. For JSON serialization I use com.trueaccord.scalapb.json.JsonFormat, my dtos are generated from proto definitions. The com.trueaccord serializer wraps ...
Jeno Laszlo's user avatar
  • 2,281
12 votes
1 answer
1k views

Apache Spark and Domain Driven Design

I've got somewhat of an abstract question. I've been using Apache Spark (also Streaming and SQL) with Scala quite a lot lately. Most of my Spark jobs basically move RDDs/Dataframes from one class to ...
Gideon's user avatar
  • 2,241
12 votes
1 answer
1k views

Scaladoc diagrams

Is it possible to generate diagrams with Scaladoc and SBT? I tried to add this line in my build.sbt: scalacOptions in (Compile,doc) := Seq("-diagrams", "-diagrams-debug") But I receive: Diagram ...
Thibaud Dauce's user avatar
12 votes
1 answer
3k views

PowerMockito throwing ClassNotPreparedException even with @PrepareForTest using Scala Test

I have the following test... import org.scalatest.junit.JUnitRunner ... @PowerMockRunnerDelegate(classOf[JUnitRunner]) @PrepareForTest(Array(classOf[AuditLog])) class ConnectorAPITest extends path....
Jackie's user avatar
  • 23.1k

15 30 50 per page
1
2 3 4 5
1598