• 119 Posts
  • 2.09K Comments
Joined 2 years ago
cake
Cake day: June 15th, 2023

help-circle





  • You don’t need to understand a command in order to copy paste an alias or Bash function. Especially newcomers could tend to do it, without knowing what the command actually does. We are also in a posting with helpful commands, so its double harmful. And you doubling down without adding any sort of disclaimer shows you don’t care.


  • There is an expression, Linux isn’t free it costs you your time.

    Just because someone said it does not make it true and certainly, I don’t have to live after that expression. It kind of is a catch all phrase to justify (or not to justify) everything. It could also be used as an argument for “Vibe Coding” (I hate that term…).

    I mean this argument about Linux does not apply to every single application (you apply it right now here to some random Python script). In example Windows, MacOS, Android, nothing is free and costs you your time. The question is, how you want spent your time. And I enjoy writing programs and scripts for various reasons.

    I personally think reinventing the wheel is great. Why? It makes you learn and do it. It makes you less dependent. The end result might not be the most polished one, but also if nobody reinvents the wheel, then we have no competition. Sure you should not reinvent everything, there is a balance act to make. And this balance is different for everyone else.


  • BTW, I’m not saying the way I am going and doing this is the right one. In the end I use additional packages when needed, BeautifulSoup as an example to make life really easier. But that is something specific to that script. Stuff like click and argparse is more than a single script, because when I switch to click then all my future scripts would depend on it. And I feel more comfortable with a solution that is already built-in (stdlib) if its not too bad.

    I don’t see click as a required package that I really need. And that is also true for many other packages, such as requests one.


  • Lemmy is a far better platform for discussions than Discourse in my opinion. The tree like sub-reply threads in each post (the Reddit concept) is preferable over a single thread of replies. You don’t need to cross quote and for readers no need to read the quote to see who and to what the reply is about. I don’t like Discourse discussion platforms at all.

    However, Discourse has a few features that fits well for a discussion platform. I like the tags and Trust system of it.


  • Very nice. Also thanks for reporting back. Yes, in Linux filenames and extensions are case sensitive, unlike in Windows. Most programs (including Windows itself) treat lowercase and uppercase in filenames as the same thing. And because most developers and users are on Windows, they are used to it this way. So on Linux we have to take extra care and in some cases rename files.

    Next would be to learn how to swap a Disc when the game asks to. I mean for games that are multi-disc, in case you play other games too: https://docs.libretro.com/guides/disc-swapping/

    And I also recommend the official forum of RetroArch too, to ask questions if you have any (I am there too ;-)): https://forums.libretro.com/ Because there are lot of engaged users who know RetroArch pretty good and even developers of RetroArch and some cores respond and help there too. Have fun with Final Fantasy Tactics (one of my alltime favorites). BTW the game was announced to have a remaster.


  • I use external packages for compiled languages. For scripting languages like Python, it makes it ab it harder to use. Because people are forced to install dependencies. I don’t like that (unless its a shell script, but that is by its nature a dependency hell).

    And for Python, I usually deliver the script as a single .py file, without requirements or special instructions, no typical file structure as well. And your argument just because other popular packages use a specific library does not mean I have to use it too. I don’t care what libraries other popular packages use, at least in context to my program / script.



  • It supports both and depending on the situation its more procedural or more object oriented. Do you consider the standard library as part of the language and are you forced to use it? Then certainly the object oriented parts of the language would be forced to use and therefore it is object oriented. Or do you only evaluate the language and its features itself? In that case, Python supports object oriented programming with classes and objects, but you are not forced to use it.

    Are we talking about the language features itself or the produced programs with it in the real world?

    So regardless if you look at the language itself or the common standard library that most Python programs use, objects and classes are an part of the language. Even if you write simple procedural scripts, does not take away that Python itself is a more object oriented programming language.




  • Nice. There is a reason why the standard library of Python does not get rid of optparse. optparse was I think marked to be removed in the future, but its no longer deprecated and will stay in the library.

    Click looks good and I would have looked in more detail. The problem to me is, it is a dependency. I usually write and try to write Python programs without external library dependency, unless it is absolutely necessary (like GUI or BeautifulSoup). Click “might” be a better alternative, but it is “only” something that does it a little bit better. This is not a reason for me to use an external library.



  • Here is on that I actually don’t use, but want to use it in scripts. It is meant to be used by piping it. It’s simple branch with user interaction. I don’t even know if there is a standard program doing exactly that already.

    # usage: yesno [prompt]
    # example:
    #   yesno && echo yes
    #   yesno Continue? && echo yes || echo no
    yesno() {
        local prompt
        local answer
        if [[ "${#}" -gt 0 ]]; then
            prompt="${*} "
        fi
        read -rp "${prompt}[y/n]: " answer
        case "${answer}" in
        [Yy0]*) return 0 ;;
        [Nn1]*) return 1 ;;
        *) return 2 ;;
        esac
    }
    

  • For the newer version of program, that’s why we have the $PATH. You put your program into one of the directories that is in your $PATH variable, then you can access your script or program from any of these like a regular program. Check the directories with echo "$PATH" | tr ':' '\n'

    My custom scripts and programs directory is “~/.local/bin”, but it has to be in the $PATH variable too. Every program and script i put there can be run like any other program. You don’t even need an alias for this specific program in example.


  • I’m not sure what you mean with the question. If you have any alias like alias rm='ls -l' in your .bashrc in example, then you cannot use the original command rm anymore, as it is aliased to something else. I’m speaking about the terminal, when you enter the command. However, if you put a backslash in front of it like \rm in the terminal, then the alias for it is ignored and the original command is executed instead.

    Edit: Made a more clear alias example.