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
scala
112,634
questions
2
votes
0
answers
63
views
ZIO fiber exception lost parent stacktrace on top level catchAll
I'm tracing some error in our production environment. Found cause.squash not give a helpful message.
And I test a demo to see how it output when exception in fiber:
import zio.*
object ...
1
vote
0
answers
54
views
Can I disable default Marker Context (NoMarker) passed implicitly when using play.api.Logger and require a different MarkerContext is always provided?
I am trying to add a unique request id to logs for each request that is made to a rest api. For that I want to pass implicitly a MarkerContext to each logger method called. Currently the NoMarker ...
2
votes
1
answer
63
views
Implementing reduce in Scala (Scala FP)
I'm implementing reduce method in Scala as an exercise of Functional Programming in Scala, and I don't think it is running in parallel. How can a create a fully parallel implementation of it?
def ...
2
votes
1
answer
47
views
Scala initialization order object vs. val
In the following program an object is reported as null, even though it is clearly initialized.
class MyClass()
class MyOtherClass(c: MyClass)
object Foo {
val myClass = new MyClass()
object ...
0
votes
0
answers
37
views
For any given project built using SBT, is there any way, by creating a plugin/other ways, to get and STORE the details of modules and dependencies
I have a sample SBT built JAVA project Apache Pekko v1.0.0
https://github.com/apache/pekko/tree/v1.0.0
I need to setup automation in such a way that I get the name of the modules in this project, or ...
0
votes
1
answer
59
views
How to organize http client requests authorization via spnego?
I am trying to authenticate on remote sever with kerberos, using http4s scala client.
After researching this tech, I realised that.
Firstly I need to make some empty request to server with no special ...
0
votes
2
answers
38
views
Determine if a condition is ever true in an aggregated dataset with Scala spark sql library
I'm trying to aggregate a dataset and determine if a condition is ever true for a row in the dataset.
Suppose I have a dataset with these values
cust_id
travel_type
distance_travelled
1
car
10
1
...
2
votes
0
answers
95
views
Are BFS and DFS the same and just the Monad is different?
I wrote a tail-recursive BFS in Scala:
import scala.collection.mutable
/** Do BFS from start and return the smallest distance to end (None if not connected) */
def bfs[A](start: A, end: A, neighbors: ...
0
votes
0
answers
23
views
How to use Apache Ignite RDD with Apache Spark RDD in a web application
I created a scala web application using apache ignite and spark. The application uses ignite RDD and Spark RDD. I was only able to successfully run the application by using spark-submit. But I wonder ...
1
vote
0
answers
72
views
How to remove comments from the scala code
Any ideas how to remove comments from the scala code so that:
Nested multi line or single line comments are removed.
Comments inside string literals are not removed.
Code can have single and triple ...
0
votes
1
answer
27
views
How. to read or retry the process for uncommited message in kafka
lets say i am getting 1 to 15 messages from kafka. I am processing it and commiting it, if the message does satisfy the condition I am uncommiting the particular message.
Now, My question is how to ...
1
vote
3
answers
77
views
InterpreterException in Apache Zeppelin V 0.11.1 executing a paragraph
Problem Description:
We tried to start Apache Zeppelin 0.11.1 on the following server.
We followed the installation instructions on the official Apache Zepplin website.
Apache Zeppelin can be started ...
0
votes
0
answers
67
views
How to parse large JSON Strings(>5,000,000) using Play JSON?
I'm using Play JSON 2.9.4 in Scala.
implementation group: 'com.typesafe.play', name: 'play-json_2.12', version: '2.9.4
I'm unable to parse JSON Strings larger than 5,000,000 characters.
The exception ...
1
vote
0
answers
23
views
How to pass a value down the call stack in Scala Play app
I need to pass some information down the call stack in a Scala Play application.
For example:
class FooController: play.api.mvc.BaseController {
...
def method1(request: play.mvc.Http.Request) = {
...
0
votes
1
answer
63
views
convert from Option[String] to Long in Scala?
I have a function that needs to be pass in a long value.
As code block example below:
val expectTime = sys.env.getOrElse("envVar", "1000").toLong
pause(expectTime.milliseconds)
...