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)
81%
+7 −0
How and where does Python code start running? How can I control that?

Suppose I have some code in a file myscript.py like: def my_function(): print("Test") What steps do I need to take in order to make my_function run? That is to say: how do I get Python to ...

2 answers  ·  posted 2y ago by Karl Knechtel‭  ·  last activity 18h ago by jhonAHILLL‭

python startup entry-point
75%
+4 −0
How to use _Generic on restrict pointers like C23 tells me to do?

I just noticed that ISO 9899:2024 6.7.4 has this weird text added, which wasn't there previously: The intended use of the restrict qualifier (like the register storage class) is to promote optim...

0 answers  ·  posted 3d ago by Lundin‭  ·  edited 2d ago by Lundin‭

c language-lawyer c23 type-qualifier
50%
+0 −0
Can I execute commands before the build system is invoked at all in a flatpak-builder module?

I'm creating a flatpak-builder manifest wherein I want to do some "pre-processing" steps of the source code in a given module before the build system is invoked. In particular, I want to "merge" th...

0 answers  ·  posted 3d ago by Newbyte‭

build
80%
+6 −0
Configure Git branch to push to different remote than it pulls from

As a loose follow-up to Why force designation of a remote main branch?, is there a Git-native way to configure a branch for GitHub's so-called "triangular" workflow? The triangular workflow is mea...

2 answers  ·  posted 4mo ago by Michael‭  ·  last activity 3d ago by Michael ‭

git
77%
+5 −0
Embedded C - memory pool types

In embedded systems, dynamic memory allocation is discouraged (or forbidden) due to various reasons. A better idea is to statically allocate a chunk of memory whose size is known at compile time -...

2 answers  ·  posted 6d ago by Carl‭  ·  last activity 3d ago by Lundin‭

c memory memory-pool static-allocation
75%
+4 −0
Declaring a callback function in usart.h, using it in usart.c but defining it in main.c

I have written a generic device driver for a uart peripheral with a source file usart.c and a header file usart.h. I don't want a user of these files have to tamper with them. I want to use the us...

3 answers  ·  posted 8d ago by Carl‭  ·  last activity 6d ago by Olin Lathrop‭

c callback
60%
+1 −0
Should total interest be derived from the rounded or the exact annuity payment?

I run a site with a small annuity loan calculator written in plain JavaScript. It shows two numbers: the monthly payment, and the total interest paid over the term. The payment comes from the stan...

0 answers  ·  posted 7d ago by softhardware‭

javascript rounding floating-point
60%
+1 −0
Smart pointer with custom deleter with 'using pointer = '

To manage libmagic's magic_t aka magic_set* cookie with a unique_ptr and a custom deleter in a RAII wrapper, I have: struct MagicDeleter { // magic_t is already a pointer (magic_set*) ...

1 answer  ·  posted 12d ago by dode‭  ·  last activity 12d ago by Indi‭

c++ resources smart-pointers
71%
+3 −0
Is it UB to read value of heap pointer after freeing?

I've read in a guide that "the use of indeterminate memory for anything, including apparently harmless comparison or arithmetic, can have undefined behavior if the value can be a trap representatio...

3 answers  ·  posted 25d ago by Intel A80486DX2-66‭  ·  last activity 12d ago by Indi‭

c undefined-behavior pointers heap-memory standard
66%
+2 −0
Checking if an array is partially initialized at compile-time

I have the following code in my project typedef enum { RELAY_CHANNEL_PIN_5, RELAY_CHANNEL_PIN_6, RELAY_CHANNEL_PIN_7, RELAY_CHANNEL_PIN_8, RELAY_CHANNELS_N } relay_channel_pin_t; ...

1 answer  ·  posted 14d ago by Carl‭  ·  last activity 14d ago by Lundin‭

c array
78%
+9 −1
how do I get markdown to render # as a shell prompt and not a comment?

Note: This is a general question about Markdown formatting for any Markdown renderer (e.g., Gitlab, Github, Codidact). So this is not just a question about Codidact's renderer. When displaying she...

3 answers  ·  posted 2y ago by Trevor‭  ·  last activity 15d ago by wjandrea‭

markdown syntax-highlighting
66%
+2 −0
Concise way to capture stderr output in an exception when calling a process from Python

I’d like to call an external executable from a Python script. If it exits with a nonzero code, I’d like an exception containing the return code and the stderr output. The exception will be caught...

0 answers  ·  posted 17d ago by Nick Alexeev‭  ·  edited 16d ago by Michael‭

