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
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...
I handle this with: Create a new branch with same commits Delete commits from main branch In the situation shown, if you do git checkout -b new_branch it will create a new branch with the sa...
You don't need a regex for this. To find first you can simply iterate through the line until you find a digit. To find second you can do the same but in reverse. This is more efficient than running...
There's not always a Spark cluster on hand to test Spark code. Is there some simple program that you can install locally, which has the same behavior as Spark (can run normal Spark scripts) withou...
Is there some sane way to allow Python to import from subfolders in projects that don't have a package? I have many Python programs that I implemented as Python files inside a directory, without a...
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...
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 ...
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 ...
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...
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...
I have git repo where the .git is deleted. I didn't realize it until after I made some changes to the code. I want to re-create the .git by cloning. However I don't want it to touch the files that...
+ 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...
robots.txt amounts to politely asking people to please not crawl you, so I wouldn't expect it to do much. At the same time, you might as well ask politely, to avoid giving the impression that you ...
Is there a way to add support for "move symbol" in Python code for VS Codium? PyCharm can do this, but I am looking for a VSC solution. PyLance can do this, but PyLance itself is closed source, a...
I like using NATURAL JOIN in Snowflake, because I find it more elegant than explicit join clauses. However, it appears that the natural join behaves similar to an inner join, in that null values o...
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...
This is not feasible as described. To learn LLMs, you can look at models like 3B WizardLM. These are open source and should be possible to just train and run as is. The build may be very complex, ...
Questions about Git should be asked in Software Development. This is a case of bringing the question to the experts. Git is a general purpose version control system, that can be used to version an...
% is one of the oldest Python syntaxes for interpolating strings. It basically works like: template_string % data_tuple In fact, you can literally do that: >>> s = "%d %d" >>&g...
SQL is as good as it gets, generally speaking. The best engine for a small project is SQLite. If you need more, the next step is Postgres. Postgres is very capable and it's unlikely that you'll nee...
This is solved in 2 steps: Find rows matching remove conditions Do anti-left-join on the the composite key (Die, Cell) To filter out the rows: # Read in the data df = pd.read_csv("data.csv...
I largely agree with existing answers, but wanted to add this: In many cases, there is no clear answer one way or the other. Take the program wc which counts characters and lines. Should the inter...
Some good options to consider: SQL create table as statements. This way you can define multiple tables all in one file, that can be copy/pasted easily. It also matches a very common thing: SQL e...