sorted by: new top controversial old
17
submitted 7 months ago* (last edited 7 months ago) by 0WN3D@lemmy.cafe to c/asklemmy@lemmy.ml

I know there was quite a bit of controversy surrounding YouTube's recommendation algorithms, but I can't seem to find a better alternative. What are the ways y'all find videos that are of interest?

I know we could use RSS and subscribe to our desired channels and get a better experience than YT's own subscription system, but what about channel/video discovery, those that you've never seen before? Is there a better way to find a video that might be interesting to you without kneeling before the almighty algorithm? Half of the recommended page on YT seems irrelevant to me, but I can't seem to find a better alternative.

[-] 0WN3D@lemmy.cafe 1 points 8 months ago

Oh, ticks are rare in my region, that's why I have no prior experience with them.

I was thinking in the context of us slapping the mosquito would be equivalent to slamming a thumbtack into your skin which could increase the damage dealt and penetration depth.

61
submitted 8 months ago by 0WN3D@lemmy.cafe to c/asklemmy@lemmy.ml

Just a random shower thought.

Mosquito's proboscis is sharp enough to penetrate your skin. So when you smack it while it is in the process of drawing your blood, isn't there a chance of its proboscis being forcefully jammed into your skin, leading to some sort of "splinter"? Or does it somehow loses its stiffness the moment it feels the impact?

I've never encountered nor heard of such occurrence in my lifetime of killing those buggers, but wondering if such a thing is even possible. If such could happen, I could only imagine the risk associated with having a piece of foreign organic matter being embed in the body

[-] 0WN3D@lemmy.cafe 1 points 10 months ago

Tried the settings on the GitHub, doesn't seem to work, and it also made the stuttering worse

opengl-pbo=yes
opengl-early-flush=no.
video-sync=display-resample

ok, here you go

https://pastebin.com/uPc5S1LU

[-] 0WN3D@lemmy.cafe 1 points 10 months ago

Yea, it seems to be using 200% CPU. But I have vo=gpu though, so I'd thought the GPU would've taken some of the load.

If I am strapped for CPU resources, how do I make it so that MPV buffer or something instead of dropping the audio when this happens? Cause it is strange the even though the visuals are acceptable, it is the audio that fails before the video

22
submitted 10 months ago by 0WN3D@lemmy.cafe to c/linux@lemmy.ml

I've tried searching around and stuff but I couldn't find a working solution

Background: I am running Arch Linux on a Raspberry Pi, mainly as a media player.

When I run MPV, it seems to drop frames (1-2 per second). Visually, nothing looks wrong so I am fine with that.

The issue is that after playing for some duration, the audio will just disappear. I would then need to pause the video for a while or seek backwards for the audio to come back (sometimes it just comes back on its own when I leave it playing too). I suspect it may be due to the dropped frames or maybe it's due to insufficient system resource.

Could someone help suggest some config changes which may help with the issue? I am totally fine with the visual dropped frames, I just want to fix the audio issue.

This is my config.

input-ipc-server=/tmp/mpvsocket
ao=pipewire
volume=120
demuxer-readahead-secs=3                                
cache=yes
[-] 0WN3D@lemmy.cafe 2 points 1 year ago

I think there's a spectrum here, and I'll clarify the stances.

The spectrum ranges from "Data shouldn't cause the function to do (something wildly) different" to "It should be allowed, even to the point of variable returns"

I think you stand on the former while I stand on the latter. Correct me if I'm wrong though, but that's the vibe I'm getting from the tone in your example.

Data shouldn’t drive the program in this way.

Suppose we have a function that calculates a price of an object. I feel it is agreeable for us to have compute_price(with_discount: bool), over compute_price_with_discount() + compute_price_without_discount()

You’ve basically spelled:

I feel your point your making in the example is a bit exaggerated. Again, coming back to my above example, I don't think we would construe it as compute_price('with_discount').

Maybe this is bandwagoning, but one of the reason for my stance is that there are quite a few examples of variable returns.

eg:

  • getattr may return a different type base on the key given
  • quite a few functions in numpy returns different things based on flags. SVD will return S if compute_uv=False and S,U,V otherwise
[-] 0WN3D@lemmy.cafe 1 points 1 year ago

I thought about it, but it isn't as expressive as I wished.

Meaning if I do

a = foo(return_more=True)
or
a, b = foo(return_more=False)

it doesn't catch these errors for me.

In comparison, the other suggested solution does catch these.

[-] 0WN3D@lemmy.cafe 2 points 1 year ago* (last edited 1 year ago)

yea, this is pretty close to what I'm looking for.

The only missing piece is the ability to define the overload methods on the bool

something like

@overload
def foo(return_more: True) -> (Data, Data)

@overload
def foo(return_more: False) -> Data

But I don't think such constructs are possible? I know it is possible in Typescript to define the types using constants, but I don't suppose Python allows for this?

EDIT: At first, when I tried the above, the typechecker said Literal[True] was not expected and I thought it was not possible. But after experimenting some, I figured out that it is actually possible. Added my solution to the OP

Thanks for the tip!

[-] 0WN3D@lemmy.cafe 1 points 1 year ago* (last edited 1 year ago)

but from a practical perspective, let's say you retrieve an object and can either return a subset of its fields as your API. Doesn't it make sense to re-use the same function, but change what fields are returned?

I'm specifically talking about the narrow use-case where your API returns either A or B of the fields, and won't extend it in the future

The alternative is to either duplicate the function, or extract it out which seems a bit overkill if it is only 2 different type of functions.

22
submitted 1 year ago* (last edited 1 year ago) by 0WN3D@lemmy.cafe to c/python@programming.dev

I know what I am asking is rather niche, but it has been bugging me for quite a while. Suppose I have the following function:

def foo(return_more: bool):
   ....
    if return_more:
        return data, more_data
   return data

You can imagine it is a function that may return more data if given a flag.

How should I typehint this function? When I use the function in both ways

data = foo(False)

data, more_data = foo(True)

either the first or the 2nd statement would say that the function cannot be assigned due to wrong size of return tuple.

Is having variable signature an anti-pattern? Is Python's typehinting mechanism not powerful enough and thus I am forced to ignore this error?

Edit: Thanks for all the suggestions. I was enlightened by this suggestion about the existence of overload and this solution fit my requirements perfectly

from typing import overload, Literal

@overload
def foo(return_more: Literal[False]) -> Data: ...

@overload
def foo(return_more: Literal[True]) -> tuple[Data, OtherData]: ...

def foo(return_more: bool) -> Data | tuple[Data, OtherData]:
   ....
    if return_more:
        return data, more_data
   return data

a = foo(False)
a,b = foo(True)
a,b = foo(False) # correctly identified as illegal

0WN3D

joined 1 year ago