PowerShell has everything related to argument parsing, helptext generation, tab completion, type coercion, validation etc. built-in with a declarative DSL. Many things work even directly OOTB, without requiring special annotations.
It is by far the nicest way to create CLI tools I have ever seen. Every other shell or commandline parsing library I ever tried, feels extremely clunky in comparison.
It encodes 20 random bytes in base64. Due to how base64 works, using 20 bytes ensures there is always an equals sign at the end. So the password contains uppercase, lowercase, numbers and special characters. Although it's not bulletproof - it could theoretically (I think) generate base64 strings without numbers or only lowercase letters etc.
Thanks! That's a solid method and definitely a good fallback when openssl or base64 are available.
passgen is more of a "C-first, offline, no-dependencies" tool — aimed at setups where even those might be unavailable or untrusted. But I’ll definitely keep developing it further, and may add some of the ideas you mentioned. Appreciate the input!
And those buttons needed to be round, because you could turn them to tune the radio or TV to a station. Pressing the button would then "snap" the tuner back to the preset position of the pressed button.
Ok, apparently there were different ways this was implemented. I remember a friends old TV as a child, where it worked exactly as I have described.
This is similar to what I mean, although it's a radio, not a TV and the buttons I remember where taller and had ridges on the side so they could be turned easily.
I think turning the tuning knob typically popped out the preset button, and holding the button down while turning the tuning knob changed the preset. I think this could be done with a loop of string (to control where the dial arrow was) and few springs and catches (to pull the string into position when the button was pressed).
I can’t imagine how the mechanism would work if each preset knob was a tuning knob.
There was only one knob. To set a preset, you first pull the button out towards you, which released sort of a clamp internal to the mechanism, then push the button back in, and it would clamp on the string at the new position.
I'm gonna have to shoot a video next time I'm at my parents' place, aren't I? (The old Blaupunkt still serves as a stereo in the garage.)
People are also struggling with Windows (any version). Especially installing programs (clicking through wizards, answering lots of questions they don't understand) and installing device drivers (how to even know what to do, to the get a device working? where to find drivers?) are often too much for non-technical users on Windows. Both of these are much easier (or unnecessary) on most Linux distros. No matter which OS they use, they will sometimes have to ask someone more knowledgable to solve some problems.
The situation is very hit or miss, I assume the downvoters don't have many problems because they're probably smart about the machines they try to put linux on.
Just this month, I put Linux Mint on an old dell laptop, and a custom built PC with a 1080 ti in it.
The laptop worked perfect, wifi worked out of the box, and it ran much smoother than it did with Windows 10.
The desktop was a pain because none of the 3 usb wifi devices I already had, worked out of the box. I started down the path of following some guides that got 2 of them "working" with the same steps, but they both behaved horribly. I gave up and ordered a device known to work with Linux for $50 because it just wasn't worth my time. It's connection speed is even faster than it runs on my windows machine, but there are frequent "blips" in the connection. Gah! Nothing is more demotivating than having trouble loading the web page trying to show you how to fix your networking issues.
The video card seems to work fine but none of the games I want to play via steam work nearly as smooth as I hoped, and they're old games, the newest one just turned 10 yo. I love what Steam is doing, and I'm sure I could get a lot of the games working pretty good with some more effort, but it's not the cakewalk it's often hyped up to be. I decided to just use it for old emulators, and stick to my Windows machine for other games.
On top of all that, it feels just about as "slow" as it did with Windows for basic operations. Again, I'm sure I could do some optimizing and get it blazing fast, but I don't have the time for that when I've already got things generally working fine on other machines.
I don't believe that. I think the desire for a new phone is mostly triggered by some unhappiness with the current one. For example because the battery doesn't last a full day anymore, the screen is cracked, it doesn't get security updates anymore or performance feels sluggish (because new OS and apps are more demanding or wasteful).
If replacing the battery or screen is expensive, buying a new phone becomes more attractive, since you might also get a better camera, more performance, larger display or other benefits. On the other hand, if I can order a new battery for cheap and swap it out in five minutes, I might just do that and keep my old phone for a few years longer.
For iPhone in the US battery replacement is not expensive.
A battery replacement not covered by the warranty or Apple Care ranges from $70 for really old phones to $100-120 for the latest models (the high end is a range because it depends on whether you have the regular model or a pro or max).
That’s way cheaper than a new iPhone. It’s even cheaper if you use a third party repair place instead of Apple. Third party repair places are common even in small towns.
In my small town there is one inside the Walmart and one in a standalone shop, and in the small town around 8 miles away there are two in the mall and one or two standalone ones.
It is already perfectly doable and easy to have the screen or battery replaced. It is not really expensive but there are parts and labour involved.
Recycling improvements would yield much more sustainable benefits but this is not as easy or PR-friendly as decreeing "just make then repairable" and then pat yourself on the back for saving the environment...
> It is not really expensive but there are parts and labour involved.
My SO's phone battery was busted after 3 years of use and replacing it would cost half of a new phone. Replacements battery itself is cheap, but amount of labor it takes to take apart current smartphones is just unreasonable.
I recently had my phone (Galaxy S21) stop charging and the SIM not be recognized anymore. I wasn't able to figure out why for a while until I opened the phone (it is relatively easy as the back is plastic and it bulges out if you blow into the SIM slot, making it easier to remove by hand). Ended up being that an internal cable came loose that connected the bottom board to the main components after I dropped it.
It just made me personally very happy that I was able to repair such a minor problem in the grand scheme of things. It really was just "detach the plastic back from the adhesive, unscrew some (~13) screws, reattach the cable, put everything back together". While I'd still love if it weren't that difficult it was all-in-all a very easy fix compared to other things I've done.
And yes, while the back still somewhat sticks to the case, is somewhat loose. I probably should replace the adhesive but I use a case anyway so it isn't really a problem.
So, it doesn't HAVE to be difficult to disassemble a phone, unless incentivised to do so, it is another revenue stream for manufacturers if they make it so that only they can repair it (pairing components cryptographically, to which they only have the keys to... just give the owner the fucking keys and let them decide...)
Smartphones (and everything in general) will be discarded at some point (realistically, sooner than later) with 100% certainty whatever slogans you want to push. So effective and efficient recycling is the most important for sustainability, it is absolutely crucial. But, as said, it is possibly the trickiest bit that requires in-depth industrial work across the whole chain so, instead, simplistic alternatives are pushed.
At one smartphone per human being over 10 years old, thinking that "reduce" and "reuse" (how?) will make a difference is completely unrealistic.
In the long term it makes zero difference if you don't recycle it. You'll end up with an unsustainable mountain of waste either way.
On the other hand, at the limit, with 100% recycling, whether you change every 2 years or 7 also makes little difference.
I really don't understand the push-back here. IMHO it really shows how wrapped by political ideology (degrowth, anti-consumption and ultimately anti-capitalism) this all is when the facts in terms of sustainability are clear: We must recycle very effectively and efficiently what we produce, otherwise in the long term we'll just marginally change the thickness of the waste the planet will end up covered with.
Regarding "degrowth", the one that we probably must go after to reduce our impact is population degrowth but strangely and illogically this is the one people don't want to hear about.
Population is declining everywhere (or will do after the lag of the current old generation). It's a serious problem as the world will have fewer workers looking after more non-workers who are used to a higher standard of living htan before.
It's pretty much settled that it's far better to only make 1 device than 3, even if you were to recycle the 3 devices and not recycle the 1 device.
On the whole recycling is a con from companies who make a fortune by making more waste. Some recycling is far better than others, but reuse is orders of magnitude better.
In the past milk came in glass bottles, delivered, drank, and then reused. That's far better than recycling the bottles after just one use, although recycling glass is far better than plastic. But there's more money to be made selling you plastic in the supermarket several times a week, so that's what we have.
Same with electronics. Far better to reuse the electronics for multiple years than to get a new one each year. Same with clothing.
> I really don't understand the push-back here.
If you currently recycle 0% of a phone every 2 years, that throws 5 phones away every decade. If you recycle 0% of a phone every 6 years, that throws 1.7 phones every decade
If you currently recycle 30% of a phone every 2 years, that throws 3.5 phones away every decade. If you recycle 30% of a phone every 6 years, that throws 1.2 phones every decade
If you currently recycle 50% of a phone every 2 years, that throws 2.5 phones away every decade. If you recycle 50% of a phone every 6 years, that throws 0.8 phones every decade
To increase recycling levels to make it better to recycle, you'd have to go from 0% to 65% recycled, or from 30% to 75%.
As a consumer I don't want a new phone every 2 years, I don't have a new phone every 2 years. I've had 4 iphones in the last 15 years. I don't even pay for them - work gives them to me for free when I push a button. I don't want a new laptop every 2 years either, the laptop I'm typing on was new in 2017. I have a desktop that I rarely use, but that still does the exact same job it did in 2016 when it was new.
> It's pretty much settled that it's far better to only make 1 device than 3, even if you were to recycle the 3 devices and not recycle the 1 device.
It's certainly neither settled not factual.
> Far better to reuse the electronics for multiple years than to get a new one each year. Same with clothing.
The point isn't whether it is 'better' or not. The point is that if you don't ultimately properly dispose of them through recycling you haven't solved anything. At best you've slowed the rate at which we're covering the planet in trash but obviously the end result will be the same: It will end up covered.
> Population is declining everywhere
Not yet and current level is unsustainable (as we're seeing) whether you do symbolic gestures like keeping your smartphone longer or not.
If you use the same struct in both an HTTP API and an ORM, you're Doing It Wrong in my opinion. These should be completely separated. Exactly to prevent accidental leaking or injection of data.
I tend to disagree with that, also. :) Even within one codebase there's immense value in having separate structs/classes per "layer" or domain. E.g. a different set of structs for the database layer than for the "business layer" (or whatever your application's internal setup is).
When that boundary is moved to outside the application, so an HTTP API between microservices, I feel even more strongly (though indeed still not as strongly as in what you call a "public API").
E.g. I have seen plenty of times a situation where a bunch of applications were managed within one team, the team split up and now this "internal API" has become an API between teams, suddenly making it "public" (when viewed from the teams perspective).
Covered in the article along with a potential snafu - adding anything else (`-,omitempty`) turns it into a key "-", not the "ignore this field" indicator.
It is by far the nicest way to create CLI tools I have ever seen. Every other shell or commandline parsing library I ever tried, feels extremely clunky in comparison.
https://learn.microsoft.com/en-us/powershell/module/microsof...
reply