• 0 Posts
  • 78 Comments
Joined 6 months ago
cake
Cake day: August 15th, 2024

help-circle

  • I feel like the “we don’t know what this function does” meme is kinda bad. There’s no reason beyond maybe time crunch why you shouldn’t be able to dissect exactly what it does.

    Despite this, the notion of a load-bearing function is still very relevant. Yeah, sure, you know what it does, including all of the little edge case behaviors it has. But you can’t at this time fully ascertain what’s calling it, and how all the callers have become dependant on all the little idiosyncracies that will break if you refactor it to something more sensible.

    It has been several times now where a part of my system of legacy code broke in some novel fantastic way, because two wrongs were cancelling out and then I fixed only one of them.






  • I got a 1U rack server for free from a local business that was upgrading their entire fleet. Would’ve been e-waste otherwise, so they were happy to dump it off on me. I was excited to experiment with it.

    Until I got it home and found out it was as loud as a vacuum cleaner with all those fans. Oh, god no…

    I was living with my parents at the time, and they had a basement I could stick it in where its noise pollution was minimal. I mounted it up to a LackRack.

    Since moving out to a 1 bedroom apartment, I haven’t booted it. It’s just a 70 pound coffee table now. :/


  • I’m surprised I’ve yet to hear of a homebrew industry of completely cutting out the microcontrollers and soldering in a Pi or something to drive the raw display. I don’t predict it to be easy, but it doesn’t seem completely unobtainable?

    Flashing a custom bootloader would be even better, but I assume that hasn’t been done because they got that shit cryptographically locked down at the chip level.


  • I think my purest moment of gaming bliss was experiencing completely blind the last handful of worlds in Super Mario Odyssey while buzzed with a few whiskeys. God, my soul was in orbit with that experience. Pure, unfettered joy and whimsy through and through and cinematically epic when it wanted to be. I wouldn’t call it the best game ever or even my favorite game ever, but god damn it, it struck me just right way at just the right time. It was something truly special.

    More games I will cherish will certainly follow, and have followed. But for that specific set of vibes and circumstances, I don’t know if I’ll ever top that peak from playing a video game ever again.



  • I only actively seek games I want to play. I have negative desire to hoard games I know I will never open. I probably wouldn’t take the clutter even if they paid me to take it. Steam or Epic.

    My Steam library is caked up with a bunch of decade old Humble Bundle packing peanuts and frankly I kind of wish it wasn’t.

    On the rare chance a game I’ve been wanting to play is the free givaway, I might take it if it’s on Steam just because I’m already invested in that platform. If Epic was the one giving it away I probably wouldn’t bother. I don’t need my games library splintered across multiple launchers. I’m already annoyed at having the one. I’d prefer no launcher at all.


  • pixelscript@lemm.eetoProgramming@programming.devThe yaml document from hell
    link
    fedilink
    English
    arrow-up
    8
    arrow-down
    1
    ·
    edit-2
    2 months ago

    The first four of them are “just how floats work”, yeah. Has nothing to do with JavaScript.

    typeof NaN
    // "number"
    

    Classic, yes, very funny. “NaN stands for ‘not a number’ but it says it’s a number”. But for real though. It’s still a variable that’s the Number type, but its contents happen to be invalid. It’s Not a (Valid) Number.

    The next three are just classic floating point precision moments.

    The Math.max() and Math.min() ones are interesting. Seems that under the hood, both methods implicitly have a fallback “number” that it compares to any argument list you give it that will auto-lose (or at closest, tie) with any other valid number you can possibly give it, so when you give it nothing at all, they leak out. Honestly, makes sense. Kinda ludicrous it needs to have defined behavior for a zero-argument call in the first place. But JS is one of those silly languages that lets you stuff in or omit as many arguments as you want with no consequences, function signature be damned. So as long as that paradigm exists, the zero-argument case probably ought to do something, and IMO this isn’t the worst choice.

    Every other one is bog standard truthy/type coercion shitlery. A demonstration of why implicit type coercion as a language feature is stupid.



  • Technically all you need is a DNS server.

    No computer knows where <whatever.tld> is located, unless that route is hard-coded in a host file somewhere. It always has to ask a DNS server for that information. If that DNS server doesn’t know, it will probably try asking some other DNS server, and so on up a chain. Eventually, it reaches a master DNS server that either has the answer on-hand somewhere in a database, or it says, “lmao, that doesn’t exist”. All the DNS servers and your PC down the chain take that answer. They might memorize it for a little while and hand it out to anyone who asks them, but after a while they’ll ask their way up the chain again to see if the answer has changed since the last time they asked.

    In order to “create” a TLD, all you have to do is make a DNS server that doesn’t ask up the chain. Just pre-program the list of valid domains yourself. You can make them anything you want. You can even “steal” existing domains and make them point to anywhere you want. Nothing is stopping you. Your DNS server will confidently report its pre-programmed answers to anyone who asks.

    The catch is that any Internet-enabled device that you want to be able to use your fancy new custom domains needs to be configured to ask your DNS server in particular. People would have to manually set your DNS server as their master server to ask, or they’d have to set it to ask some other DNS server that is itself pointed through some chain up to your DNS server. This is an explicitly opt-in system, and getting a significant mass of people to do that voluntarily is practically impossible. But it’s not technically impossible.

    The only reason you don’t have to do this manually with every single device you buy is because most devices either come from the manufacturer with a hard-coded list of DNS servers they should trust by default, or a device on the local network whispers in their ear and tells them who the local DNS server is and the device just goes along with it. It’s still technically an opt-in system; devices are simply either already “pre-opted in”, or there’s a system running on your network that auto-opts-in every device that connects, and most devices are designed to accept that auto-opt-in the moment they detect it.

    Provided you manage to get the devices you want to listen to your DNS server, you may additionally want to set up a root certificate authority. The thing that makes the little padlock show up in your browser URL box to let you know the connection is secure. Kind of like the DNS server thing, this is also very simple–just run a cheeky little OpenSSL command or two and you can be a root CA in no time–but it suffers from the same “opt-in” problem. You have to manually configure any device you want to use your system to trust your certificates. Most devices just come with a list of “acceptable authorities” built-in, and those defaults are all most people are using. But nothing is stopping you from adding anything you want to that list at any time. You’re just limited to doing it on a device-by-device basis.

    At my company, we’ve set up our own custom DNS server and our own root CA. We serve internal websites at a custom TLD we made up, and we sign them with our custom certificates to keep the connections secure. But that only works because we’ve manually configured our workstations to ask our internal DNS server for DNS requests, and we’ve manually configured all the workstations to trust our root certificate authority. A random device that connects to our network that isn’t configured with either of those things will not resolve any of our custom domains, nor will it securely connect to them. It also breaks if the configured devices aren’t on the local company network, since the DNS server isn’t reachable from the public web. Which is fine for us, since those internal websites aren’t reachable on the public web either. But yeah, that’s an example of the limitations.

    If you want to create a TLD that will be auto-accepted by everyone who is already running the default chains of trust (which is probably what most people actually mean when they ask something like this), you have to seek out the big daddy at the root of that chain of trust and ask them to poof your TLD into existence for you. That would be ICANN, and they probably won’t do anything like that without a big fat check and a lot of corporate lobbying.

    tl;dr - The tech is built in such a way that nothing is stopping you from making your own toy, and anyone can play with your toy without needing to do much. But if you want your TLD to “just work” for everyone in the world without asking every single one of them to explicitly opt-in, which is probably what you actually want, then no, you basically can’t do that.



  • I’m fuzzy on the deeper details. I think you can do something like this, but you have to be very careful, in ways where you don’t have to be so careful with ✓-1.

    One of the more obvious ways to consider: plot a graph of y = 1 / x. Note how as x approaches zero from the right, the graph shoots up, asymptotically approaching the y-axis and shooting up to infinity. It’s very tempting to say that 1 / 0 is “infinity”. “Infinity” is not a real number, but nothing is stopping you from defining a new kind of number to represent this singularity if you want to. But at that point you have left the real numbers. Which is fine, right? Complex numbers aren’t real numbers either, after all…

    But look at the left side of the graph. You have the same behavior, but the graph shoots down, not up. It suggests that the limit of approaching from the left is “negative infinity”. Quite literally the furthest possible imaginable thing from the “infinity” we had to define for the right side. But this is supposed to be the same value, at x = 0. Just by approaching it from different directions, we don’t just get two different answers, we get perhaps the most different answers possible.

    I think it’s not hard to intuit a handwavey answer that this simply represents the curve of y = 1 / x “wrapping around through infinity” or some notion like that. Sure, perhaps that is what’s going on. But dancing around a singularity like that mathematically isn’t simple. The very nature of mathematical singularities is to give you nonsensical results. Generally, having them at all tends to be a sign that you have the wrong model for something.

    You can mostly avoid this problem by snipping off the entire left half of the x-axis. Shrink your input domain to only non-negative numbers. Then, I believe, you can just slap “infinity” on it and run with it and be mostly fine. But that’s a condition you have to be upfront about. This becomes a special case solution, not a generalized one.

    I haven’t looked into it, but I believe this singularity gets even more unweildy if you try to extend it to complex numbers. All the while, complex numbers “just work”. You don’t need doctor’s gloves to handle them. √-1 isn’t a mathematical singularity, it’s a thing with an answer, the answer just isn’t a real number.


  • This is a question I see from time to time, and it’s a good question to ask.

    Your question as I understand it can be phrased another way as:

    The square root of -1 has no defined answer. So we put a mask on it and pretend that’s the answer. We do math with the masked number and suddenly everything is fine now. Why can’t we do the same thing to division by zero?

    The difference is that, if you try to put a funny mask on the square root of -1 and treat it like a number, nothing breaks, but if you try the same thing with a division by zero, all sorts of things break.

    If you define i = √-1, that is the only thing i can ever be. That specific quantity. You can factor it out of stuff, raise it to that exponent, whatever. And if it is ever convenient to do so, you can always unmask it back into that thing, e.g. i^2 = (√-1)^2 = -1. All the while, all the already existing rules of math stay true.

    A division by zero isn’t like this, because if you tried it, every number divided by zero would equal to the same thing. If we give it a name, say, 1 / 0 = z, then it would also be true that 2 / 0 = z. We could then solve both sides for zero:

    1 / z = 0

    2 / z = 0

    then set them equal:

    1 / z = 2 / z

    then multiply both sides by z:

    1 = 2

    which is a contradiction.

    i doesn’t have this problem.