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.
Search
How this recursive treewalker works? To understand what the code does, we need to first see what problem it's trying to solve and why it needs to be solved this way. Let's consider this HTML:...
Dirk's answer provides a sound solution to the literal problem you describe. Nevertheless, I would encourage you to take a step back and consider whether you really want to be editing Makefiles in ...
One simple possibility to eliminate a set of lines with precisely known content is to use the patch tool. The below code shows an example shell script. The script calls patch on the file to be mo...
Since your code performs a data base operation, the cost of this operation is likely dominating the execution time. The cost of both a return or an exception may be negligible compared to that ope...
Overflow checking for integral-type arithmetic operations is disabled by default and it can be explicitly enabled by using using checked function or the -checked compiler switch. Since I mainly de...
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. Savi...
What type of questions can I ask here? has gotten rather cluttered since we have added/removed a lot of things along the way. In particular, I think it is hard to get an idea of what's on-topic by ...
This is more or less equivalent to a long used testing technique that I've commonly heard referred to as gold filing. The benefit of it is that it is very cheap to do, and it can catch even minor c...
The context A reports related process is directly reading the production operational database once about two hours. This involves reading all the data from some 70 tables which takes a couple minu...
Code blocks inside comments are hightlighted only if I'm on the comment's thread page. If I view it on the post itself (after expanding the respective thread), it's not highlighted. Example: in ...
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: Is...
This sounds like useful content to me. I defer to the community on how best to achieve that; I'm here to offer another option from the platform side, in case it's useful. Codidact support article...
I can't speak for the designers' motivations, but here are some possible reasons: It's simple. Having one tempdb for everything is likely simpler to implement and simpler to configure. It works...
This is mostly an addition to r~~'s answer which I mostly agree with. This elaborates on the "non-idiomatic" part a bit. Modern Java code doesn't have a problem using Optional. Why? Because Option...
I'm not familiar with Drupal, but I would do this with CSS Grid. One possible example looks like this: <html> <head> <style> .menu-container { display: gr...
I have a map and a new item to add to the map and a list of keys I want to attach the new item to: => m1 {:a 1 :b 2} => itm 3 => ks [:c :d :e] => m2 {:a 1 :b 2 :c 3 :d 3 :e 3} ...
The webpage example.com has an edit webpage (from which one can edit example.com itself). example.com/index.php?title=עמוד_ראשי&action=edit I want that after I click ALT+Shift+E, I would im...
The first item your selector returns is the top level arrow. hasAttribute just tells us if the attribute is present, not what the value is. So basically your condition is returning true for all ele...
Our team deals with a legacy application that relies on a rather old deployment process and infrastructure: we deploy the application on an environment very similar to the production called Clon...
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.TEXT_NODE) { e.nodeValue =...
If I am not mistaken any DOM "tree" node is actually a "branch", which would be an HTML element or perhaps a CSS pseudo-element, of course. If that's true what are the different node types and esp...
To extend a bit on some points already mentioned: Regarding where to add checks on a case by case basis: If you have a static code analysis tool that can give you information about areas where pro...
I have a project Anonymised.Theme which contains XAML resource dictionaries for a theme. This is used by about a dozen applications which simply include it by merging <ResourceDictionary Source...
The problem is that the fill function is filling the array with references to the same empty array[1], and therefore modifying that array will affect every entry because all of them are actually th...
Is this a good approach? How can I improve my algorithm? Your code is correct and simple. That is good, and it may be all that is needed. You have received some responses that indicate that ...