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)
55%
+3 −2
Why does fopen return NULL?

#include<stdio.h> #include<stdlib.h> int main (void){ FILE *cfPtr; char name[15]; int ID; if ((cfPtr = fopen("draft.txt","w")) == NULL){ printf("File could n...

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

70%
+5 −1
How allocated memory is calculated?

int arr[] = {10,123,14,14,15,16}; cout<<sizeof(arr)/sizeof(arr[0]); I was reading the article. When sizeof() is used with the data types such as int, float, char… etc it simply ret...

1 answer  ·  posted 2y ago by Anonymous‭  ·  last activity 2y ago by Canina‭

40%
+0 −1
How to load two or more files in one AJAX call?

In my browser's JavaScript console I can add to the <body> element one file (index.html) with the following AJAX code: const whereToLoad = document.querySelector("body"); const ajax = new X...

0 answers  ·  posted 2y ago by deleted user  ·  edited 2y ago by deleted user

83%
+8 −0
Which functions in the C standard library must always be avoided?

It would seem that the C standard library is a collection of diverse functions that pretty much just ended up in the standard by tradition or "accident", rather than through some careful plan or ra...

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

83%
+8 −0
Why does Firefox block based on a restrictive default-src directive, when more specific, more permissive *-src exist?

I am working on a website which unfortunately uses a mix of linked and inline CSS and Javascript (and, even more unfortunately, I can't do a lot about the use of inline CSS and Javascript), and am ...

1 answer  ·  posted 2y ago by Canina‭  ·  last activity 2y ago by Moshi‭

77%
+5 −0
Handling high frequency requests with cancellations in an ASP.NET Core application

Issue I have recently discussed with a friend a performance issue he and his colleagues have encountered in an ASP.NET Core 5 application (a checkout app, microservices architecture). The problem...

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

66%
+2 −0
Understanding createTreeWalker method in the context of replacing strings (or parts of them)

I want to ensure I understand the following code; credit to user:m3g4p0p on Sitepoint, for this code: const walker = document.createTreeWalker( document.body, NodeFilter.SHOW_TEXT ) let...

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

71%
+3 −0
How to write a macro that discards the const qualifier, for any type?

How to write a macro that discards the const qualifier, for any type? I hope some combination of typeof and a cast will do, but haven't found the combination. I tried this, without luck: #define...

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

28%
+0 −3
Why would a form value inserted with value property won't be effective? [closed]

In a website I didn't build, I want to put a value in an HTML input field element with JavaScript and to also use it as-putted. I can put it with the browser console this way: document.querySelec...

1 answer  ·  posted 2y ago by deleted user  ·  closed 2y ago by Alexei‭

37%
+1 −3
Cannot write multipart message to byte array [closed]

I'm trying to write a MIME message to the console. ByteArrayOutputStream out = new ByteArrayOutputStream(); MimeMultipart replyMsg = mdnCreator.createMDNData(); replyMsg.writeTo(out); out.close...

0 answers  ·  posted 2y ago by artaxerxe‭  ·  closed 2y ago by Alexei‭

40%
+2 −4
constructor in C

#include<stdio.h> struct Book { char title[20]; char author[20]; int pages; }; void init_Book_types(struct Book* aTitle,struct Book* aAuthor,struct Book* aPages){ aTitle->ti...

2 answers  ·  posted 3y ago by deleted user  ·  last activity 10mo ago by __blackjack__‭

81%
+7 −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.

3 answers  ·  posted 2y ago by alx‭  ·  last activity 4d ago by alx‭

85%
+10 −0
Is it possible to undo a git reset?

For some reason, I just wanted to undo a commit on my git repository, which I've done with the following command: git reset --soft HEAD~1 So far, so good. However, by mistake I issued the comma...

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

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‭

60%
+1 −0
How to get a default value from an assoc in Factor programming language

To get a value from an assoc and provide a default value if the value does not exist, I am using the following definition: :: at-def ( key assoc default -- value ) key assoc ?at [ drop default ] w...

1 answer  ·  posted 1y ago by Razetime‭  ·  last activity 1y ago by erg‭

33%
+1 −4
Convert .npy files in a directory to images (.png)

I have around 20,000 .npy files in a directory. That main directory has no subfolders:- Main_dir | |--1.npy |--2.npy |--3.npy |--........ The absolute file paths are stored ...

2 answers  ·  posted 3y ago by Neel_Gupta‭  ·  last activity 3y ago by hoverhell‭

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 9mo ago by Lundin‭

81%
+7 −0
Is it a good idea to have a permanent branch for a feature?

I'm rather new to using git, so I'm not sure about the best practices regarding it. I have a feature branch branched off, and periodically when the feature needs to be updated I will add some commi...

3 answers  ·  posted 2y ago by Moshi‭  ·  last activity 2y ago by Hyperlynx‭

71%
+3 −0
How to retain a service's data between components in Angular 8 ?

I would like to maintain a log that is available to several modules in my Angular 8 system. So I created the following service: @Injectable({ providedIn: 'root' }) export class LogService { ...

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

16%
+0 −8
Why most hosting providers support ticket systems allow text only (no formatting)? [closed]

Through the years I have "tasted" several website hosting companies; none of them had Markdown available in their support-ticket-systems (if all any formatting method available). Why is it? What's...

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

75%
+4 −0
What are the disadvantages of using auto mapper libraries?

I have noticed that lots of projects (both in real-world and within online courses) use Automapper to map domain models to view models, API models. The main advantage seems to be convenience by re...

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

70%
+5 −1
How do I get the error message out of a requests exception?

I'm trying to log error messages from Requests exceptions. Example: try: make_web_request() except RequestException as ex: logging.error(ex) Example output: ERROR : ('Connection abo...

2 answers  ·  posted 3y ago by ajv‭  ·  last activity 3y ago by hoverhell‭

50%
+1 −1
Why are my EMA values ​​different from the ones on the website? [closed]

I wrote a program for calculating EMA, but my values ​​differ from the values ​​calculated on this site. My program: double[] x = Numbers();//array numbers int N = 5; double k = 2.0 / (N + 1...

0 answers  ·  posted 3y ago by kolaa‭  ·  closed 3y ago by Alexei‭

57%
+2 −1
Change font-family with JavaScript

I want to change the font-family of all elements in a document with JavaScript. I have tried this: document.querySelectorAll("body").forEach( (e)=>{ e.style.fontFamily = "arial"; }); ...

2 answers  ·  posted 2y ago by deleted user  ·  edited 2y ago by deleted user

50%
+1 −1
Why does a keydown event is listened only once?

The following code (credit for user:hkotsubo) moves the user to another page if Alt+Shift+E are pressed together. window.addEventListener('DOMContentLoaded', () => { let domain = window.loca...

0 answers  ·  posted 2y ago by deleted user

70%
+5 −1
What does a variable followed by parentheses ("ptr()") mean?

What does ptr() mean in this code? #include<stdio.h> #include<stdlib.h> void PrintHello() { printf("Hello\n"); } int Add(int a, int b) { return a+b; } int main...

2 answers  ·  posted 2y ago by dumplings‭  ·  last activity 2y ago by Martin Bonner‭

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

57%
+2 −1
Fixing vertical discrepancies with CSS

I have a "Our menu" webpage automatically created with Drupal 9 Views module which presents a miniature version of each menu dish webpage in that "Our menu" webpage (illustration image below). My ...

1 answer  ·  posted 2y ago by deleted user  ·  edited 2y ago by deleted user

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

75%
+4 −0
What are the risks of using iFrame as a temporary migration step for an internal web application?

Overview Our development team is currently trying to develop and migrate a Web application that is split in two: legacy: ASP.NET MVC 5, jQuery, old-style JS programming overall "next": Angular...

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

60%
+4 −2
Separate digits of a number in groups with different sizes

I have a list of 11-digit numbers stored in one single column in Excel, and I need to separate the digits according to this pattern: 2-2-1-3-3. Example: 00002451018 becomes 00 00 2 451 018. How c...

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

53%
+5 −4
What's the difference between Inheritance and Polymorphism?

I'm using Java code as an example, but this can be answered if you don't know Java. class Bird{ public void sing(){ System.out.println("Testing"); } } class anClass ex...

2 answers  ·  posted 3y ago by deleted user  ·  edited 2y ago by Alexei‭

50%
+1 −1
How to grant privileges to a user on a database specifically (i.e. not globally) in PHPMyAdmin?

In PHPMyAdmin 5.1.1 I have created a user account and a database with the same name and granted all privileges to the user on that database. I have exported the database to a backup file, deleted ...

1 answer  ·  posted 2y ago by deleted user  ·  last activity 2y ago by deleted user

75%
+4 −0
WPF MVVM ListBox not updating

I am trying to combine MVVM in WPF using Microsoft.Toolkit.MVVM. Somethings are working as expected. The text boxes bind to fields and update in both directions. The button command executes and cha...

2 answers  ·  posted 2y ago by FrankLuke‭  ·  last activity 2y ago by elgonzo‭

37%
+1 −3
Java cannot find class within same package

I've written a class object, QueueObject, but when I try to construct it inside of my main class, it says it cannot find the symbol on compilation. I've read lots of pages saying how misspellings o...

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

75%
+4 −0
Move to the edit webpage of a webpage via the keyboard with vanilla JavaScript

The webpage example.com has an edit webpage (from which one can edit example.com itself). example.com/index.php?title=עמוד_ראשי&action=edit I want that after I click ALT+Shift+E, I would im...

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

60%
+1 −0
Uncaught ReferenceError: variable is not defined

I have a variable defined using const keyword. function Text() { const variable = "Hello!"; } console.log(variable); When I try to access this variable, I get: Uncaught ReferenceError...

1 answer  ·  posted 2y ago by Kevin M. Mansour‭  ·  edited 2y ago by Alexei‭

72%
+6 −1
How to unittest method that involves contacting remote servers?

Let's say I have this class: class myService { private boolean foo(T arg) { return arg == 42; } public Response bar(U arg) { if(foo(U.field)) { return Response.st...

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

42%
+1 −2
What might happen if I ignore warning?

#include <iostream> using namespace std; int linearSearch(int array[], int n, int key){ for(int i=0;i<=n;i++){ if(array[i]==key){ return i; } } } int main() { int ...

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

50%
+0 −0
A standard about content types when creating a web shop with Drupal

I would assume the following content types would be standard when creating a web shop with Drupal but maybe I am wrong: Home page Article page Product page Service page Another page Are t...

0 answers  ·  posted 3y ago by deleted user

66%
+2 −0
What's the better way to store base64 in SQLite Database?

What's the better way to store base64 in SQLite Database? I was thinking to put base64 as TEXT since base64 has lots of chars. CREATE TABLE name (id INTEGER PRIMARY KEY AUTO_INCREMENT, image TEXT)...

1 answer  ·  posted 2y ago by Anonymous‭  ·  edited 2y ago by Anonymous‭

66%
+2 −0
Order a subcollection from linq

I am using linq/EF core to retrieve data via an API call. How do I sort the collection of related data for each retrieved entity? Assume the following structure: an Order is made on a certain da...

1 answer  ·  posted 2y ago by mcalex‭  ·  last activity 2y ago by Alexei‭

90%
+17 −0
What is the purpose of `if __name__ == '__main__'`?

I often see the construct if __name__ == '__main__' in Python code. For example, the queens.py demo in the Python repository ends with these two lines: if __name__ == "__main__": main() Ho...

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

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‭

81%
+7 −0
Conditionally ignore files in git

I'm using git for LaTeX projects and am in a little dilemma about how to best ignore files. if I add *.pdf to my .gitignore file, I keep forgetting to force add included graphics if I don...

3 answers  ·  posted 2y ago by samcarter‭  ·  last activity 2y ago by Peter Taylor‭

36%
+2 −5
What are the disadvantages of using static methods in Java?

I was using static method few moments ago. But I noticed that I was returning a variable using that static method. According to the article, Static is a keyword that identifies the class-related...

4 answers  ·  posted 2y ago by Anonymous‭  ·  last activity 2y ago by hkotsubo‭

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‭

66%
+2 −0
Collapsing AppBar with two Toolbars

I am trying to create an app with two toolbars on top and a specific collapsing/expanding behaviour on scrolling. See the mockup to get a deeper understanding of what I'm trying to achieve: I fo...

0 answers  ·  posted 2y ago by BenjyTec‭

57%
+2 −1
Function.prototype.call()

I wanted to print to browser console the number of li list items of a given ul list. This didn't work (console output was undefined): console.log(document.querySelectorAll(".example").length); ...

1 answer  ·  posted 2y ago by deleted user  ·  edited 2y ago by Alexei‭

84%
+9 −0
What is a good modern language to use for a Business Rules project?

This is a rather vague question, but I'm trying to solve a specific problem and I'm inexperienced in most of the potential solutions, so please forgive the inherent ambiguity. I have access to a d...

3 answers  ·  posted 3y ago by Sigma‭  ·  last activity 10mo ago by matthewsnyder‭