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
77%
+5 −0
Q&A How to use grep to print only specific word from a string

I wouldn't use grep. As the other answers already said, it's not the right tool for this job. Considering your specific case (fields separated by /), basename is the most straighforward way, as st...

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

Answer
77%
+5 −0
Code Reviews Detecting balanced parentheses in Python

Instead of replacing the brackets, you could do just one loop, and keep a stack with the opening brackets. Every time you find a closing bracket, check if it corresponds to the stack top: if it's n...

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

Answer
77%
+5 −0
Q&A Recursion without a procedure ("function") in JavaScript

Yes, it's possible. In a more general way, every recursive algorithm can be converted to an iterative one (and vice-versa). You just need to use a stack. Internally, a recursive function will use...

posted 2y ago by hkotsubo‭

Answer
77%
+5 −0
Q&A Does a for...of loop must contain a variable without assignment sign, and why?

Does a for...of loop must contain a variable without assignment sign (=) Yes. and why? Because that's the syntax defined by the language specification. The people who defined it decided ...

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

Answer
77%
+5 −0
Q&A What are the types of DOM nodes?

any DOM "tree" node is actually a "branch" Not exactly. Document Object Model and Nodes According to the MDN documentation, the DOM (Document Object Model) is "the data representation of the...

posted 2y ago by hkotsubo‭

Answer
77%
+5 −0
Q&A Understanding createTreeWalker method in the context of replacing strings (or parts of them)

How does storing replaced strings in the node variable makes a change in the text appearing to the end user? In your case, you're changing the textContent property. When accessed, it returns t...

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

Answer
75%
+4 −0
Meta Code block in comments is highlighted only when viewed in the thread's link

Code blocks inside comments are hightlighted only if I'm on the comment's thread page. If I view it on the post itself (after expanding the respective thread), it's not highlighted. Example: in ...

0 answers  ·  posted 3y ago by hkotsubo‭  ·  edited 2y ago by Monica Cellio‭

75%
+4 −0
Q&A How to make this treewalker code having a regular for loop or a forEach() method?

I personally think its syntax is confusing. Well, it's just a matter of getting used to it, I guess :-) Anyway, this code is just looping through all childNodes and in each iteration it cal...

posted 2y ago by hkotsubo‭

Answer
75%
+4 −0
Q&A How this recursive treewalker works?

How this recursive treewalker works? To understand what the code does, we need to first see what problem it's trying to solve and why it needs to be solved this way. Let's consider this HTML:...

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

Answer
75%
+4 −0
Q&A document.open() and the DOM tree of the loaded (closed) browser window on which it works

At the documetation you linked, if you click on "which will clear the document", it'll go to the documentation for document.open, and that page says in the beginning: All existing nodes are remo...

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

Answer
75%
+4 −0
Q&A How to make the text box such that its placeholder goes up and arranges itself in the centre of the border upon clicking?

The basic ideia is to create an input with a "fake" placeholder, and a span that will serve as the actual placeholder text. Then you group both inside a label, like this: <label> <inpu...

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

Answer
75%
+4 −0
Q&A Function.prototype.call()

TL;DR To count the number of li items, just do: console.log(document.querySelectorAll('ul.example > li').length); That's all, no need to complicate with filter.call (but I'll explain that t...

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

Answer
75%
+4 −0
Q&A What's the difference between =, == and === operators in JavaScript?

Assignment (=) = is the assignment operator: it assigns a value to "something". One important detail is that an assignment expression not only assigns a value, but it also returns it. This allows...

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

Answer
75%
+4 −0
Meta Error 500 in one specific post (the rest of the site is fine)

I've got a HTTP Error 500 when trying to access this post. Here's the quote error ID's: ef4f6ec1-8d0f-4be3-9553-36e01b5f01c4 and bbeb9bf9-2c58-43b1-be05-c9e914bb80bf. I've browsed to another pos...

0 answers  ·  posted 3y ago by hkotsubo‭  ·  edited 3y ago by Monica Cellio‭

75%
+4 −0
Meta Text with many diacritic marks are not displayed correctly in posts

When posting this question, I noticed a difference between editor's preview and the post's final render. When editing, the preview correctly shows the Zalgo Text: But after the post is saved, i...

1 answer  ·  posted 3y ago by hkotsubo‭  ·  edited 3y ago by ArtOfCode‭

Question bug status-declined
72%
+6 −1
Q&A What is the main difference between event delegation to other event handling patterns in JavaScript?

tl;dr The purpose of addEventListener is to define what happens when an event is triggered at some element. But it also allows us to implement event delegation, due to the bubbling/propagation beh...

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

Answer
72%
+6 −1
Q&A What does a variable followed by parentheses ("ptr()") mean?

void (*ptr)() defines a function pointer. It says that ptr is a pointer to a function. But that function must have a void return type, and take an arbitrary number of parameters (that's what the em...

posted 3y ago by hkotsubo‭  ·  edited 2y ago by Martin Bonner‭

Answer
72%
+6 −1
Q&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 branch...

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

Answer
71%
+3 −0
Q&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: import com.fasterxml.jackson.annotati...

posted 3mo ago by hkotsubo‭

Answer
71%
+3 −0
Q&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() retur...

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

Answer
71%
+3 −0
Meta I can't choose any tags when posting a question

The problem described below occurs in Windows 10 and Chrome 87.0.4280.66 (64 bits, JavaScript enabled). I could post this question only in mobile (Chrome/iOS 14.2), where the problem doesn't occur....

0 answers  ·  posted 4y ago by hkotsubo‭  ·  edited 1y ago by hkotsubo‭

71%
+3 −0
Q&A How to overwrite lines of STDOUT in Python?

The solution proposed by the other answer works, but there's a corner case. If the last message is shorter than the previous one, you might not get what you want. Example: print("this is some text...

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

Answer
71%
+3 −0
Q&A Move to the edit webpage of a webpage via the keyboard with vanilla JavaScript

You're getting close, just need a few adjustments. Instead of using the hostname property, I prefer to use host, because it also includes the port (in case the URL has one) - check the documentati...

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

Answer
71%
+3 −0
Q&A What are the disadvantages of using static methods in Java?

Is it better to use static method? I don't like to think of static (or any other language feature/mechanism) in terms of bad/worse and good/better (although I do that too, I constantly try to ...

posted 3y ago by hkotsubo‭

Answer
71%
+3 −0
Meta Border-bottom of inline code is (sometimes) not displayed when it's in the last line of a paragraph

After I wrote this answer, I could notice that, when there's inline code in the last line of a paragraph, sometimes the border-bottom of the inline code text is not displayed. One case is when the...

0 answers  ·  posted 4y ago by hkotsubo‭  ·  edited 3y ago by Monica Cellio‭