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 »
Q&A

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)
80%
+6 −0
Is it OK to use scanf with a void pointer?

I've created a function that calls scanf passing a void pointer as argument: void read(const char *format, void *p) { scanf(format, p); } And tested it with different types: int n; read...

2 answers  ·  posted 2y ago by hkotsubo‭  ·  last activity 2y ago by Lundin‭

80%
+6 −0
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 2y ago by klutt‭  ·  edited 2y ago by hkotsubo‭

77%
+5 −0
Is an ORDER BY required when looping through MySQL records with LIMIT?

Let's say I have a table with 10,000 rows and instead of selecting all of the rows at once I select 1,000 at a time like LIMIT 0,1000 LIMIT 1000,1000 etc. Without an ORDER BY statement the or...

1 answer  ·  posted 3y ago by Charlie Brumbaugh‭  ·  edited 2y ago by Alexei‭

66%
+2 −0
Why is my last input box not centering (class: powerwall-battery-input)?

I found a form I wanted to duplicate on a roof construction website. All my input boxes are centered except the last one that's a bit off and I cannot figure out why. Here is my code: HTML <...

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

71%
+3 −0
Detecting if a user has stopped interacting with a web view for a certain time

I am interested in finding out all the aspects I need to cover in order to correctly assess if a user has stopped interacting with a web page. So far, I found the following: Idle Detection API -...

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

80%
+6 −0
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 2y ago by klutt‭  ·  last activity 2y ago by Lundin‭

77%
+5 −0
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 2y ago by klutt‭  ·  last activity 2y ago by meriton‭

60%
+1 −0
Preloading some data at application startup as fast as possible

I am caching some very static information (changes once per day) in my ASP.NET Core application. This is normally done when needed ("lazy"). One such cache item is a 50K list of items that are tak...

1 answer  ·  posted 2y ago by Alexei‭  ·  last activity 2y ago by Alexei‭

66%
+2 −0
What are the drawbacks of using data snapshot testing?

Our team is finally focusing on writing more automatic testing and one of my ex-colleagues recommended to try out the Verify library. The tool does the following: runs the test and compares the...

1 answer  ·  posted 2y ago by Alexei‭  ·  last activity 2y ago by Derek Elkins‭

66%
+2 −0
How to write database friendly code when using an ORM?

There are a lot of articles and presentations that show little love for ORMs. This is mainly because some queries are so complex and heavy on the database that they lead to significant issues in p...

1 answer  ·  posted 2y ago by Alexei‭  ·  last activity 2y ago by Alexei‭

50%
+2 −2
Alternative to Google Adsense [closed]

I'm starting a small site with some online tools. Tried to include Google Adsense but I initially got rejected because the site was still on construction. Yet I've seen in the forums that they are...

0 answers  ·  posted 2y ago by nelson777‭  ·  closed 2y ago by Alexei‭

71%
+3 −0
Why static code analyzers such as SonarQube indicate a high code complexity for switch statements?

During a presentation of a pipeline configuration, a colleague showed a SonarQube integration and one of its reports. A warning was caused by overrunning the max value for the code complexity thres...

2 answers  ·  posted 2y ago by Alexei‭  ·  last activity 2y ago by Derek Elkins‭

50%
+0 −0
Migrating HTML strings to a more secure alternative

Our team will have to migrate an old application to use a new tech stack. One of the features involves the usage of HTML editors which serialized the content as HTML and I am able to see valid HTML...

1 answer  ·  posted 2y ago by Alexei‭  ·  last activity 2y ago by r~~‭

37%
+1 −3
Cannot write multipart message to byte array [closed]

I'm trying to write a MIME message to the console. ByteArrayOutputStream out = new ByteArrayOutputStream(); MimeMultipart replyMsg = mdnCreator.createMDNData(); replyMsg.writeTo(out); out.close...

0 answers  ·  posted 2y ago by artaxerxe‭  ·  closed 2y ago by Alexei‭

