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 aura-lsprog-86‭

Type On... Excerpt Status Date
Edit Post #293459 Post edited:
Minor grammar correction.
4 days ago
Edit Post #293459 Initial revision 4 days ago
Question Iterating over pixels in QImage (Qt): which method adapts better for any image size?
I asked this in SE years ago. I'm aware of two methods in order to access all the pixels in a `QImage` called `img`. Method 1 for (int y = 0; y < img.height(); y++) { QRgb line = (QRgb ) img.scanline(y); for (int x = 0; x < img.width(); x++) { // line[x...
(more)
4 days ago
Edit Post #293458 Initial revision 4 days ago
Answer A: How to correctly model the delay timer for a CHIP8 emulator written in C?
I received this answer in SE. Sadly, the user who wrote the answer is no longer in the site. Don't use threads and synchronization primitives (semaphores, shared memory, etc) for this. In fact, I'd go as far as to say: don't use threads for anything unless you explicitly need multi-processor c...
(more)
4 days ago
Edit Post #293457 Initial revision 4 days ago
Question How to correctly model the delay timer for a CHIP8 emulator written in C?
I asked this question in SE a while back. TL;DR I need to emulate a timer in C that allows concurrent writes and reads, whilst preserving constant decrements at 60 Hz (not exactly, but approximately accurate). It will be part of a Linux CHIP8 emulator. Using a thread-based approach with shared...
(more)
4 days ago
Edit Post #293436 Post edited:
Change ownership of reviewed script
5 days ago
Edit Post #293449 Initial revision 6 days ago
Answer A: Why is a for loop getting stuck when using a uint64_t counter, whereas a while loop isn't?
SE user DU Jiaen provided the following answer, edited by Martin Zabel and found here. The expression `i >= 0` is always true if `i` is of an unsigned integer type. The alternative and simple way is to change it into: uint64t i; for (i = 15; i != -1; i--) { ... } This works no m...
(more)
6 days ago
Edit Post #293447 Initial revision 6 days ago
Answer A: Why is a for loop getting stuck when using a uint64_t counter, whereas a while loop isn't?
SE user M Oehm provided with the following answer, as it can be found here. The condition `i >= 0` is always true if `i` is an unsigned type. Decrementing an unsigned zero will not produce a negative value, but the counter will wrap to the maximum representable number for the given type. C ...
(more)
6 days ago
Edit Post #293446 Initial revision 6 days ago
Question Why is a for loop getting stuck when using a uint64_t counter, whereas a while loop isn't?
I asked this question a while ago over SE. When I use a `for` loop with a `uint64t` as a counter, it gets stuck forever, even though the condition seems to be well defined. Offending MCVE #include #include int main() { uint64t i; for (i = 15; i >= 0; i...
(more)
6 days ago
Edit Post #293444 Post edited:
Remove commented unsigned int typedef used in the correction.
6 days ago
Edit Post #293444 Initial revision 6 days ago
Answer A: Line-drawing algorithm prints nonsensical intermediate Y values. Where is the problem?
I answered myself as it can be found here. Silly me! The root of the entire problem was the type used in both `point.x` and `point.y`: typedef unsigned int uint; typedef struct { uint x; uint y; } point; As both are unsigned integers, they "wrap up" once...
(more)
6 days ago
Edit Post #293443 Initial revision 6 days ago
Question Line-drawing algorithm prints nonsensical intermediate Y values. Where is the problem?
This question was originally asked in SE. I have a program that draws lines using line drawing algorithms. I use `gcc 5.2.1` on Xubuntu 15.10 to compile it. Executing it throws a "Segment violation" fault. Further investigation let me isolate the problem in this MCVE: #include ...
(more)
6 days ago
Edit Post #293437 Post edited:
Reformat code blocks inside bullet points.
6 days ago
Edit Post #293436 Post edited:
Add Fedora dependency install command
6 days ago
Edit Post #293438 Initial revision 6 days ago
Answer A: Serial copying from disk images to folder in Bash
The following answer was given by SE user Edward. The original source can be found here. The other answer gave some really good advice; this is intended as a complementary answer with still more things to think about. Put default arguments at the top of the script If someone wanted to ch...
(more)
6 days ago
Edit Post #293437 Initial revision 6 days ago
Answer A: Serial copying from disk images to folder in Bash
The following answer was given by SE user Oh My Goodness. The original source can be found here. Instead of `cat "$x" | command` or `echo "$x" | command`, use `command /dev/null || exit 1 done } # Code here... require jq udisksctl Read `CONF` just once,...
(more)
6 days ago
Edit Post #293436 Initial revision 6 days ago
Question Serial copying from disk images to folder in Bash
(Brought over from SE.) This is a Bash script that copies files stored inside disk images to a directory, using a defined structure provided via a JSON file. I've included the external programs it requires and the test I used so that you can test it too. Any comments regarding programming s...
(more)
6 days ago
Edit Post #293432 Post edited:
Amend lack of MathJax in answer
7 days ago
Edit Post #293432 Initial revision 7 days ago
Answer A: A simple implementation of a mutable String in C
(User JS1 answered as follows; source.) Unsafe loop This loop in `stringfind()` is unsafe since it could read past the end of your buffer: > while (str->data[pos] != c) ++pos; You should add an additional check like this: while (pos length && str->data[pos] != c) ++pos; ...
(more)
7 days ago
Edit Post #293431 Initial revision 7 days ago
Question A simple implementation of a mutable String in C
(Brought over from SE.) The following code implements a simple interface to operate on mutable `String`s in C. It is composed of two files: one for the structure definition and the available operations, and the other with the actual implementation. = This can be inexact, as only adding cha...
(more)
7 days ago
Comment Post #293416 Thanks for your insight! I understand the reasoning: if a private field is such, then there is no need to alter it from the outside. (Maybe if the field is part of a compiled library, but I suspect there are better patterns such as composition to deal with this.)
(more)
7 days ago
Edit Post #293429 Post edited:
Add linux in title and tags
7 days ago
Edit Post #293430 Initial revision 7 days ago
Answer A: Scanner fails when executing Java with admin rights (sudo) in Eclipse in Linux
I've finally managed to get it working without using a wrapper for `java`. It has to do with filesystem capabilities in Linux. To let `java` list and select network interfaces, as well as analyse and capture packets, go to the directory where the executable the IDE uses is (for example, `/usr/lib/...
(more)
7 days ago
Edit Post #293429 Initial revision 7 days ago
Question Scanner fails when executing Java with admin rights (sudo) in Eclipse in Linux
(Brought over from SE.) The problem I have followed this procedure in order to run Java applications as root when needed from Eclipse (as I use Xubuntu, for instance, when using `jnetpcap` to capture and analyse packets). The problem I have is that any `Scanner` statement reading from `Syst...
(more)
7 days ago
Edit Post #293416 Post edited:
8 days ago
Edit Post #293416 Initial revision 8 days ago
Answer A: How can I set a private class instance variable to the File object used by an unmarshaller?
I've found a way to set the private field without exposing it or giving it a setter: Reflection. Using external event listeners, I can get ahold of the `File` object. Then, inside the `beforeUnmarshal` method, and after checking that I got the correct object, I use reflection to get the private fi...
(more)
8 days ago
Edit Post #293414 Initial revision 8 days ago
Question How can I set a private class instance variable to the File object used by an unmarshaller?
(Brought over from SE) The problem I'm coding a Java Swing application dealing with XML files, so I'm using JAXB in order to marshal classes into documents and unmarshal the other way around. I want to include a private field in the class that gets marshalled, which will store the backin...
(more)
8 days ago