• 0 Posts
  • 21 Comments
Joined 2 years ago
cake
Cake day: June 27th, 2023

help-circle

  • The example even used unwrap_or_else where they should use unwrap_or. Then it uses std::i64::MIN as fallback value where they could use something like 0 that would be a better example and honestly make more sense there.

    let parsed_numbers = ["1", "not a number", "3"]
        .iter()
        .map(|n| n.parse().unwrap_or(0))
        .collect();
    
    // prints "[1, 0, 3]"
    println!("{:?}", parsed_numbers);
    

    Even without trimming this to something less convoluted, the same functionality (with different fallback value) could be written in more readable form.

    Obviously in the context of the page something like this would make way more sense:

    maybe_number.unwrap_or(0)
    

    Or perhaps more idiomatic version of the above:

    maybe_number.unwrap_or_default()
    


  • You can’t do much about users that just don’t care. But more technically inclined folks often do care and these are the people that develop the web and maintain the computer/browser for other people.

    A lot of folks in my circle use chrome, but the moment the AdBlock plugin stops working they’ll likely switch to anything that works better. They are not necessarily too concerned about privacy, but they also don’t want to have most of their browsing made effectively impossible by ads everywhere.

    I mean, just try and use the web without any sort of blocking. A lot of sites don’t even have their content visible.


  • I don’t have much experience with TS, but in other strongly typed language it goes even further than string vs number.

    For example you can have two numbers Distance and TimeInSeconds and even though they are both numbers, the type system can make sure that you won’t do distance+time.

    It can also let you do distance/time and return Speed type.

    It will prevent many logical errors even though everything is technically a number.



  • “If” being the key word here. There are nuances to be considered. One DB might run really well on arm, the other not so much.

    I’m saying it as huge fan of the arm servers. They are amazing and often save a lot of money essentially for free. (practically only a few characters change in terraform) In AWS with the hosted services (Opensearch, and such) there’s usually no good reason to pay extra for x86 hardware especially since most of the intricacies are handled by AWS.

    But there are workloads that just do not run on arm all that well and you would end up paying more for the HW to get to the performance levels you had with x86.

    And that’s beside all those little pain points mentioned above that you’re “left to deal with” which isn’t cheap either. (but that doesn’t show up on the AWS bill, so management is happy to report cost savings)


  • I’m not sure where this idea of high profile target comes from. The sim swap attack is pretty common. People just need to be in some credentials leak DB with some hint of crypto trading or having some somewhat interesting social media account. (either interesting handle or larger number of followers)

    There are now organized groups that essentially provide sim swap as a service. Sometimes employees of the telco company are in on it. The barrier to entry is not that high, so the expected reward does not need to be that much higher.




  • Yeah it’s pretty amazing system all things considered. It’s kind of as if 8-bit home computer systems continued to evolve, but keep the same principles of being really closely tied to the HW and with very blurry line between kernel and user space. It radiates strong user ownership of the system. If you look at modern systems where you sometimes don’t even get superuser privileges (for better of worse) it’s quite a contrast.

    Which is why it reminds me of Emacs so much. You can mess with most of the internals, there’s no major separation between “Emacs-space” and userspace. There are these jokes about Emacs being OS, but it really does remind me of those early days of home computing where you could tinker with low level stuff and there were no guardrails or locks stopping you.




  • Perhaps it’s kind of inevitable to have some bloat. For example apps these days handle most of the languages just fine including emoji, LTR/RTL and stuff. Some have pretty decent accessibility support. They can render pretty complicated interface at 8k screen reasonably fast. (often accelerated in some way) There is a ton of functionality baked in - your editor can render your html or markdown side by side with source code as you edit it. You have version control, terminal emulator, language servers, etc…

    But then there’s Electron, which just takes engine capable of rendering anything and uses it to render UI, so as a result there’s not much optimization you can do. Button is actually a bunch of DOM elements wrapped in CSS… Etc… It’s just good enough for the “hardware is cheap” approach.

    I think Emacs is a good example to look at. It has a ton of built in functionality and with many plugins (either custom configuration or something like Doom Emacs) you can have very capable editor very comparable to the likes of VS Code. Decades back Emacs had this reputation of being bloated, because it used Megabytes of RAM. These days it’s even more “bloated” due to all the stuff that was added since. But in absolute numbers it does not need as much resources as its Electron based peers. The difference can easily be order of magnitude or more depending on configuration.


  • Yeah I see your point there. It is indeed a bit of chicken and egg problem, but it’s not 35% for laptop with swap-able hardware. The customization is probably the main selling point. If you want Ethernet port in your laptop, that rules out pretty much any recent model out there. Add upgrade-able memory, storage (or an option for multiple storage devices), some more specific port selection (like full size HDMI) and you might only have handful of models to choose from.

    Can you do a lot of that with USB-C dongle? Sure, but dongle isn’t built in and also costs extra money. Are there many people out there that don’t need any of these ports? Sure! But if you’re one of those that do, this might be your only real option. Especially once we get to the more exotic modules like that RGB Macropad.

    I’m personally not in that market at all, but I definitely see why people might want this and saying that it’s 35% markup just for the ability to upgrade and repair is missing the point a bit.




  • Yeah, you absolutely have to set up for WFH. Which is no different than working from office. We just take that effort for granted.

    Another issue is, that lot of the office work cost is not paid by companies. (At least not directly) For example the commute to work can easily be 10% of overall time spent from leaving your house until returning back home from work. But both the commute cost and time spent is paid by employee. So obviously companies are reluctant invest into WFH, because that does generate some expenses.


  • If you design for work in office, WFH probably isn’t going to be more productive and the other way around. A lot of companies made the mistake thinking that WFH is the same as regular office but with everyone being home. This is not the case.

    I have experience with company without WFH employees, where any team that wasn’t literary all in the same building had some serious communication and cooperation isuues. I have experience with company where there was no office whatsoever, people were across globe and time zones and we managed to cooperate effectively.

    I’m not saying that WFH can be always more effective. But in many cases it’s just terribly implemented change and companies are just moving back to investing into office space instead of investing into proper WFH culture.

    Folks at Zapier wrote an excellent guide if anyone is interested. It’s serious effort, sure. People often feel like this is extra work to keep WFH viable, but they tend to forget that keeping the office running is also a serious effort. Many companies probably have office manager, how many of these have some alternative of that for WFH?


  • This is programmerhumor so perhaps allow for a bit of hyperbole on my part. I wasn’t completely factual.

    However the initial days of Docker were effectively promising to solve the exact same “it works on my laptop” problem. The idea was that developer builds docker image and pushes it to repository where it can pass through CI and eventually the same image gets to production.

    As you can see, this effectively reproduces the EXACT content as well, because you transfer the files in a set of tar files.

    It didn’t work for many reasons. One of which is the fact that it’s often not so much about the exact files, but the rest of the environment like DBs, proxies, networking, etc that is the problem. I’ve seen image misbehaving in production due to different kernel version/configuration.