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)
#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...
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...
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...
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...
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 ...
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...
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...
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...
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...
I'm trying to write a MIME message to the console. ByteArrayOutputStream out = new ByteArrayOutputStream(); MimeMultipart replyMsg = mdnCreator.createMDNData(); replyMsg.writeTo(out); out.close...
#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...
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.
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...
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...
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...
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 ...
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...
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...
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 { ...
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...
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...
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...
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...
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"; }); ...
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...
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...
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...
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 ...
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...
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...
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...
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...
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 ...
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...
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...
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...
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...
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...
#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 ...
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...
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)...
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...
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...
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...
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...
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...
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...
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...
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); ...
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...