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)
I have a variable that contains a string: $CCSR = "branches/features/arm_and_musl" I want to get only the part after the last /. In this case it's "arm_and_musl" but it can be anything. So som...
class ExtendUserSession(MiddlewareMixin): """ Extend authenticated user's sessions so they don't have to log back in following 15 minutes (set by Django's default `SESSION_COOKIE_A...
If you have a class which needs to store a construction parameter internally, and you want to take advantage of move semantics, I understand that the parameter should be passed by value: class Foo...
MWE In the terminal run: mkdir mwe cd mwe mkdir dir touch f1.txt f2.pdf dir/f1.txt dir/f2.pdf git init . Create a .gitignore with: * # ignore all !dir/ # except this directory ...
I have followed Nick Chapsas' tutorial to avoid throwing a ValidationException to treat validation errors and instead rely on LanguageExt.Common.Result<> from LanguageExt library. I have ma...
I have two strings and want to remove every occurrence of the second string inside the first one starting from the beginning of the first string and as if each occurrence was removed immediately. ...
I have just created an ASP.NET Core 6 application and added NLog support for logging: NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger() However, this API is almost deprecated as ...
I am using ClosedXML library to generate an Excel containing thousands of hyperlinks using cell's Hyperlink property: cell.SetValue(text).Hyperlink = new XLHyperlink(url); Such a call takes abo...
As a relative newcomer to Rust, I'm trying to understand the behaviour of lifetimes, but I am confused by the following code: let s: &str = "first"; let mut r: &str = s; println!("First ...
Is it possible to add listeners via VBScript/ JS directly into a SRSS report? Goal: Track changes of input fields and key press inside the wrapper React based on the events Directly in the...
I'd like to assert that some code can be optimized out, and is not present in the final binary object. #define CONSTANT 0 #if (!CONSTANT) [[landmine_A]] #endif static int foo(void); void...
I'm attempting a question to do with data structures, file streams & linked lists. The code isn't complete yet as I am still halfway working on it. I am required to use data structures in the d...
I want to enter a string to compare with the text file, and if that word matches, then I want to delete that line containing that string. How can I modify the code below, since the code below take...
So I just started learning how to use file-streams in C & decided to attempt a question which is to do with library management in C, however I am currently encountering some problems and feel l...
#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...
Most of the example code in the Zig online docs is in the form of test blocks. Sadly, this means there aren't quite enough examples of how to write functions. Given that one has a readable file, p...
Problem I'm trying to update some projects from old-style .csproj: <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.mi...
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...
Using Vim, I am trying to search for all instances of a specific string, except for those that fall somewhere in between two other specific strings. For example, I want to determine all instances ...
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...
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 keep getting this error: Cause: the class org.apache.tools.ant.taskdefs.optional.ssh.SSHExec was not found. This looks like one of Ant's optional components. Action: Check that the ap...
I am working with VS 2022 and trying to make a WPF MVVM application. The application updates the items displayed in the datagrid, persisting the changes to the database upon save. However, adding a...
This program creates a child process and shares two integers (base and height) through the shared memory. The parent process asks four times to insert two integers and wait for the child process t...
So im trying to do RUN update-crypto-policies --set LEGACY in my Dockerfile as I was getting an error "Failed to load certificate from file 'client-rsa.pem':''ee key too small". But when I build...
I have a Makefile in my Jenkins job's workspace, that I want to edit out certain parts from and then save it, before running next part of the script that uses this Makefile. The part that I want t...
A watertight mesh is one which does not have holes, and for which each face has a designated inside and outside. Such a mesh can be "tetrahedralized", has a defined volume, and can be an operand in...
Having recently learned about protocols in Python, I now wonder if you can write a protocol for enumerations. That is, a protocol that says that you are supposed to pass an enum that has certain it...
I am trying to understand this code: const iframes = iFrameResize( [{options}], [css selector] || [iframe] ); The code can be found in this documentation. Is [{options}] an array of objects an...
What is Backus–Naur form as applied in computer programming? From Wikipedia In computer science, Backus–Naur form (/ˌbækəs ˈnaʊər/) or Backus normal form (BNF) is a metasyntax notation for cont...
I am using MediatR in an ASP.NET Core 3.1 application and I want use a generic query and a generic request that deals with getting lists of some standard items I am using in drop-downs and similar:...
Say we have an abstract class Foo declared as so: class Foo { public: virtual void test() = 0; }; Let's say that we make a derived concrete class FooDerived, and decide to mark it's ve...
The following code pattern reflects this answer. This code contains a for...of loop: for (const child of e.childNodes) { // Do stuff; } Does a for...of loop must contain a variable without...
Credit for User:Meriton for developing the following code (first published here). function replaceIn(e) { if (e.nodeType == Node.TEXT_NODE) { e.nodeValue = e.nodeValue.replaceAll("a", "");...
I misunderstand why the following code outputs -1 in console. x = 42; x = (x == 42) * -1 + (x != 42) * x; -1 Due to Type Coercion, the comparison of x to 42 yields true and is thus transl...
In a dense DOM tree created by a content management system which I didn't create and don't know much about there might be pseudo elements hiding in various places. To ensure that, I want to run so...
In Python 2, I was able to create a file named .env within a project folder like so: # .env MY_ID=abc123 TOKEN=4567890 Then in a Python file in the same directory, I could read these variable...
Credit for User:Meriton for developing the following code (first published here). function replaceIn(e) { if (e.nodeType == Node.TEXT_NODE) { e.nodeValue = e.nodeValue.replaceAll("a", "");...
Credit for User:Meriton for developing the following code (first published here): function replaceIn(e) { if (e.nodeType == Node.TEXT_NODE) { e.nodeValue = e.nodeValue.replaceAll("a", "");...
I've recently been involved with creating text documentation of steps for workflows in graphical windows systems (and web-pages). These are often somewhat wordy, for example: "Click on the 'Exit' ...
If I am not mistaken any DOM "tree" node is actually a "branch", which would be an HTML element or perhaps a CSS pseudo-element, of course. If that's true what are the different node types and esp...
Primarily for learning, I would like to try to delete a specific character (letter or number or special character), wherever it is in a webpage, with vanilla JavaScript. The webpage won't change a...
Is -isystem/path/to/sys/includes a standard compiler option, or is it a compiler extension implemented by gcc, clang, and maybe other compilers? Can I rely on its availability? I couldn't find th...
In MediaWiki 1.36.1 with Skin:Timeless, the following JavaScript code doesn't work. I get in browser console: Your skin is incompatible with VisualEditor. See https://www.mediawiki.org/wiki/Exte...
I wish to view the revision-history-webpage of a webpage in MediaWiki without the conventional button to do so (I've disabled that button for aesthetic reasons). Please disable the MediaWiki View ...
Unable to boot from manjaro usb key it looks like it is due to secure boot how can I do it without disabling the secure boot
Hi How can I boot from usb key containing popos system without disabling secure boot in bios ? thanks
I have console scripts in my virtual environment in \env\Scripts, installed with packages (e.g. black, pytest, coverage). If I try to execute these in Git Bash, the output is not returned to the te...
I've been trying to get Amazon SQS working with the v3 JS client. I've gotten to the point where I can successfully create a queue using the frontend, but the issue starts when I try and send/recei...
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...