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 hkotsuboâ€
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Edit | Post #292651 |
Post edited: Minor improvements in text / added tag for Jackson library |
— | about 1 month ago |
Suggested Edit | Post #292651 |
Suggested edit: Minor improvements in text / added tag for Jackson library (more) |
helpful | about 1 month ago |
Edit | Post #292652 | Initial revision | — | about 1 month ago |
Answer | — |
A: Json deserialization of enum, forbid int One solution is to create a method in the `enum` that takes a `String` and converts it to the correspondent value. Then we annotate this method with `@JsonCreator`: ```java import com.fasterxml.jackson.annotation.JsonCreator; enum Bar { X, Y; @JsonCreator public static Bar... (more) |
— | about 1 month ago |
Edit | Post #292548 |
Post edited: |
— | about 2 months ago |
Edit | Post #292548 | Initial revision | — | about 2 months ago |
Answer | — |
A: Map<?, Optional<T>> to Map<?, T> Based on the code snippet in the question (which uses `collect` etc), I'm assuming you want to use streams. I'm also infering that "empty values" means those values for which `Optional.isEmpty()` returns `false` (and consequently `Optional.isPresent()` returns `true`). In that case, just create a ... (more) |
— | about 2 months ago |
Edit | Post #292315 |
Post edited: |
— | 2 months ago |
Edit | Post #292315 |
Post edited: |
— | 2 months ago |
Edit | Post #292315 | Initial revision | — | 2 months ago |
Answer | — |
A: How can I git checkout the previous HEAD? There are many ways to get the previous states of `HEAD`, and which one to use will depend on each situation. Git keeps reference logs (also called "reflogs"), that "record when the tips of branches and other references were updated in the local repository". To provide a simple example, let... (more) |
— | 2 months ago |
Comment | Post #292287 |
And the [same documentation](https://git-scm.com/docs/revisions#Documentation/revisions.txt-emltrefnamegtltngtemegemmaster1em) describes a way to know where `HEAD` previously was.
Basically, `HEAD@{n}` (with `n` being some number) specifies the n-th prior value of `HEAD` (and you can change `HEAD`... (more) |
— | 2 months ago |
Comment | Post #292287 |
@#53937 That's strange, it should work. Check the [release notes for version 1.6.2](https://github.com/git/git/blob/master/Documentation/RelNotes/1.6.2.txt):
> *"git checkout -" is a shorthand for "git checkout @{-1}"*
And the [documentation](https://git-scm.com/docs/revisions#Documentation/rev... (more) |
— | 2 months ago |
Edit | Post #292140 |
Post edited: |
— | 3 months ago |
Edit | Post #292140 |
Post edited: |
— | 3 months ago |
Edit | Post #292140 | Initial revision | — | 3 months ago |
Answer | — |
A: After git fetch, how to fast forward my branch? tl;dr bash git merge origin/branchname Or `rebase` instead of `merge` Long answer When your local repository has one or more remotes configured, there are special branches that the documentation calls "remote-tracking branches". Basically, those branches serve "as bookmarks, to remi... (more) |
— | 3 months ago |
Edit | Post #291927 |
Post edited: NotImplementedError and NotImplemented are different things, changing title to avoid confusion (also, fixed formatting) |
— | 4 months ago |
Suggested Edit | Post #291927 |
Suggested edit: NotImplementedError and NotImplemented are different things, changing title to avoid confusion (also, fixed formatting) (more) |
helpful | 4 months ago |
Edit | Post #291746 |
Post edited: |
— | 5 months ago |
Comment | Post #291752 |
Related: "*[What is the purpose of `if __name__ == '__main__'`?](https://software.codidact.com/posts/284646)*" (more) |
— | 5 months ago |
Edit | Post #291744 |
Post edited: reworded title and body |
— | 5 months ago |
Edit | Post #291746 |
Post edited: |
— | 5 months ago |
Edit | Post #291746 |
Post edited: |
— | 5 months ago |
Edit | Post #291746 |
Post edited: |
— | 5 months ago |
Edit | Post #291746 |
Post edited: |
— | 5 months ago |
Edit | Post #291746 |
Post edited: |
— | 5 months ago |
Suggested Edit | Post #291744 |
Suggested edit: reworded title and body (more) |
helpful | 5 months ago |
Edit | Post #291746 | Initial revision | — | 5 months ago |
Answer | — |
A: Regex to get text outside brackets > 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 we can't get all the groups in a single step. You said that the strings can have many pairs of brackets... (more) |
— | 5 months ago |
Comment | Post #291704 |
Out of curiosity, do you know why they chose this character? I'm asking because many languages use `_` as a digit separator, so I'm wondering why they opted for a different one. (more) |
— | 5 months ago |
Edit | Post #291667 |
Post edited: added relevant tags |
— | 5 months ago |
Suggested Edit | Post #291667 |
Suggested edit: added relevant tags (more) |
helpful | 5 months ago |
Edit | Post #291672 |
Post edited: |
— | 5 months ago |
Edit | Post #291672 | Initial revision | — | 5 months ago |
Answer | — |
A: How is this code "dividing" by a string? 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 another, such as `x = 'a' / 'b'`, you'll get an error. Therefore, in your code, `HOMEDIRECTORY` is c... (more) |
— | 5 months ago |
Comment | Post #291667 |
Classes can overload operators. One example is the [`Path` class from `pathlib` module](https://docs.python.org/3/library/pathlib.html#operators), which overloads the division operator `/`, so `path / anotherpath_or_string` creates another `Path` object:
```python
from pathlib import Path
# pa... (more) |
— | 5 months ago |
Edit | Post #291492 |
Post edited: |
— | 6 months ago |
Edit | Post #291492 | Initial revision | — | 6 months ago |
Answer | — |
A: In javascript is there really a good reason to never check for boolean true || false such as if(var){}else{}? As mentioned in another answer, when you have code such as `if (someVar)`, you're subject to truthiness. To be more precise, this code will run under the rules of Boolean coercion. In JavaScript, when you have `if (someVar)`, the variable `someVar` can be basically "anything" - even a boolean valu... (more) |
— | 6 months ago |
Edit | Post #283669 |
Post edited: |
— | 8 months ago |
Edit | Post #291075 |
Post edited: |
— | 8 months ago |
Edit | Post #291075 |
Post edited: |
— | 8 months ago |
Edit | Post #291075 | Initial revision | — | 8 months ago |
Answer | — |
A: How to group a flat list of attributes into a nested lists? You could create a dictionary to map each attribute to its respective list of items. Then you get the dictionary values to create the final list. Something like this: ```python import re pattern = re.compile(r'attr\d+') just to simulate a "file" file = [ 'attr1 apple 1', 'attr1 banana 2',... (more) |
— | 8 months ago |
Edit | Post #290969 |
Post edited: |
— | 8 months ago |
Edit | Post #290969 | Initial revision | — | 8 months ago |
Answer | — |
A: How to log first n lines of a stack trace in Java? 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 `getStackTrace()` method. For the current thread, you can use `Thread.currentThread().getStackTrace()`,... (more) |
— | 8 months ago |
Edit | Post #290953 | Initial revision | — | 8 months ago |
Answer | — |
A: How to delete a remote branch in git? The other answer already provides the more straighforward solution (`push` with `--delete` option). But there's an older syntax that also works: ```bash git push : ``` Note that there's the `:` character before the branch name. Example: ```bash git push origin :my-branch ``` This ... (more) |
— | 8 months ago |