Ogeon

@Ogeon@programming.dev

This profile is from a federated server and may be incomplete. Browse more on the original instance.

Ogeon,

This depends a bit on what you are looking for. The library documentation is supposed to guide you to a practical starting point, but it’s still quite light on the theoretical parts. I haven’t really collected any specific beginner material, so this may still be a bit technical. There’s a ton of info about the basics, with varying levels of detail.

Assuming you are starting from almost nothing, I would recommend getting familiar with what RGB is and how its components relate. This is the format most images are encoded in and most devices and software use. The Wikipedia page is quite thorough, so no need to read all of it: en.wikipedia.org/wiki/RGB_color_model

Next, it’s good to know there are other models. HSV and HSL tend to be used in color pickers (a bit more intuitive than RGB), so you have probably interacted with them at some point. Again, the Wikipedia page may be a good source: en.wikipedia.org/wiki/HSL_and_HSV

That’s often good enough for producing colors and reading or writing images. If you want to go more into editing, it’s good to know that you will need to massage the values you get from the images. They usually don’t represent the actual light intensities, so they have to be made linear. Palette offers functions for it and represents it in the type system. This video is a slightly simplified explanation of the problem (when it mentions the square root, it’s an approximation): youtu.be/LKnqECcg6Gw

At some point, you will realize that neither linear nor non-linear RGB is the universal answer to good looking colors. They are used in different situations. There is another category of color models/spaces that are called “perceptually uniform”, meaning that they try to simulate or predict how we actually experience the colors and relate it to the numbers in the computer. This page shows the problem and introduces one of those models: bottosson.github.io/posts/colorwrong

I can probably provide more sources if you have any specific things you want to read about, but this is a start.

Ogeon, (edited )

The rabbit hole goes deep if you really feel like going spelunking. A basic understanding of RGB, HSV and HSL takes you very far and lets you do a lot of things already. It’s good enough as long as it looks good, after all. 🙂

You really don’t need to read all of it to get started!

Pretty critical PR for rust-msi is getting held up because the maintainer understands the intent but not why this works (github.com)

Not to throw shade, just wishing that somebody here can understand. Whenever an input is reasonably long, an analyzing function will crash, and this PR aims to fix that with a mechanism that contradicts the maintainer's understanding while a similar C implementation does not need this fix. Clearly, the maintainer has not heard a...

Ogeon,

A “mantra” more programmers should have is to fix the cause of the issue, and not just the symptoms. You have to understand what the problem is to be able to fix it.

Ogeon,

I would say it’s very useful when you are looking for one specific pattern, which happens a lot with Option<T>. Plus, being able to chain it in if / else if / else chains helps with organizing the code. It generally doesn’t grow as deep as with match.

That said, match is fantastic and it’s totally fine to prefer using it. if let and let else are there for those cases when you tend to discard or not need to use the other values than the matched one. How often that happens depends on what you are doing.

Ogeon, (edited )

Ah, taking inspiration from late 1940’s literature, I see. Smart!

What are the craziest misconceptions you’ve heard about programming from people not familiar with it?

As someone who spends time programming, I of course find myself in conversations with people who aren’t as familiar with it. It doesn’t happen all the time, but these discussions can lead to people coming up with some pretty wild misconceptions about what programming is and what programmers do....

Ogeon,

Simple features are often complex to make, and complex features are often way too simple to make.

Palette hotfix 0.7.5: works around color type compile error seen by Iced users (ogeon.github.io)

Just to reiterate what the linked blog post mentions; this isn’t a bug with Iced, specifically, but seemed to have been brought into light by having Iced 0.12.0 among the dependencies. Many variants of this bug has been reported to the Rust compiler repository and some seem to be fixed by the next trait resolver.

Ogeon,

ICC profiles are definitely part of the field, but that’s sort of a topic of its own. At least in terms of scope. The color space rabbit hole is so deep that I never got as far as including them. There are other crates that go into those parts and it should be easy to bridge between them and Palette.

I would say Palette is more for the “business logic” of working with colors, so converting, manipulating and analyzing. The difference from ICC profiles when converting with Palette is that you need to know more about the source and destination color spaces during compile time. ICC profiles use more runtime information.

Palette could be used for applications like image manipulation programs, 3D rendering, generative art, UI color theme generation, computer vision, and a lot more. A lot of people also use it for smaller tasks like converting HSL input to RGB output or making gradients.

Ogeon,

That’s nice to hear! And the Ok* color spaces are indeed quite neat

Ogeon,

