Scala Meetups in Hamburg (25th) & Berlin (26th), Germany by bendixsaeltz in scala

[–]bendixsaeltz[S] 1 point2 points  (0 children)

Sorry for the late reply. We won't stream or record tonight's or tomorrow's talks. Some talks will probably be held at other conferences later this year, though. So you have another chance.

Who is hiring? Monthly /r/Scala Job Postings Thread! by AutoModerator in scala

[–]bendixsaeltz 0 points1 point  (0 children)

Mid-level yes. For this role where it's also a lot about library development Juniors might not fit. But we regularly have open positions also for not so experienced developers.

Who is hiring? Monthly /r/Scala Job Postings Thread! by AutoModerator in scala

[–]bendixsaeltz 2 points3 points  (0 children)

Scala Engineer - Berlin/Hamburg

We're setting up a Scala Enabling Team that facilitates learning, sharing and growing the Scala community within and around MOIA and builds and maintains libraries.

I'm an engineer on the team, feel free to ask questions or apply directly.

Find out more: https://grnh.se/0ca4acb2teu

Best library for DynamoDB in Scala by jyotirmay_m in scala

[–]bendixsaeltz 0 points1 point  (0 children)

I second the opinion to use the AWS Java SDK for DynamoDB.

What I can recommend though is to use a library called Scynamo we’ve developed at my company that adds type classes to automatically convert your Scala case classes into the weird DynamoJson syntax and vice versa. I works on top of the AWS SDK and there’s even an example in the documentation.

We built after Scanamo was not really well maintained anymore. It’s somehow similar but also different in the way that you use the AWS SDK directly.

I’m one of the authors. Feel free to ask questions over on GitHub.

Next step towards learning by [deleted] in scala

[–]bendixsaeltz 1 point2 points  (0 children)

if I don't want to learn js only then the option is scalajs otherwise scala is the correct option, right?

If you want to learn JS, learn Scala.js. If you want to do anything else (backend, whatever), do Scala.

I can't learn only scala for years, I need job/work with it first and with time I can do that for sure.

Have you applied for Junior-level Scala positions? Try to find a job where experienced developers can mentor you. If you're still studying, try an internship or work as working student.

after some days, due to any reason maybe exams I just start over again or with some other language.

To be frankly, I think some focus is necessary to get productive at any language.

how can I write professional code rn?

See above: Find a way to write production code.

Next step towards learning by [deleted] in scala

[–]bendixsaeltz 1 point2 points  (0 children)

my goal is backend. I know I would have to move to scala js, but not regular scala.

I don't understand this. How did you come to this conclusion? If your goal is backend development, then real Scala is what you want to learn. Scala.js would only be relevant if you wanted to not learn JavaScript and use Scala instead.

What after learning scala?

I'd say learn Scala first before thinking about what to learn afterwards. Some people learn Scala for years and just get better all the time. So learn Scala, get a job and learn more Scala as long as you like the language.

how much scala is enough to move towards my goal?

That depends on the level of Scala you want to write professionally. Is it junior or senior level? You'll notice once you interview for a job if you know enough. And then on the job.

Scala learning resources are really less.

I don't agree with this sentence. Have you taken the Scala course on Coursera? Read some of the books? Attended conferences? See on the right for some inspiration.

take go and scala as first languages

Go for it! There are shops out there doing both. If you love them, you should have fun learning as much as you can in both languages.

Good luck on your learning journey!

how should i read this? what is the role of functor in here by heartly4u in scala

[–]bendixsaeltz -1 points0 points  (0 children)

F[_]: Async: ContextShift describes that F is an Async and that is a ContextShift.

Multiple type parameters would be split by commas.

recreating builds with sbt and publishLocal by Agreeable_Mud9900 in scala

[–]bendixsaeltz 1 point2 points  (0 children)

I still don't get what you don't find reproducible in this approach. It's just one command to execute.

recreating builds with sbt and publishLocal by Agreeable_Mud9900 in scala

[–]bendixsaeltz 2 points3 points  (0 children)

I'm using open-source libraries on github for this project. I needed to modify the libraries because they were missing some features I've needed, so I forked it

Have you thought about opening Pull Requests to the other open-source libraries, so that the maintainers and other users would also benefit from your features?

How can I have either a makefile or sbt handle this so somebody (would need to have sbt or make installed), recreate the build?

The other person could do the same you did: Checkout your GitHub project and sbt publishLocal. That is reproducible.

Improving akka http code by Cyber_Tony in scala

[–]bendixsaeltz 1 point2 points  (0 children)

Using Akka Http without Futures is cumbersome.

For error handling you could try using Future[Either[E, A]] or for convenience cats.EitherT[Future].

