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
92%
+24 −0
Q&A What is HEAD in Git?

In Git documentation, there are lots of references to the term "HEAD". But what exactly is it? Some places refer to it as "a pointer to the current branch". So it's a branch? What is it used for?

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

Question git terminology
92%
+22 −0
Q&A How does Zalgo Text work, and how can I prevent my application from accepting it?

First, let's see how Zalgo Text works. Unicode Combining Characters Unicode defines the concept of combining characters. Basically, some characters can be combined with others, to "make/create"...

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

Answer
92%
+22 −0
Q&A What is HEAD in Git?

First, we need to understand what a Git repository actually is. For that, refer to this article: it explains that a Git repository is actually a DAG (Directed Acyclic Graph). I'm not going into the...

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

Answer
91%
+20 −0
Q&A What is the purpose of `if __name__ == '__main__'`?

It makes difference if the script is being imported. Let's suppose I have a file my_file.py: # my_file.py def some_function(): print('do some stuff') print('calling function:') some_fun...

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

Answer
89%
+15 −0
Q&A What's the correct way to merge a branch and its dependent branch back to master?

I think a branch is a set of commits Well, technically no, it's not. But first things first. DAG (Directed Acyclic Graph) Personally, Git became much more easier to understand after I've r...

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

Answer
88%
+14 −0
Q&A Why don't format specifiers work with lists, dictionaries and other objects?

When you use the variable without any format specifier (print(f'{variable}')), internally its __str__ method is called. Considering your Test class, it already has this method: class Test: def...

posted 3y ago by hkotsubo‭

Answer
88%
+14 −0
Q&A How does Zalgo Text work, and how can I prevent my application from accepting it?

A Zalgo Text is something like this: T̃͟͏̧̟͓̯̘͓͙͔o̤̫͋ͯͫ̂ ̥͍̫̻͚̦͖͇̌ͪ̇ͤ̑̐͋̾̕i̢͖̩͙͐͑ͬ̄̿̍̚ͅn̵̢̼̙̳̒̄ͥ̋̐v̡̟̗̹̻̜͕̲ͣ̐ͤͤ͒́oͫ͂̆͑ͩ҉͇̰͚̹̠̫͔̗k̷̭̬̭͙̹̺̯ͩ̌̾̒̋̓ͤ͛͘͠e̥͙̓̄̕ ̵̫͈ͪţ̱̺̺̑̿̉̌͛̂̇h͙̣̬̓̂͞ę̡̲̟͎͉̟͛̓̉̆̉͘ ͬ̒...

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

Question string character
88%
+13 −0
Q&A What does the "\s" shorthand match?

The complete set of characters matched by the \s shorthand varies according to the language/API/tool/engine you're using. In addition to that, there might be configurations that change this behavi...

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

Answer
88%
+13 −0
Q&A How do I support tab completion in a python CLI program?

It depends. Do you want to have autocomplete on the shell the program runs in, or do you want the program to intercept the TAB key and do the autocomplete by itself? Shell autocomplete If you'r...

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

Answer
85%
+10 −0
Q&A Git: How to clone only a few recent commits?

How do I clone the repository with only part of the history? It depends on what part you want. It's possible to have shallow clones (which is exactly what you need, only a part of the commit h...

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

Answer
85%
+10 −0
Q&A What does the "\s" shorthand match?

I've seen some regular expressions (regex) using \s when they want to match a space, but I noticed that it also matches line breaks. Example: the regex [a-z]\s[0-9] (lowercase ASCII letter, follow...

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

Question regex whitespace
85%
+10 −0
Q&A Where did my proper divisor sum program went wrong?

When you do x=y=z=[], you're making x, y and z point to the same list. Example: x=y=z=[] # add element to x x.append(1) # add element to y y.append(2) # but x, y and z all point to the same l...

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

Answer
85%
+10 −0
Q&A Can regex be used to check if input conforms to a very strict subset of HTML?

tl;dr Although it can be done with regex (and work for "most" cases), I still prefer to use a parser. Long answer I'd use something such as DOMParser to do the job: let validTags = ['p', 'span', 'b...

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

Answer
85%
+10 −0
Q&A What's the difference between Inheritance and Polymorphism?

What you're asking is a very broad topic, and it'd require entire books to cover everything. For the sake of simplicify, I'll just stick to the basics. Inheritance Inheritance can be explai...

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

Answer
84%
+9 −0
Q&A What are field separators in operating-programming languages (such as Bash)?

In Bash, IFS is an internal variable and it stands for "Internal Field Separator" <- according to this link, it "determines how Bash recognizes fields, or word boundaries, when it interprets cha...

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

Answer
84%
+9 −0
Q&A Python Regex to parse multiple "word. word. word."

First of all, let's understand why your regex didn't work. The first part is \w+\.\s, which is "one or more alpha-numeric characters" (\w+), followed by a dot and a space (\.\s). If the regex was ...

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

Answer
84%
+9 −0
Q&A Why don't format specifiers work with lists, dictionaries and other objects?

When I want to print a number or a string, I can use f-strings (Python >= 3.6) or str.format, and I can use just the variable between braces, or use format specifiers. Ex: num, text = 10, 'abc' ...

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

84%
+9 −0
Q&A How to verify if a year is leap in Java?

There are many ways to do it, it depends on what data you already have and/or the Java version. I have only the year's numeric value If you already have a value as a number (int or long), and i...

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

Answer
83%
+8 −0
Q&A How to deeply clone an array in Angular / TypeScript?

By "deeply clone", I assume you mean "also make copies of whatever nested structures the object might have". And for those, I guess libraries like Lodash are more reliable and appropriate if you wa...

posted 2y ago by hkotsubo‭

Answer
83%
+8 −0
Q&A What is [{options}] in JavaScript?

Given the link where the code comes from (based on your other question), this is just a, let's say, "free-form/pseudo-code/documentation example". It's not a valid JavaScript code. It's more like...

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

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

I've got this sample regex: Pattern p = Pattern.compile("(?:([aeiou]+)[0-9]+|([123]+)[a-z]+)\\W+"); It basically has the following parts: one or more lowercase vowels ([aeiou]+), followed by one ...

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

Question java regex
83%
+8 −0
Code Reviews Counting Sundays without Python datetime module

First of all, I've added a print in your code to show the dates: if days % 7 == 0 and current_day == 1: print(f'{current_year}-{current_month:>02}-{current_day:>02}') sundays += 1 ...

posted 3y ago by hkotsubo‭

Answer
83%
+8 −0
Q&A How to get string length in D?

what ways can I get a string's length in D? There are many different ways, and that will depend on the content of the strings, their types, and how you define the terms "character" and "length...

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

Answer
81%
+7 −0
Meta Enable syntax highlighting for D language

According to this answer, Codidact uses highlight.js for syntax highlight, and "support whatever languages are enabled by default in that package". And according to this table (in highlight.js Git...

0 answers  ·  posted 2y ago by hkotsubo‭  ·  last activity 2y ago by Anonymous‭

81%
+7 −0
Q&A What problem does innerHTML solves?

tl;dr According to the documentation, innerHTML property "gets or sets the HTML or XML markup contained within the element". Basically, "that's all", but let's see it in more detail. It makes...

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

Answer