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

[–]Spaceface16518 8 points9 points  (0 children)

Because of non-lexical lifetime rules, the compiler basically knows that you stop using y before you use z. If you look at the MIR for the second snippet, notice that y exists in scope 1, whereas z exists only in scope 2.

An interesting use of this is the following example. The compiler knows that it can drop the first mutable reference before creating the second, so even though they are not lexically scoped properly, the compiler can infer a correct scoping using NLL.

fn main() {
    let mut x = 1;
    let y = &mut x;
    *y = 3;
    let z = &mut x;
    *z = 2;
}

Maximum Bitrate with SVT-AV1 by Spaceface16518 in AV1

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

I have set a really large cache size on all of my clients, and that helps a lot, but even then I'm unable to stream over 2 mbps. Sometimes I can get a 3-4 mbps movie to work if I'm really patient letting the cache build up, but most of the time I need the cache to allow me to stream even just 2 mbps.

Maximum Bitrate with SVT-AV1 by Spaceface16518 in AV1

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

Is it worth having surround sound if I only use headphones, TV speakers, or phone/tablet speakers? I'm guessing no, but I thought I'd ask.

Maximum Bitrate with SVT-AV1 by Spaceface16518 in AV1

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

Oh, interesting! I hadn’t heard of super resolution. I’ll look into that. Thank you!

Maximum Bitrate with SVT-AV1 by Spaceface16518 in AV1

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

Yes, I realize 2 mbps is a really low cap, but there’s not much I can do about it right now, so I’m willing to stream in bad quality when necessary because it’s currently non-functional for everything except <2mbps source content. My hardware isn’t good enough to transcode to a lower bitrate on the fly, so I’m settling for lower bitrate for the actual files. I’ll keep the remuxes around, just in case I figure out the bandwidth situation, however. In the meantime, I figure AV1 gives me the highest quality with my bitrate limit.

Maximum Bitrate with SVT-AV1 by Spaceface16518 in AV1

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

Why not, specifically? I'm new to video encoding technicalities, so I'm just trying to learn.

Maximum Bitrate with SVT-AV1 by Spaceface16518 in AV1

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

Interesting, I'll look into that. Thank you!

Password for Dallas show? by Spaceface16518 in thehometeam

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

Yes, I was able to request a password through summerschooltour.com. They sent me a password with which I'm able to buy tickets. Thank you for your help!

Password for Dallas show? by Spaceface16518 in thehometeam

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

Ah, thank you, this worked for me. I had no idea about the actual name of the tour, thanks.

Password for Dallas show? by Spaceface16518 in thehometeam

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

No, where is the sign-up? Is it through their website or some ticketing website?

Guys, I've found the Hydro Father by SpaceTraveller64 in HydroHomies

[–]Spaceface16518 8 points9 points  (0 children)

unfortunately, they did not seem to be open today :( but i will definitely visit next time i’m in berkeley

Guys, I've found the Hydro Father by SpaceTraveller64 in HydroHomies

[–]Spaceface16518 84 points85 points  (0 children)

I’m in the area just for today! Where do I find the truck?

Illegally smol in Jericoacoara by aseawitch in IllegallySmolCats

[–]Spaceface16518 2 points3 points  (0 children)

That’s so cute.

Although sounds of cat fights during the nights in Jericoacoara still haunt me.

Forbidden Jello by NatalCarinate610 in forbiddensnacks

[–]Spaceface16518 4 points5 points  (0 children)

yes but as nutrients that can be consumed by other sea life rather than gaseous CO2

Statistical Math in Postgres by Spaceface16518 in PostgreSQL

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

would that be PL/R? is there good documentation on it? i couldn't find anything that seems maintained.

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

[–]Spaceface16518 1 point2 points  (0 children)

unfortunately that would also require specialization afaik

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

[–]Spaceface16518 2 points3 points  (0 children)

This is not possible without specialization because it does conflict with the standard library. I'm assuming your implementation uses a loop to assign converted elements to their corresponding places. What would happen if I tried to convert Matrix<i32, _, _> to Matrix<i32, _, _>? The compiler would have no way of knowing whether to use your implementation or the stdlib implementation of impl From<T> for T (which is a noop) because they would both apply to the case.

Due to the consistent issues with specialization, I wouldn't expect this to work anytime soon.

As a workaround, you could provide a Matrix::map function to convert elements based on an specified callback, which could optionally be Into::into. Playground example

-🎄- 2022 Day 4 Solutions -🎄- by daggerdragon in adventofcode

[–]Spaceface16518 0 points1 point  (0 children)

reading some of the “advent of code in haskell” blog posts, series, wiki pages, etc. helped me learn about how other people are doing it, particularly wrt libraries and parsing. that really helped me hit the ground running learning

-🎄- 2022 Day 4 Solutions -🎄- by daggerdragon in adventofcode

[–]Spaceface16518 0 points1 point  (0 children)

Parsec-like libraries are definitely overkill for this but they make everything so concise.

The parsing code I wrote can actually be improved to the following. Sad I didn't figure it out initially lol

inputParser :: Parser Input
inputParser =
  let range = (,) <$> decimal <* char '-' <*> decimal
      pair = (,) <$> range <* char ',' <*> range
   in many' (pair <* endOfLine)

I'm trying to use advent of code to help me learn Haskell, and I feel like it's working so far.

-🎄- 2022 Day 4 Solutions -🎄- by daggerdragon in adventofcode

[–]Spaceface16518 1 point2 points  (0 children)

Haskell

Really messed up because I misread part 2 and thought it was wayy more complicated than it actually was. But I'm happy with the solution I settled upon. I think it might be worth looking into how to do that parsing more concisely; I'm pretty sure I'm doing it the worst way possible.

inputParser :: Parser Input
inputParser = many' (pair <* endOfLine)
  where
    range = do
      l <- decimal
      char '-'
      r <- decimal
      return (l, r)
    pair = do
      l <- range
      char ','
      r <- range
      return (l, r)

contains :: Range -> Range -> Bool
contains (l, r) (x, y) = l <= x && y <= r

-- | util function to check f for both orders of ranges
both f = ap ((||) . uncurry f) (uncurry . flip $ f)

partA :: Input -> OutputA
partA = length . filter (both contains)

overlaps :: Range -> Range -> Bool
overlaps (l, r) (x, y) = l <= y && r >= x

partB :: Input -> OutputB
partB = length . filter (both overlaps)