Quantcast
Channel: User Alec - Stack Overflow
Browsing all 39 articles
Browse latest View live

Comment by Alec on Querying a large dataset in-browser using webassembly

Although I'm aware this is unsatisfying, I think there's really not much point to doing this. From WASM in the browser, the only way you are going to interact with files is by importing browser...

View Article



Comment by Alec on Concatinating two Flows in Akka stream

source.via(flow1).concat(source.via(flow2)). Note that you are re-running source twice though.

View Article

Comment by Alec on Force tableswitch instead of lookupswitch

@apangin I agree it does not matter for performance, but Java's way is actually the "smaller" bytecode. This is counterintuitive because of the way javap prints out the switch, but tableswitch...

View Article

Comment by Alec on How to compare types of different, generic HLists?

I fear I'm missing something - did you try adding an implicit ser: Serializer[ ReprA, ReprB] argument to def toSerializedKeys? In fact, why can't Serializer.toBufs be the function presented to users?

View Article

Comment by Alec on Regular expression to find URLs within a string

@TrophyGeek I think you just copied the regex from the first comment, and Akshay forgot to include the &. The right version would be: val urlRegex =...

View Article


Comment by Alec on When should I use ConcurrentSkipListMap?

It feels a little bit weird to benchmark the performance of a datastructure meant for concurrent access only single threaded. This would be more interesting with more threads (even just -tc 1,2,4,8 to...

View Article

Comment by Alec on What is the simplest way to pipe from a Read to a Write

@infogulch because read methods from Read and write methods from Write both require &mut self. As for the why behind that, I'd say it is safe to say that most implementations of read and write will...

View Article

Comment by Alec on Can generators be recursive?

@Yuta73 yes, it is

View Article


Comment by Alec on Fastest way to invoke method handle fields

No, they aren’t

View Article


Comment by Alec on Fastest way to invoke method handle fields

I definitely could use invokedynamic with a this argument and a getter bootstrap argument, but I buy that I won't get anything more out of it than invokeExact.

View Article

Uses of `final object`? [duplicate]

Is there any purpose for a final object? None of the other uses of final seem to make any sense here:preventing a type from being extended (as in final class) doesn't make sense since object's can't be...

View Article

Factoring a number into roughly equal factors

I would like to decompose a number into a tuple of numbers as close to each other in size as possible, whose product is the initial number. The inputs are the number n we want to factor and the number...

View Article

Choose a BidiFlow based on the first input element

I have a protocol which has type protocol: Flow[ByteString, ByteString, NotUsed]. Elements coming into the stream are messages sent by the user and elements exiting the stream are responses from the...

View Article


Answer by Alec for Choose a BidiFlow based on the first input element

After posting and looking more at the docs, I've figured out a semi-solution: since the BidiFlow is anyways ultimately going to be join-ed to a Flow, we can just think of the problem in terms of...

View Article

Answer by Alec for Scala and Akka HTTP: Processing form-data requests

If all you want are the string values in the form data, you just need to unmarshal to StrictForm, and then unmarshal each of the field values as strings.Here's a proof of concept Ammonite script that...

View Article


Answer by Alec for akka http: Server Binding not behaving as expected

As the snippet tells, I am terminating the server binding after 10 seconds. So I expect that if I send the request before this period expires, I should get message 'Accepted incoming connection...

View Article

Answer by Alec for passing an Akka stream to an upstream service to populate

The real issue here is that the Azure API is not designed for back-pressuring. There is no way for the output stream to signal back to Azure that it is not ready for more data. To put it another way:...

View Article


Answer by Alec for How to build an Akka Streams Source from the Akka Event...

This seems like an XY problem. If the publisher and subscriber end up de-coupled, what should happen if the publisher produces data faster than the subscriber?With that said, here's a way to do what...

View Article

Answer by Alec for Recover on Akka ask based on the message sent

Akka's ask method is actually pretty easy to recreate - it is just a mapAsync with some extra logic for better errors when the actor dies (see the code). As such, just use mapAsync manually so you can...

View Article

Answer by Alec for Where do enqueued messages go after an actor is stopped Akka

In general, you can't assume much about delivery to dead letters. As the docs on dead letters say:Messages which cannot be delivered (and for which this can be ascertained) will be delivered to a...

View Article
Browsing all 39 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>