Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Search
They are not a part of git the way .gitignore files are. It's just a convention to add empty directories to git repositories. Normally git ignores empty directories altogether. Adding an empty fil...
Workarounds Avoiding mutation Because problems are only caused by actually mutating the default argument, the simplest way to avoid problems is to... not do that. Pythonic code obeys command-quer...
I'm trying to set the transform attribute of a group within an SVG. Specifically, I'd like to set translate's value to 0 0. I tried using the set element for this but that didn't have an observab...
When developing a rust program you build and run using cargo run. However you cannot just append arguments to that as they will be caught (and likely rejected) by cargo itself. So how to pass argum...
The ideal way is to separate the upstreamable and non-upstreamable changes. For example you could maintain two branches: public and private. All upstreamable changes are cherry picked to public an...
Specify your arguments after --: cargo run --offline -- --my-argument 42 --offline is just an example of cargo's own argument. They are passed before --. --my-argument and 42 will be passed to...
I'm writing a library "MyLibrary". In there, I group code into sections that make sense. Let's say I have a folder "Reports" and a folder "Helpers". I would like to have my code separated while ...
In VS Code, is it possible to run Python code on the text being edited? I realize that I can save my text, create a .py file, switch to a terminal (including VS Code's own terminal) and run the .p...
Use os.fork(). Example: import os import time pid = os.fork() if pid == 0: os.setsid() # Prevents the child from being killed if the parent dies time.sleep(10) os.system('some...
The list you provided seems huge for a single Q/A. I think you're better off breaking them up, and linking to each other in the answers. The theory behind text encoding can be decoupled from Python...
Ok so we have fairly lax tagging rules here, as do most Codidact sites. Recently the Electrical Engineering community has started a clean-up of strange and off-topic tags. I wrote this over there: ...
I eventually also found out that the typing module has a global variable TYPE_CHECKING that can be used to only import during type-checking. Concretely, the following code for helpers.py seems to ...
It has 2 parameters for weird historical reasons that nobody seems to know the rationale for any longer. Like most functions in the C standard library, the function API was not well-designed. Keep ...
Consider the following arbitrarily-nested JSON as input to a jq filter: echo '[{"foo": [1, 2]}, {"bar": [{"baz": ["foo", "baz"]}]}]' | jq '.' My goal is to join leaf arrays into strings: [{"fo...
Looking back at my own Q&A How can I build a string from smaller pieces?, the answer is incredibly long. I'm essentially showing five different ways to solve the problem - because they all exis...
A namespace is a category to which a name can belong. Think of family names for people: I may be friends with several Jims, and if only one of them is present I can just call him Jim. But if multip...
It seems to get to job done, but the Promise will always remain pending You must call resolve() or reject() (or throw an error) inside the executor function of the Promise, otherwise the Pro...
A well-known easter egg in Python displays some ideas about writing good Python code, credited to Tim Peters (one of the core developers). This question is about the last: Namespaces are one hon...
Found this old article at the bottom of the search results to be the best explanation to date: (The longer version is here, SSL Handshake (Sun Java System Directory Server Enterprise Edition 6.0 R...
I ran some Python code and it crashed with ModuleNotFoundError. What is the general approach for dealing with these situations?
Alexei's comment gave me the answer. Instead of using the code icon, put three backticks "```" at the start and end of the code. Each set of backticks must be on it's own line. Here's an example: ...
Compare $CI_COMMIT_BRANCH to your desired branch name in rules: # .gitlab-ci.yml stages: - test - deploy # This job will run always. test-job: stage: test image: bash script:...
I would like to download the old-time radio show I Love a Mystery from the OTRR website. I figured out how to construct the list of right URLs, const urlStub = "https://otrr.org/OTRRLibrary/jukebo...
Sylvester's answer is great, but I wanted to point out that interpolation only happens in double-quoted strings ("), not in single-quoted ones ('). If you have lines that don't need any variable o...
Based on the SO comments, this is not a good general practice, and I believe the point of the posts mentioned in the question is that it can be done (but one probably shouldn't) this can be use...