In the case of Rust, you can also omit the type annotation in the vast majority of cases and the compiler will infer it.
Ephera
- 14 Posts
- 509 Comments
Ephera@lemmy.mlto Programming@beehaw.org•Resources on how to understand what API are and work and everything that could be related?English2·3 days agoIt should be noted that theoretically, we don’t know how this external API is implemented. The vast majority of APIs are REST APIs and with REST APIs, there’s a decent chance that you can download an OpenAPI definition from the server which provides the API.
REST APIs are basically APIs which use HTTP(S) for transport and then there’s some specific rules how the API should be designed. Often times, these rules are not strictly followed and people still refer to such an API as “REST”, because they assume that any HTTP API is a REST API. But yeah, similarly the guides you’ll find will likely also work with general HTTP APIs.
Ephera@lemmy.mlto Programming@beehaw.org•Resources on how to understand what API are and work and everything that could be related?English1·3 days agoSounds to me like they’re not trying to create a website for now, but rather just process some data, which they can later display in a static webpage.
So, I’m guessing something like this:
+--------+ +---------+ +----------+ | Static | | Their | | External | | Web |---->| Own |---->| API | | Page | | Backend | | | +--------+ +---------+ +----------+
But yes, unless there’s a lot of data to crunch, the design one would usually go for is rather:
+-----------+ +----------+ | *Dynamic* | | External | | Web |---->| API | | Page | | | +-----------+ +----------+
So, the data calculations would happen in the user’s browser. You would still need some hosting for that webpage, but there’s lots of free services to put a simple webpage up.
And yes, when you go with that latter design, then JavaScript would be the typical choice. It’s still possible to do it with Rust, using WebAssembly (e.g. a colleague of mine has built a small statistics webpage which gets data directly from GitHub, using the Leptos framework), but it is definitely the less beaten path.
Having said all that, frankly, fuck the usual way of doing things. If you’re comfortable with Hugo for frontend work, then I think it’s legit to build a little backend to take over the dynamic part. Better to build a useful project and learn something than to get stuck trying to learn the ‘correct’ path of doing it. Especially if you’d rather learn about Rust than JS.
Yeah, the wording is confusing. A long time ago, there was no paid software, there was only software where you got the source code and other software where e.g. it was pre-installed on some hardware and the manufacturer didn’t want to give the source code.
In that time, a whole movement started fighting for software freedom, so they called their software “free”.
For optimal performance, you should rewrite it in Rust:
inline_python::python! { print(js2py.eval_js("(number) => number % 2 ? 'odd' : 'even'")(number)) };
unsafe
doesn’t deactivate memory safety. It only allows you to then create raw pointers and whatnot, which you could use to circumvent memory safety, but all the normal language constructs still do enforce it.
As in, you call
main()
recursively? Don’t think, I’ve ever tried that in any language…
Ephera@lemmy.mlto Programmer Humor@lemmy.ml•Explaining to your boss how Sr engineers are madeEnglish5·12 days agoThe problem is that corporations are not holistic organizations. In theory¹, a company could not have any juniors and always just hire seniors from the outside. And if your boss has reason to believe that this is more cost-effective, then they have to strive for that, even if they’re well aware that it cannot work when all companies strive for that.
¹) In practice, I’ve actually found that juniors are important, too. If you staff a project team with only seniors, you quickly end up in a situation, where they don’t talk enough to each other. They know how to solve things technologically, so they don’t need to tell each other about their challenges and what solution they chose.
Similarly, you likely end up in a situation, where only big problems are being tackled, because everyone can tackle big problems and they’re just very visible, highly prioritized problems. But when you add up enough small problems, they become just as problematic.
If you run a build command on the CLI, it should tell you the full type names…
The conventional ternary is structured like a normal if-else. In fact, in many languages with functional influence, they’re the same thing.
For example, you can write this in Rust:
let vegetable = if 3 > 4 { "Potato" } else { "Tomato" };
Those also happen to be errors you’d typically run into, if you don’t yet really know Rust…
According to the screenshot I took, it was a gargoyle berserker with an axe. I had some ridiculous luck with armor drops, so basically every resistance was either maxxed or close to it. I only really got into trouble down in Zot:5…
And hmm, I should do more with Lugonu. I never really have a reason to pick him, but that means I also don’t experiment with him, so I won’t really learn what reasons there are to pick the guy…
I actually do, yes. Hundreds, if not thousands, of hours played and I made it down there and back out exactly once. 🙃
Only in 3D. In 2D, you slap some pixels on top and there’s your scarf:
Ephera@lemmy.mlto Programmer Humor@programming.dev•top 5 unsolved problems in computer scienceEnglish2·17 days agoThat would be cool, but human brains are weirdos. If you’re already copying text, you could’ve edited or annotated it, for example. For example, if it’s an opinion you don’t entirely agree with, you might feel obliged to say so, because you have the ability to do so when it’s a text post.
If you want to call that irrational, I’m not arguing against that. I’m just saying it’s the reality we live in and I’d like to have tooling to deal with that better, because I would also prefer text to not be screenshotted.
Ephera@lemmy.mlto Programmer Humor@programming.dev•top 5 unsolved problems in computer scienceEnglish1·17 days agoYeah, really unfortunate that that’s not possible. Always having to take a screenshot and then type out letter by letter what’s on the screenshot, that can be quite annoying.
But even if copying text was possible, the reason people post pictures of text is to give proper attribution, but also to distance themselves from the content, so that it’s clear that they don’t necessarily hold the exact same opinion or that they might not have all the knowledge to defend the statements in the post.
Cross-posting could fill that same roll without screenshotting text.
Ephera@lemmy.mlto Programmer Humor@programming.dev•top 5 unsolved problems in computer scienceEnglish7·18 days agoWould be cool, if we could cross-post Mastodon posts…
I don’t have much experience with IPv6 yet either, but as I understand, the primary benefit is that you can get rid of a lot of the crappiness of IPv4, which you might just deem ‘normal’ at this point, like NAT and DHCP. It does happen quite a bit, for example, that we’d like a unique identifier for a host, but with IPv4, you need to store a separate UUID to accomplish that.
It’s the same thing as ternary, just without the
? :
syntax.