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 »
Q&A

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.

General Q&A about programming, scripting, software design & architecture, process, tools, testing, and more.

Filters (None)
71%
+3 −0
Can you run Python code on text in VS Code?

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

0 answers  ·  posted 6mo ago by matthewsnyder‭

66%
+2 −0
Advanced Regex extension for VS Code

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

0 answers  ·  posted 6mo ago by matthewsnyder‭

66%
+4 −1
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 6mo ago by matthewsnyder‭  ·  last activity 6mo ago by hkotsubo‭

71%
+3 −0
How to open VS code with a particular path expanded?

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

0 answers  ·  posted 6mo ago by matthewsnyder‭  ·  edited 6mo ago by matthewsnyder‭

60%
+1 −0
How do I install Chart.js as a file?

I'm trying to replace Flot.js with Chart.js. In my application, Flot.js is included as a normal JavaScript file, like so: <script language="javascript" type="text/javascript" src="jquery.flot-...

1 answer  ·  posted 6mo ago by CavanWright‭  ·  last activity 6mo ago by Ullallulloo‭

71%
+3 −0
How to provide meaningful names for emails in Maildir?

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

1 answer  ·  posted 6mo ago by matthewsnyder‭  ·  edited 6mo ago by Alexei‭

50%
+3 −3
Regex for simplifying Amazon product URLs

Amazon product URLs are often very long, but on experimentation it is revealed that the following pattern is sufficient: https://www.amazon.com/{dp|gp}/$ID ID is a 10-char string, which I'm gue...

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

40%
+0 −1
Determine which script is slowing the page down in Firefox [closed]

A page is very slow and laggy in Firefox. I am certain it's one of the many Javascripts slowing it down. Out of curiosity, I'd like to figure out which script is creating the heaviest load. Note t...

0 answers  ·  posted 6mo ago by matthewsnyder‭  ·  closed 6mo ago by Alexei‭

60%
+1 −0
Shortcut for inserting today's date in VS Code

Is there a way to easily insert today's date when editing a file in VS Code?

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

60%
+1 −0
How does scoping work in R?

If I run ls() in R, it shows the variables (including functions) in my workspace. But there are other variables visible too, e.g. functions from packages like ls itself. And if I write a function...

1 answer  ·  posted 6mo ago by djm‭  ·  edited 6mo ago by Alexei‭

66%
+2 −0
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 6mo ago by matthewsnyder‭  ·  last activity 6mo ago by Moshi‭

50%
+1 −1
How do I properly render a quad in OpenGL using a GL_TRIANGLE_STRIP primitive?

I am currently working with LWJGL and the obstacle I face right now on my project is rendering textures to a cube, e.x a set of 8 vertices with position, color, and UV information. For now, I am st...

1 answer  ·  posted 6mo ago by cuzzo‭  ·  last activity 6mo ago by djm‭

75%
+4 −0
Is it possible to re-export types similar to JS?

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

1 answer  ·  posted 6mo ago by raphaelschmitz‭  ·  last activity 5mo ago by raphaelschmitz‭

c#
50%
+0 −0
Adding two products into cart with help of a checkbox.

I've created a code snippet in "functions.php" that should add another product to your cart if you mark the checkbox, but somehow, only the original product is add (like the single product from the...

0 answers  ·  posted 6mo ago by gft‭  ·  edited 6mo ago by gft‭

75%
+4 −0
How to pass command line arguments when using cargo run?

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

1 answer  ·  posted 6mo ago by Iizuki‭  ·  edited 1mo ago by Alexei‭

60%
+1 −0
How to delete a local branch in git?

How to delete a local git branch which hasn't been pushed to anywhere, and only exists locally?

1 answer  ·  posted 6mo ago by Iizuki‭  ·  edited 6mo ago by Iizuki‭

80%
+6 −0
What is the meaning of "short circuit" operators?

When reading about various operators used by programming languages, the term "short circuit behavior" is often used. For example in this C code: int a = 0; a && b++ Someone explained t...

2 answers  ·  posted 6mo ago by Lundin‭  ·  last activity 6mo ago by matthewsnyder‭

62%
+3 −1
How do I remove an element from a Java array?

