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)
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 ...
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...
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...
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;...
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; ...
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) {...
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...
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...
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 ...
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...
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...
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 ...
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...
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: ...
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...
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 ...
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...
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...
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)...
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...
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...
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...
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...
I find myself often writing code like this. try { // code } catch( FailedReadException const & ex) { file.close(); std::cerr << "Read failure " << ex.readFailure() <&...
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...
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...
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...
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...
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...
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...
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 ...
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...
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 ...
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...
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.
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'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...
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...
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...
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...
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...
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...
How to move the main branch back to an earlier commit in git?
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...
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...
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...
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?
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 ...
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) { ...
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...