Just a basic programmer living in California

  • 16 Posts
  • 270 Comments
Joined 1 year ago
cake
Cake day: February 23rd, 2024

help-circle

  • It’s hard to predict the future, but I can point to a couple of indexes.

    TIOBE measures language popularity according to a variety of factors. It has Java on a steady downward trend over the last couple of decades, but shows it as still very relevant. TIOBE does not show comparable growth for Golang. I don’t see much growth in the top 10 for languages that are especially suited to autoscaling. C# looks to be steady as a language in a similar niche as Java.

    OTOH another survey from devjobsscanner that looks purely at job postings shows Java openings as very steady over the last couple of years. It also shows Java as more popular than Golang.

    So I don’t know exactly what conclusion to draw from that. But learning a new language can be a helpful exercise regardless to broaden your perspective, and to keep your skills sharp.

    Personally for the purpose of producing resource-efficient binaries for scaling I prefer Rust. It’s design incorporates some correct-by-construction strategies that promote high-quality code. And it’s well-suited for compiling to WASM so you can do stuff like deploy small services to Cloudflare workers for wild scaling. But I guess Rust isn’t making a big showing in the popularity charts. And Golang is popular for its lower learning curve.



  • You have two options depending on how you set your Typescript config.

    Option 1, the default:

    declare const xs: number[]
    const x = xs[4] // inferred type is `number`
    

    Option 2, using the noUncheckedIndexedAccess setting:

    declare const xs: number[]
    const x = xs[4] // inferred type is `number | undefined`
    

    Your AI assistant appears to assume option 2. Maybe you have that option enabled in your project?

    I’m sorry you had to spend a lot of time and frustration on this problem. But fundamentally Rust and Typescript have the same limitation: neither will catch out-of-bounds access errors on variable-length collections at type-checking time. They don’t have the necessary information to do that.

    Rust can catch out-of-bounds access on a fixed-length array if you use a literal number for the index access. But Typescript can do the same thing if you use a fixed-length tuple type (e.g. [number, number] instead of number[]).




  • hallettj@leminal.spacetoLinux@lemmy.mlLinux Users- Why?
    link
    fedilink
    English
    arrow-up
    6
    ·
    16 days ago

    I also use Niri. Previously I basically used maximimized windows on dual monitors. But I really liked the idea of switching to one ultrawide display. Maximized windows wouldn’t work well in that setup. Tiling hadn’t really worked for me because you end up with a screen full of awkwardly skinny or short windows, or windows hidden away in tabs. I also didn’t like the idea of managing floating windows with… a mouse.

    So I looked for a better option. I found PaperWM, and I loved it! Exactly what I needed! But it has a number of quirks, being an extension that entirely reworks Gnome’s window management. For a long time I wished for a native scrolling wm. And then Niri came along! And it’s so polished!


  • You might be interested to learn some history of societies without state-issued currency. The book “Debt: The First 5000 years” by David Graeber has lots to say about pre-modern systems of account. I’m aware there are some criticisms of the book so I don’t want present it as absolute truth - but it is an interesting on read, and it cites lots of anthropological studies.

    One of the points of the book - and I see there are also other anthropologists who take this view - is there is no evidence that there has ever been a barter economy. Economics curriculum typically talks about prehistoric barter as an introduction; but it looks like the barter story may have been made up by Adam Smith. Smith’s “Wealth of Nations” is highly insightful, and even predicts problems with capitalism that we currently face. But he probably didn’t have the anthropological background to write authoritatively about economies of prehistoric societies.

    Graeber does claim that there have been times when barter has been a stop-gap when there is a problem with money supply. So that’s a case where something like your app might come in,

    When barter has appeared, it wasn’t as part of a purely barter economy, and money didn’t emerge from it—rather, it emerged from money. After Rome fell, for instance, Europeans used barter as a substitute for the Roman currency people had gotten used to. “In most of the cases we know about, [barter] takes place between people who are familiar with the use of money, but for one reason or another, don’t have a lot of it around.

    These were temporary situations. The fall of Rome probably seemed like the end of the world to some people at the time. But new societal structures and currencies filled the gaps.




  • Some more points about Nix:

    • It’s a fast way to get to a specific setup, like a particular DE or Vulkan gaming support, thanks to abstraction that NixOS modules provide
    • There are tons of packages
    • Because packages are installed by adding a config entry you don’t accumulate random software you forgot you installed
    • Immutable updates and rollbacks - this is similar to benefits of atomic ostree distros, but the nix solutions are more general, so you have one system that does more things with a consistent interface
      • in addition to updating the base system, rollbacks also roll back user-installed packages, and configurations if those are managed via Nix
      • devshells provide per-directory packages and configuration using the same package repos as the host system, without needing to manage docker images
    • Nix is portable - much of what it does on NixOS can also be used in other distros, or even on Macos or Windows with the Linux subsystem
      • Configurations often combine NixOS and Home Manager parts. The Home Manager part can be used à la carte on other OSes is a way that is fully isolated from the host OS package management. For example on Macos this is a much nicer alternative to Homebrew.
      • devshells also work on other OSes
    • similar to Guix - but NixOS uses systemd, and is (from what I understand) more tolerant of non-free software (whether these are pros or cons is up to individual interpretation)




  • Hospitals are required to provide emergency treatment - what we call ED or ER visits - regardless of ability to pay. Patients are expected to pay for that treatment. It’s just that the hospital isn’t supposed to deny treatment based on whether they think patients will or won’t pay the bill. This is getting-stabilized treatment.

    This is an important point in arguing for universal healthcare: if people can’t afford treatment, they’re more likely to go to the ED where they won’t be turned away. ED visits tend to cost more than non-emergency, so that drives costs up.




  • That’s a helpful one! I also add a function that creates a tmp directory, and cds to it which I frequently use to open a scratch space. I use it a lot for unpacking tar files, but for other stuff too.

    (These are nushell functions)

    # Create a directory, and immediately cd into it.
    # The --env flag propagates the PWD environment variable to the caller, which is
    # necessary to make the directory change stick.
    def --env dir [dirname: string] {
      mkdir $dirname
      cd $dirname
    }
    
    # Create a temporary directory, and cd into it.
    def --env tmp [
      dirname?: string # the name of the directory - if omitted the directory is named randomly
    ] {
      if ($dirname != null) {
        dir $"/tmp/($dirname)"
      } else {
        cd (mktemp -d)
      }
    }