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.

Posts by klutt‭

29 posts
93%
+25 −0
Meta How can we grow this community?

Increase exposure One way of increasing our exposure is to use Codidact as a source when answering on other forums. As long as we are treating Codidact as any other source, there is absolutely not...

posted 3y ago by klutt‭  ·  edited 3y ago by klutt‭

Answer
87%
+12 −0
Meta Are Linux-related questions on-topic?

Linux questions in general are not really topic here. But Bash is. After all, Bash IS a scripting language as much as Javascript. I have a hard time thinking of a question about Bash that is not o...

posted 4y ago by klutt‭  ·  edited 4y ago by klutt‭

Answer
87%
+12 −0
Meta What is a minimal, reproducible example?

Sometimes when I ask questions here, I get told that I should include a minimal, reproducible example. What is that?

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

86%
+11 −0
Meta What is a minimal, reproducible example?

TL;DR A MRE (minimal reproducible example) is simply the minimal code and information needed for someone who is reading your question to reproduce the problem you are having. It needs to be enoug...

posted 3y ago by klutt‭  ·  edited 3y ago by klutt‭

Answer
85%
+10 −0
Q&A How to properly use malloc?

I have seen this construct quite a lot: int *p = (int*) malloc(n * sizeof(int)); Is this how it should be? What is the proper way to use malloc? I have also seen this: int *p = malloc(n * size...

3 answers  ·  posted 3y ago by klutt‭  ·  last activity 1y ago by Lundin‭

82%
+12 −1
Q&A 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 3y ago by klutt‭  ·  last activity 3y ago by klutt‭

80%
+6 −0
Q&A 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 4y ago by klutt‭  ·  last activity 4y ago by hkotsubo‭

80%
+10 −1
Q&A How to avoid "exception is never thrown" when commenting out a line while debugging

While writing the question I actually came up with something that seems to work fairly well, and it's very simple. Just add if(false) in front of the statement.

posted 2y ago by klutt‭  ·  edited 2y ago by anatolyg‭

Answer
80%
+6 −0
Q&A When does it not work to dereference the pointer for sizeof during malloc?

Background This is kind of a subquestion to How to properly use malloc? When allocating, there are basically two common ways of using the sizeof operator: int *p; p = malloc(n * sizeof *p); /...

1 answer  ·  posted 3y ago by klutt‭  ·  edited 3y ago by hkotsubo‭

Question c pointers malloc
80%
+6 −0
Q&A How to properly use malloc?

TL;DR You should use int *p = malloc(n * sizeof *p); for two reasons The cast (int*) is not necessary, which means it's clutter. Using sizeof *p instead of sizeof(int) removes code duplica...

posted 3y ago by klutt‭  ·  edited 2y ago by klutt‭

Answer
80%
+6 −0
Q&A Are static pointers implicitly initialized to NULL?

Consider this code: #include <stdio.h> int main(void) { static void *ptr; if(ptr == NULL) puts("It's NULL!"); } I wonder if this is guaranteed to print "It's NULL!" I know ...

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

77%
+5 −0
Q&A Is there any rationale for the lack of local constants in PHP?

The last few years, PHP has basically exploded with lots of modern language constructs that makes the life easier. But local constants are still missing, and I find that very strange. I have found...

0 answers  ·  posted 10mo ago by klutt‭

Question php
77%
+5 −0
Q&A How to prevent token from being refreshed

I have an Angular application. The frontend has a mechanism that periodically fetches some information like this: ngOnInit(): void { setInterval( () => { this.http.get(... ).sub...

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

77%
+5 −0
Q&A Are there best practices for sticking conditions in WHERE clauses vs the JOIN statement?

@BruceAlderman gave a good answer with different aspects that covers the most. I'm not very good at SQL, so my answer is more general. When I have to choose between two different things that are e...

posted 4y ago by klutt‭  ·  edited 4y ago by klutt‭

Answer
75%
+7 −1
Meta Autocompleting usernames in comments does not seem to work

It seems like autocompleting usernames does not work. I wanted to answer a comment and started typing @ followed by the first letter in the username, but no suggestion appeared. I tried pressing ta...

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

75%
+7 −1
Q&A How to avoid "exception is never thrown" when commenting out a line while debugging

I have a code block like this: try { ... x.foo(); // This is the line that forces us to have the try block ... } catch (ArrayIndexOutOfBoundsException e) { logger.error(e.getM...

1 answer  ·  posted 2y ago by klutt‭  ·  last activity 2y ago by anatolyg‭

Question java exception
75%
+4 −0
Code Reviews Counting number of assignments that a `fscanf` format strings implies

I'm writing a function that counts the number of assignments for a fscanf format string. I studied the documentation in C standard 7.21.6.2 It looks like it works. It passes all test cases I have w...

3 answers  ·  posted 4y ago by klutt‭  ·  last activity 3y ago by klutt‭

72%
+6 −1
Q&A How to unittest method that involves contacting remote servers?

Let's say I have this class: class myService { private boolean foo(T arg) { return arg == 42; } public Response bar(U arg) { if(foo(U.field)) { return Response.st...

1 answer  ·  posted 2y ago by klutt‭  ·  last activity 2y ago by meriton‭

71%
+3 −0
Meta Suggestions for improving the UI regarding comments

See this picture How do you answer in that thread? Hmm, there are two buttons. One says "show more". I click on that and the thread collapse. Is that "more"? Ok, so I click on the thread agai...

0 answers  ·  posted 3y ago by klutt‭

71%
+3 −0
Q&A Should I cast to (void) when I do not use the return value

This is a bit opinionated, but personally, I would not do it. It would just clutter the code and could hide sources of bugs. But it depends a lot on what function it is. It's also hard to give a ve...

posted 4y ago by klutt‭  ·  edited 4y ago by klutt‭

Answer
66%
+2 −0
Meta A cleanup of "What type of questions can I ask here?"

If we compare to SO (and we do) there's one thing I really don't like there. And that is that so many questions get closed for being too opinionated. Granted, many of them is quite naively asked. ...

posted 3y ago by klutt‭

Answer
66%
+2 −0
Q&A For scripting what are the pros and cons of command line arguments versus capturing input at the start?

@‭laserkittens‭ and @dmckee has already provided good answers, and I will not copy what's there. Personally, I treat cli arguments as the default choice because of the flexibility it gives to scrip...

posted 4y ago by klutt‭

Answer
66%
+2 −0
Code Reviews Counting number of assignments that a `fscanf` format strings implies

I have found an improvement that is worth posting as an answer to my question. One thing that I was not comfortable with was coming up with test cases and figuring out how many assignments a forma...

posted 4y ago by klutt‭  ·  edited 3y ago by klutt‭

Answer
66%
+2 −0
Q&A How to check if a ldap username is valid without contacting the active directory via ldap?

I have some code connecting to an active directory via ldap. Something like this: public Response add(User user) { try { LDAPConnectionPool ldapPool = ldapConnectionPool.getPool();...

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

64%
+9 −4
Q&A Is omitting braces for single statements bad practice?

Consider this code: while(arr[index] != 0) index++; vs while(arr[index] != 0) { index++; } Personally, I prefer the first. The fact that the braces are not needed makes them -- u...

6 answers  ·  posted 4y ago by klutt‭  ·  last activity 1y ago by H_H‭