There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

cm0002 , in It's not DNS

Does anyone else have the thought that maybe it’s time to just replace these 30+ year old ancient protocols? Seems like the entire networking stack is held together with string and duct tape and unnecessarily complicated.

A lot of the decisions made sense somewhat in the 80s and 90s, but seems ridiculous in this day and age lmao

words_number ,

Some ancient protocols get replaced gradually though. Look at http3 not using TCP anymore. I mean at least it’s something.

elmicha ,

HTTP3 uses UDP, which is 6 years younger than TCP.

words_number ,

Nope, it uses a protocol on top of UDP called QUIC. If you count underlying protocols further down the stack, obviously all of them are really old.

Dangdoggo ,
@Dangdoggo@kbin.social avatar

I definitely would love to see a rework of the network stack at large but idk how you'd do it without an insane amount of cooperation among tech giants which seems sort of impossible

NaibofTabr , (edited )

Seems like the entire networking stack is held together with string and duct tape and unnecessarily complicated.

The more you learn about network technology the more you realize how cobbled together it all is. Old, temporary fixes become permanent standards as new fixes are written on top of them. Apache, which was the most widely used web server for a long time, is literally named that because it was “a patchy” server. It’s amazing that any of it works at all. It’s even more amazing that it’s been developed to the point where people with no technical training can use it.

The open nature of IP is what allows such a varied conglomerate of devices to share information with each other, but it also allows for very haphazard connections. The first modems were just an abuse of the existing voice phone network. The internet is a functional example of building the airplane while you’re flying it. We try to revise the standards as we go, but we can’t shut the whole thing down and rebuild it from scratch. There are no green fields.

It has always been so. It must be so. It will continue to be so.

(the flexibility of it all is really amazing though - in 2009 phreakmonkey was able to connect a laptop to the internet with a 1964 Livermore Data Systems Model A acoustic coupler modem and access Wikipedia!)

TheMadIrishman ,

Nothing quite as permanent as a temporary fix!

xpinchx ,

Very cool post, thanks for sharing

Yearly1845 , (edited )

