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.

jadero , in The AI plugins in my IDE right now

I’ve got just 2 now. Codium and Blackbox.ai. Not because they’re the best, but because I’m a cheapskate hobbyist and they’re free :)

I’m only just starting to play with AI tooling, so I don’t have an opinion on which is better, but something about the way Blackbox worked within VSCode means I went through the hassle of getting it installed to vscodium when I switched.

I suspect that Codium might be better at oddball stuff, though, like OpenSCAD. Blackbox seems to just make bad guesses while trying to regurgitate code I’ve already written. Codium seems to have at least a primitive idea of what’s going on with OpenSCAD. But Blackbox does a great job of cleaning up my comments and even generating decent comments for uncommented code.

FWIW, Codium actually labels OpenSCAD as “experimental”, but I don’t know if that’s just boilerplate for something it’s never been trained on or whether there is some training data in its system.

Blackbox is a pain to work with in other ways, though. It was like pulling teeth to get an account and I still can’t find anything on their pricing–or any documentation, for that matter–despite language suggesting that there are different tiers and a chat UI that offers different settings (like web browsing mode and fun mode). And the Blackbox name isn’t doing it any favours, given that “black box” is a generic term in the AI community and others. It’s own chat doesn’t seem to know that a question about the service might be about the service instead of the generic term.

Lime66 ,

Codium is one of the few which does something different

Toes , in I just wanted to build a 20 mb app.

You gotta bundle it with electron and 400MB of a Chinese telemetry package.

lushness5654 , in Guys! Should I accept the offer? 😂

no if it contains ads(don’t let anyone extract money from chldren). up to your choice if it doesn’t

slowbyrne , in whatCouldGoWrong
@slowbyrne@beehaw.org avatar

I don’t know this particular project but honestly having your government documents and policies made available on Codeberg/GitLab/Github and available for PRs is actually an interesting idea. The government would still need to be the owners and ultimately decide on what gets merged, but the transparency and opportunity for accessible civic engagement would be kinda sweet.

pewgar_seemsimandroid ,

GOGS.IO

Buttons , in ===
@Buttons@programming.dev avatar
BaardFigur ,

