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 #293663 |
Post edited: |
— | over 1 year ago |
| Edit | Post #293663 | Initial revision | — | over 1 year ago |
| Answer | — |
A: How to find the last line number of a section in a text file (particular format) > Assigning the variable end to ']' gets the line number of every closing bracket To solve this, just set the last line number only if the first line number is already set. Like this: ```python def readSection(sectionNumber): with open(file) as f: # before reading the file,... (more) |
— | over 1 year ago |
| Suggested Edit | Post #293522 |
Suggested edit: formatting / remove link as it can be seen as spam/inadequate self-promotion (more) |
helpful | over 1 year ago |
| Comment | Post #293422 |
@#53937 That's because Git only looks for the `EDITOR` variable if `core.editor` is not set. This is explained in the [documentation](https://git-scm.com/docs/git-var#Documentation/git-var.txt-GITEDITOR).
BTW, the docs says that another alternative is to set the `GIT_EDITOR` variable, which ov... (more) |
— | over 1 year ago |
| Comment | Post #293406 |
Not sure if it answers, but the [documentation](https://git-scm.com/docs/git-config#FILES) says:
> `$XDG_CONFIG_HOME/git/config`
> `~/.gitconfig`
>
> User-specific configuration files. When the `XDG_CONFIG_HOME` environment variable is not set or empty, `$HOME/.config/` is used as `$XDG_... (more) |
— | over 1 year ago |
| Edit | Post #286357 |
Post edited: |
— | over 1 year ago |
| Edit | Post #292140 |
Post edited: |
— | over 1 year ago |
| Comment | Post #292140 |
@#65961 I forgot about the `@{u}` syntax, as it's something I don't use very often. I've added that to the answer, thanks!
(more) |
— | over 1 year ago |
| Edit | Post #292140 |
Post edited: |
— | over 1 year ago |
| Edit | Post #292140 |
Post edited: |
— | almost 2 years ago |
| Edit | Post #293073 |
Post edited: |
— | almost 2 years ago |
| Edit | Post #293073 |
Post edited: |
— | almost 2 years ago |
| Edit | Post #293073 |
Post edited: |
— | almost 2 years ago |
| Edit | Post #293073 |
Post edited: |
— | almost 2 years ago |
| Edit | Post #293073 | Initial revision | — | almost 2 years 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 hi ``` ```sh echo hi ``` Belo... (more) |
— | almost 2 years 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. An... (more) |
— | almost 2 years 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) |
— | almost 2 years ago |
| Edit | Post #291746 |
Post edited: |
— | almost 2 years ago |
| Edit | Post #293025 |
Post edited: fix typo |
— | almost 2 years ago |
| Suggested Edit | Post #293025 |
Suggested edit: fix typo (more) |
helpful | almost 2 years 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:
```pyth... (more) |
— | almost 2 years ago |
| Edit | Post #292651 |
Post edited: Minor improvements in text / added tag for Jackson library |
— | almost 2 years ago |
| Suggested Edit | Post #292651 |
Suggested edit: Minor improvements in text / added tag for Jackson library (more) |
helpful | almost 2 years ago |
| Edit | Post #292652 | Initial revision | — | almost 2 years 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... (more) |
— | almost 2 years ago |
| Edit | Post #292548 |
Post edited: |
— | about 2 years ago |
| Edit | Post #292548 | Initial revision | — | about 2 years 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 creat... (more) |
— | about 2 years ago |
| Edit | Post #292315 |
Post edited: |
— | about 2 years ago |
| Edit | Post #292315 |
Post edited: |
— | about 2 years ago |
| Edit | Post #292315 | Initial revision | — | about 2 years 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,... (more) |
— | about 2 years 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 `H... (more) |
— | about 2 years 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... (more) |
— | about 2 years ago |
| Edit | Post #292140 |
Post edited: |
— | about 2 years ago |
| Edit | Post #292140 |
Post edited: |
— | about 2 years ago |
| Edit | Post #292140 | Initial revision | — | about 2 years ago |
| Answer | — |
A: After git fetch, how to fast forward my branch? tl;dr bash git merge origin/branchname Or `rebase` instead of `merge`. I'm also assuming your remote's name is "origin" (which usually is, for most cases). But of course this explanation is valid for any remotes you might have configured, and you just need to change its name in the co... (more) |
— | about 2 years ago |
| Edit | Post #291927 |
Post edited: NotImplementedError and NotImplemented are different things, changing title to avoid confusion (also, fixed formatting) |
— | about 2 years ago |
| Suggested Edit | Post #291927 |
Suggested edit: NotImplementedError and NotImplemented are different things, changing title to avoid confusion (also, fixed formatting) (more) |
helpful | about 2 years ago |
| Edit | Post #291746 |
Post edited: |
— | about 2 years ago |
| Comment | Post #291752 |
Related: "*[What is the purpose of `if __name__ == '__main__'`?](https://software.codidact.com/posts/284646)*" (more) |
— | over 2 years ago |
| Edit | Post #291744 |
Post edited: reworded title and body |
— | over 2 years ago |
| Edit | Post #291746 |
Post edited: |
— | over 2 years ago |
| Edit | Post #291746 |
Post edited: |
— | over 2 years ago |
| Edit | Post #291746 |
Post edited: |
— | over 2 years ago |
| Edit | Post #291746 |
Post edited: |
— | over 2 years ago |
| Edit | Post #291746 |
Post edited: |
— | over 2 years ago |