deleted_by_author

  • Loading...
  • wahming ,

    You can nuke the Internet, just don’t misconfigure a bgp router

    geekworking ,

    Fat fingering BGP config has nuked the internet quite a few times already.

    NaibofTabr ,

    I thought the internet was at Big Ben?

    somnuz ,

    Same unfortunately goes for a big chunk of the law on a global scale… Constant progress, new possibilities and technologies, changes in general are really outpacing some dusted and constantly abused solutions. Every second goes by and any “somehow still holding” relic is under more pressure. As a species we can have some really great ideas but the long-term planning or future-proofing is still not our strongest suit.

    Railing5132 ,

    I may be waaaay off here, but the internet as it exists is pretty much built on DNS, isn’t it? I mean, the whole idea of DARPANet back in the 60s and 70s was to build a robust, redundant, and self-healing network to survive nuclear armageddon, and except when humans f it up (intentional or otherwise), it generally does what it says on the tin.

    Now, there’s arguments to beade about securing the protocol, but to rip and replace the routing protocols, I think you’d have to call it something other than the Internet.

    Inktvip ,

    Making a typo in the BGP config is the internet’s version of nuclear Armageddon

    ryannathans ,

    Wait till you hear about when ipv6 was first introduced (90s) and how 50% of the internet still doesn’t work with it.

    Businesses don’t want to change shit that “works” so you still have stuff like the original KAME project code floating around from the 90s.

    hansl ,

    Data Link layer be pretty stable to be fair ^_^

    dipshit , in What's stopping you from coding like this ?

    my neck. my back. my…

    ShepherdPie ,

    … full development stack?

    refurbishedrefurbisher , in What if we added a social component like "Stories" to this calculator app?

    More than likely, if it’s a publicly traded company, it’s the shareholders and the board of directors.

    darcy ,
    @darcy@sh.itjust.works avatar

    democracy ftw!

    EpeeGnome ,

    The board’s job is to hire the CEO and demand good value for shareholders. The CEO’s job is to make the big decisions to achieve that goal quickly and then usually leave before their short term thinking falls apart. The manager’s job is to enforce whatever decisions the CEO makes, even if it is stupid or cruel. And the employee’s job is to suffer so that each layer above can look good to the layer above them.

    Not to say there’s no good people in the system. My manager for most of my time there was actually a good manager who felt that his primary job was to deflect away the shit that rolled down from above so we could focus on our work, but then he got laid off along with half my coworkers.

    I do miss writing software, but I really don’t miss working in the corporate world.

    m_f , (edited ) in What could go wrong trying to solve AoC in Rust?

    The collect’s in the middle aren’t necessary, neither is splitting by ": ". Here’s a simpler version

    
    <span style="font-weight:bold;color:#a71d5d;">fn </span><span style="font-weight:bold;color:#795da3;">main</span><span style="color:#323232;">() {
    </span><span style="color:#323232;">    </span><span style="font-weight:bold;color:#a71d5d;">let</span><span style="color:#323232;"> text </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#183691;">"seeds: 79 14 55 13</span><span style="color:#0086b3;">n</span><span style="color:#183691;">whatever"</span><span style="color:#323232;">;
    </span><span style="color:#323232;">    </span><span style="font-weight:bold;color:#a71d5d;">let</span><span style="color:#323232;"> seeds: Vec<</span><span style="font-weight:bold;color:#a71d5d;">_</span><span style="color:#323232;">> </span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#323232;"> text
    </span><span style="color:#323232;">        .</span><span style="color:#62a35c;">lines</span><span style="color:#323232;">()
    </span><span style="color:#323232;">        .</span><span style="color:#62a35c;">next</span><span style="color:#323232;">()
    </span><span style="color:#323232;">        .</span><span style="color:#62a35c;">unwrap</span><span style="color:#323232;">()
    </span><span style="color:#323232;">        .</span><span style="color:#62a35c;">split_whitespace</span><span style="color:#323232;">()
    </span><span style="color:#323232;">        .</span><span style="color:#62a35c;">skip</span><span style="color:#323232;">(</span><span style="color:#0086b3;">1</span><span style="color:#323232;">)
    </span><span style="color:#323232;">        .</span><span style="color:#62a35c;">map</span><span style="color:#323232;">(|x| x.parse::<</span><span style="font-weight:bold;color:#a71d5d;">u32</span><span style="color:#323232;">>().</span><span style="color:#62a35c;">unwrap</span><span style="color:#323232;">())
    </span><span style="color:#323232;">        .</span><span style="color:#62a35c;">collect</span><span style="color:#323232;">();
    </span><span style="color:#323232;">    println!(</span><span style="color:#183691;">"seeds: </span><span style="color:#0086b3;">{:?}</span><span style="color:#183691;">"</span><span style="color:#323232;">, seeds);
    </span><span style="color:#323232;">}
    </span>
    

    It is simpler to bang out a [int(num) for num in text.splitlines()[0].split(’ ')[1:]] in Python, but that just shows the happy path with no error handling, and does a bunch of allocations that the Rust version doesn’t. You can also get slightly fancier in the Rust version by collecting into a Result for more succinct error handling if you’d like.

    EDIT: Here’s also a version using anyhow for error handling, and the aforementioned Result collecting:

    
    <span style="font-weight:bold;color:#a71d5d;">use </span><span style="color:#323232;">anyhow::{anyhow, </span><span style="color:#0086b3;">Result</span><span style="color:#323232;">};
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">fn </span><span style="font-weight:bold;color:#795da3;">main</span><span style="color:#323232;">() -> Result<()> {
    </span><span style="color:#323232;">    </span><span style="font-weight:bold;color:#a71d5d;">let</span><span style="color:#323232;"> text </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#183691;">"seeds: 79 14 55 13</span><span style="color:#0086b3;">n</span><span style="color:#183691;">whatever"</span><span style="color:#323232;">;
    </span><span style="color:#323232;">    </span><span style="font-weight:bold;color:#a71d5d;">let</span><span style="color:#323232;"> seeds: Vec<</span><span style="font-weight:bold;color:#a71d5d;">u32</span><span style="color:#323232;">> </span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#323232;"> text
    </span><span style="color:#323232;">        .</span><span style="color:#62a35c;">lines</span><span style="color:#323232;">()
    </span><span style="color:#323232;">        .</span><span style="color:#62a35c;">next</span><span style="color:#323232;">()
    </span><span style="color:#323232;">        .</span><span style="color:#62a35c;">ok_or</span><span style="color:#323232;">(anyhow!(</span><span style="color:#183691;">"No first line!"</span><span style="color:#323232;">))</span><span style="font-weight:bold;color:#a71d5d;">?
    </span><span style="color:#323232;">        .</span><span style="color:#62a35c;">split_whitespace</span><span style="color:#323232;">()
    </span><span style="color:#323232;">        .</span><span style="color:#62a35c;">skip</span><span style="color:#323232;">(</span><span style="color:#0086b3;">1</span><span style="color:#323232;">)
    </span><span style="color:#323232;">        .</span><span style="color:#62a35c;">map</span><span style="color:#323232;">(</span><span style="font-weight:bold;color:#a71d5d;">str</span><span style="color:#323232;">::parse)
    </span><span style="color:#323232;">        .collect::<Result<</span><span style="font-weight:bold;color:#a71d5d;">_</span><span style="color:#323232;">, </span><span style="font-weight:bold;color:#a71d5d;">_</span><span style="color:#323232;">>>()</span><span style="font-weight:bold;color:#a71d5d;">?</span><span style="color:#323232;">;
    </span><span style="color:#323232;">    println!(</span><span style="color:#183691;">"seeds: </span><span style="color:#0086b3;">{:?}</span><span style="color:#183691;">"</span><span style="color:#323232;">, seeds);
    </span><span style="color:#323232;">    </span><span style="color:#0086b3;">Ok</span><span style="color:#323232;">(())
    </span><span style="color:#323232;">}
    </span>
    
    MaliciousKebab OP ,

    Yeah I was trying to do something like reading the first line by getting an iterator and just looping through the other lines normally, since first line was kind of a special case but it got messy quick. I realized halfway that my collects were redundant but couldn’t really simplify it. Thanks

    sukhmel ,

    Also, anyhow::Context provides a convenient way to turn Option<T> and Result<T, Into<anyhow::Error>> into anyhow::Result<T>

    Like this:

    
    <span style="font-weight:bold;color:#a71d5d;">use </span><span style="color:#323232;">anyhow::Context;
    </span><span style="color:#323232;">
    </span><span style="font-style:italic;color:#969896;">// to my understanding it's better to 
    </span><span style="font-style:italic;color:#969896;">// specify the types when their names 
    </span><span style="font-style:italic;color:#969896;">// are the same as in prelude to improve
    </span><span style="font-style:italic;color:#969896;">// readability and reduce name clashing
    </span><span style="font-weight:bold;color:#a71d5d;">fn </span><span style="font-weight:bold;color:#795da3;">main</span><span style="color:#323232;">() -> anyhow::Result<()> {
    </span><span style="color:#323232;">    </span><span style="font-weight:bold;color:#a71d5d;">let</span><span style="color:#323232;"> text </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#183691;">"seeds: 79 14 55 13</span><span style="color:#0086b3;">n</span><span style="color:#183691;">whatever"</span><span style="color:#323232;">;
    </span><span style="color:#323232;">    </span><span style="font-weight:bold;color:#a71d5d;">let</span><span style="color:#323232;"> seeds: Vec<</span><span style="font-weight:bold;color:#a71d5d;">u32</span><span style="color:#323232;">> </span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#323232;"> text
    </span><span style="color:#323232;">        .</span><span style="color:#62a35c;">lines</span><span style="color:#323232;">()
    </span><span style="color:#323232;">        .</span><span style="color:#62a35c;">next</span><span style="color:#323232;">()
    </span><span style="color:#323232;">        .</span><span style="color:#62a35c;">context</span><span style="color:#323232;">(</span><span style="color:#183691;">"No first line!"</span><span style="color:#323232;">)</span><span style="font-weight:bold;color:#a71d5d;">?     </span><span style="font-style:italic;color:#969896;">// This line has changed
    </span><span style="color:#323232;">        .</span><span style="color:#62a35c;">split_whitespace</span><span style="color:#323232;">()
    </span><span style="color:#323232;">        .</span><span style="color:#62a35c;">skip</span><span style="color:#323232;">(</span><span style="color:#0086b3;">1</span><span style="color:#323232;">)
    </span><span style="color:#323232;">        .</span><span style="color:#62a35c;">map</span><span style="color:#323232;">(</span><span style="font-weight:bold;color:#a71d5d;">str</span><span style="color:#323232;">::parse)
    </span><span style="color:#323232;">        .collect::<Result<</span><span style="font-weight:bold;color:#a71d5d;">_</span><span style="color:#323232;">, </span><span style="font-weight:bold;color:#a71d5d;">_</span><span style="color:#323232;">>>()</span><span style="font-weight:bold;color:#a71d5d;">?</span><span style="color:#323232;">;
    </span><span style="color:#323232;">    println!(</span><span style="color:#183691;">"seeds: </span><span style="color:#0086b3;">{:?}</span><span style="color:#183691;">"</span><span style="color:#323232;">, seeds);
    </span><span style="color:#323232;">    </span><span style="color:#0086b3;">Ok</span><span style="color:#323232;">(())
    </span><span style="color:#323232;">}
    </span>
    

    Edit: line breaks

    penquin , in X is just better!

    😂 But X is a very old spaghetti code from the 80s and is a security nightmare. I use X, btw!

    CanadaPlus ,

    Third option?

    Vilian ,

    improvable, also wayland problem isn’t fundamental, is the slowness to merge new protocols, wlroots, for example, add protocols that aren’t approved in the wayland gitlab to make it work better, so… third option is wayland, with protocols waiting for approval(that can be updated later if the protocol changes idk)

    also nvidia, but that can’t be fixed with a third option anyway

    to be fair people need to read the gitlab discutions, the devs there aren’t approving protocol just because the sake of it, is really hard to make things work securely and on every plataform, also, there things that really don’t need a protocol to work, look at the QT handoff that fixes an issue that even on xorg wasn’t fixed, and without needing a new protocol

    other than that, certaing things like the tearing could have being merged earlier lol

    cmnybo ,

    If you only use the CLI, you don’t need X or Wayland.

    AVincentInSpace ,

    A while ago as an experiment I set up a new system and decided to see just how much I could get done without installing a graphical environment. Most of my work happens in Neovim and there are plenty of applications that will do things like play video directly to a framebuffer so it should be pretty straightforward right? Turns out not really. Neovim will run in a kernel VT, but it’ll be … messy. The kernel virtual terminal is only designed to be good enough to use to install a desktop manager or repair your configuration. It’s not meant to be used full time. It only supports 16 colors which breaks just about every color scheme out there. It also only supports specially converted pixel fonts, meaning your choices of font size are somewhat restricted, ligatures are a complete no go, you can pretty much forget about nerdfonts (unless you wanna do a lot of work) and the only way to change fonts or font sizes is to use the setfont command which only works if run directly in the terminal as opposed to inside e.g. tmux.

    It’s usable in a pinch, but I do not recommend.

    cmnybo ,

    You can use fbterm if you want to use TTF fonts. It even works with nerdfonts, although the rendering is not quite right. It does support 256 colors, although the way it implements colors makes it a pain to use.

    AVincentInSpace ,

    TIL of fbterm. I’ll def check it out when I get a chance.

    CanadaPlus ,

    Did you do much browsing? Lynx is a thing, but it can’t do JavaScript.

    Come to think of it, is there a CLI Lemmy client?

    AVincentInSpace ,

    I just kinda used my phone for that. Like I said, not a good experience. Elinks and Links2 are marginally better than the trash fire that is Lynx, and I remember a while ago there was a project that would run Firefox in headless mode and cram its output into a terminal (wish I could remember what it was called), but you’re not really gonna get a browser in a terminal no matter what you do

    CanadaPlus ,

    I’m absolutely fascinated if somebody can point me to that.

    How well did it render most sites, compared to the other CLI browsers?

    AVincentInSpace , (edited )

    Found it again after a bit of googling. It’s called Browsh. Haven’t played with it yet (will report back when I do) but from the demo on that github page it seems to work pretty well.

    UPDATE: I’ve tried it out and hooooly craaaaaap this is good. If I didn’t know this was running in a terminal I would never have guessed. I would’ve just assumed it was a novelty browser meant to evoke that style. Smooth scrolling works astonishingly well as does video playback.

    CanadaPlus ,

    Lol, I’m already up and running. It’s pretty good, and I can actually use my mouse with it in bash. Protip, it seems very important to use the right window size. It’s good enough to do a lot of normal browsing, but openstreetmap understandably had broken controls. The only local issue is that I can’t see what I’m entering into the URL bar.

    It’s also designed to run distributed, so you can use shitty bandwidth between a rendering machine and the display machine. I should try fitting it into a radio channel or phone connection or something, haha. I also wonder if it could be adapted to work with Tor Browser.

    ILikeBoobies ,
    CanadaPlus ,

    Nice! I knew it had to be a thing.

    jkozaka ,
    @jkozaka@lemm.ee avatar

    How did you get ligatures working with neovim?

    AVincentInSpace , (edited )

    Any good terminal emulator has them. Personally I use Konsole, but I’d be remiss if I didn’t mention Neovide which supports them as well. It’s a bit like a terminal emulator that can only run Neovim and has some Neovim-specific settings and integration (e.g. change window opacity with a Vim command, animated scrolling, plus that funky little animated cursor effect you can see on the website), and as a bonus it supports Windows and MacOS if you’re a heathen

    CanadaPlus ,

    Absolute chad.

    (Mandatory disclaimer that I actually think the anti-GUI jerk goes too far)

    penquin ,

    TempleOS? Not sure if it runs X or not, but it sure is solid.

    jarfil ,

    Windows…

    CanadaPlus , (edited )

    Blasphemy! And also I’m poor, although I guess if I really wanted to run spyware as my kernel I could pirate it.

    But yeah, I’m getting the sense those are the two games in town, Linux-wise.

    jarfil ,

    The kernel is fine, it’s been in the hands of pretty cool people since at least NT. As for the stuff running on it, well… 😗🎶

    CanadaPlus ,

    Really? Is it open source, or are we just going by reputation of the developers?

    I actually don’t know much about the kernel they use, I was really just trying to emphasise the level of trust you put in your OS.

    backhdlp , (edited ) in ===
    @backhdlp@iusearchlinux.fyi avatar

    I still don’t understand the === operator

    Edit: I think a more type strict ==? Pretty sure I understand the point of typescript now.

    SmoothIsFast ,

    It’s like the ==, but there’s one more =

    Limitless_screaming ,
    @Limitless_screaming@kbin.social avatar

    == but for JavaScript. What you don't understand is the == of JavaScript.

    clb92 ,

    Like == but more strict. The == operator will do type conversion, so 0 == ‘’ will actually be true, as an example. Sometimes (honestly, most times) you may want to compare more strictly.

    See this StackOverflow answer: stackoverflow.com/…/which-equals-operator-vs-shou…

    QuazarOmega ,
    
    <span style="color:#323232;">> 1 == 1
    </span><span style="color:#323232;">true
    </span><span style="color:#323232;">> 1 == '1'
    </span><span style="color:#323232;">true
    </span><span style="color:#323232;">> 1 === '1'
    </span><span style="color:#323232;">false
    </span>
    

    (from node REPL)

    Basically it’s the real equals sign perfection

    SzethFriendOfNimi ,

    So in JavaScript there’s the assignment

    
    <span style="color:#323232;">=
    </span>
    

    and the comparator is

    
    <span style="color:#323232;">==
    </span>
    

    Since there’s no types JS will do implicit conversion before comparison when using == in a case like this

    
    <span style="color:#323232;">if(false == '0'){
    </span><span style="color:#323232;">    //this is true
    </span><span style="color:#323232;">}
    </span>
    

    But with === it doesn’t. It means literally compare these

    
    <span style="color:#323232;">if(false === '0'){
    </span><span style="color:#323232;">    //this is false
    </span><span style="color:#323232;">}else{
    </span><span style="color:#323232;">    //so this will execute instead 
    </span><span style="color:#323232;">}
    </span>
    

    But this, however, will

    
    <span style="color:#323232;">var someState = false;
    </span><span style="color:#323232;"> if(someState === false){
    </span><span style="color:#323232;">    //this is true
    </span><span style="color:#323232;">}
    </span>
    
    runswithjedi ,

    deleted_by_author

  • Loading...
  • idunnololz ,
    @idunnololz@lemmy.world avatar

    Np. closed as duplicate

    kevincox ,
    @kevincox@lemmy.ml avatar

    JS’s == has some gotchas and you almost never want to use it. So === is what == should have been.

    All examples are true:

    
    <span style="color:#183691;">"1" </span><span style="font-weight:bold;color:#a71d5d;">== </span><span style="color:#0086b3;">true
    </span><span style="color:#323232;">[</span><span style="color:#0086b3;">1</span><span style="color:#323232;">, </span><span style="color:#0086b3;">2</span><span style="color:#323232;">] </span><span style="font-weight:bold;color:#a71d5d;">== </span><span style="color:#183691;">"1,2" 
    </span><span style="color:#183691;">" " </span><span style="font-weight:bold;color:#a71d5d;">== </span><span style="color:#0086b3;">false
    </span><span style="color:#0086b3;">null </span><span style="font-weight:bold;color:#a71d5d;">== </span><span style="color:#0086b3;">undefined 
    </span>
    

    It isn’t that insane. But some invariants that you may expect don’t hold.

    
    <span style="color:#183691;">"" </span><span style="font-weight:bold;color:#a71d5d;">== </span><span style="color:#0086b3;">0
    </span><span style="color:#183691;">"0" </span><span style="font-weight:bold;color:#a71d5d;">== </span><span style="color:#0086b3;">0
    </span><span style="color:#183691;">"" </span><span style="font-weight:bold;color:#a71d5d;">!= </span><span style="color:#183691;">"0" 
    </span>
    
    Feathercrown ,

    One neat feature is you can compare to both null and undefined at the same time, without other falsey values giving false positives. Although that’s not necessary as often now that we have nullish coalescing and optional chaining.

    kevincox ,
    @kevincox@lemmy.ml avatar

    I just tested and Terser will convert v === null || v === undefined to null==v. Personally I would prefer to read the code that explicitly shows that it is checking for both and let my minifier/optimizer worry about generating compact code.

    SzethFriendOfNimi ,

    Try changing to const === variable. That’s most likely what’s it doing to minimize the risk of accidental assignment.

    kevincox ,
    @kevincox@lemmy.ml avatar

    Wut? This is an automated optimizer. It is not worried about accidental assignment.

    SzethFriendOfNimi ,

    I agree it shouldn’t. But I’ve seen linters that automatically change it since they seem to be forcing practical conventions sometimes.

    kevincox ,
    @kevincox@lemmy.ml avatar

    Linters and minifers are completely different tools.

    SzethFriendOfNimi ,

    Good point. That’s what I get for shooting from the hip.

    Thanks!

    Bougie_Birdie ,
    @Bougie_Birdie@lemmy.blahaj.zone avatar

    The other comments explains it in pretty good detail, but when I was learning my teacher explained it sort of like a mnemonic.

    1 + 1 = 2 is read “one plus one equals two”

    1 + 1 == 2 is read “one plus one is equal to two”

    1 + 1 === 2 is read “one plus one is really equal to two”

    And you hit the nail on the head, is that === is type explicit while == is implicit.

    bobbykjack ,

    I’d use something like:

    = becomes == equals === is identical to

    It’s funny how everyone thinks “equals” in this context should be “identical to” when, in normal language, it doesn’t really mean that at all!

    frezik ,

    The short answer is that your language needs === when it fucked up the semantics of ==, but it’s also too popular and you can’t fix it without breaking half the web.

    marcos ,

    Or when it is something like Prolog, where equality is inherently a messy and complex concept.

    Mikina ,

    It’s also important if you’re checking hashes (at least, it was - if you’re using correct hashing algorithm that isn’t ancient, you will not have this problem).

    Because if you take for example “0e462097431906509019562988736854” (which is md5(“240610708”), but also applicable to most other hashing algorithms that hash to a hex string), if(“0e462097431906509019562988736854” == 0) is true. So any other data that hashes to any variantion of “0e[1-9]+” will pass the check, for example:

    md5(“240610708”) == md5(“hashcatqlffzszeRcrt”)

    that equals to

    “0e462097431906509019562988736854” == “0e242700999142460696437005736231”

    which thanks to scientific notation and no strict type checking can also mean

    0^462097431906509019562988736854^ == 0^242700999142460696437005736231^

    which is

    `0 == 0``

    I did use md5 as an example because the strings are pretty short, but it’s applicable to a whole lot of other hashes. And the problem is that if you use one of the strings that hash to a magic hash in a vulnerable site, it will pass the password check for any user who’s password also hashes to a magic hash. There’s not really a high chance of that happening, but there’s still a lot of hashes that do hash to it.

    darcy ,
    @darcy@sh.itjust.works avatar

    that is terrifying

    frezik ,

    If you’re checking passwords, you should be using constant time string checking, anyway.

    More likely, you should let your bcrypt library do it for you.

    ShortFuse ,

    You don’t need Typescript, you need an linter (eslint).

    === is your basic equality like all languages. == will implicitly cast type.

    The breakdown is here: 262.ecma-international.org/5.1/-11.9.3

    Modern JS says to never use == unless you’re comparing against null or undefined.

    ClamDrinker , in Fitbit Clock Face

    Finally. A human readable format. And pretty too.

    Dkarma ,

    Jesus I hope this is a joke. I hate json 🙄

    damnfinecoffee ,

    yeah for real, let’s see an xml one instead

    gornius ,

    Ah yes, perfect data format, where markup takes more space than the actual data.

    curiousaur ,

    Would you prefer Yaml?

    lemming741 , in Programmer tries to explain binary search to the police

    When troubleshooting physical systems, it’s called half-splitting

    www.ecmweb.com/…/the-beauty-of-halfsplitting

    Ilovethebomb ,

    This is fault finding 101 for fire alarm systems.

    interolivary , in Show me a better text format for serializing
    @interolivary@beehaw.org avatar

    There’s a special place in hell for the inventor of semantically significant whitespace.

    YAML itself is one of the circles of hell. You have to copy-paste YAML from web etc sources with dubious formatting for all eternity, and the editor doesn’t have YAML support. Also you can only use Python

    synae ,
    @synae@lemmy.sdf.org avatar

    Sounds like a good time to me!

    interolivary ,
    @interolivary@beehaw.org avatar

    I’m not sure which thought is scarier: that you don’t know what you’re signing up for, or that you do know and you enjoy fixing undecidable formatting fuckups manually

    synae ,
    @synae@lemmy.sdf.org avatar

    There’s a bonus third option: I started writing python professionally in 2007 and nowadays spend 75% of my “hands on keyboard” time working on kubernetes YAML and I am indeed having a good time.

    I admit, I hastily misread the tail end of your comment as (e.g.) “A reason YAML is bad because you have to copy-paste from the web and that sucks”; not as you probably meant it “in this special hell, you must deal with copy-pasted nbsp and other trash”. So maybe I did not know exactly what I was signing up for ;)

    I don’t deal with anything like that and not entirely sure how it happens to people enough that it is a common complaint. “undecidable formatting fuckups” are a non-issue in my life, I really don’t understand how people encounter such things. Maybe they need to fix their editor/IDE/tools? Skill issue? IDK.

    As a tangent- I don’t care what language code is written in, it had better be indented properly (and linted, and follow the project’s codestyle, …). Our juniors learn pretty early that their change requests will be blocked on formatting alone by CI, and a human won’t even bother reviewing the substance of their change if they don’t follow convention. I don’t hear them ever complaining about any of these things, least of all semantic whitespace … and we have a rich culture of bitching about menial/pedantic things ;)

    magic_lobster_party ,

    Indenting copy pasted yaml is always a pain in the butt. Any indentation you give is likely a valid yaml. Especially bad considering indentation has a significant meaning. You have to double check back and forth to ensure nothing bad has sneaked in.

    With JSON there are no such discrepancies. It’s likely the editor has figured it out for you already. If it hasn’t it’s easy to prettify the JSON yourself.

    interolivary ,
    @interolivary@beehaw.org avatar

    Semantic whitespace problems can easily be literally impossible to solve automatically. One of the dumbest fucking ideas anybody ever came up with in computing and its inventor if anyone belongs in YAML Hell. As a fuckup it’s not quite as bad as null, but that ain’t exactly a high bar

    const_void , in Microsoft Edge could use a win

    What does “built for Windows 10” even mean? It’s just a browser. It’s even cross platform.

    Synthead ,

    “Designed for Windows Me Millennium Edition”

    Anticorp ,

    Almost everything that runs on Windows was built for Windows. So it’s a true statement, but pointless. That’s like BF Goodrich advertising their tires as “built for cars”.

    Hupf ,
    Anticorp ,

    😂

    AVincentInSpace ,
    Zyansheep ,

    Maybe they meant it integrates well with other windows 10 apps?

    const_void ,

    Integrates how?

    itwasawednesday ,
    @itwasawednesday@lemmy.world avatar

    You’re right, clicked it away so many times over the years and never stopped to think what a silly statement that was. I feel like it was for a time when 10 was a new shiny ‘mysterious’ thing, that it might convince people into thinking it needed something special, but has just aged like milk.

    jaybone ,

    NO WONDER I CANT GET IT TO RUN ON SOLARIS!!

    ILikeBoobies ,

    It’s integrated into the OS

    const_void ,

    In what way is it “integrated”? Please, I’d love to know.

    DosDude ,
    @DosDude@retrolemmy.com avatar

    Microsoft Edge is integrated with File Explorer in Windows 10 through a feature called “Pick up where you left off”. This feature allows users to resume their browsing session from Microsoft Edge directly within File Explorer.

    ILikeBoobies ,

    Their other apps use it or part of it in the background.

    Kind of like old Windows apps always used Explorer when they needed a browser

    I wouldn’t be surprised if the start menu was using Edge for their search/ads

    kamenLady ,

    You’re telling me, that Windows now shows ads in the start menu?

    Sorry, it’s probably a stupid question, but i haven’t used windows since XP.

    ILikeBoobies ,

    Most are in your system notifications but you’ll have “suggested apps” in the start menu for easy one-click installs

    When you try to log out you’ll see ads for OneDrive and Office 365 apparently

    There’s this

    …microsoft.com/…/acee8751-31e3-4abd-8caa-28ae7ba4…

    kamenLady ,

    Wow - that’s really something.

    It could almost be compared to Google’s feed, included in the pixel launcher…

    For some time now, every 5th or 6th card is an ad … And over time they slowly look just like the normal news cards.

    Yeah, nowadays we’re getting ads forced upon us - one way or the other ads have to be seen, preferably clicked on, by us.

    MJBrune ,

    That’s not really ads though.

    PixxlMan ,

    That unlike teams, which they didn’t bother to build for windows and instead used a webapp, they actually bothered to use their own ui tools on their own operating system for a change? (But I guess they only did that so that teams could be a webapp, based on edge…)

    phorq , in Zero to Hero in 1 hour

    I count 13 steps, so it just means you’re gonna trip up on 3 of them…

    db2 ,

    15 steps. You’re not counting the top, and the bottom is step 0 and we all know counting starts there.

    jerome ,
    @jerome@kbin.social avatar

    Both of you are nerds.

    GuybrushThreepwo0d ,

    We are on a programming sub of a federated and open source reddit clone. We are all nerds.

    ripcord ,
    @ripcord@kbin.social avatar

    I assume it was meant as a compliment.

    jerome ,
    @jerome@kbin.social avatar

    (i said it with love)

    UnRelatedBurner ,

    sometimes i start my iterator with = -1. As I only +=1 it with a condition and I know that it will return true on the first cycle. I’ll chuck array[iterator] and need it to be 0 to start with ofc.

    I just have no idea how to not do this, but it looks so bad, i need a i8 instead of a u8 at least because of this

    Kache ,

    What? My intuition is there’s always gotta be some equivalent nicer refactor that could do away with such an awkward construct.

    In what kind of situation would that be totally unavoidable?

    UnRelatedBurner ,

    I could tell you my recent cenario, but it wouldn’t get us anywhere. because I know that it’s avoidable, but it’d take for me to run a different logic for only first element of my array. which is doable, but it’d make the code like 5 extra lines longer, harder to read/follow. But I just simply choose to put -1 and boom it’s fixed, just works.

    another solution would be (without context) is to add one more variable and one more check to my foreach, but that takes more memory and cpu, I usually choose the i = -1, it’s ugly but not as ugly as other solutions would be

    KIM_JONG ,

    I hope I never have to see this code.

    UnRelatedBurner ,

    sending it asap (when I get home)

    UnRelatedBurner ,

    lucky, I forgot it

    darcy ,
    @darcy@sh.itjust.works avatar

    thats great unless you want i to be an unsigned integer

    edit: oops u already mentioned that

    pec ,

    That’s accurate. There’s always a few steps not included in the tutorial

    Boogeyman4325 , in Would you agree?

    Not really. Having heterogeneity among operating systems is better than pure homogeneity. Say, if everyone ran Linux, and some massive security flaw was discovered, we would all be screwed at the same time. However, if we ran different stuff, and some massive security hole was found for just one operating system, then only a small portion of the world is vulnerable at once. Besides, more operating systems can lead to more innovation, as long as there is good competition between them.

    Kolanaki ,
    @Kolanaki@yiffit.net avatar

    If the whole world focused and used just 1 OS for every system for a long enough time line, I think it would evolve fast enough to reach a point of perfection, where there are no security holes or flaws of any kind. I do believe that while programming has many ways of doing the same task, there is always an objectively best way to do it. Eventually the best way to do everything an OS needs to do would be found; it would be faster if there was only 1 OS to work with to reach that point.

    argv_minus_one ,

    I do believe that while programming has many ways of doing the same task, there is always an objectively best way to do it.

    I’ve been writing code in one form or another for some 30 years now, and my observation so far has been the exact opposite: there are many problems in programming for which there is no one clearly superior solution, even in theory. Just like life in general, programming is full of trade-offs, compromises, and diminishing returns.

    Nintendo ,

    where there are no security holes or flaws of any kind

    this in itself is straight up impossible to know or prove. when can you say your program has no vulnerabilities? ever hear of zerodays? finding the best way to do everything in software will never be found or stay constant either.

    ech0 ,

    Must be nice to be so ignorant…

    KairuByte ,
    @KairuByte@lemmy.dbzer0.com avatar

    I do believe that while programming has many ways of doing the same task, there is always an objectively best way to do it.

    Language has many ways of expressing the same thing, is there an objectively best way to do it?

    Is that sentence the best way to ask that question?

    dwindling7373 , in True?

    Memes came and go and this picture is still somehow relevant. How old is it? I wouldn’t be surprised if it was 10+ years!

    magic_lobster_party ,

    I’m pretty sure Steve Jobs was alive when it was created, so sounds about right.

    NeatNit , in I am a software developer at PornHub

    That was great

    sleen ,

    Unfortunately still doesn’t explain what to do when you’re covered in piss 😔

    toomanypancakes ,
    @toomanypancakes@lemmy.world avatar

    At that point you either take a shower or start licking

    lars ,

    Would you do it for $100?

    toomanypancakes ,
    @toomanypancakes@lemmy.world avatar

    If I had the $100 to spare I’d totally take you up on that

    towerful ,

    Clearly you use your keyboard to dry you off

    Aussiemandeus ,
    @Aussiemandeus@aussie.zone avatar

    You mean p!$$

    db2 , in rm -rf /

    Is that better or worse than pushing a corrupt C-00000291*.sys?

    CosmicTurtle0 ,
    PepperoniNipple ,
    CanadaPlus ,

    Better. I’m not even sure this is bad, per se. Presumably you’re sure your present repo is trash.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines