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
Instead of sh, use shell or console. So this: ```shell # echo hi ``` ```console # echo hi ``` Is rendered as: # echo hi # echo hi While this: ```bash # echo hi ``` ```sh #...
The other answer already provides the more straighforward solution (push with --delete option). But there's an older syntax that also works: git push <remote-name> :<branch-name> N...
This behaviour is documented here: "... an ambiguous timestamp that could fall on either side of a jump-back transition is assigned the UTC offset that prevailed just after the transition." S...
First of all, we need to understand what a JavaScript Date actually is. And surprisingly, it's not exactly a date (at least not in terms of having unique values for day, month, year, hour, minute a...
The standard for multi-line text input is to use a textarea. Don't use input type="text", it won't work. I'm not sure why you don't want to use a textarea, but after reading this answer, I hope you...
How to verify if a year is leap? Given a numeric value (such as 2023) or some object that represents a date (such as Date, Calendar, LocalDate, etc), how can I do it?
PS: for small arrays and/or if the function is fast and doesn't cause performance bottlenecks, none of the below is really necessary (see the analysis in the end). That said, let's see how to sol...
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 ...
tl;dr [1] git merge origin/branch_name Or rebase instead of merge Long answer When your local repository has one or more remotes configured, there are special branches that the documentation ...
As already said by another answer, you're not "dividing a string by another string". I'd just like to complement by providing more details about how this works. If you try to divide a string by ...
I can't speak for the people who designed it, but I guess it was made this way because you can merge multiple branches all at once. Let's say I've created multiple branches: C---D => ...
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...
When using the Array.prototype.sort method, we can pass a compare function as argument. Then, this function can be used to process array's elements, so the comparison is made using some custom crit...
Why object-oriented instead of class-oriented? tl;dr Because you can "do OOP" without classes. Long answer A class is one possible way to implement object oriented programming. But it's n...
I've kinda found a very limited, not so elegant, far from ideal "solution", using replaceAll: String regex = "(?:([aeiou]+)[0-9]+|([123]+)[a-z]+)\\W+"; System.out.println("ae123.".replaceAll(regex,...
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...
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...
Matching a valid email address can be as complicated as you want it to be. If you want to be compliant with RFC 5322, the regex will be a monster (see below). But if you want a subset of it, with...
This MDN link might help to explain that: When a function is called as a method of an object, its this is set to the object the method is called on. Which is your first example (calling obj.a())....
I recently suggested an edit to an answer. Basically, I formatted some code, adding code fences around it: But at the "Review suggested edit" page, the differences are not clearly displayed. I...
Checking the list of tags, I noticed that all of the tag wikis are empty, like this: I also noticed that I can't edit those info. Will it be possible for regular users to add tag wikis?1 And if th...
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: ...
It's not clear where this stack trace comes from (either from an exception or the current thread), but it doesn't matter, the way to do it is the same. Both Exception's and Thread's have the getSt...
Perhaps regex is not the best solution. Although it's possible, the expression will be so complicated that it won't be worth the trouble, IMO. But if you insist on using regex... I'm afraid w...
- ← Previous
- 1
- 2
- 3
- 4
- Next →