Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »

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‭

89 posts
81%
+7 −0
Q&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: ```shell # echo hi ``` ```console # echo hi ``` Is rendered as: # echo hi # echo hi While this: ```bash # echo hi ``` ```sh #...

posted 12d ago by hkotsubo‭  ·  edited 9d ago by hkotsubo‭

Answer
81%
+7 −0
Q&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: git push <remote-name> :<branch-name> N...

posted 10mo ago by hkotsubo‭

Answer
81%
+7 −0
Q&A SQL timestamp for daylight saving day when clock goes 1 hour back.

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...

posted 3y ago by hkotsubo‭  ·  edited 3y ago by hkotsubo‭

Answer
81%
+7 −0
Q&A Why is this client code getting the wrong date for a few hours a day?

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...

posted 3y ago by hkotsubo‭  ·  edited 3y ago by hkotsubo‭

Answer
81%
+7 −0
Q&A Accessibility standard/s for multilined <input type="text"> fields

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...

posted 3y ago by hkotsubo‭  ·  edited 3y ago by hkotsubo‭

Answer
81%
+7 −0
Q&A How to verify if a year is leap in Java?

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?

1 answer  ·  posted 2y ago by hkotsubo‭  ·  last activity 2y ago by hkotsubo‭

Question java date
81%
+7 −0
Q&A When using the compare function in Array.prototype.sort, how to avoid an element to be processed more than once?

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...

posted 3y ago by hkotsubo‭  ·  edited 3y ago by hkotsubo‭

Answer
80%
+6 −0
Q&A Change font-family with JavaScript

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 ...

posted 3y ago by hkotsubo‭  ·  edited 3y ago by hkotsubo‭

Answer
80%
+6 −0
Q&A After git fetch, how to fast forward my branch?

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 ...

posted 5mo ago by hkotsubo‭  ·  edited 1d ago by hkotsubo‭

Answer
80%
+6 −0
Q&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 ...

posted 6mo ago by hkotsubo‭  ·  edited 6mo ago by hkotsubo‭

Answer
80%
+6 −0
Q&A Why is git merge from rather than to?

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 => ...

posted 1y ago by hkotsubo‭  ·  edited 1y ago by hkotsubo‭

Answer
80%
+6 −0
Q&A Is it OK to use scanf with a void pointer?

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...

2 answers  ·  posted 3y ago by hkotsubo‭  ·  last activity 3y ago by Lundin‭

Question c pointers scanf
80%
+6 −0
Q&A When using the compare function in Array.prototype.sort, how to avoid an element to be processed more than once?

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...

2 answers  ·  posted 3y ago by hkotsubo‭  ·  last activity 1y ago by matthewsnyder‭

80%
+6 −0
Q&A Why object-oriented instead of class-oriented?

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...

posted 3y ago by hkotsubo‭  ·  edited 3y ago by hkotsubo‭

Answer
80%
+6 −0
Q&A How can I emulate regular expression's branch reset in Java?

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,...

posted 4y ago by hkotsubo‭  ·  edited 4y ago by hkotsubo‭

Answer
80%
+6 −0
Q&A Separate digits of a number in groups with different sizes

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...

posted 3y ago by hkotsubo‭  ·  edited 3y ago by hkotsubo‭

Answer
80%
+6 −0
Q&A How to parse a date with more than 3 decimal digits in the fractions of second?

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...

posted 3y ago by hkotsubo‭  ·  edited 3y ago by hkotsubo‭

Answer
80%
+6 −0
Q&A How to parse a date with more than 3 decimal digits in the fractions of second?

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...

1 answer  ·  posted 3y ago by hkotsubo‭  ·  last activity 3y ago by hkotsubo‭

80%
+6 −0
Q&A How to match standard email addresses with regex?

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...

posted 4y ago by hkotsubo‭  ·  edited 4y ago by hkotsubo‭

Answer
80%
+6 −0
Q&A Function call; `this` gets bound to unexpected value

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())....

posted 4y ago by hkotsubo‭  ·  edited 4y ago by Alexei‭

Answer
80%
+6 −0
Meta "Review suggested edit" page doesn't display Markdown source correctly

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...

1 answer  ·  posted 4y ago by hkotsubo‭  ·  edited 2y ago by Monica Cellio‭

80%
+6 −0
Meta Can regular users add tag wikis? And what are the guidelines for creating them?

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...

1 answer  ·  posted 4y ago by hkotsubo‭  ·  last activity 4y ago by Monica Cellio‭

77%
+5 −0
Q&A Why is the switch statement not executing the correct case blocks?

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: ...

posted 3y ago by hkotsubo‭  ·  edited 3y ago by hkotsubo‭

Answer
77%
+5 −0
Q&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 getSt...

posted 10mo ago by hkotsubo‭  ·  edited 10mo ago by hkotsubo‭

Answer
77%
+5 −0
Q&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 w...

posted 6mo ago by hkotsubo‭  ·  edited 22d ago by hkotsubo‭

Answer