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.
Posts by matthewsnyder
Files with .py extension are scripts. You run them with python myscript.py. Python is an imperative language, so executing a file will run each line one by one, starting from the top, and exit whe...
I ran some Python code and it crashed with ModuleNotFoundError. What is the general approach for dealing with these situations?
I am writing some scripts that operate on emails in Maildir format. A lot of things are easy in this format, but the filenames are absolutely incomprehensible. For example, one script moves mails ...
When you try to do a privileged systemd operation without the privilege, you get an escalation prompt: $ systemctl stop docker ==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ==== ...
I am trying to generate my own root CA certificate. Context My goal is to sign an intermediate CA with this certificate, and then install the intermediate CA on my own client machines. The interm...
PEP20 aka the Zen of Python has a statement: Namespaces are one honking great idea -- let's do more of those! What exactly are we supposed to "do" according to this? Is it saying we should h...
When you do: cd /some/path code . VS Code opens with that location shown in the "Explorer" sidebar. However, the state of the file tree and the currently open files will be the same as what wa...
You can try to break up the query into CTEs, and then see if any of the individual CTEs are unusually slow. I am guessing the query is not just one select, but probably has subqueries, window func...
I don't think the question is trivial. Maven is very complex and confusing at first. The documentation is also quite something. It's not easy to figure out what's going on unless you already know. ...
Create a hash map and precalculate the sort key in it: // Set up: Create mock input let u = ['4', '16', '8', '2', '6']; function expensive_key_fn(x) { console.log("Doing expensive operation...
I know that 1 is sometimes called a pure function - although apparently a pure function must also not vary when the input is constant. By negation, the other kind are called impure functions, alth...
New LLMs like ChatGPT are now creating competition with Q&A sites like Codidact and StackOverflow. Moreover, this is parasitic: LLMs get "boosted" by Q&A sites because they can use them for...
Is it possible for a Python program to send itself in the background? For example, on Linux you can do nohup some_cmd & and any program will run in the background. Some programs also support s...
Suppose you have a jinja template like this: I am going to {{ foo }} to get some {{ bar }}. I hope I can find: {% for i in baz %} - {{i}} {% endfor %} This template will require you to pass ...
Your example is a bipartite graph in adjacency list format. The cars are nodes on the left, the people are nodes on the right. When a person "has" a car, there is an edge between the car and person...
The obvious way would be to simply start with an empty list of lists, loop through the input, and for each item decide which sublist to put it in. It's not super dev-friendly to remember which lis...
ModuleNotFoundError means that in running your program, Python attempted to import some module xyz but it was not present on your system. It could be that you forgot to install the module (forgot ...
The Python ternary "operator" is if and else: x = 1 if some_condition else 0 In Python, this is called a "conditional expression" rather than an operator, and the documentation explains it: htt...
+ is string concatenation and only be applied by strings. Non-string operands like numbers or class instances must be converted to strings using str(). That's all there really is to it, except Pyth...
VS Code supports regex search, but the search/replace is UI is just a tiny dialog box. It's okay if you know regex well and the expression is not complex, but when trying to apply complicated expre...
print() normally adds text to STDOUT, it does not erase existing text. https://linux.codidact.com/posts/289869 describes various ways of doing the overwrite in shell scripts. How can you do this ...
There are a few ways to understand "wiki". Like wikipedia - an interlinked web of articles in a standardized format. Like SO's documentation project or Github wikis - a stripped down wiki that ...
You can use snippets for this. In the example below, when you type today and trigger completion (usually Ctrl+Space) you will see an option to insert the date by pressing Enter. Snippet code: "to...
I've figured out that code --new-window /foo/bar/baz.txt will open baz.txt in a new window. But when I do this, it says "no folder opened" in the file explorer pane. That makes it hard to work with...
It means the program can give up early if checking the rest of a boolean expression is pointless. For example, naively to evaluate p and q you must check the value of both p and q, and then do the...
- ← Previous
- 1
- 2
- 3
- 4
- Next →