77%
+5 −0
bootstrap : how to align text with a button inside a grid

I have this bootstrap code (grid) <div class="container p-3 center"> <div class="row"> <div class="bg-light border-bottom border-secondary border-top col-6 te...

0 answers  ·  posted 2y ago by meneguzzo68‭  ·  edited 2y ago by Alexei‭

66%
+2 −0
Rationale of using database-level transactions inside a store procedure when application layer already manages a transaction

One of the legacy applications my team has to maintain has almost always this pattern for dealing with data modification: try { // get the connection // begin transaction // optional...

0 answers  ·  posted 2y ago by Alexei‭  ·  edited 2y ago by Canina‭

75%
+4 −0
What are the disadvantages of using auto mapper libraries?

I have noticed that lots of projects (both in real-world and within online courses) use Automapper to map domain models to view models, API models. The main advantage seems to be convenience by re...

2 answers  ·  posted 2y ago by Alexei‭  ·  edited 2y ago by Alexei‭

66%
+2 −0
Collapsing AppBar with two Toolbars

I am trying to create an app with two toolbars on top and a specific collapsing/expanding behaviour on scrolling. See the mockup to get a deeper understanding of what I'm trying to achieve: I fo...

0 answers  ·  posted 2y ago by BenjyTec‭

80%
+6 −0
When stored procedures are preferred over application layer code?

A person I used to work with several years ago was hired to rewrite a product using a .NET-based modern tech stack. One of the aspects that stroke me was that he believes that the product should mo...

2 answers  ·  posted 2y ago by Alexei‭  ·  last activity 2y ago by Derek Elkins‭

75%
+4 −0
In the current development context (2020+), is there any reason to use database triggers?

I have not used a database trigger in years in the projects of the teams I have worked in, but I have seen them being used by other teams. Back in 2009, it seemed like a heated debate, but I am wo...

1 answer  ·  posted 2y ago by Alexei‭  ·  last activity 2y ago by Derek Elkins‭

75%
+4 −0
What advantages does Agner Fog's VCL have over OpenMP?

Agner Fog has this C++ Vector Class Library, which is ... useful for improving code performance where speed is critical and where the compiler is unable to vectorize the code automatically in an...

1 answer  ·  posted 2y ago by anatolyg‭  ·  edited 2y ago by Alexei‭

77%
+5 −0
Kotlin FloatArray from Iterable<Float>

Suppose I am using a Java API from Kotlin and I want to call a function that takes a FloatArray (represented as float[] in Java), and I have an Iterable<Float> as my input data type. To be mo...

1 answer  ·  posted 2y ago by Josh Hyatt‭  ·  edited 2y ago by Alexei‭

66%
+6 −2
Why object-oriented instead of class-oriented?

I understand that in object-oriented programming, an object is an instance of a class. If it's an instance, I misunderstand why does it need the term object at all (we could just say "instance"). ...

4 answers  ·  posted 2y ago by deleted user  ·  last activity 2y ago by hkotsubo‭

62%
+3 −1
cannot initialize a variable of type 'CFDictionaryRef'

Background story: I'm on mac OS 11.6 and would like to access an identifier for the current space/desktop from the command line. I found a helpful article at https://ianyh.com/blog/identifying-spac...

1 answer  ·  posted 2y ago by foobar‭  ·  edited 2y ago by Alexei‭

70%
+5 −1
A keydown event succeeds for an English letter but not for an Hebrew one, sharing the same key

I am trying to listen to the event in which the keyboard key containing the Hebrew final-letter ך is pressed. This key stands for both the English letter L and the Hebrew final letter ך. If my op...

0 answers  ·  posted 2y ago by deleted user  ·  edited 2y ago by deleted user

85%
+10 −0
What does the "\s" shorthand match?

I've seen some regular expressions (regex) using \s when they want to match a space, but I noticed that it also matches line breaks. Example: the regex [a-z]\s[0-9] (lowercase ASCII letter, follow...

1 answer  ·  posted 3y ago by hkotsubo‭  ·  last activity 2y ago by hkotsubo‭

77%
+5 −0
C Language Standard Linking Specifications

What (if anything) does the C standard have to say about linking objects? My guess is that, because C only defines language->behavior rules, it completely ignores any potential intermediate form...

1 answer  ·  posted 2y ago by Josh Hyatt‭  ·  edited 2y ago by Josh Hyatt‭

60%
+4 −2
Question regarding an error message in my compiler to do with my code on linked list.

Can anyone help me, I'm currently learning pointers, this is the code I wrote to try and insert a node at the beginning of the list. However at the part where I included the comment of "error at th...

1 answer  ·  posted 2y ago by hamburgersarecool‭  ·  edited 2y ago by hamburgersarecool‭

75%
+4 −0
Appropriate HTTP status code for "user confirmation required"

I'm working on a system where the frontend will make a call to the backend to perform an action. Sometimes this action can cause other unintended consequences (like charging the customer), in thes...

2 answers  ·  posted 2y ago by Welz‭  ·  last activity 2y ago by Alexei‭

28%
+0 −3
How to implement "Loss leader" marketing pattern in ecommerce websites? [closed]

Loss leader is a marketing pattern implemented in stores: A customer enters a store and while heading to some most desired expensive products far from entrance, that customer picks some products s...

0 answers  ·  posted 2y ago by deleted user  ·  closed 2y ago by Alexei‭

77%
+5 −0
How to manage CPU capabilities of Jenkins nodes?

We use Jenkins Pipeline to build and test some C++ software. The pipeline script runs the tests on 10 different nodes in a parallel way in order to save time. All of these nodes are real (not virtu...

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

50%
+2 −2
Manipulate a web browser to hide a certain HTML element in a certain website by a single action

Before I publish a new webpage in my website (in the content management system itself), I zoom in from say 100% zooming to 500% zooming and then re-read it, as a nice way to check for typos. The p...

2 answers  ·  posted 2y ago by deleted user  ·  last activity 2y ago by bta‭

86%
+11 −0
What is malloc's standard-defined behavior with respect to the amount of memory it allocates?

I recently told a friend that malloc(n) allocates and returns a pointer to a block of at least N bytes of memory, as opposed to exactly N; that it is allowed to allocate 'extra' memory to meet e.g....

2 answers  ·  posted 2y ago by ajv‭  ·  last activity 2y ago by bta‭

66%
+2 −0
How to create fire and forget tasks Q&A in ASP.NET Core with dependency injection support?

One of the legacy applications our team manages contained the following pattern (in the controller): // initialization private readonly IServiceScopeFactory _serviceScopeFactory; public FooCon...

1 answer  ·  posted 2y ago by Alexei‭  ·  last activity 2y ago by Alexei‭

40%
+0 −1
How to mock LazyCache when performing unit testing?

A few of my services rely on LazyCache and they use it by injecting IAppCache. For unit testing, I would like to mock this. I have found MockCachingService, but it does not do any caching (as spec...

1 answer  ·  posted 2y ago by Alexei‭  ·  last activity 2y ago by Alexei‭

84%
+14 −1
What's the correct way to merge a branch and its dependent branch back to master?

In git I branched feature-A from master. To reduce eventual merge conflicts later, I branched feature-B, which heavily overlaps and depends on A, from feature-A. A build of the feature-B branch s...

2 answers  ·  posted 2y ago by Monica Cellio‭  ·  edited 2y ago by hkotsubo‭

80%
+6 −0
Can I set a memory limit for the .NET Core garbage collector to collect objects more aggressively?

I have an ASP.NET Core 5 web application that provides functionality that involves file upload + rather large processing (memory consumption mainly). After each processing (with success or not) the...

2 answers  ·  posted 2y ago by Alexei‭  ·  edited 2y ago by Alexei‭

77%
+5 −0
How to deeply clone an array in Angular / TypeScript?

I have an array that I need to clone in Angular / Typescript. That is, any change done on an element from the cloned array should not affect the content of the initial array. How can I achieve thi...

2 answers  ·  posted 2y ago by Alexei‭  ·  last activity 2y ago by hkotsubo‭

77%
+5 −0
Using nested paths vs. flat ones for API resources

This is based on a code review discussion that I had with a colleague about the way I have designed the resources paths for an ASP.NET Core controller that is currently consumed only internally (by...

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

62%
+3 −1
java.lang.UnsupportedClassVersionError: when trying to connect to JDBC with JDK 14 in Eclipse

I'm trying to connect to a db file in my project but having some troubles. I'm using JDK 14 with ojdbc11 however I am still getting this when trying to connect: java.lang.UnsupportedClassVersionEr...

1 answer  ·  posted 2y ago by cuzzo‭  ·  edited 2y ago by Alexei‭

81%
+7 −0
Conditionally ignore files in git

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...

3 answers  ·  posted 2y ago by samcarter‭  ·  last activity 2y ago by Peter Taylor‭

50%
+1 −1
Tracking what users are searching in a content management system

I have a website with a search box. Running search queries in that search box creates frontend/dynamic search result webpages in which search results based on a search query can appear. Let's ass...

2 answers  ·  posted 2y ago by deleted user  ·  edited 2y ago by Alexei‭

77%
+5 −0
How to dynamically change panel of ItemsControl?

Let's say I have some collection of data. My goal is to provide different kind of view of ItemsControl depending on user`s preference. For simplicity, we can assume that user can select only betwe...

1 answer  ·  posted 2y ago by FoggyFinder‭  ·  edited 2y ago by FoggyFinder‭

71%
+3 −0
Transferring files from a legacy project to an existing one as varbinary

Our team is currently transferring all functionality (+ some changes) from small and very old project A (almost code freeze) to project B (actively developed). As part of the data migration, there ...

1 answer  ·  posted 2y ago by Alexei‭  ·  last activity 2y ago by Derek Elkins‭

84%
+9 −0
Behavior of Pointer Arithmetic on the Stack

Consider the following code: #include <stdio.h> int main() { int a = 5; int b; ++*(&b + 1); printf("%d\n", a); return 0; } The output is as expected: 6 ...

4 answers  ·  posted 2y ago by Josh Hyatt‭  ·  last activity 2y ago by Alexei‭

37%
+1 −3
Regarding the heap sort algorithm.

I get the concept of the heap sort algorithm and its like first you have a heap(ordered binary tree) then we have the Max heap which has the highest element value in the array at the top of the tre...

1 answer  ·  posted 2y ago by hamburgersarecool‭  ·  edited 2y ago by Alexei‭

50%
+1 −1
iframe tag is vertically scrollable although I would expect it to vertically stretch 100%

I have an iframe tag to which I didn't set height so it has a default height which is 150px (at least in Google Chrome). As a consequence, the iframe appears partially in such a way that constant ...

1 answer  ·  posted 2y ago by deleted user  ·  last activity 2y ago by deleted user

57%
+2 −1
width="100%" for an iframe, breaks responsiveness CSS directives

In a MediaWiki website I embed a PHP file containing a contact form via <iframe> with the following attribute pattern: width="100%" frameBorder="0" My problem I need the iframe to stre...

1 answer  ·  posted 2y ago by deleted user  ·  edited 2y ago by deleted user

75%
+4 −0
How to clear the contents of a file?

How to clear the contents of a file using C?

1 answer  ·  posted 2y ago by dumplings‭  ·  edited 2y ago by hkotsubo‭

28%
+0 −3
Data structure implementation with Linked lists.

Could someone explain this part of the coding for data structures & linked list? I actually got this code from a textbook but no matter how I read the textbook, I still don't get the concept &a...

1 answer  ·  posted 2y ago by hamburgersarecool‭  ·  last activity 2y ago by Alexei‭