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

Type On... Excerpt Status Date
Edit Post #286317 Post edited:
declare variable rather than polluting window
about 2 years ago
Edit Post #286317 Post edited:
about 2 years ago
Edit Post #286317 Initial revision about 2 years ago
Answer A: Delete all occurrences of a character in a webpage with vanilla JavaScript
With the help of a little recursion, it's straightforward to go through all text nodes and replace their contents: ``` function replaceIn(e) { if (e.nodeType == Node.TEXTNODE) { e.nodeValue = e.nodeValue.replaceAll("a", ""); } else { for (const child of e.childNodes) { repl...
(more)
about 2 years ago
Comment Post #286151 In this case, the image was actually helpful because it revealed that OP was invoking the compiler by hand rather than using the built in eclipse compiler.
(more)
about 2 years ago
Edit Post #286155 Initial revision about 2 years ago
Answer A: Java cannot find class within same package
eclipse has a built-in compiler. When developping in eclipse (or any other Java IDE), you can run from eclipse, you can package as a JAR file from eclipse, and even run a full fledged maven / gradle build from eclipse. There is no need to ever run javac by hand when you have a Java IDE. One reason...
(more)
about 2 years ago
Edit Post #286038 Initial revision about 2 years ago
Answer A: Mocking methods with arguments
You mean, aside from giving the team that made `B` a stern talking to? ;-) You could introduce another layer of indirection, and mock that. For instance like this: interface MockFriendlyB { public void add(T arg); } class UnmockedB implements MockFriendlyB {...
(more)
about 2 years ago
Comment Post #286019 Well, I'd prefer: ``` assertEquals(13, fun(42).getY()); assertEquals(10, fun(43).getY()); assertEquals(16, fun(44).getY()); assertEquals(133, fun(47).getZ()); assertEquals(1, fun(3).getZ()); assertEquals(16, fun(2).getZ()); ``` which makes it way more obvious that the blocks invoke dif...
(more)
about 2 years ago
Edit Post #286019 Initial revision about 2 years ago
Answer A: How to create an object, call one of it's methods and pass it as an argument as a oneliner?
It seems to me that you are hobbling yourself by making design constraints more absolute than they need to be. For instance: You don't want to change the code under test, not even a tiny little bit. You don't want to introduce a helper function, because helper functions clutter the code (is tha...
(more)
about 2 years ago
Edit Post #286013 Initial revision about 2 years ago
Answer A: How to unittest method that involves contacting remote servers?
> I'm actually mainly interested in testing foo() Ok, so let's do that. > I could make it public, but I really don't want to do that just so that the test class can access it Java has 4 different access modes: `private`, default access, `protected`, and `public`. The typical solution is to u...
(more)
about 2 years ago
Edit Post #285942 Post edited:
about 2 years ago
Edit Post #285942 Initial revision about 2 years ago
Answer A: Why is my last input box not centering (class: powerwall-battery-input)?
To investigate such problems, open the developer tools of your browser, and use the inspect this element feature to inspect the bounding boxes of the various elements. in Chrome: press F12 to open dev tools click the icon at the very top left of the dev tools, which has a tooltip that reads ...
(more)
about 2 years ago
Edit Post #285937 Initial revision about 2 years ago
Answer A: Best practices in setting up a development & production environments
As a baseline, here's what we did in my last company: For tests, we used an in-memory database, whose schema was initialized by our object-relational mapper, with initial data loaded either from an SQL-Script, or code using the O/R-Mapper. Before deploying, we would generate SQL-Scripts for mig...
(more)
about 2 years ago
Comment Post #285916 I guessed that this was the reason you mentioned onbeforeunload :-) Just to be perfectly clear, the problem I see is that network I/O in onbeforeunload can not be relied on to work, because the application will likely unload before the server response arrives, making it impossible to react to a failu...
(more)
about 2 years ago
Comment Post #285918 In the Schwartzian transform, I'd prefer using an object to hold the tuple rather than arrays for better readability (i.e. one can then write `sort((a,b) => a.sortKey - b.sortKey)` rather than using "magic index 1". Also, your conclusion makes it sound as if execution speed were the only concern. It ...
(more)
about 2 years ago
Comment Post #285908 That last question might be specific enough to be answered in a reasonable amount of text (this answer is gonna be: it depends, and would have to enumerate the various things that usually factor into this decision). The question you originally posted is bit too broad IMHO. You may therefore want to e...
(more)
about 2 years ago
Edit Post #285916 Initial revision about 2 years ago
Answer A: Detecting if a user has stopped interacting with a web view for a certain time
The weakness of responding to idle state is that the app might be closed before the idle state is reached, and that a closing app might no longer be able to communicate with the outside world. Saving to local storage rather than remote systems may therefore be more robust and cheaper, allowing more f...
(more)
about 2 years ago
Comment Post #285908 Well, the difference is that the databases will be separate databases. Can you clarify what you mean with "set up"? Installing the database software (off topic here), migrating schemas, configuring a different database connection in test and production, or something else?
(more)
about 2 years ago
Comment Post #285902 Do you know the environment well enough to say that with certainty? For instance, people are never interrupted by a ringing phone and have to handle that before continuing? Or the arrival of an urgent email? Or some coworker asking for help through chat? Obviously, I don't know the environment you ar...
(more)
about 2 years ago
Edit Post #285902 Initial revision about 2 years ago
Answer A: How to prevent token from being refreshed
It's worth noting that logging out a user goes way beyond not fetching a token, because your UI needs to inform the user he is about to be (or has been) logged out. And if your UI closes or locks itself, it probably doesn't matter if it has a current token. So I'd handle this fully in the UI; for ...
(more)
about 2 years ago
Comment Post #285875 +1 to Lundin's comments.
(more)
about 2 years ago
Comment Post #285883 What problem are you trying to solve with this? Why is it a problem if a token is updated while the user is away from his keyboard?
(more)
about 2 years ago
Comment Post #285844 Why do you need to detect whether a user is idle?
(more)
about 2 years ago
Edit Post #285523 Initial revision over 2 years ago
Answer A: Can I set a memory limit for the .NET Core garbage collector to collect objects more aggressively?
Generally speaking, the frequency of garbage collection is a space / time tradeoff: collection effort live object size GC overhead ----------------- = ---------------- memory freed dead object size In defaulting to collect garbage only whe...
(more)
over 2 years ago
Comment Post #285489 I see. Knowing that you are concerned about peak memory use, rather than, say, the length of garbage collector pauses helps writing targeted answers.
(more)
over 2 years ago
Comment Post #285491 On .NET Core, the AppDomain implementation is limited by design and does not provide isolation, unloading, or security boundaries
(more)
over 2 years ago
Comment Post #285489 Does this memory use cause an actual problem for you? Most modern servers comes with hundreds of GB of memory, so you should have memory to spare?
(more)
over 2 years ago
Edit Post #285504 Post edited:
over 2 years ago
Edit Post #285504 Initial revision over 2 years ago
Answer A: Using nested paths vs. flat ones for API resources
Actually, while REST mandates a great many things, it does not constrain the structure of URLs. To wit: The paper that coined the term "REST" describes resource identifiers as black boxes, and makes no reference to their internal structure. In fact, if we take a strict reading of the REST architectur...
(more)
over 2 years ago
Edit Post #285328 Post edited:
over 2 years ago
Edit Post #285328 Post edited:
over 2 years ago
Edit Post #285328 Initial revision over 2 years ago
Answer A: Regarding the heap sort algorithm.
As you know, a max heap is a binary tree such that each parent is greater than its children. The most compact and efficient way to represent such a tree is an array, where each index corresponds to a node in the tree, numbered from the root, level by level, from left to right, as shown in the foll...
(more)
over 2 years ago
Edit Post #284988 Post edited:
over 2 years ago
Edit Post #284988 Initial revision over 2 years ago
Answer A: Questions easily answered by studying a beginner-level book
How to ask says: > Do some research > > Before asking a new question, first take a look around. Has your question been asked before here on Software Development Codidact? You can do a search for keywords related to your question, or take to your favorite search engine to see if your answer is a...
(more)
over 2 years ago
Edit Post #284616 Initial revision over 2 years ago
Answer A: Specify framework / library version in the answer
We already have such a text field. In fact, we have several: The big one we type our answer into, and the small one we type our comments into. And this approach even allows to specifically express which part of an answer is version dependent, or to express disagreement about the designation. The o...
(more)
over 2 years ago
Comment Post #284552 Then I agree with you :-) The example I was making was about somebody not consulting Wikipedia, which I'd expect every reasonable person to know.
(more)
over 2 years ago
Comment Post #284552 Obvious to whom? It may be obvious to us, and to "every reasonable person", but not to them.
(more)
over 2 years ago