nous

joined 2 years ago
[–] nous@programming.dev 19 points 7 months ago (1 children)

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 2 points 7 months ago

Spend more time reading documentation basically. You quickly learn what is available when you have to spend time looking it up. autocomplete is a nice speed boost but if it breaks and you cannot do anything then maybe you should spend some time without it and learning to lookup/read the docs. Quite often the docs give a lot more details about how things should be used that autocomplete cannot convey. IMO you should see it as a nice reminder of things rather then the main way you learn about APIs.

[–] nous@programming.dev 80 points 7 months ago (5 children)

This assumes people are rational and that what they say they are willing to pay matches what they are actually willing to pay. And that is just the people not trying to abuse the system.

[–] nous@programming.dev 2 points 7 months ago (1 children)

So it would be really good for everyone if they were forced to sell Chrome

And who do you think would buy it? Loads of companies will be jumping at the chance not out of the goodness of their hearts but because they can see massive profits if they can control it. Very likely will start to squeeze it for all the profit they can and the enshitification process will begin.

For all the bad the Google has done they have kept chrome relatively free from the enshitification process. Likely as so much of their business would not exist if people didn't have a good browser to access their services on.

[–] nous@programming.dev 19 points 7 months ago (4 children)

should a third-party acquire control over chrome's development, mv3 gets shredded. restrictions and limitations on adblockers get scaled-back or reverted outright.

That is far too optimistic. If the courts force a sale then a for profit company will but it expecting a return on investment. Which very likely means more monetisation efforts like embedding ads or even more tracking built into it. It is a fantasy to think who ever gets it will scale anything you dislike about it back.

[–] nous@programming.dev 36 points 7 months ago (5 children)

That is not true though. The vast majority of people are people that don't do much on their systems at all. Maybe look at Facebook or a few sites, write the occasional document or email and maybe play a few simple games. The type of people that have never heard of Linux or even know what an OS is let alone able to switch to another one. Those types of people will be perfectly happy on Linux if it came pre installed.

The people switching ATM and having issues are the highly technical people that have far more complex requirements and for those it does depend on the person and what they need to do.

The low percentage of users is not a sign of of it not being ready, just the sheer marketing and effort Microsoft has put into making windows the default option.

[–] nous@programming.dev 2 points 7 months ago

Good, loved the idea of this when they first released it on mobiles but I hardly ever watch media on my phone so having a module app was basically pointless for me. Glad they have finally released a desktop app.

[–] nous@programming.dev 5 points 7 months ago* (last edited 7 months ago)

Any surface that looks/feels flat will be good enough for this use case, no need to find a bit of glass. Most table tops will do. You might need something better for flattening heat sinks, but for 3d prints you don't need to be that accurate. The plastic will deform far more under light pressure then the difference in any relatively flat surface you can find.

If you have one then there is no harm in using it - but also not need to explicitly look for something that flat. Any table will likely be good enough.

[–] nous@programming.dev 4 points 7 months ago

It looks like the gap is a whole perimeter missing likely caused by the infill being printed first? Or something else inside stopping it from being flush on the outside. This might not help now (unless you can separate the parts without damaging the outer perimeter) but before gluing it up it would have been best to get some sandpaper on a flat surface and sand the whole top flat until you have one complete outer perimeter. Or cut away the infill so the outer perimeter is the highest point.

If you cannot separate them without damage to the outer perimeters then you have a few options. First you could deform the plastic near then seam to cover it up. This can be done by heating the seam up with a hot air gun or hair dryer and pressing the layers together to close up the gap. You would really want to be gentle with the heat, just enough to let it start plasticity deforming with moderate/light pressure but not enough so it deforms under its own weight. Too much heat will also start to melt the surface edges of the layers rounding them over and making them look shiny which can look very obvious as well. So you really need to take it slow and apply as little heat as you can until it is just soft enough to deform.

The other options are to fill the gap. This can be done with any old filler but requires lots of sanding and painting afterwards. Or you can try to fill it with more plastic. You can use your printer to print small lines to give you something the right shape to fill the gaps, then it is just a matter of gluing or melting it in place. Super glue/CA glue will not be a good option here as it tends to leave white smear on 3d prints if you get any over spill which is very likely with a small gap. There are some glues designed for PLA that don't do this but I have never tried them myself. You could also heat the patch first until it can deform and press it in quickly though this can be tricky to do quickly enough before it cools and may not stick in well. There are also solvents you can get that dissolve the plastic and let it weld together, best way to use that is to dip the patch peace in it and press that into the gap trying to get as little on the print as you can - any spillage will start to dissolve the layer lines smoothing them over and making them look shiny.

Each of these does require some skill to do well and are easy to mess up making the print look worst - so i would try them out on some scraps first. Though you can always opt to use any filler and sand/paint the model after but that requires quite a bit of work to make it look good but is the only real option that you can keep going until it looks good.

[–] nous@programming.dev 3 points 7 months ago* (last edited 7 months ago)

I saw that when playing a game, it counted the time since it was opened while playing. But always saw it correct itself to actual time running withing a few seconds/minutes of closing the game on the deck.

[–] nous@programming.dev 4 points 8 months ago

The article calls that out explicitly:

When installing on unsupported hardware, Microsoft will push a small disclaimer that effectively cancels your warranty in case of compatibility-related mishaps. Likewise, you won't be entitled to receiving updates - including security updates - so we're back to square one.

What is the point in upgrading if you wont get security upgrades either way. Just more spyware and ads in the newer version.

[–] nous@programming.dev 1 points 8 months ago (1 children)

That is a lot of contradictory sets of requirements. If it is important to have on the deck then it is going to be trivially searchable online. Something that is niche that others are not really doing is going to be very subjectively interesting or useful. That makes it impossible to recommend anything without violating one of those requirements.

Instead here is some advice for finding project ideas: Look at your own interests/hobbies/things you need to do and start taking note of problems you encounter, grievances or annoyances you have or just things you think could be made/done easier. Out of those you can look at ones that you think a steam deck could help solve and from that you can start to investigate ways to use the steam deck to solve those problems. That is essentially how you find niche and interesting/useful things that are specific to you to work on. It can take time, but the more you think about it and write things down the easier it becomes to find projects to do.

Things that I can just easily stop.

Technically any non-online game will work since you can just put the steam deck to sleep with the tap of the power button when ever you want and resume later on. It takes a couple of seconds to go to sleep and so the only times it is annoying is when you are directly in the middle of some action - which is generally easy to avoid in most games if you know you are coming up to your stop.

Personally I have been playing monster hunter world like this which works quite well - especially since there is quite a bit of less action packed stuff you can do between the main story line.

view more: ‹ prev next ›