Spyke

Replies

linux

Comment on

nmcli unable to connect to password protected home WiFi

Reply in thread

Is your keyboard layout set correctly?

I would suppose so, cause I used nmcli d WiFi connect SSID password PASSWORD, and the PASSWORD is displayed correctly.

Does the SSID or password have a , or weird character?

My password is alphanumeric, so that shouldn't be the issue. My SSID is alphanumeric + (), but I don't think that's the issue either cause I cannot connect to my password protected hotspot that is only alphanumeric.

python

Comment on

[Answered] Typehints for functions that have variable signatures

Reply in thread

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
python

Comment on

[Answered] Typehints for functions that have variable signatures

Reply in thread

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!

Comment on

[Resolved] Missing audio with MPV + Wayland

Reply in thread

I tried with cage + Xwayland and that works perfectly, so I highly doubt that is the issue. Maybe it is something to do with cage + alacritty that is causing it, but I'm not too well versed in the Wayland stuff to know if spawning a terminal application may somehow not support audio.

Comment on

[Resolved] Missing audio with MPV + Wayland

Reply in thread

are you running it from a tty on login

Yea, directly on tty.

I imagine these are two separate issues.

I'd think they are related since mpv is working fine on Xwayland but not when I launch alacritty instead

Can you dump your installed packages with pacman -Qe and post it here? I’ll compare it to mine.

alacritty 0.12.2-1
ani-cli 4.6-1
archlinuxarm-keyring 20140119-2
base 3-1
base-devel 1-1
bat 0.23.0-3
cage 0.1.5-1
dhcpcd 10.0.2-1
dialog 1:1.3_20230209-1
linux-rpi 6.1.54-1
lobster 4.0.0-1
man-db 2.11.2-1
neovim 0.9.1-1
net-tools 2.10-2
netctl 1.28-2
noto-fonts 1:23.9.1-1
opendoas 6.8.2-1
openssh 9.4p1-4
pacman-contrib 1.9.1-1
raspberrypi-bootloader 20230921-1
raspberrypi-firmware 20230921-1
ripgrep 13.0.0-3
socat 1.7.4.4-1
tmux 3.3_a-7
vi 1:070224-6
which 2.21-6
wireless-regdb 2023.09.01-1
wireless_tools 30.pre9-3
wpa_supplicant 2:2.10-8
xorg-xwayland 23.2.1-1
linux

Comment on

MPV dropping frames and audio

Reply in thread

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

Comment on

Mosquito splinters

Reply in thread

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.

Comment on

Help with API design for price pegging with JWT

Reply in thread

Or, maybe just tell them the JWT they’ve got is expired, and ask them yes or no if they want the new (current) price instead, and update it transparently if they say yes.

Based on this, it seems like you're suggesting to move the logic closer to the frontend and leave the auto-refetching logic out of the backend?

The more I look at the responses, the more I feel this is a front-end problem to be solved rather than the backend's.

Comment on

Help with API design for price pegging with JWT

Reply in thread

I think the idea was that as long as it is within 5 min, our service can be certain that the price shouldn't change and thus we can save the computation cost of having to compute the price.

It also is a user requirement, cause within that 5 min, even if the price is supposed to be changed, we will still use the price in the JWT.

godot

Comment on

Quick advise on multiplayer deck builder

Reply in thread

so don’t ever send anything you don’t absolutely have to.

Hmm I was thinking that after I've establish a base and was going to optimize, I think that setting the multiplayer nodes to be manually updated should be ok rather than having them done periodically, since a card game game state progress at fixed events rather than being real time.

but I generally personally prefer modifier parent nodes because the tree is very efficient and it seems to allow for more flexibility.

One downside with nodes that I noticed is that if we store the cards in the deck as nodes under a deck node, it becomes rather annoying to manipulate them, eg shuffle them, as compared to list. Would that be enough a drawback to reconsider using a list instead?