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)
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 ...
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...
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...
Is there a way to easily insert today's date when editing a file in VS Code?
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...
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 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...
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 ...
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...
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...
How to delete a local git branch which hasn't been pushed to anywhere, and only exists locally?
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...
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) { ...
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...
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 ...
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...
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...
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...
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...
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 ...
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...
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...
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...
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...
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....
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...
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...
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...
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...
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...
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...
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...
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...
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,...
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...
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...
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...
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...
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...
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.
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...
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...
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,...
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...
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 ...
The C language has gone through many iterations and the latest one not yet released is informally called "C23", supposedly because they hoped to release it in 2023. The latest draft version N3096 i...
I have the following xarray Dataset: d: <xarray.Dataset> Dimensions: (x: 79, y: 63, t: 1) Coordinates: * x (x) float64 0.9412 1.882 2.824 3.765 ... 71.53 72.47 73.41 74.35 * ...
I'm currently writing an input and output handling library for the D language, and I'm not getting any kind of input language change messages when the language is being toggled with hotkeys, and on...
Mathematically, the purpose of a function is to return an output. However, in a programming context functions often have side effects. It is even common to call functions for the side effects alone...
In Python, multiprocessing is easy to do if you follow a "list projection" paradigm. Say you want to take a list of inputs X and apply some function f to every x_i, such that y_i = f(x_i) and the y...