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 »

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.

Activity for Karl Knechtel‭

Type On... Excerpt Status Date
Comment Post #292972 I agree that `any` and `all` are overkill here - they're general-purpose tools, meant to illustrate that there's always that fall-back option. The best approaches for various simple cases are... varied, because there are a lot of them. I didn't get to filling out the table because it's a daunting ...
(more)
about 19 hours ago
Comment Post #292978 I tend to agree with these comments and I greatly appreciate the effort put into them (and the answer). I do wonder, however, if Software might be better off with separate sections for design questions vs. implementation questions. Implementations can generally be measured in terms of correctness, me...
(more)
about 19 hours ago
Edit Post #292986 Initial revision about 19 hours ago
Answer A: How does the strict aliasing rule enable or prevent compiler optimizations?
Aliasing is perhaps better understood as a property of assignments through pointers, not of the pointers themselves. First, let's consider the reasoning behind applying the optimization to the first example. In the first code block, the underlying storage of `b` is only assigned to via the `b` ...
(more)
about 19 hours ago
Edit Post #292985 Initial revision about 20 hours ago
Question How does the strict aliasing rule enable or prevent compiler optimizations?
Inspired by https://meta.stackoverflow.com/questions/432242, and the relevant main-space questions. I have heard that C and C++ something called the "strict aliasing rule", which means for example that if we have code like: ```c int aliased(float f, int i) { f = (reinterpretcast i);...
(more)
about 20 hours ago
Edit Post #292972 Initial revision 4 days ago
Answer A: Simultaneous comparison in Python
Using `and` and `or` correctly The left-hand side and right-hand side of these operators should both be valid operands, which should each come from a comparison. Thus, we should repeat the comparison on each side: ```python if myname in email and yourname in email: print("The email is abo...
(more)
4 days ago
Edit Post #292971 Initial revision 4 days ago
Question Simultaneous comparison in Python
I want to make multiple comparisons at once, of the same type, in a Python program. For example, to check whether all of a certain group of strings are `in` a longer test string; or whether a specific variable is equal to any of some test values; etc. I discovered that these naive approaches won't...
(more)
4 days ago
Edit Post #292970 Post edited:
Collapse some parts; improve some labels and such
4 days ago
Edit Post #292970 Post edited:
Show worked examples of applying the steps, and be explicit that the and/or swap is bidirectional
4 days ago
Comment Post #292970 In addition to the arithmetic-relational operators (to compare whether values are equal and/or which is larger), Python also has an `in` relational operator - `x in y` checks whether `y` "contains" `x` in some sense (depending on the types of the values). This operation also has a negation: `not (x i...
(more)
4 days ago
Edit Post #292970 Initial revision 4 days ago
Answer A: Understanding "de Morgan's laws"
Overview de Morgan's laws are rules of logic that allow you to transform one conditional expression into another, equivalent expression. Because (in Boolean logic) two negations cancel each other out (i.e. `not(not x)` is equivalent to `x`), we can also infer rules for negating an expression. T...
(more)
4 days ago
Comment Post #292969 Again, I'm asking so that there's a canonical available when someone encounters the problem and the question ought to be closed as a duplicate. Related Stack Overflow questions: * [De Morgan's rules explained](https://stackoverflow.com/questions/2168603/de-morgans-rules-explained) * [Why does ...
(more)
4 days ago
Edit Post #292969 Initial revision 4 days ago
Question Understanding "de Morgan's laws"
While trying to understand logical 'or'/'and', I encountered another problem (I'm writing Python code here, but my question is about the logic, not about any given programming language). I have some code like: if x or y: pass else: dosomething() (Of course, following ...
(more)
4 days ago
Edit Post #292968 Initial revision 4 days ago
Question Understanding "logical OR" and "logical AND" in programming languages
I'm posting this as a language-agnostic catch-all for a simple class of logical errors, so that beginner questions can be duplicated to it in the future. In my experience, the large majority of questions along these lines are asked by new Python programmers, but in principle the question applies ...
(more)
4 days ago
Edit Post #292967 Post edited:
Emphasis on the important parts, fix a bit of wording
4 days ago
Edit Post #292967 Post edited:
4 days ago
Edit Post #292967 Initial revision 4 days ago
Answer A: Common string handling pitfalls in C programming
Understanding the representation of text in C "Text" is a high level abstraction that C doesn't properly support Fundamentally, C does not have any built-in "string" type. It arguably doesn't even have a real character type. `char` is really a numeric, integral type which has a size of one byte...
(more)
4 days ago
Edit Post #284850 Post edited:
Format with details blocks for an at-a-glance view of the combined "FAQ".
4 days ago
Edit Post #284849 Post edited:
improve formatting; copyedit for clarity
4 days ago
Suggested Edit Post #284850 Suggested edit:
Format with details blocks for an at-a-glance view of the combined "FAQ".
(more)
helpful 4 days ago
Suggested Edit Post #284849 Suggested edit:
improve formatting; copyedit for clarity
(more)
helpful 4 days ago
Edit Post #292960 Initial revision 5 days ago
Question Comparing our site scope to Stack Overflow
We've had discussions before about the site's intended scope (range of permissible topics and questions), but for new users coming from the Stack Exchange network, I think it would be useful to draw an explicit comparison with Stack Overflow and related sites. The Stack Exchange network has severa...
(more)
5 days ago
Edit Post #292959 Initial revision 5 days ago
Answer A: Generating combinations of elements, which are themselves sequences of the same length, where the elements have no value in common at any position
Using filtered products of candidates, over combinations of first letters Let's consider the n=2 case first. (For higher n, we can use the same sort of recursive generator approach as in my other answer, but recursing on n instead of k.) Partition the input words according to the first letter; ...
(more)
5 days ago
Edit Post #292958 Post edited:
Update to match the change to the question example input
5 days ago
Edit Post #292957 Post edited:
Reduce the input set to a more tractable size to facilitate comparisons and discussion
5 days ago
Edit Post #292958 Initial revision 5 days ago
Answer A: Generating combinations of elements, which are themselves sequences of the same length, where the elements have no value in common at any position
Using a recursive generator There isn't anything like a built-in solution for this algorithm, but it's easy to express the desired output recursively. A valid output combination of k-many inputs looks like an arbitrarily selected first element, followed by a combination of k-1-many elements that: ...
(more)
5 days ago
Edit Post #292957 Post edited:
5 days ago
Edit Post #292957 Post edited:
More clarification and mathematical rigor.
5 days ago
Edit Post #292957 Post edited:
5 days ago
Edit Post #292957 Initial revision 5 days ago
Question Generating combinations of elements, which are themselves sequences of the same length, where the elements have no value in common at any position
This question is adapted from a question I just helped fix up on Stack Overflow. I'm giving a different motivating example which I think will make it clearer what the requirements are and why a naive approach would take prohibitively long. (Also, I want to attempt an answer, but by personal polic...
(more)
5 days ago
Comment Post #292774 I think this is simply a "mental typo" or failure to think it through properly. As a hint: you say that your "goal is to compile all `*.c` files" - notice that you *didn't* say "all `%.c` files"? Also, if you're using existing Stack Overflow Q&A to try to solve something, obviously you shouldn't coun...
(more)
about 1 month ago
Edit Post #292334 Initial revision 3 months ago
Answer A: What actually is a pytest fixture?
The term long predates Pytest and is not at all specific to Python. The idea is described on Wikipedia: > In the context of software a test fixture (also called "test context") is used to set up system state and input data needed for test execution.2 For example, the Ruby on Rails web framework us...
(more)
3 months ago
Comment Post #292286 What kind of danger specifically do you have in mind? This is a very different question if it's about supposed security exploits vs. losing work by overwriting your working copy.
(more)
3 months ago
Edit Post #292142 Post edited:
Improve clarity: simplify a bit; minor word-choice etc. tweaks; fix per comment discussion to present two ways of implementing a SSG clearly (instead of as separate but "related solutions")
3 months ago
Suggested Edit Post #292142 Suggested edit:
Improve clarity: simplify a bit; minor word-choice etc. tweaks; fix per comment discussion to present two ways of implementing a SSG clearly (instead of as separate but "related solutions")
(more)
helpful 3 months ago
Edit Post #292139 Post edited:
Reusing code in an ordinary programming language looks very different. Codidact doesn't put tags in the page title automatically like Stack Overflow does; so it's useful to make the title unambiguously indicate a language.
3 months ago
Edit Post #292162 Post edited:
The underlying motivation or purpose for a how-to question doesn't actually change what the question is about. This question is not about *using* version control.
3 months ago
Suggested Edit Post #292139 Suggested edit:
Reusing code in an ordinary programming language looks very different. Codidact doesn't put tags in the page title automatically like Stack Overflow does; so it's useful to make the title unambiguously indicate a language.
(more)
helpful 3 months ago