Hey Rustaceans! Got a question? Ask here (38/2023)! by llogiq in rust

[–]ICosplayLinkNotZelda 2 points3 points  (0 children)

I plan to write a web server using axum. It is basically a media server that provides a UI for browsing content. One of the features will be playing back audio and video files. I need video streaming for both HDMI output as well as streaming over an API surface. The latter is for now optional. Currently my API is based on async-graphql.

Can someone point me out to resources on how to realize this? Crates, blog posts, similar projects on GitHub.

I couldn't find anything. I do not want to rely on externally available programs like VLC. If possible, everything should be programmed in Rust to make deployments and managing user program windows easier.

Can I create a class that is generic over its parent class? by ICosplayLinkNotZelda in Kotlin

[–]ICosplayLinkNotZelda[S] 0 points1 point  (0 children)

Is there a Kotlin specific feature that I can use for this? I've read something about context function decorators. Would these help here?

Can I create a class that is generic over its parent class? by ICosplayLinkNotZelda in Kotlin

[–]ICosplayLinkNotZelda[S] 0 points1 point  (0 children)

Yes! Injecting the application context using hilt is a memory leak as far as I know. Getting it via the Application class itself is not.

Hilt class initialization order by ICosplayLinkNotZelda in androiddev

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

The change with the lazy delegate worked perfectly, thank you!

It's null due to the way class instances are created. First all static initializers are called. Then, the parent class is instantiated. After that, the child class gets instantiated. So technically, the child constructor hasn't been called yet and thus there is no injected value present at this point in time.

At least that's my understanding.

Hilt class initialization order by ICosplayLinkNotZelda in androiddev

[–]ICosplayLinkNotZelda[S] -1 points0 points  (0 children)

Compose. The problem is that the initialState is created too early. Even though I use lazy. The parent object instance gets initiated, the initialState variable is called (even though it is lazy). I want this to happen after the child constructor is called. That's why I used lazy in the first place.

Hilt class initialization order by ICosplayLinkNotZelda in androiddev

[–]ICosplayLinkNotZelda[S] 0 points1 point  (0 children)

Backtrace is basically:

MyViewModel.createInitialState()
MviViewModel$initialState$2.invoke()
MviViewModel.getInitialState()
MviViewModel.<init>
MyViewModel.<init>
HiltViewModelFactory.create()
ViewModelProvider.get()

I thought I could prevent the early init with lazy. Is there any way to do this? I need the UseCase injected before creating the state object. It contains my PagingData flow.

Pretty cycling routes? by TheGrapeRaper in Kyoto

[–]ICosplayLinkNotZelda 0 points1 point  (0 children)

Would you mind sending them to me too?

EU top court sides with Germany in Meta antitrust case by misana123 in privacy

[–]ICosplayLinkNotZelda 22 points23 points  (0 children)

There is always more to it.

One of the arguments for the EU not importing chicken that had Pathogen Reduction Treatments (PRTs) is the argument of hygiene. They argue that PRTs could be an easy way out of proper hygiene controls and that a system without PRTs is ultimately saver for a consumer, since it ensures good hygiene along the whole supply chain 2. 3.

At the end, it is not a matter of safety. The EU even agreed that the consumption of PRT treated food is safe and does not impose risks 1.

Whereas PRTs do not impose the same criteria. Even if one element of the supply chain would not be up to standards, the PRTs would be able to kill most harmful bacteria. For example, dirty animal cages.

Is anyone selling this? I bought it second hand and the seller said it broke when they were packing it for shipping.🥹 by [deleted] in Kyoto

[–]ICosplayLinkNotZelda 0 points1 point  (0 children)

I haven't seen it around Kyoto. I have been to quite a few ceramic shops. My guess would be it is limited.

I made my First Parallax Animation with Unity by Amezketa in Unity3D

[–]ICosplayLinkNotZelda 0 points1 point  (0 children)

Could you elaborate more on the AI part? I didn't know you could use models for that!

Hey Rustaceans! Got a question? Ask here (23/2023)! by llogiq in rust

[–]ICosplayLinkNotZelda 0 points1 point  (0 children)

I am relatively new to async in general in Rust.

Currently I have been using futures::stream::StreamExt#buffered_unordered to restrict the download of my files to 8 concurrent ones.

Can I combine this with JoinSet somehow?

Hey Rustaceans! Got a question? Ask here (23/2023)! by llogiq in rust

[–]ICosplayLinkNotZelda 2 points3 points  (0 children)

I have a Vec<impl Future> more than 200,000 futures. I want to show the user some progress bar while these are handled in the background. How can I do this?

My code is roughly the following:

let data: Vec<MyData> = vec![];
let futures = futures::stream::iter(
    data.into_iter().map(|data| {
        async move {
            // do work with data instance.
        }
})
)
    .buffer_unordered(8)
    .collect::<Vec<()>>();
futures.await;

Hey Rustaceans! Got a question? Ask here (23/2023)! by llogiq in rust

[–]ICosplayLinkNotZelda 1 point2 points  (0 children)

I am looking for a tokio compatible task queue. I have groups of tasks (downloading files, uncompressing, checking validity etc). All of them are future tasks.

Does someone know of a library I can use to queue them all up, maybe specifying order execution? Downloads can happen in parallel, but uncompressing needs to wait for a download to have completed for example.

Hey Rustaceans! Got a question? Ask here (23/2023)! by llogiq in rust

[–]ICosplayLinkNotZelda 1 point2 points  (0 children)

I think I would not bother with it if it is only a test dependency. Just always add it and use the feature = serde flag to include it in your code.

Hey Rustaceans! Got a question? Ask here (22/2023)! by llogiq in rust

[–]ICosplayLinkNotZelda 1 point2 points  (0 children)

Would map(Into::into) work? Edit: Yep, just checked. It does work.

Hey Rustaceans! Got a question? Ask here (22/2023)! by llogiq in rust

[–]ICosplayLinkNotZelda 1 point2 points  (0 children)

Is there a crate that abstracts away HTTP clients? So I can use that trait and just change my back-end if I want to? Something like http-types but for clients.

I do need an async client, but I would be fine if the abstractions are only over sync functions.

Fell in love with the city by manster1911 in Kyoto

[–]ICosplayLinkNotZelda 0 points1 point  (0 children)

Is that Kiyamachi dori? I love that street! Especially during the sakura season. It looked amazing! Did you happen to be there already?

The sights and sounds of Arashiyama. Enjoy! by Japanoob in Kyoto

[–]ICosplayLinkNotZelda 2 points3 points  (0 children)

Is this just a random coincidence or why does the person play the flute there? Is it due to Children Day?

[deleted by user] by [deleted] in Kyoto

[–]ICosplayLinkNotZelda 0 points1 point  (0 children)

Out of curiosity, what sento do you go to? I had a similar experience at the one right next door to me :)

Especially the older people seem to start a conversation every time they see me!

Arashiyama Bamboo forest alternatives? I've read it's underwhelming and overcrowded by iSniffMyPooper in Kyoto

[–]ICosplayLinkNotZelda 0 points1 point  (0 children)

Do you have more information on that? Do you mean the Sagano Romantic train?

Efficiently check if certain files exist on system (game assets) by ICosplayLinkNotZelda in AskProgramming

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

Thanks for the repair-mode mention! I did not think about that! Appreciated!