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‭

81 posts
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 2mo ago by hkotsubo‭  ·  edited 2mo 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
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 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 2y ago by hkotsubo‭  ·  edited 2y 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 2y ago by hkotsubo‭  ·  edited 1y ago by Monica Cellio‭

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 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 2y ago by hkotsubo‭  ·  edited 2y 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 2y ago by hkotsubo‭  ·  edited 2y 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 2y ago by hkotsubo‭  ·  edited 2y 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 2y ago by hkotsubo‭  ·  edited 2y 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 2y ago by hkotsubo‭  ·  edited 2y ago by Martin Bonner‭

Answer
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 6mo ago by hkotsubo‭  ·  edited 6mo 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 2y 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 3y ago by hkotsubo‭  ·  edited 3y ago by Monica Cellio‭

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 3y ago by hkotsubo‭  ·  edited 5mo ago by hkotsubo‭

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
66%
+2 −0
Q&A How to run a remote JavaScript file from GitHub?

As you're using userscripts, I'm assuming this code is supposed to run in a browser. Hence, you could download the scripts and add its contents to the page's DOM (by using a script element). For t...

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

Answer
66%
+2 −0
Q&A Delete all occurrences of a character in a webpage with vanilla JavaScript

Some comments and your answer are doing this: document.body.innerHTML = document.body.innerHTML.replace(/x/g, '*'); But as explained in the comments, this is not a good solution, because it can...

posted 2y ago by hkotsubo‭

Answer
66%
+2 −0
Q&A How can the Caesar cipher be implemented in Java?

Caesar Cipher originally deals only with letters (ASCII "A" to "Z", without diacritics/accents), so I'm not sure why you included ۤ$%& in your answer. And using indexOf (as you did) is not ver...

posted 2y ago by hkotsubo‭

Answer
66%
+2 −0
Meta I answered a question that was deleted, then undeleted, and my answer disappeared

Yesterday I answered this question. This morning, when I visited site, the question has disappeared, so my guess is that it was deleted. But now I saw that it was undeleted (I initially thought t...

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

66%
+2 −0
Meta Is there a workaround to highlight code blocks if the language doesn't have syntax highlight enabled?

I've seen that recently two requests to add syntax highlight to some languages were deferred (this and this). According to the status-deferred tag description: "the requested feature will not be i...

0 answers  ·  posted 2y ago by hkotsubo‭  ·  edited 1mo ago by hkotsubo‭

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

Currently, Java 16 is the latest version, and there's no support to branch reset yet. But one - still far from ideal - alternative is to use lookarounds: Pattern pattern = Pattern.compile("([aeiou...

posted 3y ago by hkotsubo‭

Answer
66%
+2 −0
Meta Error 500 when trying to comment

I've tried to post a comment in this question, and when I clicked in "Post" button, I've got this error message: 500 Internal Server Error If you are the administrator of this website, then ple...

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