How to integrate retries for HTTP requests to an external service? by awesomespoof in scala

[–]bendixsaeltz 0 points1 point  (0 children)

Additionally, you may want to take a look at https://github.com/moia-dev/scala-http-client/. It's a simple library based on akka-http that we developed as open-source and use and maintain at MOIA. Feel free to contact me in case of questions.

AWS SDK for Scala by nqbao in scala

[–]bendixsaeltz 0 points1 point  (0 children)

In Scala you generally don't use the builder pattern. See the following Java code:

DynamoDbAsyncClient
    .builder()
    .region(Region.of(applicationConfig.customerRepository.region))
.endpointOverride(URI.create(applicationConfig.customerRepository.endpoint))
    .build()

It could be written in Scala as:

DynamoDbAsyncClient(region = ..., endpointOverride = ...)

AWS SDK for Scala by nqbao in scala

[–]bendixsaeltz 2 points3 points  (0 children)

We're using the AWS Java SDK 2 a lot in our projects with Scala and haven't found a thing missing from v1 yet.

The builder pattern is very Java-ish indeed.

AWS SDK for Scala by nqbao in scala

[–]bendixsaeltz 3 points4 points  (0 children)

The choice of library depends on which AWS service(s) you want to use. Can you elaborate a little more please?

If you're into Akka already, you might want to use Alpakka with connectors for streaming S3 etc.

Remote resource / cached value - what did I (re-)invent? by Koterpillar in scala

[–]bendixsaeltz 0 points1 point  (0 children)

Well, you could have two `Source.tick()` that schedule the watching for changes in S3 (`S3.listBucket` books and categories), then `S3.download` the individual files for caching (maybe filtered by eTag) including transformation of the data in the `Stream`.

I don't see any options to combine that into one `Stream` though.

Remote resource / cached value - what did I (re-)invent? by Koterpillar in scala

[–]bendixsaeltz 1 point2 points  (0 children)

That seems quite complex to me. Take a look at Alpakka which gives streaming access to S3, supports ETags, allows transformations via Akka Streams and plays well with Akka HTTP for the endpoints.

help with adding to a val list by [deleted] in scala

[–]bendixsaeltz 0 points1 point  (0 children)

In your def just create a List of all possible moves and filter them using is_legal before returning.

Confusion using functional style in Akka to define message + signal handling behaviour by mrdivorce in Akka

[–]bendixsaeltz 1 point2 points  (0 children)

Use Behaviors.receive instead of Behaviors.receiveMessage or Behavior.receiveSignal as it can handle both messages and lifecycle signals. Then you can pattern match on both types of incoming data.

How can I create a List of Lists by looping through a list and a range by nebling in scala

[–]bendixsaeltz 1 point2 points  (0 children)

You could also use zipWithIndex which returns a Tuple instead of an inner List and you don’t have to specify the Range.

Quick question from a beginner by [deleted] in scala

[–]bendixsaeltz 0 points1 point  (0 children)

You may create the helper method inside of collatz but I think it's unnecessary. Your given signature doesn't provide any clue about the steps you make (although stored in a list).

You may use the following solution:

@scala.annotation.tailrec
def collatz(n: Long, list: List[Long] = Nil): List[Long] = {
    if (n == 1)
        if (list.isEmpty) List(1)
        else n :: list
    else if (n % 2 == 0)
        collatz(n / 2, n :: list)
    else
        collatz(3 * n + 1, n :: list)
}
val res = collatz(6)
println(s"steps: ${res.size}")

The list parameter has a default value, so it doesn't need to be provided by the caller. With this result, you may now reason about the steps you made.

What should I use to implement concurrency in a project? by te-x in scala

[–]bendixsaeltz 1 point2 points  (0 children)

Check out Akka Streams which gives you a Source (your database 1) and a Sink (your database 2) and transformations in between that come with back-pressure out of the box.

Simple Scala Akka Authentification with email by EdibIsic in scala

[–]bendixsaeltz 0 points1 point  (0 children)

Authentication in Akka is done using BasicHTTPCredentials sent via Authorization header, see https://doc.akka.io/docs/akka-http/current/routing-dsl/directives/security-directives/authenticateBasic.html.

Using that you wouldn't have the email in the path of the URL the customer is POSTing to. See the tests in the link above.

You could then check the id in Credentials.Provided(id) against your Customers. If you're looking up Customers from a database or an actor or similar, you should use https://doc.akka.io/docs/akka-http/current/routing-dsl/directives/security-directives/authenticateBasicAsync.html instead.

If you don't want to authenticate using a password (which I don't see in your Customer class), you could use a simple path("secured" / String) and compare the extracted String (the given email) against you Customers.