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 |
---|---|---|---|---|
Edit | Post #285918 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285918 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285918 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285918 | Initial revision | — | almost 3 years ago |
Answer | — |
A: When using the compare function in Array.prototype.sort, how to avoid an element to be processed more than once? > PS: for small arrays and/or if the function is fast and doesn't cause performance bottlenecks, none of the below is really necessary (see the analysis in the end). That said, let's see how to solve it. I'm going to suggest two ways to make sure that the `getSortKey` function processes each eleme... (more) |
— | almost 3 years ago |
Edit | Post #285917 | Initial revision | — | almost 3 years ago |
Question | — |
When using the compare function in Array.prototype.sort, how to avoid an element to be processed more than once? When using the `Array.prototype.sort` method, we can pass a compare function as argument. Then, this function can be used to process array's elements, so the comparison is made using some custom criteria. But I noticed that this can lead to some, let's say, redundancy. For instance, this code: ... (more) |
— | almost 3 years ago |
Edit | Post #285899 |
Post edited: I believe that a footnote is better than <sup>*</sup> |
— | almost 3 years ago |
Suggested Edit | Post #285899 |
Suggested edit: I believe that a footnote is better than <sup>*</sup> (more) |
helpful | almost 3 years ago |
Comment | Post #285911 |
Related: https://meta.codidact.com/posts/277244 (more) |
— | almost 3 years ago |
Comment | Post #285811 |
There are some classic examples, such as "_I'm querying the database and showing the info in HTML and it doesn't work_". If the problem is in the database (maybe in the query, or in how you're processing the results), the HTML part is irrelevant: just print the data to show how wrong it is, and how t... (more) |
— | almost 3 years ago |
Comment | Post #285784 |
@#53483 Then please edit the question and show the code that uses Bouncy Castle, specifically the part that fails, so we can reproduce the problem. (more) |
— | almost 3 years ago |
Comment | Post #285784 |
I don't get it, `javax.mail` doesn't use Bouncy Castle (BC). Perhaps the `mdnCreator.createMDNData()` method creates an object that uses BC to generate mime data? As you didn't provide the code for `createMDNData`, I've made a simple test:
```java
ByteArrayInputStream in = new ByteArrayInputStrea... (more) |
— | almost 3 years ago |
Edit | Post #285801 |
Post edited: fix quotes in code, minor fixes in formatting |
— | almost 3 years ago |
Comment | Post #285801 |
I've made a test in Python 3, and python-dotenv worked fine:
```python
import os
from dotenv import load_dotenv
load_dotenv()
# both os.environ and os.getenv worked
print(os.environ["MY_ID"], os.environ["TOKEN"])
print(os.getenv("MY_ID"), os.getenv("TOKEN"))
```
The `.env` file is ex... (more) |
— | almost 3 years ago |
Suggested Edit | Post #285801 |
Suggested edit: fix quotes in code, minor fixes in formatting (more) |
helpful | almost 3 years ago |
Edit | Post #285727 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285727 | Initial revision | — | almost 3 years ago |
Answer | — |
A: Why object-oriented instead of class-oriented? > Why object-oriented instead of class-oriented? tl;dr Because you can "do OOP" without classes. Long answer A class is one possible way to implement object oriented programming. But it's not the only one. OOP is a programming paradigm: a particular "style"/way of designing program... (more) |
— | almost 3 years ago |
Edit | Post #285720 |
Post edited: minor fixes |
— | almost 3 years ago |
Suggested Edit | Post #285720 |
Suggested edit: minor fixes (more) |
helpful | almost 3 years ago |
Edit | Post #282066 |
Post edited: |
— | almost 3 years ago |
Suggested Edit | Post #285603 |
Suggested edit: Fix link and typo (more) |
helpful | almost 3 years ago |
Edit | Post #282752 |
Post edited: Adding relevant info from the comments |
— | almost 3 years ago |
Suggested Edit | Post #282752 |
Suggested edit: Adding relevant info from the comments (more) |
helpful | almost 3 years ago |
Edit | Post #282753 |
Post edited: |
— | almost 3 years ago |
Edit | Post #285505 | Initial revision | — | almost 3 years ago |
Answer | — |
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 want to save some work. Of course for simple cases (such as arrays containing only numbers, strings, or... (more) |
— | almost 3 years ago |
Edit | Post #285350 |
Post edited: Removed markdown from title (doesn't work), added tags |
— | almost 3 years ago |
Suggested Edit | Post #285350 |
Suggested edit: Removed markdown from title (doesn't work), added tags (more) |
helpful | almost 3 years ago |
Edit | Post #282227 |
Post edited: Using the correct module name |
— | almost 3 years ago |
Suggested Edit | Post #282227 |
Suggested edit: Using the correct module name (more) |
helpful | almost 3 years ago |
Edit | Post #285204 |
Post edited: Make the question more objective (it doesn't matter file extension) and change tags |
— | about 3 years ago |
Suggested Edit | Post #285204 |
Suggested edit: Make the question more objective (it doesn't matter file extension) and change tags (more) |
helpful | about 3 years ago |
Comment | Post #285190 |
Instead of `form id="#prcf_form"`, it should be `form id="prcf_form"`. The `#` is used only in the selector, it indicates that you're searching for an id. But in the HTML, there should be no `#` (more) |
— | about 3 years ago |
Comment | Post #285190 |
`document.querySelector('#prcf_form')` didn't return a `form` element. Have you checked in your HTML if there's a form with `id="prcf_form"`? (more) |
— | about 3 years ago |
Comment | Post #285130 |
The answer below is basically doing what I suggested (using `fetch` and `FormData` to send the data via POST).
As you didn't say if it worked, I assumed it didn't work and therefore there might be some missing details (because based on what I could understand, that code should work) (more) |
— | about 3 years ago |
Comment | Post #285169 |
This code is simply defining the list's structure and the functions that will manipulate it. What exactly you didn't understand? (more) |
— | about 3 years ago |
Comment | Post #285130 |
In the PHP file you're getting `$_POST['email']`, which means that it's getting the email sent by the client (if the backend will get another email that the client side can't know, then where/how it will be done?). Well, it seems that there is a *lot* of missing information, please edit the question ... (more) |
— | about 3 years ago |
Comment | Post #285154 |
@#54710 Have you read [the link I suggested](https://software.codidact.com/posts/284849)? I believe it explains what you need to know (more) |
— | about 3 years ago |
Comment | Post #285130 |
@#36363 "send data" means making a http request, using fetch with POST method (there's an example in the [docs](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#supplying_request_options)). And you can use [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) t... (more) |
— | about 3 years ago |
Comment | Post #285130 |
@#36363 Then I suggest you to edit the question and add this information there.
But anyway, if you want to execute behavior.php, you'll have to send data to it (which is basically what I described above) (more) |
— | about 3 years ago |
Comment | Post #285148 |
Regarding string handling, [this post](https://software.codidact.com/posts/284849) might be helpful (more) |
— | about 3 years ago |
Comment | Post #285130 |
After the last edit it's still unclear what you mean by "*apply backend behavior*".
Do you have a `form action="URL A"` and want to send all its data to URL B using JavaScript? (more) |
— | about 3 years ago |
Edit | Post #285135 |
Post edited: Missed one extra backtick in code block, now it should be correct |
— | about 3 years ago |
Suggested Edit | Post #285135 |
Suggested edit: Missed one extra backtick in code block, now it should be correct (more) |
helpful | about 3 years ago |
Edit | Post #285135 |
Post edited: Better title, fix code block |
— | about 3 years ago |
Suggested Edit | Post #285135 |
Suggested edit: Better title, fix code block (more) |
helpful | about 3 years ago |
Comment | Post #285130 |
Not sure if that's what you need, but if I understood correctly, it'd be something like this:
```javascript
let form = // get the form somehow (for example, with querySelector)
form.addEventListener('submit', function(e) {
e.preventDefault(); // don't submit the form
fetch('backend.url')
... (more) |
— | about 3 years ago |
Edit | Post #285104 |
Post edited: Remove clutter and try to come up with a better title |
— | about 3 years ago |