• 1 Post
  • 2.35K Comments
Joined 3 years ago
cake
Cake day: June 12th, 2023

help-circle

  • FWIW Here’s similar go code (converted by a llm).

    func TestReplyAlreadyBookmarked(t *testing.T) {
        var reply PostReply
        err := db.Raw(`
            SELECT pr.* FROM post_replies pr 
            WHERE pr.id IN (
                SELECT post_reply_id FROM post_reply_bookmark WHERE user_id = ?
            ) AND pr.deleted = false 
            LIMIT 1
        `, userID).First(&reply).Error
        
        if err == nil {
            err := putReplySave(auth, map[string]interface{}{
                "comment_id": reply.ID,
                "save":       true,
            })
            
            assert.Error(t, err)
            assert.Equal(t, "This comment has already been bookmarked.", err.Error())
        }
    }
    

    You can create in-line data structures AND be a properly typed language.



  • Equating complex data structures with user-defined data structures (in the form of classes and fields and whatnot), and using the latter as the primary method of storing and working with data (so that you’re constantly having to bring into your mental scope a bunch of different classes and how they need to interact), is 100% a C++ type of program structure.

    What does that even mean?

    struct User {
        active: bool,
        username: String,
        email: String,
        sign_in_count: u64,
    }
    

    How do you define that in Python? Just a dict[str, Any]?



  • The hate is ridiculous as is the hype.

    It’s a new tool that is often useful when used correctly. Don’t use it to write entire applications - that’s a recipe for disaster.

    But if you’re learning a new language it’s amazing. You have an infinitely patient and immediately available tutor that can teach you a language’s syntax, best practices, etc. I don’t know why that would make you “ill” besides all the shame “real developers” seem to want to lump on anybody who uses AI. If you’re not concerned about passing some “I don’t use an IDE” nerd’s purity test you’ll be fine.




  • Plus I felt python was too new and would skip a lot of core programming skills id just like to know

    Python was first released in the '90s. It’s older than C#.

    That said I consider Python to be a garbage language. “Easy” to use for trivial things, a pain in the ass if you have more than 500 lines of code. The lack of strict typing makes even the most trivial of refactoring an all day task.



  • I use VMs a lot for desktops doing development work. It’s certainly possible, with some caveats. Here’s a bit of a knowledge-dump that may be helpful.

    Multiple displays can be tricky. If you just want a single monitor you’re fine. But hypervisors have varying support for more than one display and some do it better than others. VirtualBox had the absolute best support for it. Hyper-V has “support” for it but only really if you use their preferred Ubuntu install. I’m not sure how libvirt handles it. Remote display protocols have varying support and can be options - rustdesk seems to support it very nicely (one window per display like VirtualBox) but I’ve had lots of keyboard issues with that.

    Running VMs is less efficient, you’ll need more memory in the base system to handle each VM but it sounds like you’re pretty decked out there.

    Access to hardware can be tricky. Hyper-V sucks at this - don’t use it if you can help it. I’ve never quite done gaming in a VM but I suspect this would be the most problematic. I have done libvirt pass-through of an nvidia card but only for video encoding/decoding with Jellyfin - which does work just fine. But VM displays tend not to be well accelerated so I would expect other issues. As an example my hyper-v Linux guest can’t play video above a small resolution without the audio skipping and losing track.

    I’d avoid Hyper-V entirely. It absolutely sucks as a desktop environment. It relies heavily on RDP “enhanced mode” for everything, has shitty support for hardware pass-through, etc. Just a complete fail.

    VirtualBox was really quite good for a desktop environment - but Oracle is more lawfirm than software company these days. There are hidden license issues with using any extensions (for, e.g. accelerated displays).

    Libvirt I don’t have as much experience with unfortunately. I’ve usually emulated Linux on Windows not the other way 'round.