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)
86%
+11 −0
How to do private encapsulation in C?

I'm using an object-oriented design for my C project and trying to implement classes with private encapsulation. How do I do this? Some things I've tried that are problematic: Using a struct f...

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

66%
+2 −0
Can UWPNuGetPackages be moved to another drive?

I'm trying to make a UWP app in Visual studio, but the NuGet package files have been huge. They just don't fit on my SSD, but I do have an HDD I could theoretically use. After a bunch of tinkering...

1 answer  ·  posted 1y ago by Ullallulloo‭  ·  last activity 1y ago by Ullallulloo‭

71%
+3 −0
Why is boolean value f (false) defined as a parsing-word while t (true) is not in Factor?

I noticed when attempting to generate random booleans that t and f are not treated in the same way: t random ! Error f random ! returns a value In the factor 0.98 and 0.99 documentation, t is ...

1 answer  ·  posted 1y ago by Razetime‭  ·  edited 1y 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‭

66%
+2 −0
How to create a quotation containing the given token in a syntax word in Factor programming language

I am trying to define a syntax word as follows: USING: kernel syntax parser fry prettyprint ; IN: syn-try SYNTAX: syn scan-word '[ _ ] . ; Given a word, I want to create a quotation conta...

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

85%
+10 −0
How to manage user-specific application data on Linux?

I am developing an application that targets Linux-based OS, and I need to store the user's configuration, metadata and other things in a persistent way (i.e. on the file system). I know that one c...

3 answers  ·  posted 1y ago by Björn‭  ·  last activity 1y ago by celtschk‭

66%
+2 −0
How to plot table from pandas dataframe

MWE import pandas as pd import numpy as np import matplotlib.pyplot as plt df = pd.DataFrame(np.random.rand(9, 4), columns=['a', 'b', 'c', 'd']) df.plot.bar(table=True) # don't want plot, ...

1 answer  ·  posted 1y ago by mcp‭  ·  last activity 1y ago by __blackjack__‭

77%
+5 −0
Keep local branch changes to resolve all remaining conflicts in a merge

On branch-x, I do git merge branch-y Now there are some conflicts, and git status shows Changes to be committed: new file: a new file: b Unmerged paths: (use "git a...

1 answer  ·  posted 1y ago by Quasímodo‭  ·  last activity 1y ago by Quasímodo‭

77%
+5 −0
What is the Python Global Interpreter Lock?

What exactly is the Python Global Interpreter Lock (GIL)? As someone who is relatively new to Python, is this something I need to be aware of, or is this just some implementation detail of the inte...

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

71%
+3 −0
How to correctly daemonize a Rocket-based app?

Summary I'm refactoring a Rust-based service/daemon to move away from gRPC and use a Rocket-based API instead. I'm also using the daemonize crate to turn the foreground process into a background p...

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

71%
+3 −0
How to add vertical lines for visual separation in pandas plot

MWE import pandas as pd import numpy as np import matplotlib.pyplot as plt df = pd.DataFrame(np.random.rand(9, 4), columns=['a', 'b', 'c', 'd']) df.plot.bar() plt.show() Question Ho...

2 answers  ·  posted 1y ago by mcp‭  ·  last activity 1y ago by samcarter‭

81%
+7 −0
How to use grep to print only specific word from a string

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

3 answers  ·  posted 1y ago by Megan‭  ·  edited 1y ago by hkotsubo‭

28%
+0 −3
Need help in migrating a Python2 custom middleware to current Python3 version

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

0 answers  ·  posted 2y ago by roronoa_zoroDR‭  ·  last activity 1y ago by Monica Cellio‭

71%
+3 −0
Do you need to use std::move to store a parameter passed by value?

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

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

75%
+4 −0
How to configure .gitignore to ignore all files except a certain directory

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

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

50%
+0 −0
Working with a generic class that uses a type that should be of generic type

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

0 answers  ·  posted 2y ago by Alexei‭

23%
+1 −8
How to efficiently remove every occurrence of one string inside another

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

1 answer  ·  posted 2y ago by dumplings‭  ·  edited 2y ago by __blackjack__‭

50%
+0 −0
How to migrate NLog configuration from XML file(s) to application settings (JSON)?

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

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

60%
+1 −0
How to generate lots of hyperlinks rather fast using ClosedXML library?

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

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

83%
+8 −0
What allows a string slice (&str) to outlive its scope?

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

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

60%
+1 −0
VBScript Listener in SSRS

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

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

71%
+3 −0
Assert that some code is not present in the final binary, at compile or link time.

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

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

33%
+2 −6
Regarding the implementation of data structures.

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

1 answer  ·  posted 2y ago by dumplings‭  ·  edited 2y ago by Alexei‭

33%
+1 −4
How can I modify the code above to accept string as user input and use strcmp to compare with the contents of the text file & then delete that line?

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

1 answer  ·  posted 2y ago by dumplings‭  ·  edited 2y ago by Alexei‭

40%
+2 −4
Problems with data structures and filestreams.

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

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

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‭

57%
+2 −1
How to pass in a readable file (stream) to a Zig function?

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

0 answers  ·  posted 2y ago by aghast‭

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‭

75%
+4 −0
How to define custom configurations in new-style .csproj?

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

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

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‭

85%
+10 −0
Vim: how to search for all instances of a string, except for those that are between two specific strings

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

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

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‭

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‭

42%
+1 −2
How to solve missing JAR files error from Ant

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

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

66%
+2 −0
C# WPF datagrid not persisting inserts

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

0 answers  ·  posted 2y ago by FrankLuke‭

40%
+2 −4
Child process works only once after the parent's two calls to scanf

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

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

60%
+1 −0
How to set update-crypto-policies to LEGACY in Dockerfile

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

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

77%
+5 −0
How to open a file and edit its content in groovy script

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

2 answers  ·  posted 2y ago by Megan‭  ·  last activity 2y ago by Alexei‭

60%
+4 −2
Watertight Mesh Representation

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

0 answers  ·  posted 2y ago by Josh Hyatt‭  ·  edited 2y ago by Josh Hyatt‭

75%
+4 −0
Is it possible to write protocols for enumerations in Python?

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

1 answer  ·  posted 2y ago by celtschk‭  ·  last activity 2y ago by r~~‭

28%
+0 −3
What is [{options}] in JavaScript?

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

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

62%
+3 −1
What is Backus–Naur form as applied in computer programming?

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

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

77%
+5 −0
Mapping generic handler to generic query in MediatR

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

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

77%
+5 −0
Why can't a derived class add a const qualifier to a method?

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

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

25%
+0 −4
Does a for...of loop must contain a variable without assignment sign, and why?

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

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

33%
+1 −4
How this recursive treewalker works?

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", "");...

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

30%
+1 −5
Explaining the result of an arithmetic expression in JavaScript

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

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

40%
+0 −1
Is there a JavaScript command to remove all CSS pseudo-elements whatsoever in a document? [closed]

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

0 answers  ·  posted 2y ago by deleted user  ·  closed 2y ago by Alexei‭

66%
+4 −1
Load environment variables from .env file in Python 3 [closed]

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

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

28%
+0 −3
How to make this treewalker code having a regular for loop or a forEach() method?

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", "");...

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