[-] nous@programming.dev 20 points 3 months ago

Yeah, Steam may be effectively a monopoly, but it's because nobody else really wants to compete with them at their level.

Steam has two types of customers. Us the gamers where we can decide which platform to use. They have an effective monopoly on us because they provide a good service. But with a large game library we are locked into steam as well and cannot just switch to a different platform. If valve ever did decide to be evil then we are screwed.

But developers are also customers of valve. And this is arguably where valve makes their money. They take a cut from the developers sales. Devs cannot just use a different platform without cutting out a huge userbase. This gives valve a real monopolistic control over developers.

[-] nous@programming.dev 21 points 1 year ago* (last edited 1 year ago)

The indicator being stuck is a recently fixed issue:

Fixed a case where the battery level indicator could become stuck

https://store.steampowered.com/news/app/1675200?emclan=103582791470414830&emgid=529850584204838038

[-] nous@programming.dev 20 points 1 year ago* (last edited 1 year ago)

252 of that 592 used memory is buffers/cache, not application memory. That is used by the kernel for kernel buffers and the filesystem cache - IE files read by something at some point. The kernel keeps them in memory in case they are needed again to speed up file reads. You can effectively ignore these vales as they will always grow to fill your ram and will be evicted when programs require memory and there is not enough free.

These tools are not lieing to you, just telling you something other then what you are reading into them. Tracking and reporting on what is using memory is a complex topic and here used is just what is physically allocate. It doesn't mean much over all as it always tends to be full of your system has been running for a decent amount of time. Available is typically the more useful one to look at as it is an estimate about how much the kernel can reclaim now if an application request it without needing to swap things out.

[-] nous@programming.dev 21 points 2 years ago

The biggest/only real problem is the .unwrap(). This will cause the program to exit with an error message if the user inputs an invalid value. Which is not a great user experience. Better to reject the input and ask them again (aka start the loop again). You can do this with a match on the returned value of parse with a message and a continue on Err (good time to learn about enums and pattern matching as well).

A minor improvement can be done to this:

        input = input.to_string().replace("\n", ""); // removing the \n
        let user_input: u32 = input.parse::<u32>().unwrap();

By replacing it with:

        let user_input: u32 = input.trim().parse::<u32>().unwrap();

Which has a few advantages:

  • it removes all white space, including tabs and spaces from both the start and end.
  • it requires no allocations.
  • it is one fewer lines while still being clear what it is doing.
  • no mutability needed (though input still needs to be mutable here in other cases this can be a benefit).

These are more nitpicks than anything substantial - would lead to nicer code in more complex situations but negligible at best in this code base (only really pointing out to give you some things to think about):

Since you break in the win condition the attempts += 1; can be moved out of the other branches at the same level as the input.clear().

Rand has a gen_range function which can be used like:

rand::thread_rng().gen_range::<u32>(0..=100);

Though typically you would save the thread_rng() output to a local and reuse that throughout your program instead of creating one each time - here you only need one number so that matters less. The Rng trait has a lot more convenience function on it as well so it is generally worth using over just the random() function. Though in this case it makes very little difference overall here - typically you would want to opt for one of those methods instead so is worth knowing about.

I dislike the name x as it is very ambiguous. IMO short letters should be used only in smaller scopes or when they represent some sort of mathematical value. Here I would use secret_number or secret_value or something more descriptive. Though in this case there is not a much better domain name here, more often there is.

[-] nous@programming.dev 21 points 2 years ago

Worst then that, it is an excuse to continue or increase emissions and distract people from real solutions. We need to reduce emissions first. It might be valuable someday once the low hanging fruit has been dealt with.

[-] nous@programming.dev 20 points 2 years ago

Of these 25 reasons, most apply to a lot of languages and are far from Java exclusive or even java strong points. Pick any mainstream language and you will hit most of the benefits it lists here. With quite a few being almost meaningless. Like this:

Java/JVM/JIT can achieve runtime optimization on frequently run code, especially on something that’s running as a service so that you avoid the overheads from JVM startup times.

Compiled languages generally don't need a JIT or to be optimized at runtime as they are compiled and optimized at compile time. And most language that don't have a runtime like Javas already run faster than Java without its heavy startup time. Language with JITs are generally interpreted languages which have these same benefits as java lists here. Though do often suffer from other performance issues. But really at the end of the day all that really matters is how fast the language is and how good its startup times are. Java is not ahead of the pack in either of these regards and does not do significantly better then other languages in its same class (and often still drastically sucks for startup time).

