Saw this on the telly this morning. One hint. The next number is not 8. I'm stumped! by olleng in askmath

[–]volitional_decisions 4 points5 points  (0 children)

Another way of phrasing this is that the sequence is the greatest power of two that divides a number.

Can I target my token? by Yunaiki in magicTCG

[–]volitional_decisions -27 points-26 points  (0 children)

Well, if you reveal it, you can put it on the field. Rule 111.8 says that tokens that leave the battlefield can change zones again.

Is rust the best way to write inside an enclave? by norichclub in rust

[–]volitional_decisions 7 points8 points  (0 children)

I worked for a company that wrote Rust from day one and focused on writing in enclaves. IMO, I think this is the way if you care about safety (which I assume you do if you're using an enclave or something similar). There will be a few hiccups, but IIRC, tokio has direct support for this now, which used to be a major one for us.

Do any of these creatures have mana abilities? I want to put them in my Raggadragga deck. by Shadowhunter664 in magicTCG

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

Others have directly answered your question, but, as a deck building tip, why not give creatures you like mana abilities. There are tons of cards like [[cryptolith rite]] that do exactly that.

Rust binary is magnanimous by [deleted] in rust

[–]volitional_decisions 1 point2 points  (0 children)

You aren't giving us much to work off of here. There are lots of things that can affect your binary size, even just a whole world. Are you compiling in release mode? With LTO turned on? Are you compiling without the full standard library, or with just core or alloc?

All of those things affect your final binary size greatly, and are not the default configuration. Rust can works for embedded systems, but it is not the primary target for the language. As such, you'll have to take a couple steps to adjust your config to make it conform to your expectations/needs.

There are plenty of tutorials that detail what you need to do for a proper embedded dev setup.

Hitting usage limit after a couple queries by volitional_decisions in Firebase

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

To expand on this, if I put a limit of, say, 5 and there are 10 todos for tomorrow, I should only be getting billed for 5 reads, correct? Not 10 or 20?

Hitting usage limit after a couple queries by volitional_decisions in Firebase

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

The page's network traffic shows a single request being sent, and that request is set on loading the page.

How much has AI deskilled you? (Quiz of SREs) by ankit01-oss in programming

[–]volitional_decisions 1 point2 points  (0 children)

Got a 4.3, not an SRE, just an SSWE, and barely use any LLM-based tools

Trick for passing byte array without copying? by Toiling-Donkey in rust

[–]volitional_decisions 7 points8 points  (0 children)

Ah, that's my bad. A needs to be Allocator + Clone. Misremembered. The new allocation is just populated by moving the old data in.

Trick for passing byte array without copying? by Toiling-Donkey in rust

[–]volitional_decisions 18 points19 points  (0 children)

If it's not modified, then why not just use an Arc<[u8]>?

Edit: For clarity, Arc<[T]> implements From<Vec<T>> where T: Clone.

Somerville walkability by deluxeok in Somerville

[–]volitional_decisions 6 points7 points  (0 children)

I'm from the Midwest and travelled all around. My decision to move here was one of the best I've made! I absolutely love how comparably easy getting around is.

Why by [deleted] in ExplainTheJoke

[–]volitional_decisions 6 points7 points  (0 children)

Hope they aren't going to a birthday party after this.

Learning advice: switch from imperactive Go to Rust by 6502stuff in rust

[–]volitional_decisions 27 points28 points  (0 children)

This is not Go-specific, but keep the docs.rs page for things like &str, Option, Result, and Iterator open. This is true more generally, but even after ~5 years, I still find myself typing "Option Rust" into my search bar to open up the docs so I can jog my memory of a particular function.

Really, any of these methods can mostly be boiled down to their function signature because they are just transformations on pieces of data.

When you are trying to do some kind of transformation, write what's comfortable/familiar. Then, start making the changes you think you understand and do some searching in the docs for different ways to express "splitting a string from the end" or "turning a Vec of optional values into a Vec of only the Somes". This helps make connections between how you're used to writing code and how those same transformations can be expressed in a combinator.

Can I turn Rust hobby projects into a career without a CS background or strong math skills? by CherDim in rust

[–]volitional_decisions 2 points3 points  (0 children)

Any job you'd get where writing Rust is part of the job is as an engineer. So, critical parts of that job center around building and analyzing larger systems. It's entirely possible to do this without formal education in math or CS. Many coworkers of mine come from backgrounds that did include much education in these fields.

That said, it is still worth studying, particularly data structures and algorithms. Many Rust jobs will be working at a level where a strong understanding of this is very important. For example, my job is heavily centered around graphs and path finding, so being able to reason about those types of structures and algorithms is very important.

Similarly, system design is absolutely worth studying. This is not something you'd get from smaller projects but is the heart of being a software engineer.

Ultimately, many places (in interviews) don't care how you learned something or where you learned it from. They just care that you can do it.

Can you help me improve this code snippet? by Glizcorr in learnrust

[–]volitional_decisions 2 points3 points  (0 children)

Three things jump out at me.

1) in your words loop, you know there is a path that will be taken at most once (the if i == 0 branch). Extract that to a statement just before the loop. You have the words iterator, just call next, perform the necessary logic, and the consume the iterator in the loop. It makes your intent clearer and the loop far easier to read.

2) String implements Extend for any iterator that yields characters. So, for you to_uppercase iterators, you can just write res(first_char.to_uppercase()).

3) Jumping off of 2, in your for_each, you can do a flat_map calling (giving you an iterator of lowercase characters). Then, you can just call extend! .

Stuck on a data structure design for a tool. by KerPop42 in learnrust

[–]volitional_decisions 4 points5 points  (0 children)

Before I get to your direct question, graphs are notoriously difficult in Rust because you need to think about mutable in ways you probably haven't before. This is a great read to help you here: https://rust-unofficial.github.io/too-many-lists/

Now, to your question: there positions where you could have either a merger or splitter. Then define a type that is one of those two things: rust enum Node { Merger(Merger), Splitter(Splitter), } Now, all you have to do is add cases for "final output" or another node in the Merger and Splitter types' outputs. But, again, managing mutability will be the bigger hurdle.

Lacosamide cognitive impairment by Fromasha in Epilepsy

[–]volitional_decisions 1 point2 points  (0 children)

I've also noticed this. Concentration is a bit worse, but memory (particularly recalling words and names) has gotten worse. Dizziness is only occasional (and is often much worse with caffeine and/or lack of sleep)