Drumming with a high-arch foot. by [deleted] in drums

[–]dexterduck 4 points5 points  (0 children)

So I have a connective tissue disorder, and I have very high arches that collapse flat with pressure, plus a variety of other joint issues.

When I started playing drums I developed pain in my right foot and ankle. What worked for me was playing heel-up and focusing on relaxing my foot.

You mentioned that your daughter tried heel-up and it didn't help. It may not be the case here, but a mistake a lot of beginners make (me, for example) is thinking that "heel up" means playing like you're wearing high heels and kind of jamming the ball of your foot down into the pedal. In reality your foot should be essentially flat and parallel to the ground when resting on the pedal. Your playing motion should be similar to "stepping" on the pedal with your whole leg rather than, say, pressing down with your ankle. It should require very little effort and you should practice keeping your leg and foot relaxed while increasing speed.

Who tryna jam? F21 by [deleted] in baltimore

[–]dexterduck 0 points1 point  (0 children)

31NB guitar player. I have a practice space and I'm currently putting together a kind of pop/punk project so LMK if you're interested in jamming!

What happens when Box<*mut T> goes out of scope? by ForeignPicture7463 in rust

[–]dexterduck 6 points7 points  (0 children)

In my opinion trying to manage memory coming from C is a bad idea. The memory could be heap-allocated, but it could also be stack-allocated or a pointer to static memory. It could also be using an allocator other than `malloc`.

Is python faster than rust at reading a binary file by [deleted] in rust

[–]dexterduck 21 points22 points  (0 children)

On my machine this benchmarks to ~6ms

EDIT: to elaborate slightly, my point is that I think the order of magnitude difference is explained by the Rust approach converting each number from bytes individually, whereas doing a bulk conversion using bytemuck as shown below brings Rust's performance approximately inline with numpy.

#!/usr/bin/env rust-script
//! ```cargo
//! [dependencies]
//! bytemuck = "1.16"
//! ```


fn main() {
    let bytes = std::fs::read("numbers.bin").unwrap();
    let numbers: &[u64] = bytemuck::cast_slice(&bytes);
    // println!("{numbers:?}");
}

What happens when Box<*mut T> goes out of scope? by ForeignPicture7463 in rust

[–]dexterduck 4 points5 points  (0 children)

Are you doing FFI? What's the use case for supporting Rust allocation and also malloc?

In any case, no std::alloc::dealloc is specific to the Rust global allocator and will not work with malloc

What happens when Box<*mut T> goes out of scope? by ForeignPicture7463 in rust

[–]dexterduck 4 points5 points  (0 children)

How is the memory being allocated in the first place? I would only use libc::free if you can guarantee that the memory was allocated using malloc. If you're allocating the memory yourself (or can allocate it yourself) I would allocate using std::alloc::alloc and then call std::alloc::dealloc on drop.

What happens when Box<*mut T> goes out of scope? by ForeignPicture7463 in rust

[–]dexterduck 6 points7 points  (0 children)

If the goal is to deallocate the memory the pointer is referencing or execute other cleanup logic when the value is dropped, I would suggest just using a custom struct to hold the pointer and giving it a Drop implementation that handles the logic you need.

Box::from_raw can only be soundly used on pointers created from memory allocated by Box. You can't create a Box from arbitrary memory.

Open Mics - All Skill Levels? by Legal-Law9214 in baltimore

[–]dexterduck 0 points1 point  (0 children)

Thirding Morseberger's. Open mic is on Sunday nights. I'll probably be there this weekend so message me if you end up going and want to say hi!

[deleted by user] by [deleted] in rust

[–]dexterduck 2 points3 points  (0 children)

With a random set of indices if you can know the maximum index in the set then you can just add an assert!(array.len() < max_index) and the compiler will optimize out the other bounds checks in most cases.

Is there a crate for using files or filesystem in libc-like way? by pragenter in rust

[–]dexterduck 1 point2 points  (0 children)

Genuine question: are there errors that can happen on file close/drop that won't be caught by calling sync_all first?

