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.

Activity for hkotsubo‭

Type On... Excerpt Status Date
Answer 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 explained as an "is a" relation, or a specialization of a especific type. Borrowing (and extending) the e...
(more)
almost 3 years ago
Answer 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 read things like this. The "whoa" moment was when it compares Git to a DAG (Directed Acyclic Grap...
(more)
almost 3 years ago
Question 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 posts and pages and all of them are working fine. It seems that only that specific post causes the...
(more)
almost 3 years ago
Answer 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'll understand why an `input` is not the correct solution. Definitions MDN defines `input ...
(more)
almost 3 years ago
Answer 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: ```python 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 list print(z) # [1, 2] ``` So the first thing to fix is this, set a different list to...
(more)
almost 3 years ago
Answer A: 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 not, the string is invalid, else, pop the opening bracket and proceed to the next character. Do it unt...
(more)
almost 3 years ago
Answer A: 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 currentday == 1: print(f'{currentyear}-{currentmonth:>02}-{currentday:>02}') sundays += 1 And in the first lines I've noticed that you're actually counting the Tuesdays: ```none 190...
(more)
almost 3 years ago
Answer 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]+(?=\\d+\\W+)|[123]+(?=[a-z]+\\W+))"); Matcher matcher = pattern.matcher("ae123. 111abc!!"); w...
(more)
almost 3 years ago
Answer 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 behaviour. In a general way, `\s` - at least in the engines that I've seen - always include the following...
(more)
almost 3 years ago
Question 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, followed by `\s`, followed by a digit) matches both `a 1` and ```none b 2 ``` Because `\s` matc...
(more)
almost 3 years ago
Answer 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 and second). A JavaScript `Date` actually represents a timestamp. More precisely, according to the...
(more)
almost 3 years ago
Question 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, it's rendered in the browser like this: Note that part of the text (the diacritics at the to...
(more)
about 3 years ago
Answer 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" different ones (you can also say that they can modify other characters). > Example: in Portu...
(more)
about 3 years ago
Question 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͙̣̬̓̂͞ę̡̲̟͎͉̟͛̓̉̆̉͘ ͍̯̱͎̬͍ͬ̒ͣͩ͟͡ḥ̗͖̝̮̗̼ͮ̋̉̃͐̿ͪͅi̞͉̯͖̞͉̙ͬͦ̄͋̈̂ͥ̊́̕v̶̝̼̫͔̬̯̯ͯ͑̈͠e̪͓͕̦̪̗̠ͯ͛͌̀̉͘ͅ-̍̉ͦ̈́͌͏̸͉͍͖̥͓̭̗̖mͣͣͪ̇͂͏̳̤̺...
(more)
about 3 years ago
Answer 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." So, when there's an ambiguous timestamp (when a local date/time occurs twice: first in Daylight Saving ...
(more)
about 3 years ago
Answer 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 predefined arbitrary rules, then your monster will be a little less scary. Considering the simpl...
(more)
about 3 years ago
Question 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 paragraph is followed by either a horizontal line or a code block: inline code with border-bottom...
(more)
about 3 years ago
Answer 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 character strings". Its default value is a "whitespace" (space, tab, and newline), but you can change it ...
(more)
about 3 years ago
Answer 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 only this, it would match `THIS. ` &nbsp;(the word "THIS", plus the dot and space after it). ...
(more)
about 3 years ago
Question 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. I also tested in MacOS 10.5.5/Chrome 83.0.4103.116, and the problem doesn't occur (all 3 tests - Window...
(more)
over 3 years ago
Question 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 please read this web application's log file and/or the web server's log file to find out what went wr...
(more)
over 3 years ago
Question 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 that it was posted again, but I don't think that's the case because my vote is still there), but it h...
(more)
over 3 years ago
Answer A: How can I write an egrep (grep -E) regexp that matches lines containing two stanzas in arbitrary order?
> Can that even be done without having to repeat either or resorting to more advanced processing than pure regular expressions I don't think it can. If you don't want to repeat `x1=y2` and `c5=d6`, you'll have to use more advanced features, such as lookaheads: grep -P "^(?=([^;]+; )x1=y2)(?...
(more)
over 3 years ago
Answer 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: ```javascript let validTags = ['p', 'span', 'br', 'i', 'b', 'u']; let validAttribs = ['style', 'href']; function vali...
(more)
over 3 years ago
Answer 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()`). But the link above also mentions that "this behavior is not at all affected by how or where t...
(more)
over 3 years ago
Question "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: suggest edit - editor shows newlines But at the "Review suggested edit" page, the differences are not clearly displayed. It shows all the answer text in a single "line": pending e...
(more)
over 3 years ago
Answer 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: ```python class Test: def init(self, valor): self.valor = valor def str(self): print('c...
(more)
over 3 years ago
Question 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: ```python num, text = 10, 'abc' passing just the variables print(f'{num} {text}') or #print('{} {}'.format(num, text)...
(more)
over 3 years ago
Question 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: empty tag wiki I also noticed that I can't edit those info. Will it be possible for regular users to add tag wikis?[^1] And if there is such possibility, what are the recommendations for creating those wi...
(more)
over 3 years ago
Answer 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`: ```java String regex = "(?:([aeiou]+)[0-9]+|([123]+)[a-z]+)\\W+"; System.out.println("ae123.".replaceAll(regex, "$1$2")); System.out.println("111abc!!".replaceAll(regex, "$1$2")); ``` This prints...
(more)
over 3 years ago
Question How can I emulate regular expression's branch reset in Java?
I've got this sample regex: ```java 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 or more digits (`[0-9]+`), or - one or more digits 1, 2 or 3 (`[123]+`), follo...
(more)
over 3 years ago