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 hkotsubo
void (*ptr)() defines a function pointer. It says that ptr is a pointer to a function. But that function must have a void return type, and take an arbitrary number of parameters (that's what the em...
At the documetation you linked, if you click on "which will clear the document", it'll go to the documentation for document.open, and that page says in the beginning: All existing nodes are remo...
How does storing replaced strings in the node variable makes a change in the text appearing to the end user? In your case, you're changing the textContent property. When accessed, it returns t...
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 ...
To do that, you could change the selector from body to *, as the other answer said. By selecting only body, it won't change child elements that has defined a more specific rule, and that's why you ...
Before we start, I'd like to be a little bit pedantic regarding 00002451018 being a number. When we talk about numeric types/values, the zeroes at the beginning are irrelevant: 2, 02 and 000002 al...
It depends. Do you want to have autocomplete on the shell the program runs in, or do you want the program to intercept the TAB key and do the autocomplete by itself? Shell autocomplete If you'r...
It makes difference if the script is being imported. Let's suppose I have a file my_file.py: # my_file.py def some_function(): print('do some stuff') print('calling function:') some_fun...
First, we need to understand what a Git repository actually is. For that, refer to this article: it explains that a Git repository is actually a DAG (Directed Acyclic Graph). I'm not going into the...
In Git documentation, there are lots of references to the term "HEAD". But what exactly is it? Some places refer to it as "a pointer to the current branch". So it's a branch? What is it used for?
tl;dr According to the documentation, innerHTML property "gets or sets the HTML or XML markup contained within the element". Basically, "that's all", but let's see it in more detail. It makes...
It depends. Regarding "grouping functions/methods": as a general rule, you should group things that make sense to be together. Yes, it's a very broad and generic rule, and somewhat subjective. How...
tl;dr The purpose of addEventListener is to define what happens when an event is triggered at some element. But it also allows us to implement event delegation, due to the bubbling/propagation beh...
The problem is the fallthrough behaviour of case statements. Basically, once a case's condition is met, all the others after that are also executed. Example: int x = 2; switch (x) { case 1: ...
Is it better to use static method? I don't like to think of static (or any other language feature/mechanism) in terms of bad/worse and good/better (although I do that too, I constantly try to ...
As you're using userscripts, I'm assuming this code is supposed to run in a browser. Hence, you could download the scripts and add its contents to the page's DOM (by using a script element). For t...
The basic ideia is to create an input with a "fake" placeholder, and a span that will serve as the actual placeholder text. Then you group both inside a label, like this: <label> <inpu...
You could use fgets to read from STDIN. And to print the message, just use the short tag (<?= whatever, which is a shorthand to <?php echo whatever; ?>): <?='Hello, '.fgets(STDIN).'!'...
I've seen that recently two requests to add syntax highlight to some languages were deferred (this and this). According to the status-deferred tag description: "the requested feature will not be i...
The solution depends on the Java version you're using. First, let's see the solution for earlier versions, that doesn't use SimpleDateFormat. Then we'll see why the problem happens and alternatives...
I'm using SimpleDateFormat to parse a string containing a date/time, but the result has a different date, hour, minute, second and millisecond: SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM...
TL;DR To count the number of li items, just do: console.log(document.querySelectorAll('ul.example > li').length); That's all, no need to complicate with filter.call (but I'll explain that t...
According to this answer, Codidact uses highlight.js for syntax highlight, and "support whatever languages are enabled by default in that package". And according to this table (in highlight.js Git...
what ways can I get a string's length in D? There are many different ways, and that will depend on the content of the strings, their types, and how you define the terms "character" and "length...
Assignment (=) = is the assignment operator: it assigns a value to "something". One important detail is that an assignment expression not only assigns a value, but it also returns it. This allows...
- ← Previous
- 1
- 2
- 3
- 4
- Next →