• 3 Posts
  • 24 Comments
Joined 9 months ago
cake
Cake day: October 14th, 2023

help-circle


  • If our content gets federated to threads then it just means that google results will point to it first rather than to us, they will probably have better indexing and search features than the fediverse. People will also probably think the content originated on threads too (since that’s where they see it and threads could easily obfuscate info like that) instead of who actually made it.

    It could increase the short term engagement but in the long run, it will just serve to make threads better.






  • That’s not really a good solution although it is a temporary workaround.

    • Many users won’t know this is a feature they can use, or how to set it up
    • Some users use alternative instances that federate with lemmy which might not have this feature
    • Content still gets copied and hosted on this instance which might not be desireable

    Besides, at the end of the day, shouldn’t the admins and mods here curate the content according to the community’s guidelines and spirit? If someone started spamming undesired content on a forum you’re administrating, the answer wouldn’t be “all the users can just block it if it’s an issue”. I don’t think it should be the answer here either






  • Was pretty simple in Python with a regex to get the game number, and then the count of color. for part 2 instead of returning true/false whether the game is valid, you just max the count per color. No traps like in the first one, that I’ve seen, so it was surprisingly easy

    def process_game(line: str):
        game_id = int(re.findall(r'game (\d+)*', line)[0])
    
        colon_idx = line.index(":")
        draws = line[colon_idx+1:].split(";")
        # print(draws)
        
        if is_game_valid(draws):
            # print("Game %d is possible"%game_id)
            return game_id
        return 0
    
                
    def is_game_valid(draws: list):
        for draw in draws:
            red = get_nr_of_in_draw(draw, 'red')
            if red > MAX_RED:
                return False
            
            green = get_nr_of_in_draw(draw, 'green')
            if green > MAX_GREEN:
                return False
            
            blue = get_nr_of_in_draw(draw, 'blue')
            if blue > MAX_BLUE:
                return False    
        return True
            
                
    def get_nr_of_in_draw(draw: str, color: str):
        if color in draw:
            nr = re.findall(r'(\d+) '+color, draw)
            return int(nr[0])
        return 0
    
    
    # f = open("input.txt", "r")
    f = open("input_real.txt", "r")
    lines = f.readlines()
    sum = 0
    for line in lines:
        sum += process_game(line.strip().lower())
    print("Answer: %d"%sum)
    




  • I only have half as much experience as you, and none with Go specifically, so I can’t give you any good answers but I can say I empathize - the company I work at is also stuck with a legacy monolith that’s still on .net framework and everything is so coupled that it’s impossible to even unit test, less alone deploy the projects separately. Some people aren’t bothered even with the basic principles of code writing and the senior people are just overworked and can’t keep tabs on it even if they wanted to.

    The worst part is that the company is mostly either juniors just doing what they are told or older seniors that are stuck in their ways and are afraid of anything new - although as I got older I started to see why that might be the correct approach, not everyone wants to learn and adapt to new tech and it’s a big ask of the upper management to risk it on that. Basically we’re just repeating the same mistakes and wasting time fixing known errors that keep happening and any actual improvement or proper removal of tech debt never happens.

    So yeah… I’m starting to believe that “clean good code” only happens either in hobby projects or new startups. Any larger, “stable” codebase of a larger company is going to be an inefficient mess however 🤷‍♂️





  • I use the CLI for simple commands, especially if helping someone on another PC and I don’t have access to my preferred tool, but I honestly don’t get people who use it religiously and never even try tools with GUIs. The convenience of being able to easily see the commit history, scroll through it, have a right click context menu or ability to just click it and see file changes (and then right click those files for additional options), is just something I can’t abandon. Nowadays even the aliasing can be replicated in those tools if they support creation of custom commands so even that is a moot point - with some setup you can be as fast as with a CLI.


  • Hmm, having googled very superficially about django and flask, it seems to me like the state (at least today) is the opposite - flask is lightweight and django is more heavy duty, having a built in ORM layer, authentication service, admin interface, db migration framework, etc.

    To be fair the article also says Django is known for its performance but when I googled that the other day, it looked like it was often near the bottom of the chart rather than top… I guess it really comes down to personal preference in the end 🤷‍♂️