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)
83%
+8 −0
Is it correct to run code inside a method whose object has been destroyed?

Consider an object for which a method is invoked. Beyond certain point the method no longer accesses this at all. No read/writes of non-static members. No invocation of non-static methods. Is it ...

1 answer  ·  posted 3y ago by Estela‭  ·  last activity 3y ago by Hyperlynx‭

83%
+8 −0
Is `uint8_t` always an alias for a character type if it exists?

Is uint8_t guaranteed to be a character type if it exists? Will using a uint8_t* to examine bytes of an object cause violation of the strict aliasing rule? Is the following legal code: #include &l...

1 answer  ·  posted 3y ago by Ayxan Haqverdili‭  ·  edited 3y ago by Lundin‭

83%
+8 −0
How do I find the order that yields the shortest path?

The Problem I have a path optimization problem that in some ways reminds me of the Traveling Salesman Problem, but differs in some key respects. I have a group of items that need to be used by a m...

1 answer  ·  posted 3y ago by matthewb‭  ·  edited 3y ago by matthewb‭

83%
+8 −0
Update list based on presence of identifier in a second list

In C#, I have two lists and need to mark records in the first based on the second. Here's a sample: public class Vehicle { public string Make { get; set; } public string VIN { get; set;...

3 answers  ·  posted 3y ago by FrankLuke‭  ·  last activity 3y ago by Andrew Shepherd‭

83%
+8 −0
How to set text-align for whole column of HTML table?