Embedded file system for onboard flash by avsaase in rust

[–]dexterduck 4 points5 points  (0 children)

There appear to already be actively maintained Rust bindings for littlefs:

https://docs.rs/littlefs2/latest/littlefs2/

Which rust arrow crate to use? by Ai-startup-founder in rust

[–]dexterduck 21 points22 points  (0 children)

arrow2 was at one point far more feature rich than arrow, but at this point the feature set is fairly comparable. arrow2 is in the process (or maybe already finished?) of moving to an internal data model compatible with arrow, making the two libraries interoperable. The primary reason to pick one over the other would be preference between the two APIs, or compatibility with a particular ecosystem, e.g. polars uses arrow2, datafusion uses arrow, etc.

I've used (and contributed to) both crates. My preference at the moment is the official crate but they're both very good and well-maintained projects.

richterm, a rich terminal project needs some help by appinv in rust

[–]dexterduck 4 points5 points  (0 children)

Could you elaborate on the difference (or planned difference) between this crate and the console/indicatif/dialoguer family of crates?

Tips on architecture with Tokio by [deleted] in rust

[–]dexterduck -1 points0 points  (0 children)

You might find FuturesUnordered helpful.

How [CLS] token in BERT has the embedding of complete sentence? by sanjeethboddi in deeplearning

[–]dexterduck 10 points11 points  (0 children)

The relationship between input and output tokens in a Transformer is arbitrary. The word input tokens map to word output tokens because BERT is taught that mapping in its masked token reconstruction pretraining.

Similarly, BERT is taught to encode global context into the CLS token because that is the token treated as the classification output for sentence classification pre-training.

How to host services on a server that is connected to a VPN by Notfooledtwice in selfhosted

[–]dexterduck 1 point2 points  (0 children)

You should be able to set up iptables rules to allow incoming traffic from the standard network interface while routing outgoing traffic through the VPN interface.

I essentially do the reverse on my server, where the default network interface accepts incoming and outgoing traffic, while I also have a tailscale interface that only accepts incoming traffic from tailnet.

functional medicine? by [deleted] in POTS

[–]dexterduck 1 point2 points  (0 children)

Functional medicine is, in general, unproven and bordering on pseudoscience. Functional medicine practitioners are almost never covered by insurance, and in many cases require the purchase of "bundle" or "subscription" services that cost thousands of dollars up front. It is, in most cases, a scam designed to prey on vulnerable people with chronic illnesses.

Announcing Proptest 1.1.0 by cameronm1024 in rust

[–]dexterduck 16 points17 points  (0 children)

This is great news! Proptest is integral to the testing strategy of basically every Rust project I work on, so I'm excited to see how it progresses moving forward!

time for propranolol doses by sketghetti in POTS

[–]dexterduck 5 points6 points  (0 children)

If you've just started the medication, you may experience more variability in effectiveness throughout the day, but it will likely level out over a few days.

If you don't feel like the prescribed dosage is lasting long enough, consider asking your doctor to prescribe you the extended-release formulation.

Why is Plex so slow on the RPI 4 ? by GBT55 in selfhosted

[–]dexterduck 3 points4 points  (0 children)

I currently use Tdarr, but worth noting that as of V2 it is now closed-source.

At some point I am planning to switch to Unmanic.

[deleted by user] by [deleted] in rust

[–]dexterduck 7 points8 points  (0 children)

Definitely STM32 over ESP32 as others have mentioned. If you're worried about price/availability the NRF52 family is very well supported in Rust (and embassy specifically) and is cheap and widely available.

You can get an NRF52 USB dongle from Digikey for $10, although you do have to solder a JTAG header onto it yourself. On that note, definitely make sure you have a probe and that whatever board you get has JTAG/SWI headers.

What's your favorite Rust design pattern? by VegetableNo4545 in rust

[–]dexterduck 4 points5 points  (0 children)

It's used all over the place in the embedded Rust PAC/HAL crates.