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 #292140 |
Post edited: |
— | 1 day ago |
Edit | Post #293073 |
Post edited: |
— | 9 days ago |
Edit | Post #293073 |
Post edited: |
— | 11 days ago |
Edit | Post #293073 |
Post edited: |
— | 12 days ago |
Edit | Post #293073 |
Post edited: |
— | 12 days ago |
Edit | Post #293073 | Initial revision | — | 12 days ago |
Answer | — |
A: how do I get markdown to render # as a shell prompt and not a comment? Instead of `sh`, use `shell` or `console`. So this: markdown ```shell echo hi ``` ```console echo hi ``` Is rendered as: ```shell echo hi ``` ```console echo hi ``` While this: markdown ```bash echo hi ``` ```sh echo hi ``` Is rendered as: ```bash echo ... (more) |
— | 12 days ago |
Comment | Post #293029 |
I don't see how this can have a significant impact on performance. Git is incredibly fast and a simple `git log` with some filters shouldn't take so long to run. Unless you're dealing with a really huge repository and runs `git blame` millions of times a day, which I don't think it's the case. Anyway... (more) |
— | 21 days ago |
Comment | Post #293029 |
As you can't know the hash before commiting, I don't see a way to keep the ignore file updated within a single commit.
Instead of keeping this file, you could run something like this:
```bash
git blame $(for hash in $(git log --format="%H"); do echo "--ignore-rev" $hash; done) -- file
```
... (more) |
— | 22 days ago |
Edit | Post #291746 |
Post edited: |
— | 22 days ago |
Edit | Post #293025 |
Post edited: fix typo |
— | 22 days ago |
Suggested Edit | Post #293025 |
Suggested edit: fix typo (more) |
helpful | 22 days ago |
Comment | Post #292972 |
`if any(cheese == kind for kind in ("cheddar", "edam", "havarti"))` is a bit overkill. For this specific case, you could simply do `if cheese in ("cheddar", "edam", "havarti")`.
Using `any` would be suitable for non-exact matches, such as looking for a phrase that contains the word:
```python
... (more) |
— | about 1 month ago |
Edit | Post #292651 |
Post edited: Minor improvements in text / added tag for Jackson library |
— | 3 months ago |
Suggested Edit | Post #292651 |
Suggested edit: Minor improvements in text / added tag for Jackson library (more) |
helpful | 3 months ago |
Edit | Post #292652 | Initial revision | — | 3 months 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) |
— | 3 months ago |
Edit | Post #292548 |
Post edited: |
— | 3 months ago |
Edit | Post #292548 | Initial revision | — | 3 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) |
— | 3 months ago |
Edit | Post #292315 |
Post edited: |
— | 4 months ago |
Edit | Post #292315 |
Post edited: |
— | 4 months ago |
Edit | Post #292315 | Initial revision | — | 4 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) |
— | 4 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) |
— | 4 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) |
— | 4 months ago |
Edit | Post #292140 |
Post edited: |
— | 5 months ago |
Edit | Post #292140 |
Post edited: |
— | 5 months ago |
Edit | Post #292140 | Initial revision | — | 5 months ago |
Answer | — |
A: After git fetch, how to fast forward my branch? tl;dr [^1] 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... (more) |
— | 5 months ago |
Edit | Post #291927 |
Post edited: NotImplementedError and NotImplemented are different things, changing title to avoid confusion (also, fixed formatting) |
— | 6 months ago |
Suggested Edit | Post #291927 |
Suggested edit: NotImplementedError and NotImplemented are different things, changing title to avoid confusion (also, fixed formatting) (more) |
helpful | 6 months ago |
Edit | Post #291746 |
Post edited: |
— | 6 months ago |
Comment | Post #291752 |
Related: "*[What is the purpose of `if __name__ == '__main__'`?](https://software.codidact.com/posts/284646)*" (more) |
— | 6 months ago |
Edit | Post #291744 |
Post edited: reworded title and body |
— | 6 months ago |
Edit | Post #291746 |
Post edited: |
— | 6 months ago |
Edit | Post #291746 |
Post edited: |
— | 6 months ago |
Edit | Post #291746 |
Post edited: |
— | 6 months ago |
Edit | Post #291746 |
Post edited: |
— | 6 months ago |
Edit | Post #291746 |
Post edited: |
— | 6 months ago |
Suggested Edit | Post #291744 |
Suggested edit: reworded title and body (more) |
helpful | 6 months ago |
Edit | Post #291746 | Initial revision | — | 6 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) |
— | 6 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) |
— | 6 months ago |
Edit | Post #291667 |
Post edited: added relevant tags |
— | 6 months ago |
Suggested Edit | Post #291667 |
Suggested edit: added relevant tags (more) |
helpful | 6 months ago |
Edit | Post #291672 |
Post edited: |
— | 6 months ago |
Edit | Post #291672 | Initial revision | — | 6 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) |
— | 6 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) |
— | 7 months ago |