Förutom att välja de som verkar mest intressanta (finska vinterkriget är en bra klassiker) skulle jag också säga att man kan börja med de senaste och gå bakåt. De har en del repriser med bättre ljudkvalitet som man lätt missar annars. Enstaka serier är de enda man kan behöva se till att man börjar i rätt ände av, men de är tydligt numrerade eller ihopklippta.

Thousands of people are reportedly lining up to have a portion of their skull removed and one of Elon Musk's brain chips implanted (www.businessinsider.com)

Earlier this year, the US Food and Drug Administration gave Neuralink, which Musk cofounded in 2016, approval to launch human trials of its device that Musk has described as a “Fitbit in your skull.” The FDA had previously rejected Neuralink’s bid for human testing in March over safety concerns, Reuters reported, including...

Ogeon,

It’s useful for keeping track of your mental gymnastics.

Ogeon, (edited )

It may be possible to use the https://doc.rust-lang.org/std/any/trait.Any.html trait to “launder” the value by first casting it to &amp;Any and then downcasting it to the generic type.


<span style="color:#323232;">let any_value = match tmp_value {
</span><span style="color:#323232;">    serde_json::Value::Number(x) => x as &amp;Any,
</span><span style="color:#323232;">    // ...
</span><span style="color:#323232;">};
</span><span style="color:#323232;">
</span><span style="color:#323232;">let maybe_value = any_value.downcast_ref::&lt; T >();
</span>

I haven’t tested it, so I may have missed something.

Edit: to be clear, this will not actually let you return multiple types, but let the caller decide which type to expect. I assumed this was your goal.

Ogeon,

I don’t know, something about seeing the same diarrhea pills ad over and over doesn’t exactly spark joy for me.

Ogeon,

My shower has its own favorite temperature and will slowly readjust itself to it.

Ogeon,

Also the Swedish classic “glida in på en räkmacka” ((to) slide in on a shrimp sandwich), which basically means to end up somewhere (location, career, situation) without any difficulties. The shrimp sandwich symbolizes a life without difficulties or in some luxury.

Then there’s also “halka in på ett bananskal” ((to) slip in on a banana peel), which is similar to the above, but not always favorable and you don’t have any plan or preparation. You just winged it or it just happened by accident.

Ogeon,

Static types aside, the file system has a lot of failure cases, which every language is affected by, and Rust makes them very visible. This can indeed feel like a lot, but it’s an intentional feature and makes more sense in larger projects. I guess the feeling may get amplified by the author’s style of long form posts with a lot of details.

Error handling in practice contains a lot of “let the caller deal with it”, using the ? operator to pass errors up the call stack. The more verbose options are for when you need to actually handle it.

Ogeon,

Absolutely, I didn’t mean to suggest otherwise. :) I’m just giving a bit of context and perspective from someone who has used it for a while.

Ogeon,

They interviewed multiple eye witnesses.

Ogeon,

To make things worse, that teapot doesn’t have a bottom surface.

Ogeon, (edited )

I’m of course only one single anecdotal sample, but the release cadence has probably been the least of my problems. My experience is that it’s fine to not update for quite some time. I have a crate with 1.60 (released about one and a half years ago) as MSRV, which means I run unit tests with that version, as well as stable, beta and nightly. The only pressure to upgrade is that some dependencies are starting to move on. Not that the newer compilers reject my code, not even anything deprecated.

Also, small, frequent releases usually takes away a lot of the drama around upgrading, in my experience. Not the opposite. A handful of changes are easier to deal with than a whole boatload. Both for the one releasing and for the users.

How would I make a 2d parallax environment that's cyclical and seamless?

I’m trying to make something in 2d where once the player reaches the end of the level, they’re back at the beginning and it just keeps going like that. I could imagine how this could be done in terms of setting the player position, but if I have a scrolling parallax background, how would I make that match up reliably?

Ogeon,

Do you want the background to have looped back to the start after one cycle? If so, you probably have to make it repeat N times more than the foreground, and move by a factor of 1/N in comparison to the foreground. Or put another way, have 1/N times the length. That means that after one cycle, the background has moved a distance of 1/N, but also repeated exactly once.

I hope this makes sense…

  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • kavyap
  • DreamBathrooms
  • tacticalgear
  • mdbf
  • InstantRegret
  • magazineikmin
  • Youngstown
  • thenastyranch
  • rosin
  • slotface
  • Durango
  • cubers
  • ngwrru68w68
  • anitta
  • cisconetworking
  • GTA5RPClips
  • modclub
  • tester
  • khanakhh
  • everett
  • provamag3
  • osvaldo12
  • Leos
  • normalnudes
  • ethstaker
  • megavids
  • lostlight
  • All magazines