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)
72%
+6 −1
Why is atoi dangerous and what should be used instead?

According to Which functions in the C standard library must always be avoided?, the atoi family of functions is dangerous and should never be used for any purpose. The rationale given in the answer...

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

75%
+4 −0
Understanding "logical OR" and "logical AND" in programming languages

Many programming languages either have keywords like or and and used for logic, or equivalent operators such as || or && - which are referred to as "logical or" and "logical and" respective...

3 answers  ·  posted 2mo ago by Karl Knechtel‭  ·  edited 2mo ago by Andreas is speechless at the number of bird deaths‭

66%
+2 −0
Dynamically do something after a useState variable has been set?

Since setState is asynchronously executed, how to dynamically do something after a useState variable has been set? Consider import { useState } from "react"; const [myVar, setMyVar] = useState("...

1 answer  ·  posted 11d ago by propatience‭  ·  edited 11d ago by propatience‭

50%
+1 −1
How to Suppress System Sound for Keyboard Shortcuts in C++ Desktop Application [closed]

In my desktop application developed in C++, I am encountering an issue where pressing the Ctrl + X, Ctrl + Shift + X, and Ctrl + D shortcut keys triggers a system sound. I would like to suppress o...

0 answers  ·  posted 3mo ago by Junior_Dev‭  ·  edited 2mo ago by Alexei‭

71%
+3 −0
Unit Testing #define Directives in Visual Studio

I have some methods in my codebase that utilize the #if DEBUG preprocessor directive to provide specialized behavior that differs between the debugging environment and the production environment. I...

1 answer  ·  posted 4mo ago by Orladdin‭  ·  last activity 4mo ago by Olin Lathrop‭

60%
+1 −0
I can't install the Spacy library using the terminal in VSCode on Windows 10

I am trying to install the Spacy library in VSCode in a folder with a virtual environment. The output appearing in the terminal is excessively long; I will share it with a pastebin later. My versio...

1 answer  ·  posted 3mo ago by Richard‭  ·  last activity 3mo ago by Alexei‭

50%
+0 −0
Using sqlline, how do you filter/find tables using the !tables command

I need to filter/find and list tables using the sqlline !tables command. For example, these are the type of queries i wish to fire Find out all the tables in a particular schema s1 All tables ...

1 answer  ·  posted 4mo ago by Abbas Gadhia‭  ·  last activity 4mo ago by Abbas Gadhia‭

60%
+1 −0
Simultaneous comparison in Python

I want to make multiple comparisons at once, of the same type, in a Python program. For example, to check whether all of a certain group of strings are in a longer test string; or whether a specifi...

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

60%
+1 −0
Best Practices for Precalculating Expensive Variables in Functions

A class might calculate static variables during instantiation, which are then used by various functions. A common technique to optimize function performance is to precalculate expensive variables u...

2 answers  ·  posted 2mo ago by wagimek‭  ·  last activity 2mo ago by wagimek‭

77%
+5 −0
C#: Performance hit from using calculated property instead of get-only property with initializer?

JetBrains Rider suggests that I change this (for example): public class Foo { public int OnePlusOne { get; } = 1 + 1; } to this: public class Foo { public int OnePlusOne => 1 + 1...

1 answer  ·  posted 4mo ago by LyndonGingerich‭  ·  last activity 3mo ago by Michael‭

71%
+3 −0
What does Nixpkgs' `callPackage` do?

callPackage is a complex function (reasons include the Nix language being lazy, usage of fixed-point evaluation, overrides, etc.), and this complexity steals the spotlight from what this function a...

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

66%
+2 −0
Understanding "de Morgan's laws"

While trying to understand logical 'or'/'and', I encountered another problem (I'm writing Python code here, but my question is about the logic, not about any given programming language). I have som...

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

71%
+3 −0
How can I interact with the target widget from a drop event

I'm trying to update a ListBox widget after dropping some files on it. This is the relevant part of my current code: fn on_file_drop(target: &DropTarget, value: &Value, ...

2 answers  ·  posted 5mo ago by GeraldS‭  ·  last activity 3mo ago by jmb‭

66%
+2 −0
How to execute and find gradients of a tensorflow (1) graph object

I have an "tensorflow.python.framework.ops.Graph" object loaded from a .pb file. def load_pb(path_to_pb): with tf.compat.v1.gfile.GFile(path_to_pb, "rb") as f: graph_def = tf.compat....

0 answers  ·  posted 6mo ago by purplenanite‭

77%
+5 −0
How do you implement polymorphism in C?

The topic of how to implement polymorphism in C tends to pop up now and then. Many programmers are used to OO design from higher level languages and supposedly OO is a "language-agnostic" way of pr...

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

77%
+5 −0
How does the strict aliasing rule enable or prevent compiler optimizations?

Inspired by https://meta.stackoverflow.com/questions/432242, and the relevant main-space questions. I have heard that C and C++ something called the "strict aliasing rule", which means for exa...

2 answers  ·  posted 2mo ago by Karl Knechtel‭  ·  last activity 19d ago by Lundin‭

77%
+5 −0
Why does a lack of object encapsulation constitute a security breach?

In the current version of OpenJDK's JEP 401: Value Classes and Objects (Preview), it is said that value classes can leak data stored in their fields, and that this is potentially a security concern...

2 answers  ·  posted 6mo ago by Andreas is speechless at the number of bird deaths‭  ·  last activity 1mo ago by LAFK‭

71%
+3 −0
How to disable debug windows automatically opening up when I hit a breakpoint in vscode?

In vscode, when I hit a breakpoint it automatically opens "Run and Debug" window. I don't want that because I am using a small screen (and that sidebar takes up space) and I don't always need to us...

1 answer  ·  posted 4d ago by Vanity Slug ❤️‭  ·  last activity 4d ago by Vanity Slug ❤️‭

71%
+3 −0
Are these two function pointer declarations equivalent?

Say I have two functions: FILE* get_input(const char fname[static 1]); FILE* get_output(const char fname[static 1]); And I wish to declare a function pointer and assign it the result of some p...

1 answer  ·  posted 7mo ago by Melkor-1‭  ·  edited 7mo ago by Melkor-1‭

70%
+5 −1
how do I get markdown to render # as a shell prompt and not a comment?

Note: This is a general question about Markdown formatting for any Markdown renderer (e.g., Gitlab, Github, Codidact). So this is not just a question about Codidact's renderer. When displaying she...

1 answer  ·  posted 2mo ago by Trevor‭  ·  last activity 2mo ago by hkotsubo‭

66%
+2 −0
Helm delete old release revisions

Helm keeps track of releases and their revisions by creating a kubernetes Secret each time a chart is installed, upgraded etc. These are of course useful in case you want to rollback, but they do p...

1 answer  ·  posted 18d ago by Iizuki‭  ·  edited 18d ago by Iizuki‭

77%
+5 −0
Reusing HTML without rewriting it

I have a site hosted through GitHub and I'm using footers for special links and it also serves as my main navigation bar for now. I find it a little frustrating to manually copy-paste the footer's ...

3 answers  ·  posted 6mo ago by General Sebast1an‭  ·  last activity 6mo ago by matthewsnyder‭

60%
+4 −2
Is `git pull` dangerous?

I heard git pull is dangerous. Is it really dangerous? If so, why or how is it dangerous? Are there any flags that mitigate or remove the danger? What are the alternatives if it...

2 answers  ·  posted 5mo ago by alx‭  ·  last activity 5mo ago by alx‭

git
66%
+2 −0
how can I run pytest on Flask routes?

I'm trying to implement pytest for one of my Python Flask projects. The application is instanciated like this in appname.py def create_app(): app = Flask(__name__) app.config.from_pyfil...

0 answers  ·  posted 5mo ago by GeraldS‭  ·  edited 5mo ago by GeraldS‭

60%
+1 −0
how to save the line number of a double-clicked line in tmux

In tmux I have the following command in my .tmux.conf, which will save a double-clicked line to the file /tmp/tmux_line.txt: bind-key -n DoubleClick1Pane select-pane \; copy-mode -M \; send-keys -...

0 answers  ·  posted 2mo ago by Trevor‭

60%
+1 −0
empty line in table cell in reStructuredText (rst)

I would like to have an empty line in the cell of a table in reStructuredText. Consider the following example: .. list-table:: :header-rows: 1 * - aaa - bbb * - ccc - ddd ...

0 answers  ·  posted 2mo ago by Trevor‭  ·  edited 2mo ago by Trevor‭

42%
+1 −2
How to invoke dialog modal from module instead of directly using the showModal() method

I need to have 2 different models to create projects and to-do lists. I've figured out, that for HTML there is only one dialog menu that can be invoked with window.dialog.showModal(); directly. So ...

0 answers  ·  posted 3mo ago by Sevenfold‭  ·  edited 2mo ago by Andreas is speechless at the number of bird deaths‭

66%
+2 −0
typeof_unqual behaves differently in gcc and clang

C23 6.7.3.6 contains this (informative) example demonstrating the use of typeof_unqual: const char* const animals[] = { "aardvark", "bluejay", "catte", }; typeof_unqual(animals) anima...

1 answer  ·  posted 2mo ago by Lundin‭  ·  edited 2mo ago by hkotsubo‭

50%
+0 −0
How to make Box drive have the files prepared for access when I need it?

I have Box drive on Windows. I use it as a regular folder on the computer. I can store images there. When I store a small number of images (on the order of a couple hundreds) and I do not wait lon...

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

60%
+1 −0
Test Extension Method Received Call with NSubstitute

How can I verify that an extension method was called when using NSubstitute for unit testing? For a normal method I'd do something like: substitutedClass.Recieved().CheckedMethod(...) But exten...

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

81%
+7 −0
Why is the new auto keyword from C++11 or C23 dangerous?

In older C and C++ standards, the auto keyword simply meant automatic storage duration. As in the compiler automatically handles where the variable is stored, typically on the stack or in a registe...

2 answers  ·  posted 7mo ago by Lundin‭  ·  last activity 5mo ago by celtschk‭

60%
+1 −0
In javascript is there really a good reason to never check for boolean true || false such as if(var){}else{}?

I am fairly certain this isn't a duplicate so please bear with me. I check for boolean true||false using if() as a matter of course in my programming. I've programmed extensively in PHP, some in C...

3 answers  ·  posted 8mo ago by MER‭  ·  last activity 8mo ago by hkotsubo‭

60%
+1 −0
Add an IDistributedCache to EntityFramework

Is there a standard way to add an IDistributedCached in front of a database using EntityFramework? Something that handles checking the cache for reads, updating the cache on writes, and uses distri...

0 answers  ·  posted 8mo ago by rcmosher‭

66%
+2 −0
Why is package.json needed for running a SvelteKit application?

I'm trying to containerize a SvelteKit application that uses the @sveltejs/adapter-node. The Build and Deploy section from the documentation recommends to build the application, and then run the a...

0 answers  ·  posted 5mo ago by ɯıpɐʌ‭

77%
+5 −0
Differences between Haskell tools Stack and Cabal?

Haskell tooling can be confusing. Both Stack and Cabal appear to be build tools with similar goals. How do they differ? Why should you pick one over the other?

1 answer  ·  posted 4mo ago by Iizuki‭  ·  edited 3mo ago by Alexei‭

50%
+0 −0
What can cause an HTML form submission result in a new pop-up window?

These are the methods I know of: Set the form's target attribute to _blank. Add submit event listeners (e.g., this SO thread). In the proprietary web app that I have to work with, every form...

0 answers  ·  posted 2mo ago by toraritte‭  ·  edited 2mo ago by toraritte‭

57%
+2 −1
How to mock methods like `pathlib.Path.is_dir`?

I used to have some testing code for mocking a simple directory structure when working with pathlib. I recently tried to run these tests to learn that some of the internals in pathlib have changed ...

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

75%
+4 −0
What does an exclamation mark mean in a GraphQL schema?

Types are often followed by exclamation marks in GraphQL schemas. What do they mean? type User { id: Int! email: String! name: String! updatedAt: String! createdAt: String...

1 answer  ·  posted 4mo ago by Iizuki‭  ·  last activity 3mo ago by Alexei‭

66%
+2 −0
Why can't I use a library I just installed with Pip?

I tried installing package-installation-test[1] using Pip, and it appeared to be successful. But I can't use it as advertised, either by itself or by importing it from my code: Failed attempts ...

1 answer  ·  posted 7mo ago by Karl Knechtel‭  ·  edited 7mo ago by Karl Knechtel‭

40%
+0 −1
Addressing W25Q64 flash IC [closed]

I am using a W25Q64 flash ic to store some stuff for an ESP-32 project. I used this library from Github as it seems intended for ESP. It seemed weird that the read function uses two 16-bit paramet...

0 answers  ·  posted 9mo ago by HinkyDinky‭  ·  closed 9mo ago by Lundin‭

60%
+1 −0
Identifying non-daemon threads in an Android ANR stack dump

One of "my" Android apps is showing a heavy frequency of "slow exit" application-not-responding (ANR) problems. The Play Console has the "insight": Slow exit Problem The main thread has finish...

0 answers  ·  posted 5mo ago by Peter Taylor‭

71%
+3 −0
Regex to get text outside brackets

I am trying to capture the content outside square brackets in groups, using this regex: (.*)\[.*?\](.*) And it works perfectly for a simple string like this: testing_[_is_]_done This is the...

2 answers  ·  posted 8mo ago by TonyMontana‭  ·  last activity 2mo ago by hkotsubo‭

50%
+0 −0
How can I make a standalone executable from Python code?

I know that I can make Python code run starting from the script, but this still requires the user to have Python installed (and will still rely on configuring the system so that it can find Python ...

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

77%
+5 −0
Reinstall old Python libraries after update

Recently, Python updated from 3.11 to 3.12 and now all my libraries are gone. Actually they're in the old 3.11 site-packages, but now that python points to 3.12 those are not active. Every time I r...

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

60%
+1 −0
How to start creating a Giraffe web project and how to serve it?

Having some trouble with giraffe-template on Mac M1, so decided to set up a Giraffe project manually. Started following the Doing it manually section of the Giraffe README, but got stuck right away...

1 answer  ·  posted 10mo ago by toraritte‭  ·  last activity 10mo ago by toraritte‭

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

50%
+2 −2
How to write a bash function to sanitize filenames for Linux and Windows

I'm trying to write a bash function that can sanitize filenames to make them compatible with both Linux and Windows file systems. The function should perform the following operations: Replace in...

0 answers  ·  posted 10mo ago by ShadowsRanger‭

71%
+3 −0
Privilege escalation from Python like from systemd

When you try to do a privileged systemd operation without the privilege, you get an escalation prompt: $ systemctl stop docker ==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ==== ...

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

50%
+1 −1
How can I properly implement Hexagonal Architecture and Domain Driven Design in the same application?

I'm trying to use the "hexagonal architecture" and "domain-driven design" paradigms together, in a Java application using Spring. I understand that my application should have a structure with 3 la...

1 answer  ·  posted 4mo ago by rudahee‭  ·  edited 2mo ago by Karl Knechtel‭

75%
+4 −0
Managing a dependency for a C application

One of my applications has a dependency on a stb-library. Now I am publishing this application to Github. Should I: Include the header that was used during development with the code? Have an in...

2 answers  ·  posted 7mo ago by Melkor-1‭  ·  edited 7mo ago by matthewsnyder‭