Posts by Rafael Tavares • 4,528 points
139 posts
-
0
votes1
answer245
viewsA: Group data with Sequelize and My SQL
The behavior of group You misunderstood how the group works. In a query group: ['tipo'] it will group the data by tipo. So if I have: [{ id: 1, nome: "A", tipo: 1 }, { id: 2, nome: "B", tipo: 2 }, {…
-
0
votes0
answers298
viewsQ: How to know when the virtual DOM and real DOM update happens?
I’m developing a project in React and noticed that using multiple setState() followed caused the surrender of my component again, for example: function MeuComponente() { console.log("Componente…
-
1
votes1
answer184
viewsA: How to access and change objects within an XML file by Activity?
By which file to access the elements? To access the components of a layout.xml, you must access by whom inflated the .xml, that in your case is being the AcompanhamentoFragment.java. How to access…
-
0
votes1
answer203
viewsQ: How to use "shouldComponentUpdate" with Hooks?
I have a component <Filho> who does not receive props, but is rendered again whenever the <Pai> has some status update (useState). To solve this I figured I could do, in the component…
-
5
votes2
answers88
viewsA: Typescript files in version history
To indicate what goes to your repository or not, you must indicate the file path (or directory) in question in your archive .gitignore. For more details, see Configure . gitignore to not upload…
-
4
votes2
answers215
viewsA: Did "Class Components" die in React?
TLDR: Classes will not die. (at least not so soon). As has already been answered here, documentation points out that there are no plans to remove classes from React. However, the documentation…
-
3
votes2
answers277
viewsA: Is it possible to use the resize function of the textarea in an input?
The estate resize has the following specification: Note: resize is not applied in the following cases: Elements inline Elements block on which property overflow not with the value visible You can…
-
1
votes1
answer62
viewsA: What is the "done" function in Passport for?
Well, in the documentation of Passport there is an example with done, which is probably what you’re quoting: var passport = require('passport') , LocalStrategy = require('passport-local').Strategy;…
-
0
votes2
answers91
viewsA: Footer does not resize
The problem is that your footer is with the min-width: 100vw, as his #app is with width: 700px. So when the width of the screen is smaller than 700px, the #app does not decrease (creating a…
-
1
votes1
answer52
viewsA: Why do I have to click twice to create an image?
What happens is that the image takes a while to load, so you’re having the <canvas> before you knew what draw in fact. The second time works because you had already downloaded the image and it…
javascriptanswered Rafael Tavares 4,528 -
1
votes1
answer115
viewsA: Why is my canvas not working properly?
This problem happens because, as specifications of <canvas>: The canvas element has two attributes to control the size of the element bitmap: width and height. These attributes, when…
-
1
votes1
answer36
viewsA: Two vertical menus on both sides of the browser
Probably what you missed was just putting right: 0 in his #right, indicating that it is fixed on the right. Here is an example I created: #left { /* Fixo à esquerda e topo, ocupando toda altura */…
-
0
votes1
answer49
viewsA: Nav Bar in Bootstrap does not open in 768px responsive
This problem is related to version 3.5.0 jQuery. A Issue on Github has been resolved and you can find more information in the post about jQuery 3.5.1 Release. To resolve, reinstall jQuery in version…
-
6
votes2
answers298
viewsA: Why does factorial above 170 return infinite?
In the Soen you can find an answer on that, which I adapted and added some things I found researching: What happens is that you are exceeding the precision of a double in a 64bit system. This…
phpanswered Rafael Tavares 4,528 -
1
votes1
answer148
viewsQ: Is there a performance problem in using many foreign keys (FK)? If so, is it bad to have foreign attributes without being FK?
To clarify how much can be "many foreign keys", I will explain the context: In a system, I want to store by whom a certain record has been edited ( updatedBy) or raised (createdBy). This can happen…
-
4
votes3
answers117
viewsA: What technical obstacle for Android not support the new versions of Java
First, researching, I found nothing talking directly about technical obstacles, but on the topic of this answer on Java 8 you will see something about this point. Kotlin and Java I will complement…
-
1
votes1
answer69
viewsA: Use of fadein and fadeOut on click() with jQuery
You need to have a control variable to know if the element is visible or not. The method fadeOut() does not return a boolean as you expect, it just hides the element. let estaVisivel = true; // No…
-
0
votes1
answer90
viewsA: React, map with 2 json without id
Analyzing your code better I realized that the error is on the line const { postsApi } = await response.data Problems: console.log You say that the console.log returns the correct JSON, but you call…
reactanswered Rafael Tavares 4,528 -
4
votes3
answers128
viewsA: Map with dynamic array and property
You can access the property the way objeto[prop]. When trying to use the ({ prop }) you will be looking for an attribute called prop. So as the prop is a variable, the best way would be: Receive as…
-
0
votes1
answer110
viewsA: Invalid Layer Save Flag - only ALL_SAVE_FLAGS is allowed android API 28+
You are using an outdated version of com.mikepenz.materialdrawer. Doing a little digging on their Github, I found this Issue where the repository maintainer says Those flags are no longer applied in…
-
2
votes1
answer171
viewsA: How do I remove the underline from the text of a link?
As the element that has the underscore is the anchor (<a>), you should apply style to it. Apply style to <span> will have no effect as you will be removing the text-decoration of…
-
2
votes1
answer57
viewsA: Is this path valid for all devices?
You should take the directory you want through Android methods, as it is common to change from version to version for security reasons and permission. Today, for example, from Android Q (API 29) on…
-
0
votes2
answers2367
viewsA: How to send a JSON object in a POST request with ajax?
Although the @Lucas Bittencourt response works, a simpler and more flexible option is to use the method JSON.stringify(). The method JSON.stringify() converts values into javascript for a String…
-
2
votes1
answer32
viewsA: When climbing the site javascript did not run
What’s going on is that when your main.js executes, HTML elements not yet created. A recommendation is to import <script>'s always at the end of HTML, rather than at the beginning (as you are…
-
1
votes1
answer393
viewsQ: What is the advantage of using a Refresh Token instead of just the Access Token?
I understand the difference between Access Token and Refresh Token, there already exists a question about it here at Sopt. I also saw Soen issues involving the use of Refresh Token. Amid spend a…
-
3
votes1
answer583
viewsA: React-router <Redirect> does not work
The problem is that you are using return in the ComponentDidMount intended to render an element. This does not happen. To render the element, it must be returned inside the render. Once you put the…
-
1
votes1
answer34
viewsA: Error while sending ZIP file via Intent on Android
To share a file you need to pass a URI with reference to its location, you can try: Uri.fromFile(File file) or FileProvider.getUriForFile(Context context, String authority, File file) Documentation:…
-
2
votes1
answer1938
viewsQ: What’s the difference in having a JKS or a PKCS12 subscribing to my Android app?
I was generating a Keystore for my application by Android Studio and received the following warning: Key was created with errors: Warning: The storage of keys JKS uses a proprietary format. It is…
-
0
votes1
answer323
viewsA: Search for record in another table with mysql and sequelize
In order to be able to do this "Join", you must have the two associated models, so postagens.categoria will be a Foreign key. Then you can give one include in the findAll of your Post indicating to…
-
1
votes1
answer626
viewsA: Change the action value inside the form
You can change the action of form in the onClick of each button: HTML: <form id='form' method='post' enctype='multipart/form-data'> <button type='submit' id='botaoFinalizar' class='btn…
-
1
votes1
answer243
viewsA: How to make the scroll start at the bottom of the page?
You can use the method window.scrollTo to scroll the full height of the body. Syntax: window.scrollTo(eixoX, eixoY) $(function scroll() { window.scrollTo(0, document.body.scrollHeight); }) The…
-
1
votes1
answer58
viewsA: how to pass multiple database queries to a route?
For you to perform two queries and then do something with the results, you can use async/await. The results of the queries will be stored in the corresponding variables and you can make N queries,…
-
0
votes1
answer360
viewsA: Sequelize error when performing BD registration [Model.hasMany called with Something that’s not a subclass of Sequelize.Model]
Your problem occurs due to a typo. In the Model Factor, use this.hasMany(models.Sub_Fator, { instead of this.hasMany(models.Sub_fator, {. Emphasis on Subfactor instead of Subfactor. This is because…
-
2
votes1
answer67
viewsA: ATM simulator in Android Studio
What’s happening is that when you click on the button you call the method Verificacao. When this method is called, it checks 4 times (it is inside a for) for i = 0, 1, 2 and 3. To achieve correct…
-
1
votes1
answer509
viewsA: Android app generating Exception: androidx.fragment.app.Fragment$Instantiationexception
Summary Your fragments need a default constructor (no arguments) so that Android can recreate them when necessary (when changing the orientation of the phone, for example). Explanation When there is…
-
1
votes1
answer100
viewsA: I understand that the post method is getting it wrong at Postman
Probably what is missing for you is to indicate your POST Header: Next to the tab Body, select Headers. In Key, write Content-Type. In Value, write application/json. Send us your post. The…
-
1
votes3
answers303
viewsA: When I compare two strings to the "bigger" and "smaller" operators, what am I comparing?
According to documentation of Mozila: Strings are compared based on standard lexicographic ordering, using Unicode values. So, String words are compared letter-to-letter. You can see more…
-
1
votes1
answer108
viewsA: Variable char error C Visual Studio
The function scanf_s has an optional third parameter, which represents the size of the buffer in characters. I believe this is the problem that occurs in your case (not specifying this parameter),…
-
1
votes1
answer208
viewsA: Textinputedittext cannot be converted
In XML, your element with id formulario_cadastro_campo_nome_completo is an element TextInputEditText. In Java code, you are trying to put it into a variable of type TextInputLayout, so the error is…