python subprocess
84%
+9 −0
Why is the new auto keyword from C++11 or C23 dangerous?

In older C and C++ standards, the auto keyword simply meant automatic storage duration. As in the compiler automatically handles where the variable is stored, typically on the stack or in a registe...

3 answers  ·  posted 2y ago by Lundin‭  ·  last activity 21d ago by Indi‭

c c++ storage-duration c23 c++11
71%
+3 −0
How to compress columns of dataframe by function

How can I compress each column of a dataframe to the output of a function (i.e., mean), preserving columns? MWE import pandas as pd data = {"A": [1, 2, 3, 4], "B": [5, 6, 7, 8]} df = pd.Data...

2 answers  ·  posted 3y ago by mcp‭  ·  last activity 24d ago by wjandrea‭

python pandas
75%
+4 −0
How to plot a table from a pandas dataframe

How do I generate a table in its own figure from a pandas dataframe? I can generate a bar plot with a table below it, like so: import pandas as pd import numpy as np import matplotlib.pyplot as...

1 answer  ·  posted 4y ago by mcp‭  ·  edited 24d ago by Karl Knechtel‭

python plot pandas matplotlib
80%
+6 −0
Choosing between multiple Python installations (environments) on the same computer

I have multiple installations of Python on my machine. When I run Python, what determines which installation is used? How can I control this?

1 answer  ·  posted 2y ago by Karl Knechtel‭  ·  last activity 24d ago by Moshi‭

python installation runtime-environment
71%
+3 −0
How do I make Phosh consider my app "mobile friendly"?

I'm working on an app for Linux phone operating systems like postmarketOS and publishing it as a Flatpak on Flathub. What steps do I need to take to make it appear as a "mobile friendly" app in the...

1 answer  ·  posted 1mo ago by Newbyte‭  ·  last activity 1mo ago by Michael‭

linux
22%
+0 −5
Create self-referencing many-to-many relation [closed]

