Hacker Newsnew | past | comments | ask | show | jobs | submit | AnyTimeTraveler's commentslogin

Many Linux display managers let you chose what to do, when a window requests focus. For me on Sway, it just turns the border red.

I chose what happens after. Can recommend. I wasn't even aware of my privilege.


Weird. My android phone is 3+ years old and was not a flagship when I got it. It had a little problem with stuttering on more complex examples. It sounded like it was running out of things that can play at the same time, but scrolling was still smooth. It didn't feel like it was pinning my phone's cpu. On my laptop, it didn't break a sweat with firefox and pipewire. Are you sure it's not a config issue?


I can't tell, things like BespokeSynth are running ok with alsa or jack. I got the rt kernel, made a few things to audio priority, fiddled with governors, but no luck. Let's say that it happens quite quickly with the Stitch Angel fast trance example "the key needs to be G" supersaw synth.

Chromium is better at it than Firefox though.

Maybe this 5800X3D needs a buff up...


> alsa or jack. I got the rt kernel, made a few things to audio priority, fiddled with governors,

Maybe the issue is you touched too much?

A 5800X3D is freaking power house. It's not a hardware issue. You can run "fast trance" on a laptop twice the age of your CPU.


Yes, true, any music production oriented live distro recommendation to test if it's the case anyone?


What?

This website

1. reacts well to my system preference of a dark theme in my news-reader

2. has a toggle at the top for dark theme

3. works flawlessly with DarkReader in my browser

Until I saw your comment, I didn't even know the website had a light version.

Again: What?


Have you thought about just not making the variable global and instead adding it as a parameter to the functions that actually need it?

You can also create a struct, put your "global" variable inside it and then put all the functions that need the variable into an Impl block of that struct. If you then add the parameter `&self` to these functions, you can access the "global"variable any time via `self.global_variable`.

If that is not enough, then you can always make an actual global variable by first wrapping it in a Mutex, to prevent simultaneous access and then wrapping that in an Arc for Atomic Reference Counting. That allows you to pass "copies" of that variable around anywhere, satisfying the borrow-checker (since the variable is now reference-counted in a thread-safe way).

If you need a lot of parallel reading, replacing the Mutex with an RwLock is a good idea, since it allows locking from multiple threads, if you want to read it in most cases.


Rust's number types have functions like "wrapping_add" or "overflowing_add", which do not panic when overflowing and instead explicitly wrap around or return a result that must be checked.

You can easily write code that does not contain any possible panic points, if you want.


I don't think it's quite as easy to guarantee panic freedom as you think.

For example: do logging frameworks guarantee no-panic behavior? People can add logging statements practically anywhere, especially in a large team that maintains a codebase over significant time. One innocuous-looking debug log added to a section of code that's temporarily violated invariants can end up putting the whole program into a state, post-panic, in which those invariants no longer hold.

A lot of experience tells us that this happens in practice in C++, Java, Python, and other excpeption-ful languages. Maybe it happens less in Rust, but I'd be shocked if this class of bugs were absent.

Note that I'm talking about both safe and unsafe code. A safe section of code that panics unexpectedly might preserve memory safety invariants but hork the higher-level logical invariants of your application. You can end up with security vulnerabilities this way too.

Imagine an attacker who can force a panic in a network service, aborting his request but not killing the server, such that the panic on his next request grants him some kind of access he shouldn't have had due to the panic leaving the program in a bad state.

I'm not seeing Rust people take this problem as seriously as I think is warranted.


> A safe section of code that panics unexpectedly might preserve memory safety invariants but hork the higher-level logical invariants of your application

The usual way of dealing with this is to use impl Drop to cleanup properly. Resources are guaranteed to be dropped as expected on panic unwinds. Eg the database transaction rolls back if dropped without committing.

> Imagine an attacker who can force a panic in a network service, aborting his request but not killing the server, such that the panic on his next request grants him some kind of access he shouldn't have had due to the panic leaving the program in a bad state.

You need to be more specific. Why would the web server be left in a bad state because of such panics (in safe rust). All the memory will be cleaned up, all the database transactions will be cleaned up, mutexes might get poisoned, but that's considered a bug and it'll just cause another panic the next time someone tries to lock the mutex.


Sure, it's not trivial, but plenty of people who need this seem to do it.

https://crates.io/crates/no-panic


Huh. That's neat.


That's Anubis. A proof-of-work based protection against AI-Crawlers.

https://github.com/TecharoHQ/anubis


This readme could really benefit from a screenshot.


Seems like Claude is not good at generating screenshots yet.


Came here to say the exact same thing. At a glance, is it 3D or 2D? Console game like snake or with color and sprites? Etc.

Either screenshots or a gif would be nice.


I'm pretty sure that that didn't exist in 2015 ;)


My common sense tells me: "If you aren't paying for the product, you are the product." Am I the only one who finds it a bit weird, that they are hosting a the video conversion part of server with graphics cards etc. for free? I see no way to support that long term, unless they are doing something more than the data gathering with Plausible that they have on their page.

Anything I missed, that explains this?


Take a look at the Intel 8052 Microcontroller. It has a part of its internal RAM that can be addressed as bytes with normal instructions, but also has special bit-instructions. You could set and clear a bit and jump if is was set or not set. I used this feature a lot when making a little tetris game for the processor, but it was not essential.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: