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)
80%
+6 −0
How to store credentials for PHP scripts on a Windows machine?

I have a number of command line PHP scripts that are either run by a user or by Windows Task Scheduler. These scripts use DB and API credentials and I am wondering if there is a better way of stori...

1 answer  ·  posted 3y ago by Charlie Brumbaugh‭  ·  edited 3y ago by Charlie Brumbaugh‭

80%
+6 −0
How are integers interpreted in contexts that expect a date?

I found a confusing construction in several stored procs in an MS SQL 2008 R2 database: DATEADD(dd, 0, DATEDIFF(dd, 0, some_date)) As I understand it, these are the relevant function signatures: D...

1 answer  ·  posted 3y ago by ajv‭  ·  edited 3y ago by Alexei‭

80%
+6 −0
Is it recommended for ASP.NET Web API actions to always include a CancellationToken?

Note: This is basically a question from Stack Overflow that was closed for a very long period of time and I fear it might get closed again as primarily opinion based. I am wondering if my ASP.NET C...

1 answer  ·  posted 3y ago by Alexei‭  ·  last activity 3y ago by Peter Taylor‭

80%
+6 −0
Are generic enums completely abstract?

When using Result or Option to get a value, the value is wrapped in a Ok or Some. For example, with pattern matching to get a Result: let var: Json = match serde_json::from_str(&my_string) { ...

1 answer  ·  posted 3y ago by jla‭  ·  last activity 3y ago by Derek Elkins‭

80%
+6 −0
How to use function composition for applying a function to first elements of a list?

Can anyone explain to me why my Haskell function gives rise to a type-definition error? Originally, I wrote the following function to subtract one from the first n elements in a list: dec_first :...

2 answers  ·  posted 9mo ago by mr Tsjolder‭  ·  last activity 9mo ago by mauke‭

80%
+6 −0
How do I find disjoint sets in a dataset

I have a dataset of car bookings like this: car_id user_id 1 1 2 1 1 2 3 3 1 2 3 3 In this dataset, two separate groups/sets of cars and users...

2 answers  ·  posted 10mo ago by andreas‭  ·  edited 10mo ago by matthewsnyder‭

80%
+6 −0
Can I access an array element from a pointer to an object contiguous with but outside the array?

C prohibits accessing an array out of bounds even if measures were taken to ensure that what should lie outside those bounds were known: struct MyStruct { int x[2]; int y, z; }; static...

1 answer  ·  posted 16d ago by CPlus‭  ·  last activity 13d ago by Lundin‭

80%
+6 −0
Git apply vs git am

What are the differences between git apply and git am commands? Both seem to be used for applying patches to repositories. When should one be used over the other?

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

git
80%
+6 −0
How to read lines into an array in Bash

I wish to fill an array with strings, using Bash scripting. The strings are in a file, one per line. Here is what I've tried: declare -a my_array=() while read line; do my_array+=( "$line"...

3 answers  ·  posted 3y ago by LVx0‭  ·  edited 2y ago by Alexei‭

80%
+6 −0
Is migrating emails from one hosting provider to another a trouble?

I rent a shared-hosting environment with CentOS-Bash, Apache, PHP, MySQL and a web-based IMAP email client (Roundcube) and some more tools, on which I host my personal website; I don't have Cpanel...

1 answer  ·  posted 3y ago by deleted user  ·  edited 14d ago by Alexei‭

80%
+6 −0
How can I test my front end for accessibility to the blind?

I'd like my web front end to be accessible, including to people who use screen readers. I know the basics about labels and alt text for images, but there are some areas where I'm not sure what a s...

1 answer  ·  posted 3y ago by Monica Cellio‭  ·  last activity 3y ago by Peter Cooper Jr.‭

80%
+6 −0
When does it not work to dereference the pointer for sizeof during malloc?

Background This is kind of a subquestion to How to properly use malloc? When allocating, there are basically two common ways of using the sizeof operator: int *p; p = malloc(n * sizeof *p); /...

1 answer  ·  posted 2y ago by klutt‭  ·  edited 2y ago by hkotsubo‭

80%
+6 −0
TypeScript is unable to infer the correct type for a mapped tuple

I was playing around with mapped tuples and came across an interesting case where TypeScript cannot infer the types used: interface Foo<A, B> { (a: A, b: B): any } function test<...

0 answers  ·  posted 2y ago by Moshi‭  ·  edited 2y ago by Moshi‭

80%
+6 −0
PGP sign emails sent with git-send-email(1)

How can we use git-send-email(1) to sign patches (emails) with the gpg(1) keyring? I've heard it can be done, but couldn't find anything in the git-send-email(1) documentation nor in a web search.

2 answers  ·  posted 2y ago by alx‭  ·  last activity 2y ago by alx‭

80%
+6 −0
array of arrays vs array of pointers to store array of string literals

Let's consider the following code: const char a[][4] = {"aa", "aaa"}; const char *b[] = {"bb", "bbb"}; const char *const c[] = {"cc", "ccc"}; For shared libraries, both b and c arrays require...

0 answers  ·  posted 2y ago by alx‭  ·  edited 2y ago by alx‭

80%
+6 −0
Is it OK to use scanf with a void pointer?

I've created a function that calls scanf passing a void pointer as argument: void read(const char *format, void *p) { scanf(format, p); } And tested it with different types: int n; read...

2 answers  ·  posted 2y ago by hkotsubo‭  ·  last activity 2y ago by Lundin‭

80%
+6 −0
How to find out which packages target .NET 3.1 in a .NET 5 application?

After upgrading a Web application from ASP.NET Core 3.1 to ASP.NET Core 5.0, it worked fine on an existing server. However, when deployed on a server that had only .NET 5.0 installed, the applicat...

1 answer  ·  posted 3y ago by Alexei‭  ·  last activity 3y ago by Alexei‭

80%
+6 −0
How to parse a date with more than 3 decimal digits in the fractions of second?

I'm using SimpleDateFormat to parse a string containing a date/time, but the result has a different date, hour, minute, second and millisecond: SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM...

1 answer  ·  posted 2y ago by hkotsubo‭  ·  last activity 2y ago by hkotsubo‭

80%
+6 −0
error[E0507]: cannot move out of X which is behind a shared reference.

Making a Nannou App that draws a line to the screen. My model only contains the window itself and a vector of tuples describing the points and color. Similar to this example(under Drawing Lines) ...

1 answer  ·  posted 2y ago by telefza‭  ·  last activity 2y ago by telefza‭

80%
+6 −0
Strange change of object lightness and colour in Nannou application

Building a Nannou App from their template. I want a circle to slowly fade in color and randomly change color when hitting the boundary of the window. But there is something strange going on when ...

1 answer  ·  posted 3y ago by telefza‭  ·  last activity 3y ago by telefza‭

80%
+6 −0
Interpreted language: What is its benefit for being written in that way ?

Whenever I search in google why a specific language is interpreted language, I get differences between compiled languages and interpreted languages but nowhere the benefit for being interpreted rat...

3 answers  ·  posted 3y ago by aditya98‭  ·  last activity 3y ago by Olin Lathrop‭

80%
+6 −0
Fail to send DICOM C-Echo, although DICOM Association seems successful.

I am building an Android app to perform a DICOM C-Echo. (DICOM is a standard for storing and transferring medical images; the specification is at dicom.nema.org). My purpose is to learn more about ...

0 answers  ·  posted 3y ago by FractionalRadix‭  ·  edited 3y ago by FractionalRadix‭

80%
+6 −0
Why is this symlink() call returning successfully while apparently failing to create the sym-link?

Summary I'm building an internal system (hardware simulator, using Rust) to help test some Python-based services that talk to hardware. (The services talk to hardware via TTYs.) To trick the Pytho...

1 answer  ·  posted 3y ago by ghost-in-the-zsh‭  ·  last activity 2y ago by ghost-in-the-zsh‭

80%
+6 −0
How to do "out-of-source" build properly with cmake?

There are two broad types of build environments - in-source and out-of-source. "In-source" means the compiled files will appear in the same directory as source files. "Out-of-source" means there is...

2 answers  ·  posted 3y ago by anatolyg‭  ·  last activity 3y ago by alex‭

80%
+6 −0
Proper way of sending large amount of data from View to ViewModel

The problem I am working on a simple drawing app for Android. I have a custom view on which the user can draw. This means that a lot of data (a list of points) is generated in this View. I want t...

1 answer  ·  posted 3y ago by FractionalRadix‭  ·  last activity 2y ago by nnlei‭

80%
+6 −0
Python Regex to parse multiple "word. word. word."

I'm trying to parse lines like "THIS. THAT..OTHER " so that "THIS. THAT." is found. There can be more than one <word><dot> separated by a space except no space after the last one. ...

2 answers  ·  posted 3y ago by CodeFarmer‭  ·  last activity 2y ago by hkotsubo‭

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‭

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
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 7mo ago by Lundin‭  ·  last activity 7mo ago by matthewsnyder‭

80%
+6 −0
How to compare a git stash to the current working tree?

In git you can put your current changes aside for a moment with git stash. This is really neat but what often ends up happening is that you forget what was in there, and what was the state of the b...

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

80%
+6 −0
How kill a child process without read() hanging in the parent process?

There is an external program I'm calling from within my C/C++ program, by using fork() and execl(), and redirecting the stdio with dup2() to be able to read the output from the external program. I...

1 answer  ·  posted 2y ago by sktpin‭  ·  edited 2y ago by Lundin‭

80%
+6 −0
Continuously read from piped input using Vim

In Vim, it's possible to tell it to read from stdin instead of a file, by using vim -. This is so that you can pipe the output of one command into Vim, to view/edit it there. The problem I'm facin...

2 answers  ·  posted 2y ago by Hyperlynx‭  ·  last activity 2y ago by deleted user

80%
+6 −0
When stored procedures are preferred over application layer code?

A person I used to work with several years ago was hired to rewrite a product using a .NET-based modern tech stack. One of the aspects that stroke me was that he believes that the product should mo...

2 answers  ·  posted 2y ago by Alexei‭  ·  last activity 2y ago by Derek Elkins‭

80%
+6 −0
Can I set a memory limit for the .NET Core garbage collector to collect objects more aggressively?

I have an ASP.NET Core 5 web application that provides functionality that involves file upload + rather large processing (memory consumption mainly). After each processing (with success or not) the...

2 answers  ·  posted 2y ago by Alexei‭  ·  edited 2y ago by Alexei‭

80%
+6 −0
Are static pointers implicitly initialized to NULL?

Consider this code: #include <stdio.h> int main(void) { static void *ptr; if(ptr == NULL) puts("It's NULL!"); } I wonder if this is guaranteed to print "It's NULL!" I know ...

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

80%
+6 −0
When using the compare function in Array.prototype.sort, how to avoid an element to be processed more than once?

When using the Array.prototype.sort method, we can pass a compare function as argument. Then, this function can be used to process array's elements, so the comparison is made using some custom crit...

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

80%
+6 −0
Are there any downsides related to using Maybe or Optional monads instead of nulls?

I have recently stumbled across the Maybe (or Optional) modal usage in .NET Code: example code or this one example article Based on everything I read, there are multiple advantages on relyi...

2 answers  ·  posted 2y ago by Alexei‭  ·  last activity 2y ago by Derek Elkins‭

78%
+9 −1
What is do { } while(0) in macros and should we use it?

Background I can see the need to use { } when implementing a function-like macro such as this one: #define HCF(code) fprintf(stderr, "halt and catch fire"); exit(code); Because if we use the f...

2 answers  ·  posted 3y ago by Lundin‭  ·  last activity 5mo ago by Karl Knechtel‭

77%
+5 −0
F-bounded polymorphism, interface operators, and type inference in C#

C# language version 8.0 introduces limited support for static methods, operators, etc. in interfaces. However, there are still limitations. I was hoping to use the new language features to try a ge...

0 answers  ·  posted 3y ago by Peter Taylor‭

77%
+5 −0
When should I use wait() instead of get() when using C++ threads

I'm trying to understand the purpose of the wait() function in Class future<> for C++. At the moment I don't see any purpose for calling wait() instead of get(). What I have tried in code: i...

1 answer  ·  posted 3y ago by hamsasimon‭  ·  last activity 3y ago by Derek Elkins‭

77%
+5 −0
Is it possible in MySQL to require each row in a table have at least one foreign key record in a join table?

I have tables A and B and then I have a many to many join table with foreign keys to both called a_b. Neither foreign key can be null and the combinations for the foreign keys to A and B are unique...

2 answers  ·  posted 3y ago by Charlie Brumbaugh‭  ·  last activity 3y ago by Alexei‭

77%
+5 −0
Validate All Object Properties with JSON Schema

I'm writing a JSON schema to validate asset files for a program. The JSON I need to parse is structured so: { "jobs": { "software-developer": { "job-description": "sw-dev.md:0", "pay": 800...

1 answer  ·  posted 3y ago by Josh Hyatt‭  ·  last activity 3y ago by elgonzo‭

77%
+5 −0
What's the difference between =, == and === operators in JavaScript?

While learning JavaScript, I started to see =, == and === operators. What's the difference between them?

3 answers  ·  posted 2y ago by Kevin M. Mansour‭  ·  last activity 2y ago by hkotsubo‭

77%
+5 −0
updating a function within a struct

What I want: An object that contains a function that I can update after creation. I created a struct that contains a parameter b and a function(closure?) named Internal_Fn. struct MyThing { ...

1 answer  ·  posted 3y ago by telefza‭  ·  last activity 3y ago by Derek Elkins‭

77%
+5 −0
How to configure Python pip to look for packages in a private index first?

When I run pip install foo, pip looks for foo in PyPi. I want it to look for it first in a private repo, let's say pypi.bar.com. Only if foo cannot be found in pypi.bar.com, should pip then look f...

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

77%
+5 −0
Storing more bytes than a union member has, but less than the union size, with memcpy(3)

Let's say we have an object, we store it in a union (into some other narrower type, but with memcpy(3), so it's allowed --I guess--), and then read it from the union via it's original type (so no a...

2 answers  ·  posted 11mo ago by alx‭  ·  last activity 10mo ago by Lundin‭

77%
+5 −0
Library that is platform-specific via selective compilation?

The proposed library would sit alongside cross-platform libraries in Xamarin apps for iOS and Android. However, it would include files with names like MyLibraryFile.android.cs MyLibraryFile.ios...

1 answer  ·  posted 11mo ago by plod‭  ·  last activity 11mo ago by Olin Lathrop‭

77%
+5 −0
Using DBUS and GTK in one perl program

Perl is by far the language I have the most experience with, and I have (big) parts of the functionality I want in the new program in existing programs. So I'm looking for a way to do this in perl,...

1 answer  ·  posted 10mo ago by Grove‭  ·  last activity 10mo ago by deleted user

77%
+5 −0
Can freed pointers undergo lvalue conversion?

char *p, *q; p = malloc(1); free(p); q = p; // lvalue conversion Is the last lvalue conversion (= p;) Undefined Behavior or not? We didn't take the address of the local p. C11::6.3.2.1...

2 answers  ·  posted 1y ago by alx‭  ·  last activity 1y ago by Dirk Herrmann‭

77%
+5 −0
Possible drawbacks for having duplicate local sources of the project tracking the same Git remote

Context I have started working on an Angular upgrade for a medium-sized project (from v. 10 to v. 15) and this is a rather long activity that is interrupted by other changes that need to be perfor...

2 answers  ·  posted 10mo ago by Alexei‭  ·  last activity 10mo ago by Andrew‭