I've turned the tables movies and scenes into media and now I don't know what to do with the movies_scenes relation. CREATE TABLE IF NOT EXISTS "movies_scenes" ( `movie_id` integer, `sce...

1 answer  ·  posted 3y ago by filosoful‭  ·  closed 1mo ago by Karl Knechtel‭

database-schema
60%
+1 −0
Parallel execution with algorithms and execution policies

I've just learned about algorithms, ranges and views (from a book), including execution policy such as std::execution::par and I naively tried: import std; int main() { auto values {std::r...

2 answers  ·  posted 1mo ago by dode‭  ·  last activity 1mo ago by Indi‭

c++ algorithms multithreading
75%
+4 −0
How do I type something different at each cursor when using multi-cursor editing in VS Code?

For example, say I have this CSS: .ocean {} .land {} .sky {} I want to give each of them a background-color, so I use multi-cursors and type: .ocean { background-color: } .land { background...

2 answers  ·  posted 1mo ago by wjandrea‭  ·  last activity 1mo ago by user253751‭

vs-code multi-cursor
77%
+5 −0
Why is global evil?

Many languages discourage global variables. Why is this?

4 answers  ·  posted 2y ago by matthewsnyder‭  ·  last activity 1mo ago by Indi‭

software-practices language-agnostic
71%
+3 −0
Extern keyword in C and proper way to use extern variables in embedded systems

I have an 8-bit microcontroller with 100 pins. Each pin belongs to a port with a unique address and each pin has a number from 0 to 7. I want to create a scheme where in the code each pin is a stru...

2 answers  ·  posted 2mo ago by Carl‭  ·  last activity 1mo ago by Lundin‭

c embedded extern
71%
+3 −0
Can all compiler errors be caught by language server?

Here is the reasoning: Compiler error is syntax error Language server can catch all syntax error Therefore, all compiler errors can be caught by language server I have the feeling that this...

2 answers  ·  posted 1mo ago by Ooker‭  ·  last activity 1mo ago by Olin Lathrop‭

syntax-error compiler-errors ide language-server code-editor
66%
+2 −0
Avoiding checking opcode multiple times in state machine for embedded system

I am implementing a state machine for an electrical relay control board and am trying to follow the principles/structure presented by Lundin here for doing that in C. My machine has currently four...

1 answer  ·  posted 1mo ago by Carl‭  ·  last activity 1mo ago by Lundin‭

c state-machine embedded
80%
+6 −0
Rails 6.1, trouble with session management, sessions behave weirdly

I am at a complete dead end with Rails sessions. I have an old Rails project. It started with Rails 3 or 4, and it is now running on Rails 6.1.7.10, the code has been updated carefully. I use sess...

1 answer  ·  posted 7mo ago by plain_toast‭  ·  last activity 1mo ago by plain_toast‭

ruby-on-rails
77%
+5 −0
Is there any reason not to use the latest version of MISRA C guidelines?

I am contemplating on purchasing a personal copy of the MISRA C guideline document. Looking at their website shows several different versions - MISRA C:2025, MISRA C:2012 3rd ed., MISRA C:2004, etc...

1 answer  ·  posted 2mo ago by Carl‭  ·  last activity 1mo ago by Lundin‭

c misra-c
71%
+3 −0
Why can't I use a library I just installed with Pip?

I tried installing package-installation-test[1] using Pip, and it appeared to be successful. But I can't use it as advertised, either by itself or by importing it from my code: Failed attempts ...

1 answer  ·  posted 2y ago by Karl Knechtel‭  ·  last activity 1mo ago by carmenelectra‭

python installation runtime-environment pip
80%
+6 −0
Any testimonials for any C++ units of measure library?

The question is about libraries that extend the data type system to ensure physically realistic computations. Think std::chrono but for distance and mass and other things as well as for time. Inste...

2 answers  ·  posted 4y ago by Fred Wamsley‭  ·  last activity 1mo ago by Indi‭

c++ units-of-measurement
86%
+11 −0
What does the "\s" shorthand match?

I've seen some regular expressions (regex) using \s when they want to match a space, but I noticed that it also matches line breaks. Example: the regex [a-z]\s[0-9] (lowercase ASCII letter, follow...

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

regex whitespace
50%
+0 −0
Are memccpy(3) or strncpy(3) bad for copying and catenating strings with truncation?

I heard strncpy(3) is bad, and also heard that C23 added memccpy(3) to replace it. However, I also heard memccpy(3) is even more terrible than strncpy(3). Are these functions really bad? How so?...

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

c string.h
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 5y ago by hkotsubo‭  ·  last activity 2mo ago by deleted user

java date simpledateformat date-parsing
90%
+17 −0
What compiler options are recommended for beginners learning C?

When reading questions about C programming from beginners, I very often see them describing peculiar run-time errors and crashes, segmentation faults and similar. They have spent a lot of time chas...

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

c compiler compiler-errors compiler-warnings compiler-options
71%
+3 −0
How to apply a unit constraint in SymPy

The solution to this is probably easy, but I haven't been able to find it. Using SymPy, I am trying to solve this equation: $$ {x_1}^2 + {x_2}^2 + {x_3}^2 + 3 = a $$ with this constraint: $$ ...

3 answers  ·  posted 2mo ago by Trevor‭  ·  last activity 2mo ago by wjandrea‭

sympy
84%
+9 −0
Can you ever assume that casting pointers is safe?

This was inspired by the SO question Can you ever assume typecasting pointers is safe? I started to write an answer there, but I realized I'd rather post it here instead, so here's a self-answered ...

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

c pointers implicit-conversion conversions
66%
+2 −0
How to link an existing Odysee web wallet to the local lbrynet daemon for automated video publishing?

I'm building an automated content pipeline that publishes daily video briefings from a headless Arch Linux server. The pipeline already works for other platforms (Bluesky, Mastodon, PieFed, Telegra...

0 answers  ·  posted 2mo ago by ShadowsRanger‭

automation odysee lbry api cli
28%
+0 −3
Why is the ground of my Dino game(in PDF) not moving and instead shrinking ?

I'm creating a Chrome Dino-style game inside a PDF using JavaScript form fields . The ground is implemented using two adjacent button widgets that should continuously scroll left to create an infin...

0 answers  ·  posted 3mo ago by Ted‭  ·  edited 3mo ago by Karl Knechtel‭

javascript pdf
60%
+1 −0
Download a PDF file in Playwright instead of opening it in a new tab when clicking on its link

My organisation uses Moodle as their online e-learning system on which teachers share resources, and oftentimes numerous documents that we need to view/download are posted there. The default way of...

2 answers  ·  posted 3mo ago by Elefy‭  ·  last activity 3mo ago by Elefy‭

javascript web-scraping automation playwright pdf
66%
+2 −0
How do I add tags to a PieFed post via the API?

I'm automating posts to PieFed and I can't get tags/labels to actually show up on the created post. What I'm doing I'm POSTing to create a post with a body that includes hash-style tags, somethin...

0 answers  ·  posted 3mo ago by ShadowsRanger‭

automation lemmy piefed webapi tags
60%
+1 −0
Playwright script to generate PDF of a page that requires scrolling (Khan Academy)

Currently I am using One Click Page to PDF to get the job done, although the lack of working open-source tools fit for this task has led me to creating my own; the web page "that won't print" is th...

1 answer  ·  posted 3mo ago by Elefy‭  ·  last activity 3mo ago by ggorlen‭

javascript web-scraping automation playwright html-to-pdf
66%
+2 −0
eclipse templates -- creating and setting a permanent variable

In eclipse (java) Window->Preferences->Java->New new templates can be created. In the field "Pattern" I entered System.out.println("DEBUG ${label}"); ${cursor} I like old-style debug...

1 answer  ·  posted 10mo ago by watchmaker‭  ·  last activity 3mo ago by skye‭

Eclipse
66%
+2 −0
How do authors of custom URI schemas prevent conflict with those registered with IANA in the future?

en.wikipedia.org/w/index.php?title=List_of_URI_schemes states that: Many URI schemes are registered with the IANA; however, there exist many unofficial URI schemes as well. Everyone knows how...

1 answer  ·  posted 4mo ago by Mr. Beedell, Roke Julian Lockhart (RJLB)‭  ·  edited 3mo ago by Karl Knechtel‭

standard uri
83%
+8 −0
Compile-time rounding with the pre-processor

When searching the Internet, I came across this SO post Rounding in C Preprocessor but immediately noted that none of the answers are showing a way to perform actual rounding - rather, they are doi...

3 answers  ·  posted 4mo ago by Lundin‭  ·  last activity 4mo ago by John C‭

c rounding floating-point c-preprocessor
75%
+4 −0
How do websites built by website builders defend security threats or follow secure coding?

There are SaaS providers for building and hosting websites made with WYSIWYG and LLM-prompt website builders, such as WordPress.com, Webflow, etc. I guess these services should be secure-by-default...

1 answer  ·  posted 4mo ago by Ooker‭  ·  last activity 4mo ago by John C‭

security hosting website-builder website
50%
+1 −1
Are metaframework and server-side framework the same?

I occasionally hear the split between framework and metaframework, and then the split between client-side framework and server-side framework. Are they just the same? Sources use "metaframework": ...

0 answers  ·  posted 4mo ago by Ooker‭

javascript metaframework server-side-framework
71%
+3 −0
Integrating a standalone database 'engine' into an OLAP database

I'm trying to build a proper understanding of what an OLAP[1] datastore vs an OLAP data engine is. I tend to put too much value on keywords like "engine" vs "data store." If it has "engine," I thin...

0 answers  ·  posted 2y ago by erjcan‭  ·  last activity 4mo ago by Alexei‭

database olap
81%
+7 −0
Why does a lack of object encapsulation constitute a security breach?

In the current version of OpenJDK's JEP 401: Value Classes and Objects (Preview), it is said that value classes can leak data stored in their fields, and that this is potentially a security concern...

2 answers  ·  posted 2y ago by Andreas‭  ·  last activity 4mo ago by roberto almdnde‭

java security encapsulation
81%
+7 −0
How to verify if a year is leap in Java?

How to verify if a year is leap? Given a numeric value (such as 2023) or some object that represents a date (such as Date, Calendar, LocalDate, etc), how can I do it?

1 answer  ·  posted 3y ago by hkotsubo‭  ·  last activity 4mo ago by roberto almdnde‭

java date
75%
+4 −0
Rails 6.1, unbelievable assets-precompile time for a smallish project

I have an old Ruby on Rails project currently running on Rails 6.1. It isn't very large. I have got the old asset pipeline, 2.7 MB of Javascript in a node_modules folder and 3.7 MB of files in the ...

1 answer  ·  posted 4mo ago by plain_toast‭  ·  last activity 4mo ago by plain_toast‭

ruby-on-rails
50%
+1 −1
JOptionPane doesn't show; application combines Swing and console.

What is wrong in the following code: package oren; import java.util.Scanner; import javax.swing.JOptionPane; public class Main { public static void main(String[] args) { double x,y,z...

1 answer  ·  posted 4mo ago by programAngel‭  ·  edited 4mo ago by FractionalRadix‭

java swing Eclipse
60%
+1 −0
Recommended Books on Node.js

I've gained responsibility for some services at work that run on Node.js. I am wondering if anyone could recommend a book on Node. The website documentation is pretty good but I like the structure ...

2 answers  ·  posted 7mo ago by fausty‭  ·  last activity 5mo ago by tsvt‭

javascript node.js