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

help-circle
  • you could look at the user agents and have 2 versions, one for normal browsers and one for Links and similar.

    you could also probably do something terrible with having an initial page that supports both, adding a cookie and detecting if the css file gets downloaded, then after that point serving them the css styled if they did or the table styled if not. you could even reload the page with js if it’s enabled and you detect the css was downloaded. this hinges on Links and similar not even downloading the css, which I’m not sure if is true.


  • even without hotswappable switches there’s a good chance you’d be able to replace the switch anyway

    if cleaning it doesn’t work, you should be able to look up how to desolder and then replace the switch yourself. you should only need a cheap soldering iron, some wick, some solder, and a new switch.

    as long as it’s easy to physically get the keyboard apart, the switches should be just about the easiest thing to solder there is





  • briantoProgrammer Humorexit
    link
    fedilink
    arrow-up
    5
    ·
    15 days ago

    repr is generally assumed to be side effect free and cheap to run, so things like debuggers tend to show repr of things in scope, including possibly exit

    also then it behaves differently between repl and script, since repr never gets run. to do it properly it has to be a new repl keyword I imagine, but I still don’t know if I’m sold on the idea



  • briantoProgrammingLukas Atkinso: Net-Negative Cursor
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    17 days ago

    yeah it’s incorrect bc it destroys multibyte characters, but no idea what you’re saying about u8 being a different type from unicode. the original code was reading bytes and converting them too? the typing isn’t the issue, you can still store utf8 as a series of bytes


  • I mean, I’m not a big fan of bash, the most likely default shell, so my advice would be to explore some alternate shells.

    I am a little surprised completions aren’t working in bash by default, but yeah idk if it’s possible to get the cycling through suggestions. double tap tab and it should at least list the options though.

    I’d recommend you hop between some shells and see what you like. most distros tend to keep the default shell pretty vanilla, the most change you’ll get is maybe zsh with some nicer defauls.

    nushell is great and would be my first recommendation. everything is structured like powershell, but way less verbose and more emphasis on integrating the existing cli ecosystem than pwsh’s commandlets for everything.

    fish or oh-my-zsh are things other people recommend. you don’t get structured data but they do give a better completion experience and other nice things

    I want to like xonsh, and used it for a few years, but it has the same problems pwsh has with separate ecosystems of structured commands and unstructured text. if you’re a python person though I’d consider it too though.


  • python isn’t the only language to do “execute everything imported from a particular file and all top level statements get run”. both node and c# (but with restrictions on where top level statements can be) can do that type of thing, I’m sure there’s more.

    python conventions are unique because they attempt to make their entrypoint also importable itself without side effects. almost no one needs to do that, and I imagine the convention leaked out from the few people that did since it doesn’t hurt either.

    for instance in node this is the equivalent, even though I’ve never seen someone try before:

    if (path.resolve(url.fileURLToPath(import.meta.url)).includes(path.resolve(process.argv[1])))
    {
      // main things
    }
    




  • briantoProgrammer HumorTell me the truth ...
    link
    fedilink
    arrow-up
    1
    arrow-down
    1
    ·
    27 days ago

    because with things that the compiler does, like padding for alignment, it frequently takes up more space than that. that was my argument the whole time. what til are you talking about? I’m talking about an extra layer you’ve decided doesn’t count. ofc sizeof bool will be a byte in all of those languages.

    a bool taking up a single byte is a fantasy that those languages use because developers generally don’t need to think about all the other stuff going on.




  • briantoProgrammer HumorTell me the truth ...
    link
    fedilink
    arrow-up
    2
    ·
    27 days ago

    c++ guarantees that calls to malloc are aligned https://en.cppreference.com/w/cpp/memory/c/malloc .

    you can call malloc(1) ofc, but calling malloc_usable_size(malloc(1)) is giving me 24, so it at least allocated 24 bytes for my 1, plus any tracking overhead

    yeah, as I said, in a stack frame. not surprised a compiler packed them into single bytes in the same frame (but I wouldn’t be that surprised the other way either), but the system v abi guarantees at least 4 byte alignment of a stack frame on entering a fn, so if you stored a single bool it’ll get 3+ extra bytes added on the next fn call.

    computers align things. you normally don’t have to think about it. Consider this a TIL moment.