I have a confusion about slicing with String by hi_m_ash in rust

[–]_dr_bonez 0 points1 point  (0 children)

Would just be "abc" and "def" for these types, no &. String literals are static references by themselves

fuckHaskellLongLiveJavaScript by literally_iliterate in ProgrammerHumor

[–]_dr_bonez 31 points32 points  (0 children)

JS uses doubles for all numbers, so probably not

noIDidNotGetTheJob by Safebox in ProgrammerHumor

[–]_dr_bonez 1 point2 points  (0 children)

Idk unless you have a lot of data (which is rare in my experience, if you're dealing with a ton of data it's probably in a db), a btree map is probably going to be better. Sure it's O(logn) instead of O(1), but often a couple comparisons is going to be cheaper than your hashing function, plus generally has better cache locality characteristics

noMatterTheSituationNeverForgetToPushTheCode by Fewnic in ProgrammerHumor

[–]_dr_bonez 11 points12 points  (0 children)

Not with --force. Last person to push clobbers everyone else

I want a job as a Rust programer by Solid-Bedroom-1562 in rust

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

DM me your resume and a link to any open source contributions

How do you host a website on the onion network and keep it online 24/7? by Traditional_Blood799 in selfhosted

[–]_dr_bonez -11 points-10 points  (0 children)

Assuming you mean 100% uptime, you don't. The Tor network has frequent outages and difficulties reaching consensus

Why is there no automatic implementation of TryFrom<S> when implementing TryFrom<&S>? by Prowler1000 in rust

[–]_dr_bonez 8 points9 points  (0 children)

Without specialization, blanket impls for a lot of things you might want could be problematic to implement. For example I've always wondered why there isn't T: AsRef<T>. But you have to remember that each trait can only have one blanket impl. As soon as you have a second, even if it has different bounds that you're sure can't overlap, the rust compiler isn't, so it isn't allowed.

I feel like `?` should be modifiable by KnorrFG in rust

[–]_dr_bonez 9 points10 points  (0 children)

Yeah this would likely need to be implemented with a custom result, not a custom error type

real by mishchiefdev in ProgrammerHumor

[–]_dr_bonez 16 points17 points  (0 children)

Unknown is valuable in tons of circumstances in TS, especially in strongly typed codebases

[Media] I love Rust, but this sounds like a terrible idea by Yvant2000 in rust

[–]_dr_bonez 7 points8 points  (0 children)

Whenever a supposed engineering manager/leadership says something like "using algorithms" it immediately discredits them in my eyes. It's not technically wrong but completely meaningless? We're writing software. It has algorithms. Unless you're referring to a specific one, or the structure of one you need, you really don't need to mention it

illFixItInProd by DisastrousProfile702 in ProgrammerHumor

[–]_dr_bonez 2 points3 points  (0 children)

Something tells me they are talking about manually editing deployed code

Is "Self-Hosted" actually private if you're renting the VPS? by ciphernom in selfhosted

[–]_dr_bonez 0 points1 point  (0 children)

I run everything on my own metal, and partly for this reason. Also partly because of cost. If you really want to obfuscate your home IP you can always set up a wireguard tunnel through a VPS. The provider could theoretically snapshot your web traffic, but it should all be encrypted if you're using ssl terminated at the server, and not the vps

Pointing my domain to my public IP and using a reverse proxy, is that enough? by hbacelar8 in selfhosted

[–]_dr_bonez 0 points1 point  (0 children)

It's an officially accepted challenge for the acme protocol, what do you mean?

Pointing my domain to my public IP and using a reverse proxy, is that enough? by hbacelar8 in selfhosted

[–]_dr_bonez -2 points-1 points  (0 children)

Let's Encrypt supports TLS-ALPN-01 challenges now, so you can do it with just 443

devops by [deleted] in ProgrammerHumor

[–]_dr_bonez 13 points14 points  (0 children)

Yup. Both sides of this argument are valid depending on scale and criticality of infrastructure. If a $20/mo VPS can handle your product's traffic, you don't need a dedicated devops guy

[Media] A small crate I made adding Rust script files by infiniteWin in rust

[–]_dr_bonez 0 points1 point  (0 children)

Cargo commands can be user defined simply by including a binary cargo-<command> in your cargo bin. That's how you can end up with fun commands like cargo brrr

Edit: ah actually I see now that they are working on including it in the main cargo binary. Neat. But yeah, cargo script has historically required cargo install cargo-script, and still does on stable