One way to remove element from array is to replace element with zero. Below is a rough snippet I am sharing: int N = sc.nextInt(); int pos = sc.nextInt(); int A[] = new int[N]; if(pos == i) { ...

1 answer  ·  posted 6mo ago by abhinavxyz‭  ·  edited 6mo ago by E_net4‭

71%
+3 −0
How do I pass field names containing dashes in dbt source yml file?

Working with dbt version 2 I'm trying to set up source checks but I'm running into an issue where the column names I'm setting tests for have dashes (e.g. my_table.some-field-with-dash). I current...

1 answer  ·  posted 6mo ago by Sigma‭  ·  last activity 6mo ago by Sigma‭

84%
+9 −0
Understanding mutable default arguments in Python

Consider this code example: def example(param=[]): param.append('value') print(param) When example is repeatedly called with an existing list, it repeatedly appends to the list, as ...

4 answers  ·  posted 6mo ago by Karl Knechtel‭  ·  last activity 4mo ago by matthewsnyder‭

85%
+10 −0
Alternatives to `EXPLAIN ANALYZE` for queries that won't complete

I have a large and complex PostgreSQL SELECT query that I would like to make faster. EXPLAIN suggests it should run quickly, with the worst parts being scans of a few thousand rows. When run, it do...

2 answers  ·  posted 6mo ago by Emily‭  ·  last activity 6mo ago by matthewsnyder‭

50%
+1 −1
Is there a text version of pickle?

Is there a Python serialization format that has capabilities similar to Pickle, but is text based? The problem I always have with pickle is that it's binary, so I can't manually view or edit the d...

0 answers  ·  posted 6mo ago by matthewsnyder‭

33%
+0 −2
Help with android studio gradle [closed]

I need help figuring out if my dependencies need upgrading or conflict with each other. I tried using the command prompt to solve problems but it didn't help. Here is my code. Android Studio Iguan...

0 answers  ·  posted 6mo ago by dnmnbg‭  ·  closed 6mo ago by Alexei‭

60%
+1 −0
Optimized representation for sets?

I need to do a lot of calculations involving sets. There are relatively few values in the "universe" of candidates that could appear in any of the sets, but potentially very many such sets (they mi...

1 answer  ·  posted 7mo ago by Karl Knechtel‭  ·  last activity 7mo ago by Karl Knechtel‭

71%
+3 −0
How should open source forks, with a mix of upstreamable and non-upstreamable commits, be maintained?

I have a few different projects that rely on open source technology that I wish to make modifications to (say, to add key features for business or personal use) that will vary between upstreamable ...

1 answer  ·  posted 7mo ago by eoin.oneill‭  ·  last activity 6mo ago by matthewsnyder‭

66%
+2 −0
Pipeline for zipping multiple file chanel into a single output channel

I am in need of downloading some files (from dynamic list of URLs) and archive them into a single zip file. Since these files can be arbitrarily sized (totaling hundreds of MB), I want to avoid dow...

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

66%
+2 −0
Reaching to a directory in git-bash

I have created a directory named Temporary_add_to_version_control on Desktop. Now I am trying to reach that directory by typing the following in git-bash: cd ~/Desktop/Temporary_add_to_version_con...

1 answer  ·  posted 7mo ago by Birbal01‭  ·  edited 7mo ago by meta user‭

80%
+6 −0
Name for host + path (parts of a URL)

Among other things, a URL consists of a host and a path: I was wondering (and couldn't find anything) if there's a name for the combination of host and path. Is there a name for these: examp...

1 answer  ·  posted 7mo ago by Matthias Braun‭  ·  edited 7mo ago by Matthias Braun‭

url
50%
+0 −0
What is a Crossfilter group?

From reading about the Crossfilter data manipulation library for JavaScript, I take it that "groups" are an important concept in its operation. However, the Crossfilter documentation does not ever...

0 answers  ·  posted 7mo ago by CavanWright‭

50%
+0 −0
Best practices to write functions for both execution modes in Tensorflow, eager and graph mode

I regularly run into the problem that I have a Python function that I want to use in both, eager and graph execution mode. I therefore have to adjust the code so that it can handle both situations....

1 answer  ·  posted 7mo ago by daniel_s‭  ·  edited 7mo ago by daniel_s‭

60%
+1 −0
Can't use tf.timestamp() from within @tf.function with XLA / jit_compile=True

I would like to use tf.timestamp() when it is available (eager mode and graph mode without XLA), and use 0. (or a better fallback if there is one) when it is not available (with XLA; @tf.function(j...

0 answers  ·  posted 7mo ago by daniel_s‭

42%
+1 −2
Listen for key events in a CLI app

I have a Python program like this: done = False while u and not done: i = u.pop() print(f"Processing {i}") do_big_task(i) finish_up() Since this takes a long time, the user m...

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

66%
+2 −0
Is it okay to use python operators for tensorflow tensors?

TL;DR Is (a and b) equivalent to tf.logical_and(a, b) in terms of optimization and performance? (a and b are tensorflow tensors) Details I use Python with Tensorflow. My priorities are Make t...

1 answer  ·  posted 7mo ago by daniel_s‭  ·  edited 7mo ago by meta user‭

42%
+1 −2
How to implement automatic text-to-link conversion in TypeScript?

I'm trying to create an automatic text-to-link conversion feature in a TypeScript application. The desired workflow is: Copy a URL to the clipboard Select some text Paste the URL - this should...

0 answers  ·  posted 7mo ago by ShadowsRanger‭  ·  edited 7mo ago by ShadowsRanger‭

75%
+4 −0
Replace leaf arrays with joined strings in a nested structure in jq

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

1 answer  ·  posted 7mo ago by ggorlen‭  ·  edited 7mo ago by ggorlen‭

60%
+1 −0
Tidy Ansible assert module loop output

Looping in Ansible usually produces a neat output of one line per iteration (per host): ... ok: [Arch] => (item=something) ok: [Arch] => (item=something_else) ok: [Arch] => (item=yet_a...

1 answer  ·  posted 7mo ago by Iizuki‭  ·  edited 7mo ago by Iizuki‭

71%
+3 −0
How to convert Dos paths to Posix paths in Powershell

What is the best way to convert Dos paths to Posix paths in Powershell? eg given: C:\Program Files\PowerShell\Modules\ I want something like: /Program\ Files/PowerShell/Modules/ Is the only so...

1 answer  ·  posted 7mo ago by kjw‭  ·  last activity 6mo ago by H_H‭

50%
+0 −0
Embedding other controller-action with Phalcon

I'm trying to revive an old project of mine. It was built with Phalcon PHP 2 or 3 (I don't even remember which version, but quite old). There I could include a call to the loop inside the controll...

0 answers  ·  posted 7mo ago by posthy‭  ·  edited 7mo ago by Alexei‭

66%
+2 −0
Android Studio "not showing null elements" in unit tests.

My Android app needs to process lists that contain nullable elements. I am using JUnit 4.13.2 for unit testing. I am using Android Studio Flamingo | 2022.2.1 Patch 2 . I have a failing test,...

1 answer  ·  posted 7mo ago by FractionalRadix‭  ·  edited 7mo ago by FractionalRadix‭

71%
+3 −0
How can a Python program send itself to the background?

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

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

77%
+5 −0
How can I schedule a later task in Python?

I want my CLI Python program to schedule a task, and then exit. After some times has passed (say 10 minutes) the task should execute. The task can be a Python method or a shell command, whatever i...

3 answers  ·  posted 7mo ago by matthewsnyder‭  ·  last activity 7mo ago by H_H‭

66%
+2 −0
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 7mo ago by matthewsnyder‭  ·  last activity 7mo ago by matthewsnyder‭

71%
+3 −0
OpenGL: Pass a double vector from vertex shader to fragment shader

TL;DR: How to pass a interpolated double vector, such as a dvec2, from the vertex shader to the fragment shader? I have a vertex shader. In this the output variable out vec2 uv; is set. And i have...

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

77%
+5 −0
Why does calloc accept 2 arguments, and with what arguments should one call it?

According to the standard (C17 draft, 7.22.3.2) The function calloc void *calloc(size_t nmemb, size_t size); "allocates space for an array of nmemb objects, each of whose size is size [and] i...

1 answer  ·  posted 7mo ago by Lover of Structure‭  ·  last activity 7mo ago by Lundin‭

86%
+11 −0
Git: How to clone only a few recent commits?

How do I clone the repository with only part of the history? For example, let's say I want to download only the last 5 commits out of thousands.

2 answers  ·  posted 7mo ago by matthewsnyder‭  ·  last activity 7mo ago by hkotsubo‭

66%
+2 −0
Resolving "fatal: Unable to find remote helper for 'https'" and a warning about templates

On a live boot of Ubuntu 20.04, I was trying to clone into a private GitHub repository. I went through the hassle of installing git, and then gh, and making sure I was signed in through the termina...

0 answers  ·  posted 7mo ago by Mithical‭

git
60%
+1 −0
How to put text next to my ImageIcon on a cell in a JTable

I have an application that works with a JTable, and in this JTable, I want each cell to have both an ImageIcon and some text. I see at this link, JTable supports ImageIcon OR text, but seemingly n...

1 answer  ·  posted 7mo ago by davidalayachew‭  ·  edited 7mo ago by Alexei‭

77%
+5 −0
How can I properly type-hint methods in different files that would lead to circular imports?

I am writing a Python package where I have two classes in different files that (indirectly) depend on each other. If I wouldn't care about type-hints, there would be no problem, but unfortunately,...

2 answers  ·  posted 7mo ago by mr Tsjolder‭  ·  edited 7mo ago by Alexei‭

77%
+5 −0
How to trigger an error/warning immediately upon compile/run if an item on my class-path is missing

I have a very simple source file -- HelloWorld.java public class HelloWorld { public static void main(String[] args) { System.out.println("hello world"); } } I have th...

0 answers  ·  posted 7mo ago by davidalayachew‭  ·  edited 7mo ago by davidalayachew‭

84%
+9 −0
What is the point of pipx?

Background Many Python programs now recommend installing with pipx, and there is a sense that you shouldn't install with pip anymore, you should use tools like pipx. Main Question However, what ...

3 answers  ·  posted 7mo ago by matthewsnyder‭  ·  last activity 6mo ago by tripleee‭