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

Type On... Excerpt Status Date
Answer A: How to manage user-specific application data on Linux?
Just as an additional information: If you are writing Python code, there's the useful package `appdirs` that provides a platform-agnostic interface to user-specific application data directories. For Linux, it implements the XDG specification.
(more)
over 1 year ago
Answer A: How to use grep to print only specific word from a string
While I agree with Dirk Herrmann that `basename` is the right tool for the job, I think it is still worthwhile to know how to do it with `grep`, because you might one day encounter a sufficiently similar situation that is not covered by a specialised tool. The question can be broken into two quest...
(more)
almost 2 years ago
Question Is it possible to undo a git reset?
For some reason, I just wanted to undo a commit on my git repository, which I've done with the following command: git reset --soft HEAD1 So far, so good. However, by mistake I issued the command a second time, thus deleting also an earlier commit. It also turned out that I had forgotten to ...
(more)
almost 2 years ago
Question A state machine in Python
I've written the following code implementing a state machine in Python, and I'd like some feedback on it. The basic idea is that each state has a set of corresponding actions that trigger a state change. You can register observer functions with states, which are then called whenever the state is e...
(more)
almost 2 years ago
Question Reaction comment doesn't appear if previous comment for retracted reaction was deleted
On this answer I just reacted with “works for me” with comment, but then retracted it because of what finally turned out to be a mistake on my end, and deleted also the comment (and thus the comment thread). After figuring out my mistake, I gave again the “works for me” reaction with comment, but thi...
(more)
almost 2 years ago
Question Is it possible to write protocols for enumerations in Python?
Having recently learned about protocols in Python, I now wonder if you can write a protocol for enumerations. That is, a protocol that says that you are supposed to pass an enum that has certain items with certain values, but doesn't specify a specific enum. To explain how I mean it, here's some n...
(more)
almost 2 years ago
Answer A: Are there references in C?
C does have references, but it does not have pass by reference. A reference is simply an expression that references an object (object here is meant in the general sense, not in the OO sense; for example, a variable is an object). In C, references are implemented using pointers. However C does n...
(more)
about 2 years ago
Answer A: C Language Standard Linking Specifications
The standard does not talk about object files and/or linking, but it does talk about translation units. In typical compilers, a single translation unit translates into a single object file. Obviously the C standard does not talk about translation units that are not themselves C; that's what a plat...
(more)
over 2 years ago
Answer A: What is malloc's standard-defined behavior with respect to the amount of memory it allocates?
Since accessing the memory allocated by `malloc` beyond the size given to the call is undefined behaviour (which means that the standard poses no restriction to the behaviour of a program that does this), and since there's no standard way to determine the length of the allocated block, malloc is inde...
(more)
over 2 years ago
Answer A: Behavior of Pointer Arithmetic on the Stack
Not only does the C language not guarantee it, it also will fail on actual compilers, as soon as you enable optimisation (which you'll generally want to do because you want your code run fast, after all). Try it online! – Try It Online")
(more)
over 2 years ago
Answer A: Why does fopen return NULL?
Besides the possible issues that Lundin told you, there is also the possibility that the current directory of the program is not what you think it is (note that the current directory is not necessarily the directory the executable is in, nor is it necessarily your user directory). This problem is unl...
(more)
over 2 years ago
Answer A: Invalid memory access when trying to dereference a pointer obtained through a function call
Your function returns a pointer to a local non-static variable. Such a variable exists only during execution of the function and is removed on return. This means you are left with a so-called dangling pointer, a pointer that points to a no longer valid address. Note that using such a pointer is un...
(more)
over 2 years ago
Question A class to access dicts using attribute syntax
I've written a class that allows to access dictionary entries of arbitrary dicts with appropriate string keys through attribute access syntax on an instance of the class. My questions are: 1. Is this class a good idea to begin with? 2. Is there anything that should be done differently? ...
(more)
over 2 years ago
Answer A: Detecting balanced parentheses in Python
You've got an inefficiency in your code, as you always do replacements 3/2 times the length of the string. That is unnecessarily expensive. By instead testing in each iteration whether the length actually changed, you get a much improved performance: ``` def isvalid(s: str) -> bool: if le...
(more)
over 2 years ago
Question A simple game with pygame
I've just started playing around with pygame and have written a small game in it, of which I'd like a review. Note that I'm not only a complete beginner in pygame, but I also have very little experience in Python in general, therefore I also would welcome comments on my Python code that are not relat...
(more)
over 2 years ago
Answer A: Why is it considered bad practice to use float for representing currency?
The main problem with using floating point is that the typical floating point type is binary floating point. But in binary floating point, most decimal fractions cannot be represented exactly. That is, if you store the number 9.95 in a floating point number, the number that you are actually storing i...
(more)
over 2 years ago
Question Is this a good fit for Code Reviews, and if so, how to best post it?
I've just dived into pygame and written a little game in it, of which I'd like a review (it's my first try of pygame). However I'm not sure if it is a good fit for the site, and if so, how exactly I should post it. First, the rules ask for complete code. Here's what `wc` says about all the Python ...
(more)
over 2 years ago