[-] livingcoder@programming.dev 4 points 2 months ago

I leave mine in the trunk and have only walked into the store without them twice. Not forgetting them before walking into the store and putting them back into the trunk after unloading them is the hardest part.

[-] livingcoder@programming.dev 4 points 2 months ago

I think this prediction will age extremely well if we last that long. That's a very big "if".

[-] livingcoder@programming.dev 4 points 3 months ago

There are a few different ways to solve this problem without using unsafe and I'm not sure what would be considered idiomatic. Another option is to ultimately encapsulate all of the nodes in a reference-counted box like Rc or Arc and specify the type of your parent/child/sibling references to the same reference-counted box type. With that, you just share cloned instances around as needed.

The primary drawback here is that for mutable access you end up having to perform a lock every time on an underlying Mutex (or something similar). You also no longer have direct access to the singular instance of the node.

There are pros and cons to every approach.

[-] livingcoder@programming.dev 4 points 3 months ago* (last edited 3 months ago)

One way of solving this is to structure all of your nodes into a HashMap with the node ID as the key and the node type as the value. The underlying node type could have node IDs for referencing purposes. You lose the ability to reference the parent/child/sibling directly, but you avoid direct circular dependencies. That said, now you need to manage dangling references for when the node is removed from the main HashMap collection.

[-] livingcoder@programming.dev 4 points 5 months ago

In Rust, using the Option and Result types make the general flow of the application much easier to organize, make modular, and reuse.

[-] livingcoder@programming.dev 5 points 9 months ago

What did he whisper in her ear?

[-] livingcoder@programming.dev 4 points 10 months ago

Oh, okay. Thank you for clarifying. So doesn't that mean we should never have a compiler written in the same language that it compiles? Why would we ever choose to make the mistake of using the same language? Is it ever not a mistake?

[-] livingcoder@programming.dev 4 points 10 months ago

Who wanted a visual reboot of the Klingons?

Discovery had so many problems for me: ship flies on magic mushrooms, her mom basically doesn't care about her anymore by the end of it - the show-starting plot line, and the Klingons look like sweaty orcs.

[-] livingcoder@programming.dev 4 points 10 months ago

Who is writing SQL in the terminal?

[-] livingcoder@programming.dev 4 points 11 months ago

Do you happen to know of any good algorithms or numbers? Pi gets harder to calculate with each digit, so it's not a great candidate.

[-] livingcoder@programming.dev 5 points 1 year ago

Oh, I thought that the temp files were named by the user. If that's not the case, that these are not databases created specifically by McAfee in the temp directory, then I'm not sure what the appropriate solution should be. Obscuring the file type and how the file is used from users is still a bad practice.

[-] livingcoder@programming.dev 4 points 1 year ago

Yesterday doing a search using vim for a class that shared a lot of characters at the front with many other classes: /Bas.*Some I could have done a more precise search with better regex, but this was quick, easy, and worked.

view more: ‹ prev next ›

livingcoder

joined 2 years ago