To start off, here is the complete HTML of a simple example table: <html lang="en-US"> <head> <title>Title</title> <style> table { width: 20em; ...

2 answers  ·  posted 3y ago by Olin Lathrop‭  ·  edited 3y ago by Alexei‭

83%
+8 −0
Is partial allocation of an object Undefined Behavior?

Is it valid to partly allocate an object, as long as you only use the allocated part of it? #include <stdio.h> #include <stdlib.h> struct s { int i[100]; }; int main(void) {...

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

83%
+8 −0
How to delete contents of a specific field, if it matches a pattern and there is nothing else in the field

How do I delete contents of a specific field, if it matches a pattern, and there is nothing else in the field? I have a several GB tsv file, and I am interested in a specific field (72). If it cont...

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

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

83%
+8 −0
How to define an object with different subclasses in an if-statement?

Note: I asked this question on TopAnswers a couple weeks ago, but didn't get any response, so I figured I'd ask it here. I am currently learning C++. I have a parent class (Vehicle) and two subc...

1 answer  ·  posted 1y ago by Trevor‭  ·  edited 1y ago by Alexei‭

83%
+8 −0
What are disadvantages of static functions (ie functions with internal linkage) in C?

Functions in C have external linkage by default. In other words, the storage class specifier extern is applied to functions by default, with the effect that they are visible to all translation unit...

3 answers  ·  posted 10mo ago by Lover of Structure‭  ·  last activity 10mo ago by Dirk Herrmann‭

83%
+8 −0
How can I emulate regular expression's branch reset in Java?

I've got this sample regex: Pattern p = Pattern.compile("(?:([aeiou]+)[0-9]+|([123]+)[a-z]+)\\W+"); It basically has the following parts: one or more lowercase vowels ([aeiou]+), followed by one ...

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

83%
+8 −0
Should I cast to (void) when I do not use the return value

I saw at least one compiler (Codewarrior for HC12) warn me if I use a function without using it's return value. Other compilers (clang/gcc) do not issue a warning though, even when using the std=90...

3 answers  ·  posted 3y ago by Kami‭  ·  edited 3y ago by Monica Cellio‭

83%
+8 −0
How can I define a method on [&mut T] where T: MyTrait?

I'm trying to make a trait method callable on mutable slices of a type implementing that trait (see main). Rust doesn't like me for it. use core::convert::AsMut; trait A { type B; fn f(m: ...

1 answer  ·  posted 3y ago by wizzwizz4‭  ·  last activity 3y ago by r~~‭

83%
+8 −0
Is there a way to estimate the execution time of a statement in MySQL?

From time to time I will have large structural changes to make on my MySQL DB, things like adding columns, changing datatypes, adding indexes etc. These types of changes result in downtime and what...

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

83%
+8 −0
Path separator for Atom / JavaScript on Windows

I have developed an Atom package which calls SyncTeX (a utility for reverse lookup for LaTeX), and then opens in Atom the file specified in the SyncTeX response. I'm developing on Linux, but now a ...

0 answers  ·  posted 3y ago by A. Donda‭  ·  last activity 3y ago by Kevin M. Mansour‭

83%
+8 −0
Git-ignoring files with special characters in their names, especially newlines

My actual motivation is to understand the semantics of the .gitignore file syntax in precise detail, for a program which is expected to emulate them as accurately as possible. However, while coming...

1 answer  ·  posted 5mo ago by Karl Knechtel‭  ·  last activity 5mo ago by Peter Taylor‭

82%
+12 −1
Why is it considered bad practice to use float for representing currency?

This is intended to be a canonical post for this problem which is pretty common. Especially among beginners. I've heard that I should avoid using floating point variables for representing curren...

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

82%
+12 −1
What is the difference between operator precedence and order of evaluation?

When doing something simple such as this int a=1; int b=2; int c=3; printf("%d\n", a + b * c); then I was told that operator precedence guarantees that the code is equivalent to a + (b * c)...

1 answer  ·  posted 3y ago by Lundin‭  ·  edited 3y ago by Lundin‭

81%
+7 −0
Function call; `this` gets bound to unexpected value

I recently encountered a strange situation in javascript; if I have: let obj = { a: function() { return (this === obj) ? this.b : 'bye'; }, b: 'hello' }; I can call obj.a with this bound...

2 answers  ·  posted 3y ago by Gershy‭  ·  last activity 3y ago by Alexei‭

81%
+7 −0
How do I customize merge behavior for a shared git repo?

I often find it useful to arrange things so that each commit on master's first-parent is a discrete change. It allows git log --first-parent --oneline to be used as a concise, automatically-generat...

1 answer  ·  posted 3y ago by ajv‭  ·  last activity 7mo ago by GrantMoyer‭

81%
+7 −0
Why can't we mix increment operators like i++ with other operators?

I'm experimenting with different operators and have a hard time understanding the outcome of certain expressions. I try to combine the ++ operators with other operators such as assignment in the sa...

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

81%
+7 −0
Pros and cons of various type_traits idioms

My work tasks have recently started requiring me to use the type_traits header to restrict the classes that may be used in template functions, methods, and classes. And while I used it for a long t...

1 answer  ·  posted 3y ago by dmckee‭  ·  edited 3y ago by Marc.2377‭

81%
+7 −0
Multiple catches with almost the same code.

I find myself often writing code like this. try { // code } catch( FailedReadException const & ex) { file.close(); std::cerr << "Read failure " << ex.readFailure() <&...

2 answers  ·  posted 3y ago by Estela‭  ·  edited 3y ago by Ayxan Haqverdili‭

81%
+7 −0
How can I find git branches where all branch-local commits are from specific people?

We have a bunch of dead branches in our git repository, and I'd like to clean them up. Ones that were merged (but not deleted at the time) are easy; we can see those in the branch list on Bitbucke...

2 answers  ·  posted 3y ago by Monica Cellio‭  ·  edited 3y ago by Alexei‭

81%
+7 −0
How to properly deal with impersonation in a Web application? (security vs. usefulness for tech support)

Context Our team has begun migrating a pretty old internal application and one aspect that got my attention is the impersonation. This is implemented as follows: only administrators are allowed...

2 answers  ·  posted 3y ago by Alexei‭  ·  last activity 3y ago by meriton‭

81%
+7 −0
Why is this client code getting the wrong date for a few hours a day?

Our web site has a widget that displays some date-based information that we retrieve from some JSON-formatted data (one object per date). We get the current date from the environment, possibly adj...

2 answers  ·  posted 3y ago by Monica Cellio‭  ·  last activity 3y ago by hkotsubo‭

81%
+7 −0
SQL timestamp for daylight saving day when clock goes 1 hour back.

On 25th October 2020 in Europe/Berlin clocks where set back from 03:00 AM to 02:00 AM to change from summer time (CEDT) to winter time (CET). Which means there is a 1 hour separation between 02:30...

1 answer  ·  posted 3y ago by Estela‭  ·  last activity 3y ago by hkotsubo‭

81%
+7 −0
What are field separators in operating-programming languages (such as Bash)?

The concept of field separator has some private cases in different operating system shells and their utilities (IFS on Bourne shell and derivates, RS on AWK and perhaps more) but I am having troubl...

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

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‭

81%
+7 −0
How do I ask git-show-branch to display a commit range?

For some tasks, I find git show-branch easier to follow than git log. For example, inspecting the history on someone's PR before merging it. git show-branch master topic stops at the first common ...

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

81%
+7 −0
What's the difference between placing <script> in the <head> and placing in the <body>?

While learning JavaScript, I started to see sometimes the <script> is placed in the <head> and sometimes it is placed in the <body>, What's difference between placing the <scri...

1 answer  ·  posted 2y ago by Kevin M. Mansour‭  ·  last activity 2y ago by Kevin M. Mansour‭

81%
+7 −0
How to choose backend technology for my project?

I am planning to build a "Customer Management Portal" as a hobby project using technologies like HTML,CSS,JavaScript,JAVA,JDBC,Oracle Database.The description of the portal is: 1)Customer details ...

3 answers  ·  posted 3y ago by aditya98‭  ·  last activity 3y ago by Matthewericfisher‭

81%
+7 −0
.elf file - What contributes to the resulting .bin file size?

I have found this nice library for parsing/writing .elf files as output by e.g. the GCC toolchain: ELFIO I have a bare metal embedded project with an ARM Cortex M target. My goal is to overwrite...

0 answers  ·  posted 3y ago by sktpin‭  ·  edited 3y ago by sktpin‭

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 3d ago by alx‭

81%
+7 −0
Console scripts in virtual environment do not output to terminal in git bash

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

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

81%
+7 −0
Is there a name for a data format like `key[type]=value`?

I'm working on an integration with a proprietary (black box) system. There is some TCP communication that occurs between two microservices. I've managed to sniff the traffic and it's being sent in...

0 answers  ·  posted 2y ago by Welz‭  ·  edited 2y ago by Welz‭

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 2y ago by Megan‭  ·  edited 2y ago by hkotsubo‭

81%
+7 −0
Is there any benefit to using new?

I've heard that in modern C++, smart pointers are preferred to raw pointers for ownership (the so-called RAII principle, as I understand it). This makes sense, and since then I've always used them...

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

81%
+7 −0
Qt Button changes drastically when setting its `border-radius`.

In a Qt application I have nothing more than a window with a button as its direct child. I set its background color and all is fine: Window::Window(QWidget *parent) : QWidget(parent) { but...

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

81%
+7 −0
What is the purpose of grouping the tests in a `tests` module and is it possible to split them?

What is the purpose of grouping the tests in a tests module like this #[cfg(test)] mod tests { use super::*; #[test] fn test_function_1() { // test code for function 1 g...

3 answers  ·  posted 1y ago by ShadowsRanger‭  ·  last activity 9mo ago by Moshi‭

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‭

81%
+7 −0
How to revert main branch to an earlier commit in git?

How to move the main branch back to an earlier commit in git?

2 answers  ·  posted 7mo ago by Iizuki‭  ·  last activity 5mo ago by Michael‭

git
81%
+7 −0
Git add/stage only part of a file's changes

Say I've made a bunch of changes to a file and would like to split those changes into two or more commits. Normal git add however stages the whole file in one go. So how to add only some of the ch...

1 answer  ·  posted 6mo ago by Iizuki‭  ·  last activity 6mo ago by Iizuki‭

git
81%
+7 −0
What is the point of triggering CI/CD with an empty git commit?

I read posts (e.g., 1, 2, 3) that recommend triggering a CI build process by pushing an empty git commit. I don't understand how this is a good idea as the commit history will be peppered with mea...

3 answers  ·  posted 6mo ago by toraritte‭  ·  last activity 5mo ago by matthewsnyder‭

81%
+7 −0
How do I add functionality to the back button?

How do I add functionality to the back button in Android without reimplementing the back button entirely? Prior to last year, I would just call onBackPressed() and then simply override it: overri...

1 answer  ·  posted 10mo ago by Ullallulloo‭  ·  edited 10mo ago by Ullallulloo‭

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 1y ago by hkotsubo‭  ·  last activity 1y ago by hkotsubo‭

81%
+11 −1
Why would excluding records by creating a temporary table of their primary keys be faster than simply excluding by value?

I have two tables with millions of records. Every so often I need to join them and exclude just a handful of records where a bit(1) column is set to 1 instead of 0. I can do it with either, WHERE ...

2 answers  ·  posted 3y ago by Charlie Brumbaugh‭  ·  edited 3y ago by Alexei‭

80%
+6 −0
Is it undefined behaviour to just make a pointer point outside boundaries of an array without dereferencing it?

I have heard that it is undefined behaviour to make a pointer point outside boundaries of an array even without dereferencing it. Can that really be true? Consider this code: int main(void) { ...

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

80%
+6 −0
Multiple string concatenation in Excel

In Excel I would like to concatenate several strings into one. I could type and fill in the blanks CONCATENATE(A1, A2, ....) but it is a lot of work This would be cool, but it does not work CONCATE...

2 answers  ·  posted 3y ago by James Jenkins‭  ·  last activity 3y ago by Alexei‭