Or

Much of a company’s framework can be stable Java, with Scala or Clojure-backed business logic.

Many languages you can embed other languages inside. Nothing really special about scala or clojure here except that they work well with java. And I don't really see this as a major benefit as most places I see dont separate their core code and business logic into different languages.

And the remaining issues that are more java specific are:

Java was one of the first mainstream GC strongly typed OOP languages. So it got its niche.

Java has been one of the main programming languages taught in colleges and universities in the last few decades.

Java’s Legacy Migration: Many banks in particular migrated legacy systems to Java in the early 2000’s when it was getting a lot of popularity and the industry was collectively in the midst of a huge OOP fever dream.

Which all paint a picture - it was popular long ago and taught in universities and lots of business pushed it when back in the day. And now it is hard to move off it.

And lastly:

Oracle

What? How is this a point? If anything this should be a massive negative.

Not exactly 25 reasons to pick java in financial enterprise.

[-] nous@programming.dev 20 points 2 years ago

They said on a linked post:

Make fish available on servers that run old LTS distros Making it easy to build and run

Which suggests to me they are using features from newer versions of libraries then exist for older LTS distos. Making it hard to compile and run on them. Most of rust libraries are statically compiled so that is not an big issue for rust. Though this is just speculation on my part.

[-] nous@programming.dev 20 points 2 years ago

The license is MIT, so should be fine for most things

[-] nous@programming.dev 20 points 2 years ago* (last edited 2 years ago)

Oh, just invest in adobe and get it developed for Linux - easy, why didnt anyone think of this before. And better yet, if they do invest they could make it a PopOS exclusive!!?!?!! \s

It wont work because Adobe does not care and there is not enough market share in Linux for them to bother with it. No amount of money that PopOS has will be able to convince Adobe to develop it for Linux and there is no way in hell Adobe will give them access to their source to develop it for Linux. That whole argument is just a non-starter.

[-] nous@programming.dev 21 points 2 years ago* (last edited 2 years ago)

TBH, I find the whole premise a bit silly. The one use case the original video talks about there this might be a good idea is when you have something like a MonsterId(String), and argues for MonsterId(Arc) instead - which I think is an anti-pattern. Use MonsterId(usize) and it becomes far cheaper to clone than even an Arc. There is no need to lug around strings as ids - which are presumably going to be used to look up values in a hashmap or similar (which again, I would suspect it is faster to has a usize than a string of any type).

Most of the rest of the time cloning a string is not a huge issue or if it is &str is often good enough. I find it rare that you would ever need the clone performance and multiple ownership of a Arc.

There are also crates like smallstring, smallstr etc, that are stack allocated strings up to a certain limit before they start allocating. Which would be worth a look at and see how they preform compared to Arc or String. Since most things I bet they were using Strings for would fit inside these types just find without the extra allocation.

It is a neat trick to have in your toolbag - but not the first thing I would jump for when dealing with strings.

[-] nous@programming.dev 20 points 2 years ago* (last edited 2 years ago)

Car manufacturers did a lot of lobbying to class them as light trucks rather than cars so they can benefit from more lax emissions regulations. Then marketed the hell out of them as the more they sold the less they have to comply with the stricter emissions regulations for normal cars.

So as with every shit thing these days the big reason is to increase profits at any expense.

After successfully lobbying lawmakers to class these vehicles as light trucks rather than cars, binding SUVs to less stringent fuel efficiency standards, the industry set about slotting them into almost every arena of American life.

https://www.theguardian.com/us-news/2020/sep/01/suv-conquered-america-climate-change-emissions

[-] nous@programming.dev 20 points 3 years ago

They do have open-source firmware though. Not sure if all of it is but at the very least released:

And it looks like they are looking at coreboot, they have made attempts to port it (unsuccessfully) and given unlocked laptops to people in the coreboot community - though it seems like this is not a trivial task to do: https://community.frame.work/t/responded-coreboot-on-the-framework-laptop/791

view more: ‹ prev next ›

nous

0 post score
0 comment score
joined 3 years ago