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 |
---|---|---|---|---|
Suggested Edit | Post #282544 |
Suggested edit: Improved grammar, formatted code (more) |
helpful | over 3 years ago |
Comment | Post #282532 |
Perhaps you should edit and clarify the question. At least for me, I'm failing to see what the actual problem is. Why can't you use PHP (as you confirmed you're already using) as some `include`'s will do the job, and why limiting the number of lines is such a serious issue/requirement (so "serious" t... (more) |
— | over 3 years ago |
Comment | Post #282532 |
I'm afraid you're focusing on the wrong issues. 80 lines is not large, and nesting is good to make things easy and convenient for the dev team: it makes the code clearer and easier to understand and maintain (on the other hand, keeping everything in one non-nested line just for the sake of having few... (more) |
— | over 3 years ago |
Comment | Post #282525 |
I've seen those being called "single page" and "multi page" forms. But I don't believe there's a formal standard for that (more) |
— | over 3 years ago |
Edit | Post #282486 |
Post edited: Improved grammar, added tags |
— | over 3 years ago |
Comment | Post #282487 |
If we're meant to be pedantic/technically accurate, we'd never call it "string", but if you call it that way, people - at least anyone familiar with the language - will usually know that you actually mean "*a contiguous sequence of chars terminated by the null character (`\0`)*" (regardless of how it... (more) |
— | over 3 years ago |
Comment | Post #282487 |
@Istiak Actually, it's a little bit more complicated than that. A pointer to some type `T` is, let's say, "interchangeable" with an array of `T` (actually, the pointer points to the array's first element). In C, a string is actually an array of chars (terminated by `\0`), so a `char *` (a pointer to... (more) |
— | over 3 years ago |
Suggested Edit | Post #282486 |
Suggested edit: Improved grammar, added tags (more) |
helpful | over 3 years ago |
Edit | Post #282354 |
Post edited: |
— | over 3 years ago |
Edit | Post #282354 | Initial revision | — | over 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) |
— | over 3 years ago |
Comment | Post #282344 |
`input type="text"` is single line by definition. If you want multiline input, use a `textarea` - unless there's a good reason to not use it (and I don't see - and can't imagine - any reason for that) (more) |
— | over 3 years ago |
Comment | Post #282283 |
@elgonzo There's still the challenge of code-golfing the code (make it as small as possible). But as I said, I'm not the best one to suggest anything about that, so it's "left as an exercise to the reader (aka Derrick)" :-)
(more) |
— | over 3 years ago |
Edit | Post #282283 |
Post edited: |
— | over 3 years ago |
Edit | Post #282283 |
Post edited: |
— | over 3 years ago |
Edit | Post #282283 |
Post edited: |
— | over 3 years ago |
Edit | Post #282283 | Initial revision | — | over 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) |
— | over 3 years ago |
Edit | Post #282233 |
Post edited: |
— | over 3 years ago |
Edit | Post #282233 |
Post edited: |
— | over 3 years ago |
Comment | Post #282233 |
@elgonzo AFAIK, lists in Python can't be preallocated. You can create one with N elements, and then use those already-created spaces. I've tested here, but that didn't make the code much faster.
(more) |
— | over 3 years ago |
Comment | Post #282233 |
And the `timeit` module already takes care of most "disturbances", and does the tests as clean as possible, running each test lots of times and doing some other stuff that I admit I don't fully know (but I've read some docs mentioning some things it does to eliminate any disturbances). Anyway, I incr... (more) |
— | over 3 years ago |
Comment | Post #282233 |
@elgonzo The "unbalanced in the beginning" took `1.2465003237593919e-05` seconds - note the scientific notation, with "e-05" in the end, which actually means `0.0000124...` seconds. (more) |
— | over 3 years ago |
Edit | Post #282233 |
Post edited: |
— | over 3 years ago |
Edit | Post #282233 |
Post edited: |
— | over 3 years ago |
Edit | Post #282233 | Initial revision | — | over 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) |
— | over 3 years ago |
Edit | Post #282227 |
Post edited: fixed typo and added tag |
— | over 3 years ago |
Suggested Edit | Post #282227 |
Suggested edit: fixed typo and added tag (more) |
helpful | over 3 years ago |
Edit | Post #282229 | Initial revision | — | over 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) |
— | over 3 years ago |
Edit | Post #282164 | Initial revision | — | over 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) |
— | over 3 years ago |
Edit | Post #282066 | Initial revision | — | over 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) |
— | over 3 years ago |
Edit | Post #282065 | Initial revision | — | over 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) |
— | over 3 years ago |
Edit | Post #282006 |
Post edited: |
— | over 3 years ago |
Edit | Post #282006 |
Post edited: |
— | over 3 years ago |
Edit | Post #282006 | Initial revision | — | over 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) |
— | over 3 years ago |
Comment | Post #281886 |
Actually, `print` will add a new line if you set `$\ = "\n"`. The doc mentions that: "*If the output record separator (`$\`) is not `nil`, it is appended to the output*" - as the [default value is `nil`](https://ruby-doc.org/docs/ruby-doc-bundle/Manual/man-1.4/variable.html#bslash), `print` won't nor... (more) |
— | over 3 years ago |
Comment | Post #281871 |
Actually, `print` will add a new line if you set `$\ = "\n"`
(more) |
— | over 3 years ago |
Comment | Post #281762 |
From my experience, the main issue in any ticket system is when users can't explain their problem with enough details (and we need to contact them to get those details). Markdown, as a markup language, (with **formatting purposes only**), wouldn't help to solve this problem - because it's a communica... (more) |
— | over 3 years ago |
Edit | Post #281730 |
Post edited: formatting |
— | over 3 years ago |
Suggested Edit | Post #281730 |
Suggested edit: formatting (more) |
helpful | over 3 years ago |
Comment | Post #281585 |
I agree that in most cases we simply shouldn't do it. But the main subject of the question is Zalgo Text, so how could I show an example without actually showing it? I believe the question is a valid case where this should be done, otherwise the post would lack important information. Anyway, if the d... (more) |
— | over 3 years ago |
Edit | Post #281552 |
Post edited: |
— | over 3 years ago |
Comment | Post #281555 |
I recognize this is probably a minor issue, as text like that will be rarely used in posts, so I don't mind if this issue gets low priority. (more) |
— | over 3 years ago |
Edit | Post #281555 | Initial revision | — | over 3 years ago |