deleted_by_author

  • Loading...
  • darcy ,
    @darcy@sh.itjust.works avatar

    almost forced to for web front end. why you would use it anywhere else, however, i will never know

    Turun ,

    The same reason people drive their car to buy groceries.

    You bought it for something where it was the only option, driving 30km to work everyday. But ever since you got it, the trip to the super market is kinda too hot in the summer and too cold in the winter and what if you spontaneously need to buy more than expected?

    People learn it for front end dev, and then they use what they know for back end too.

    FooBarrington ,

    Typescript :)

    ByteJunk ,
    @ByteJunk@lemmy.world avatar

    Yep. It’s the only reason I’m still somewhat sane.

    fidodo ,

    I got by without it for years, but not that I have it I have no idea how I did it back then.

    schnurrito ,

    by not ever using == and !=, but only === and !==

    FrostKing ,

    Ikr? English is hard /s

    blackn1ght ,

    Because in reality you’re not doing stupid stuff like that in the image. And using Typescript definitely helps.

    However I’m always annoyed that the month parameter when constructing a date object is 0 based. So 1st of Jan is

    
    <span style="color:#323232;">new Date(2024, 0, 1)
    </span>
    
    JaddedFauceet ,

    Looks confusing at first, but I found it nice for accessing a month array.

    
    <span style="color:#323232;">const months = ["Jan", "Feb", ...];
    </span><span style="color:#323232;">
    </span><span style="color:#323232;">months[0] === "Jan";
    </span><span style="color:#323232;">
    </span><span style="color:#323232;">const label = months[date.getMonth()];
    </span>
    
    JaddedFauceet ,

    By banishing the bad part of the language with linter.

    For instance, standard eslint preset has rules that enforce usage of ===, eslint.org/docs/latest/rules/eqeqeq

    These rules often come with project starter template

    fidodo ,

    And typescript is basically just a linter on steroids

    TootSweet , in whatCouldGoWrong

    Huh. I’d never heard of The Venus Project, but it’s giving Freedom by Daniel Suarez or Walkaway by Cory Doctorow vibes, except (aspirationally at least) in the real world.

    callyral , in ===
    @callyral@pawb.social avatar

    1+1====2!dreamberd developer

    gandalf_der_12te ,
    jenny_ball , in ===
    @jenny_ball@lemmy.world avatar

    it depends on what your definition of is is

    gandalf_der_12te ,

    it depends on what your definition of is is

    Tyfon , in ===

    I’m JavaScript developer. I love coding WebApps. JS sucks💩.

    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.

    gravitas_deficiency , in Bug Fixing
    
    <span style="color:#323232;">======== 37/37 tests passing ========
    </span>
    
    OsrsNeedsF2P ,

    That’s when the real debug session begins

    lorty ,
    @lorty@lemmy.ml avatar

    Great time to find out your tests are useless!

    gravitas_deficiency ,

    They’re not completely useless. They’re conditionally useless, and we don’t know the condition yet.

    CanadaPlus , (edited )

    So how do you write a good test? It’s like you have to account for unknown unknowns, and I don’t really have a good theory for doing that.

    Right now, I usually end up writing tests after the code is broken, and most of them pass because they make the same mistakes as my original code.

    Theharpyeagle ,

    For unit tests, you should know the input and expected output from the start. Really responsible devs write the unit tests first, because you should know what you’re going to put in and what you’ll get out before you start writing anything. If you find yourself making the same mistakes in your tests as you do your code, you might be trying to do too much logic in the test itself. Consider moving that logic to its own testable class, or doing a one-time generation of a static set of input/output values to test instead of making them on the fly.

    How granular your tests should be is a matter of constant debate, but generally I believe that different file/class = different test. If I have utility method B that’s called in method A, I generally test A in a way that ensures the function of B is done correctly instead of writing two different tests. If A relies on a method from another class, that gets mocked out and tested separately. If B’s code is suitably complex to warrant an individual test, I’d consider moving to to its own class.

    If you have a super simple method (e.g. an API endpoint method that only fetches data from another class), or something that talks with an external resource (filesystem, database, API, etc.) it’s probably not worth writing a unit test for. Just make sure it’s covered in an integration test.

    Perhaps most importantly, if you’re having a lot of trouble testing your code, think about if it’s the tests or the code that is the problem. Are your classes too tightly coupled? Are your external access methods trying to perform complex logic with fetched data? Are you doing too much work in a single function? Look into some antipatterns for the language/framework you’re using and make sure you’re not falling into any pitfalls. Don’t make your tests contort to fit your code, make your code easy to test.

    If ever you feel lost, remember the words of the great Testivus.

    CanadaPlus ,

    First off, thanks for the help!

    Really responsible devs write the unit tests first, because you should know what you’re going to put in and what you’ll get out before you start writing anything.

    I’ve obviously heard the general concept, but this is actually pretty helpful, now that I’m thinking about it a bit more.

    I’ve written pretty mathy stuff for the most part, and a function might return an appropriately sized vector containing what looks like the right numbers to the naked eye, but which is actually wrong in some high-dimensional way. Since I haven’t even thought of whatever way it’s gone wrong, I can’t very well test for it. I suppose what I could do is come up with a few properties the correct result should have, unrelated to the actual use of it, and then test them and hope one fails. It might take a lot of extra time, but maybe it’s worth it.

    How do you deal with side effects, if what you’re doing involves them?

    Theharpyeagle ,

    For your vector issue, I’d go the route of some static examples if possible. Do you have a way to manually work out the answer that your code is trying to achieve?

    For side effects, that may indicate what I referred to as tightly coupled code. Could you give an example of what you mean by “side effect”?

    CanadaPlus , (edited )

    For your vector issue, I’d go the route of some static examples if possible. Do you have a way to manually work out the answer that your code is trying to achieve?

    Not necessarily. In this scenario I’d imagine it’s a series of numbers as opposed to something more human-friendly exactly because there’s internal complexity that’s important but hard to manually survey, let alone generate. If you’ve worked with GANs at all, maybe it’s a point in a latent space.

    For side effects, that may indicate what I referred to as tightly coupled code. Could you give an example of what you mean by “side effect”?

    I mean it in the standard functional language way, if you’re familiar. There’s an operation that happens at some step of an algorithm, and it changes a data structure which is referred to or updated at another step. Sometimes you can’t really avoid it, because the problem itself has an interconnection like that.

    A sorting algorithm example, if that doesn't make this too complicated.Concurrency it’s pretty much guaranteed to do it, so let’s say we’re trying to implement some sort of bespoke sorting algorithm, where each compare is large and complex enough we have bugs, and which runs in multiple threads. If threads are interfering with each other in this program, how do you test for that? The whole thing won’t give expected results, obviously, but another unsorted array or a failure to terminate doesn’t tell you much. Each compare and each swap might look correct at first, and give properly typed results. Let’s assume that each thread might traverse to anywhere in the array, so you can’t just check when they’re overlapping.

    majestic , in ===

    As a backend developer i still dont know a shit what that means

    UndercoverUlrikHD ,

    In javascript, === does not perform type coercion when checking for equality

    blackn1ght ,

    Because in JS:

    
    <span style="color:#323232;">1 == "1" // true
    </span><span style="color:#323232;">1 === "1" // false
    </span>
    
    BleatingZombie , in Good&Evil is a classic altrock album by Tally Hall, and now, for something completely different, JSON

    I’m trying to figure out what the hidden message in bold means

    hosaka ,

    It’s a reader assistance, some paid for tool that highlights parts of a word, can’t recall what it’s called…

    Vishram1123 ,
    Aatube OP ,
    @Aatube@kbin.social avatar

    The Cooler Bionic Reader

    Maven ,
    @Maven@lemmy.sdf.org avatar

    It’s also not necessarily paid for, Jiffy Reader is a free browser addon

    fenndev ,
    @fenndev@leminal.space avatar

    This reminded me that I wanted to look into open source alternatives to Bionic Reader…

    Aatube OP ,
    @Aatube@kbin.social avatar

    All extensions are technically open source because they “compile” to JavaScript. Most, including the one I use, don’t bother obfuscating

    LinuxSBC ,

    Open source is a license. What you’re referring to is “source-available.” You can’t legally fork, redistribute, or contribute to it.

    maxmalrichtig ,
    @maxmalrichtig@discuss.tchncs.de avatar

    I think you got that one wrong.

    Open source is not a license. Open source literally just means that the source is openly available. It does not include the right for you to reuse or change any of the source.

    That’s why most of the time, people are talking about “Free Open Source Software” (FOSS) when they think of openly licensed source code.

    That’s why you can publish your project on e.g. Github (= open source) but if you don’t add a license statement, your work is still protected by an “all rights reserved copyright”. (= not free)

    Anyhow, I would not necessarily deem a project OSS, just because the used language is readable by default. To me, OSS needs at least the developers intention to make it openly available.

    aberrate_junior_beatnik ,

    Open-source software (OSS) is computer software that is released under a license in which the copyright holder grants users the rights to use, study, change, and distribute the software and its source code to anyone and for any purpose.

    en.wikipedia.org/wiki/Open-source_software

    maxmalrichtig ,
    @maxmalrichtig@discuss.tchncs.de avatar

    Well put me in a dress and call me Sheryl. Never knew that the “accepted definitions” were really that close. Thanks!

    I knew that some definitions of OSS were really basic (as in “as long as there is source at some point”) but I didn’t know that the OSI definition was so close to the idea of “free software”.

    I found the read about the history and similarities & differences quite interesting: web.archive.org/…/open-source-misses-the-point.ht…

    Aatube OP ,
    @Aatube@kbin.social avatar

    put me in a dress and call me Sheryl

    That's a colorful expression if I've ever seen one

    MinekPo1 ,
    @MinekPo1@lemmygrad.ml avatar

    While I agree with you , the Open Software Initiative doesn’t :

    Open source doesn’t just mean access to the source code.

    So according to the OSI’s definition of open source , a project being public on github , but with out a license or with a license which does not comply with the requirements set out by the OSI

    Aatube OP ,
    @Aatube@kbin.social avatar

    I use a Firefox thing which has additional features and is free

    Aatube OP ,
    @Aatube@kbin.social avatar

    That’s what everyone says

    aberrate_junior_beatnik , in Good&Evil is a classic altrock album by Tally Hall, and now, for something completely different, JSON

    I had really hoped that by time we would finally have got beyond good & evil.

    Aatube OP ,
    @Aatube@kbin.social avatar

    At least we have a miracle

    abbadon420 ,

    We have. Evil won.

    luciole , in ===
    @luciole@beehaw.org avatar

    I wish the assignment operator wasn’t the equal sign.

    cerement ,
    @cerement@slrpnk.net avatar

    :=

    MxM111 ,

    That’s delayed assignment.

    cerement ,
    @cerement@slrpnk.net avatar

    procrastination assignment

    QuazarOmega ,
    
    <span style="color:#323232;">x 👈 5
    </span>
    
    xedrak ,
    @xedrak@kbin.social avatar

    Ok deal, but that means we need to change the equality operator to 👉👈

    OpenStars ,
    @OpenStars@startrek.website avatar

    You sonnofabitch I’m in!:-P

    OpenStars ,
    @OpenStars@startrek.website avatar
    
    <span style="color:#323232;">x 🔫 5
    </span>
    

    the pew pew principle /s

    Malgas ,

    Interpreter: Wait, x is 5?

    This code: Always has been.

    OpenStars ,
    @OpenStars@startrek.website avatar

    It is now, if you know what’s good for you.

    expr ,

    In Haskell, it’s the same as the mathematical = symbol.

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