Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »

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‭

111 posts
66%
+2 −0
Q&A VS Code: How to open a file and folder in a new window?

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...

2 answers  ·  posted 1y ago by matthewsnyder‭  ·  last activity 1y ago by Moshi‭

Question vs-code
66%
+2 −0
Q&A Turn all changes after latest origin/main into a branch

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...

posted 4mo ago by matthewsnyder‭

Answer
66%
+4 −1
Code Reviews Parsing numbers from a text file

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...

posted 5mo ago by matthewsnyder‭  ·  edited 5mo ago by matthewsnyder‭

Answer
66%
+2 −0
Q&A Run Spark code without Spark?

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...

1 answer  ·  posted 6mo ago by matthewsnyder‭  ·  last activity 6mo ago by congusbongus‭

Question apache-spark
66%
+4 −1
Q&A Subfolders for package-less module imports

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...

1 answer  ·  posted 7mo ago by matthewsnyder‭  ·  last activity 7mo ago by matthewsnyder‭

Question python-3
66%
+2 −0
Q&A How to group a flat list of attributes into a nested lists?

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...

posted 9mo ago by matthewsnyder‭

Answer
66%
+2 −0
Q&A How to troubleshoot ModuleNotFoundError?

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 ...

posted 11mo ago by matthewsnyder‭  ·  edited 11mo ago by Karl Knechtel‭

Answer
66%
+2 −0
Q&A Does Python have a "ternary operator" (conditional evaluation operator like "?:" in other languages)?

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...

posted 1y ago by matthewsnyder‭

Answer
66%
+2 −0
Q&A Get list of all variables from Jinja template

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 ...

0 answers  ·  posted 1y ago by matthewsnyder‭  ·  edited 1y ago by Karl Knechtel‭

66%
+4 −1
Q&A How to overwrite lines of STDOUT in Python?

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 ...

2 answers  ·  posted 1y ago by matthewsnyder‭  ·  last activity 1y ago by hkotsubo‭

Question python-3
66%
+2 −0
Q&A Shortcut for inserting today's date in VS Code

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...

posted 1y ago by matthewsnyder‭  ·  edited 1y ago by matthewsnyder‭

Answer
66%
+2 −0
Q&A What is the meaning of "short circuit" operators?

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...

posted 1y ago by matthewsnyder‭  ·  edited 1y ago by matthewsnyder‭

Answer
66%
+2 −0
Q&A Clone .git repo into current dir, without touching files

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...

1 answer  ·  posted 1y ago by matthewsnyder‭  ·  last activity 1y ago by matthewsnyder‭

Question git-clone
66%
+2 −0
Q&A How can I build a string from smaller pieces?

+ 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...

posted 1y ago by matthewsnyder‭  ·  edited 1y ago by matthewsnyder‭

Answer
66%
+4 −1
Meta Should we disallow ChatGPT-User crawler (and others) from scraping Software Codidact?

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 ...

posted 1y ago by matthewsnyder‭

Answer
66%
+2 −0
Q&A "Move symbol" refactor for Python in Visual Studio Codium

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...

0 answers  ·  posted 1y ago by matthewsnyder‭  ·  edited 1y ago by matthewsnyder‭

66%
+2 −0
Q&A Does Snowflake NATURAL JOIN support outer-style join?

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...

1 answer  ·  posted 1y ago by matthewsnyder‭  ·  edited 1y ago by matthewsnyder‭

Question sql join snowflake
66%
+2 −0
Q&A How do I find disjoint sets in a dataset

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...

posted 1y ago by matthewsnyder‭

Answer
62%
+3 −1
Q&A Building a language model completely from scratch

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, ...

posted 10mo ago by matthewsnyder‭

Answer
62%
+3 −1
Meta Where should I ask git questions?

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...

posted 5mo ago by matthewsnyder‭

Answer
60%
+1 −0
Q&A Why are commas not needed for modulo string formatting when printing?

% 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...

posted 1y ago by matthewsnyder‭

Answer
60%
+1 −0
Q&A Can pandas be used as a database backend for persistent storage?

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...

posted 1y ago by matthewsnyder‭

Answer
60%
+1 −0
Q&A Remove entries by two-column ID everywhere, that meet a condition somewhere

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...

posted 1y ago by matthewsnyder‭

Answer
60%
+1 −0
Q&A For scripting what are the pros and cons of command line arguments versus capturing input at the start?

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...

posted 1y ago by matthewsnyder‭

Answer
60%
+1 −0
Meta Best practices for posting tabular data

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...

posted 1y ago by matthewsnyder‭  ·  edited 1y ago by matthewsnyder‭

Answer