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)
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
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%
+7 −1
Automatically install all packages needed

When running various Python scripts, I often need to do this annoying dance: $ python script.py ... ModuleNotFoundError: No module named 'foo' $ pip install foo $ python script.py ... Module...

3 answers  ·  posted 10mo ago by matthewsnyder‭  ·  last activity 7mo ago by meta user‭

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‭

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‭

63%
+10 −5
Is it wrong to demand features in open-source projects?

I have been using open-source software, and the open-source Community is great at maintaining such projects. But I have observed something in smaller open-source projects. Whenever I demand some f...

3 answers  ·  posted 3y ago by theabbie‭  ·  edited 7mo ago by tripleee‭

77%
+5 −0
How to move a tag in git?

I have created a tag in my project, using git tag v2023 However, I forgot to commit a few changes. Now I would like to move this tag to the current point (after having committed the changes I had...

1 answer  ·  posted 8mo ago by mr Tsjolder‭  ·  edited 7mo ago by meta user‭

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‭

83%
+8 −0
How to declare variable-length arrays correctly?

This is meant as a FAQ Q&A regarding variable-length arrays (VLA). The two bugs described below are surprisingly common. I'm trying to use the variable-length arrays feature of C99 (and newe...

1 answer  ·  posted 2y ago by Lundin‭  ·  last activity 7mo ago by Lundin‭

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‭

71%
+8 −2
Write to same file from multiple threads

I want to write a text file from multiple threads. The file structure is line-oriented. This means writing of lines should be atomic. I am using Qt 5.15.2. Is it enough to protect a shared QTextSt...

2 answers  ·  posted 3y ago by Silicomancer‭  ·  edited 7mo ago by Shree‭

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‭

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‭

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~~‭

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‭

64%
+9 −4
Is omitting braces for single statements bad practice?

Consider this code: while(arr[index] != 0) index++; vs while(arr[index] != 0) { index++; } Personally, I prefer the first. The fact that the braces are not needed makes them -- u...

6 answers  ·  posted 3y ago by klutt‭  ·  last activity 7mo ago by H_H‭

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‭

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

85%
+10 −0
What is C23 and why should I care?

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

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

c c23
50%
+1 −1
How to resolve a "ValueError: dimension 't' already exists as a scalar variable" arising when I am using xarray.Dataset.assign_coords()?

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

1 answer  ·  posted 8mo ago by Ivan Nepomnyashchikh‭  ·  last activity 7mo ago by mr Tsjolder‭

60%
+1 −0
Issues with receiving WM_INPUTLANGCHANGE etc. messages when language is chosen using hotkeys

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

1 answer  ·  posted 8mo ago by ZILtoid1991‭  ·  edited 8mo ago by Karl Knechtel‭

75%
+4 −0
Readable syntax for executing many callables with useful side effects

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

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

77%
+5 −0
Terms for types of functions with respect to side effects

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

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

85%
+10 −0
How to properly use malloc?

I have seen this construct quite a lot: int *p = (int*) malloc(n * sizeof(int)); Is this how it should be? What is the proper way to use malloc? I have also seen this: int *p = malloc(n * size...

3 answers  ·  posted 2y ago by klutt‭  ·  last activity 8mo ago by Lundin‭

80%
+6 −0
Why is git merge from rather than to?

Why does git merge take the source branch rather than the destination branch as a parameter? The most common merge case by far for me is "Okay, this branch looks good, let's merge it into branch X...

4 answers  ·  posted 8mo ago by matthewsnyder‭  ·  last activity 8mo ago by hkotsubo‭

66%
+4 −1
How can I build a string from smaller pieces?

Suppose I have some variables like: >>> count = 8 >>> status = 'off' I want to combine them with some hard-coded text, to get a single string like 'I have 8 cans of Spam®; b...

2 answers  ·  posted 8mo ago by Karl Knechtel‭  ·  last activity 8mo ago by Karl Knechtel‭

87%
+12 −0
What are statements and expressions?

When I have tried to read technical explanations of the syntax rules for programming languages, and when I am trying to decipher error messages, I often encounter the terms expression and statement...

4 answers  ·  posted 8mo ago by Karl Knechtel‭  ·  last activity 8mo ago by Dirk Herrmann‭

71%
+3 −0
How can I output / display multiple values, with controlled spacing, without building a string?

I know that I can display a single string in the terminal window like print("example") (or similarly with a string in a variable), and I know how to open text files and write to them. I also know ...

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

81%
+7 −0
What is the purpose of grouping the tests in a `tests` module and is it possible to split them?

What is the purpose of grouping the tests in a tests module like this #[cfg(test)] mod tests { use super::*; #[test] fn test_function_1() { // test code for function 1 g...

3 answers  ·  posted 1y ago by ShadowsRanger‭  ·  last activity 8mo ago by Moshi‭

66%
+2 −0
What does the w3c standard say about tabbing away from a disabled element?

I'm looking at the behaviour of Chrome and my test framework and trying to understand what the correct behaviour should be before raising an issue/ticket on one or the other (or revisiting how my t...

0 answers  ·  posted 8mo ago by pureferret ‭  ·  edited 8mo ago by Alexei‭

61%
+6 −3
Why are commas not needed for modulo string formatting when printing?

Suppose I have two variables that are called animal and age, and print them as a string in the console like so: animal = "giraffe" age = 25 print("A %s can live up to %d years" %(animal,age)) ...

3 answers  ·  posted 1y ago by Bennshinpoes‭  ·  edited 8mo ago by Karl Knechtel‭

60%
+1 −0
How to call static methods in ColdFusion?

How to use static functions in ColdFusion? How to import component? How to call a static function using both tag and script syntaxes? Adobe added support for static functions in ColdFusion...

0 answers  ·  posted 8mo ago by Vanity Slug ❤️‭

71%
+3 −0
How to compress columns of dataframe by function

Problem How can I compress each column of a dataframe to the output of a function (i.e., mean), preserving columns? MWE import pandas as pd data = {"A": [1, 2, 3, 4], "B": [5, 6, 7, 8]} ...

2 answers  ·  posted 1y ago by mcp‭  ·  last activity 8mo ago by mr Tsjolder‭

77%
+5 −0
Programmatically import, edit and export DBC files

I am looking for a way to programmatically edit and save .dbc files that are meant for J1939 CAN communication. I have a few large files that need to be compared/edited. Being able to import, edit...

1 answer  ·  posted 9mo ago by HinkyDinky‭  ·  last activity 8mo ago by HinkyDinky‭

60%
+1 −0
How to solve the "ReferenceError: service is not defined"?

Temporary notice: this is part of an ongoing project of transferring and splitting my canonical from Stack Overflow on common errors in Google Apps Script. As soon as the Q&As are finalized, ...

1 answer  ·  posted 8mo ago by Oleg Valter‭  ·  last activity 8mo ago by Oleg Valter‭

71%
+3 −0
How do I serialize a const generic length array with Serde?

I have the following code: use serde::{Deserialize, Serialize}; #[derive(Sereialize, Deserialize)] struct Container<const SIZE: usize> { contents: [String; SIZE] } But I'm getti...

0 answers  ·  posted 8mo ago by mousetail‭

66%
+2 −0
VS Code can't find node installation due to dynamically setting the PATH

I installed Node.js using NVS to manage my node installations. This works great, except that I haven't been able to figure out how to debug using VS Code. When trying to launch, I receive this err...

0 answers  ·  posted 8mo ago by Moshi‭

75%
+4 −0
How do I pull new changes in git submodules?

I have a git repository with some submodules. When the submodule repos get new commits on the remote, how can I pull them all?

0 answers  ·  posted 8mo ago by matthewsnyder‭

71%
+3 −0
How to solve the "Cannot call from this context" error?

Temporary notice: this is part of an ongoing project of transferring and splitting my canonical from Stack Overflow on common errors in Google Apps Script. As soon as the Q&As are finalized, ...

1 answer  ·  posted 8mo ago by Oleg Valter‭  ·  last activity 8mo ago by Oleg Valter‭

71%
+3 −0
How to resolve the mypy error "Returning Any from function declared to return 'Dict[str, Any]'" in Python?

I have a function that loads JSON data and is declared to return a dictionary with string keys and values of any type (Dict[str, Any]). However, mypy is raising an error stating that I am returning...

1 answer  ·  posted 8mo ago by ShadowsRanger‭  ·  last activity 8mo ago by Moshi‭

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

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

33%
+2 −6
How do I use an existing AI model to classify pornographic images? [closed]

In the last few months, AI has advanced considerably, notably in the area of generating images. We now have powerful models like DALL-E, Stable Diffusion, etc. These are quite competent at generati...

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

50%
+2 −2
Slicing a dictionary using a string variable

I am working on adding uncertainty to some of my dynamics within a larger Monte Carlo simulation. As a way to perform multiple operations on each value, I decided to make and use a new function to ...

1 answer  ·  posted 8mo ago by megalomaniac‭  ·  edited 8mo ago by megalomaniac‭

66%
+2 −0
Log4j2 not looking for log4j.properties even with the system property set

I am migrating an application from Log4j1 to Log4j2 using the API bridge jar. All references to the log4j1.jar have already been removed. I set the system property in Websphere as a JVM argument -...

1 answer  ·  posted 8mo ago by tarhalda‭  ·  edited 8mo ago by Alexei‭

66%
+2 −0
Redux Toolkit Issue with Managing States

I am all new with using Redux Toolkit, I followed the official documentation to setup the store: // store.ts import { configureStore, ThunkAction, Action, combineReducers } from '@reduxjs/toolkit...

0 answers  ·  posted 8mo ago by boudagga.ma94‭

60%
+1 −0
What can be used in react-native instead of an html label tag to achieve the same result?

I wanna make a form in React native. A field in this form in (non-native) React would be like this: <div> <label htmlFor="lastName">Last Name:</label> <input type="text...

0 answers  ·  posted 8mo ago by andre‭  ·  edited 8mo ago by andre‭