Posts by Felipe Avelar • 9,507 points
190 posts
-
2
votes0
answers18
viewsQ: What HTTP method do you use to search for data using request body?
Previously, according to RFC2616, which dealt with the HTTP/1.1 specs, it said that the content of a request body should be ignored when the method used was GET. Therefore, the POST was used when we…
-
2
votes1
answer62
viewsA: Change the HTML background when input is true
Probably the path to the image url is wrong if the current directory does not need the / no /myimage.jpg or you can use it too ./myimage.jpg, Also, the apostrophes are missing within the url. Other…
-
5
votes1
answer241
viewsQ: How to test Exports of a package?
I have a file index.ts which is responsible for exporting all components as follows: export * from './components/com1' export * from './components/com2' export * from './components/com3' export *…
-
0
votes1
answer187
viewsQ: How do I update my package dependencies without publishing a new version of my package?
I am developing a package that is dependent on other packages. What I wanted to know is if there is a form of the package I am developing already download the latest version of the packages without…
npmasked Felipe Avelar 9,507 -
1
votes1
answer64
viewsQ: How to use Generics with the props of a component?
I’m trying to create a component that will accept a generic type within the props. I’m trying to do it this way: interface Props<T> { items: T[]; } const componente:…
-
3
votes1
answer172
viewsA: My useSelector variable is printing Undefined even when Reducer has returned the value
There are two unrelated problems in your code, so I’m going to split the answer into parts: How your state works First, you are trying to seek membership value directly in your Return with the line:…
-
10
votes2
answers6959
viewsQ: What is the difference between npm and npx?
I am studying React Activate and noticed that many places use the command: npx react-native run-android Why can’t I use the following command? npm react-native run-android And what’s the difference…
-
1
votes1
answer51
viewsA: Variable this.variable does not load the information for search, but for listing uploaded
The problem, basically, is that the list of Clientes was never started, for this, just create a new builder in the class ControleClienteService, implementing the method CarregarCliente(). That…
-
1
votes1
answer649
viewsQ: How to use . env in NPM publications?
I’m trying to publish a npm package with a file .env using the package dotenv. When I test locally using the process.env.MINHA_PROPRIEDADE, it works normally though, when I try to use installing the…
-
2
votes2
answers358
viewsA: how to get class name with javascript
For this you just need to take the accordion item that was clicked using the first parameter of the function you declare in the click. Once done, you can access the currentTarget of the event, which…
-
2
votes1
answer133
viewsA: Is there any way to force the stash override on the current modifications?
To overwrite the files with what is in stash, it is necessary to perform a checkout with the stash files, just use the command: git checkout stash -- . This command will take all the stash commits,…
gitanswered Felipe Avelar 9,507 -
2
votes2
answers384
viewsA: How do I find a particular file in all branches?
What you need to do first is find which commit deleted that file, for that, just use the following command: git log --all --diff-filter=D -- <seu_arquivo> This will give you all the commits…
gitanswered Felipe Avelar 9,507 -
4
votes1
answer57
viewsA: IF and ELSE check is not working
The problem is in how you do the check. When you run this line: const formError = $('.validate-error'); The jQuery will return an object with 0 children, but not a Undefined object, this will make…
jqueryanswered Felipe Avelar 9,507 -
1
votes1
answer49
viewsA: Why use local functions?
Quoting the documentation: Local functions make the intent of your code clear. Anyone reading your code will be able to see that the method cannot be called, except by the method that contains it.…
-
5
votes1
answer51
viewsQ: How to use multiple repository sources with priority in NPM?
I know it is possible to use local records with the command npm config set registry <registry url> However, as I understand it, this command changes the NPM to search only in that repository.…
npmasked Felipe Avelar 9,507 -
1
votes1
answer35
viewsA: How to fetch next pages until they run out
By checking the next link of the API you placed, I received the following URL: https://pokeapi.co/api/v2/pokemon?offset=20&limit=20 That is, it is possible to pass two parameters via GET which…
reactanswered Felipe Avelar 9,507 -
3
votes2
answers256
viewsA: How to get checkbox value unchecked using JS?
Just select all selected checkboxes using the querySelectorAll and checking that its size is greater than zero, as follows: let checkedBoxes = document.querySelectorAll('.messageCheckbox:checked');…
-
2
votes1
answer895
viewsA: CORS is not enabling
The problem is that you were not putting the full url and it did not identify the server request protocol. Change the url of the ajax request to http://localhost:3030/api/admin/employees should…
-
3
votes1
answer222
viewsA: Change default column Datatables JS
Looking at the documentation, it is possible to change the sorting of a Datatable using the property order which is a vector of two-position vectors, where the first indicates which column (from 0)…
javascriptanswered Felipe Avelar 9,507 -
1
votes2
answers193
viewsA: How to make a Select with multiple SUM?
What you are trying to do is count the number of activities per user. I imagine the following script solves your problem: select status, count(*) from tbl_atividades where responsavel = 'BRUNO'…
mysqlanswered Felipe Avelar 9,507 -
1
votes1
answer37
viewsA: Replace Content Collapse
The problem is that you are simply taking the content of div and checking whether it is being displayed or not. To solve the problem the correct one would be to do the following: function…
-
0
votes1
answer35
viewsA: Generate and delete rows from a table with Jquery
There are two problems with your script. The first is that i is being decremented after removing the line, so it will try to decrement a line that has not yet been created. The second is that you…
-
2
votes1
answer173
viewsA: Can I use the same SSH on two different computers?
It is possible to use the same SSH key on both machines. However, it is important to remember that the more devices that use this key, the more valuable it will be from a security perspective. It is…
-
0
votes1
answer86
viewsA: Group object in javascript by categories
To do this, just do the following: const data = [ {"moeda": "Real", "valor":-56.12}, {"moeda": "Real", "valor":-48.54}, {"moeda": "AU", "valor":-46.60}, {"moeda": "Real", "valor":-46.60}, {"moeda":…
-
0
votes1
answer346
viewsA: Removing elements in common between 2 arrays
To solve your problem just use a filter combined with a includes according to the following script: let array1 = [1,2,3,4,5,6] let array2 = [1,2,3] array1 = array1.filter(item =>…
-
2
votes1
answer130
viewsA: Problem with loop in React
The problem is that you are using the useMemo with only one parameter, this will cause it to execute every time the component is rendered, to solve this problem you must define the variable that…
-
2
votes1
answer1334
viewsA: Filter an object array within another object array
There are two solutions to solve your problem. The first is if you just want the drives, then you would do it as follows: array.map(obj1 => (obj1.movimentacoes.InternaMov.filter(obj2 =>…
-
2
votes1
answer2503
viewsA: Importing css into React JS
The problem is, in your code, you’re saying that the file style.css is on the way aplication\src\components\, since you are importing in the following way: import './style.css'; //Aqui diz para…
-
0
votes1
answer142
viewsA: Communicate Checkbox with Python
To solve, just use the fetch to solve your problem as follows: checkbox.change(function(event) { const checkbox = event.target; fetch(`http://www.example.com/?status=${checkbox.checked}`)…
-
0
votes1
answer363
viewsA: How to check a State to know if it is undefinied in React Native?
The problem is described in the Warning itself Invariant Violation: setState(...): takes an Object of state variables to update or a Function which Returns an Object of state variables. That is, you…
-
7
votes4
answers130
viewsA: String Manipulation in Javascript?
Just do the following: function adicionarTexto(str, caracter, indice){ return str.slice(0, indice) + caracter + str.slice(indice) } var wcalcAlm = ('0140') console.log(adicionarTexto(wcalcAlm, ':',…
-
3
votes3
answers175
viewsA: Typewriter effect is not working properly
The problem is that you are using the function querySelector and, how it is possible to see in the documentation, it returns only the first element found. To fix this you need to change to…
-
3
votes1
answer2105
viewsA: How to convert the response to an Axios request with React-Native?
As discussed in the comments, the problem is that data is a vector returned from the server, so unstructuring won’t work if you don’t tell which vector index you want to unstructure. To fix the…
-
1
votes2
answers176
viewsA: Get how many times each element of a list repeats
Just run the following code: import collections CLIENTE = ['MARIA','JOAO','MARIA','JOAO'] resultado = collections.Counter(CLIENTE) print(resultado) working example…
pythonanswered Felipe Avelar 9,507 -
0
votes1
answer186
viewsA: Include hour with minute in a javascript hour array
From what was passed in the comments, it probably solves your problem: function listaHorasDia() { var horas= []; for (var h = scope.horaInicio; h < (scope.horaFinal +1); h++) { horas.push({…
-
7
votes2
answers768
viewsA: What is the usefulness of the console.dir() in Javascript?
The console.log() and the console.dir(), today, do the same things. However, for some time, in firefox, the dir was tasked with printing the element tree, while the log was in charge of printing…
javascriptanswered Felipe Avelar 9,507 -
6
votes2
answers99
viewsA: Require function with another associated function?
That’s a high order Function, basically is a function that returns a function and executes the returned function. As we can see in the following example: function soma(a,b){ return a+b; } function…
-
2
votes1
answer40
viewsA: Function that returns the client name using the . filter method
As you can see by the error, the problem is that getNomeCliente is not void, nor returns anything (any), so something needs to be returned, in this case a string. Other than that, you can use the…
-
3
votes2
answers382
viewsA: How not to repeat CSS code
As discussed in the first comment, the correct thing would be for you to divide into classes, for example: .icone { width: 21px; height: 21px; background-repeat: no-repeat; float: left; margin-left:…
cssanswered Felipe Avelar 9,507 -
3
votes1
answer1423
viewsA: How to undo 'Discart All Changes' from Visual Studio Code
Changes that were not committed cannot be recovered as they have never been "tracked" by git, so unfortunately, it does not have a snapshot with these changes. If you have any plugin in vs code that…
-
1
votes1
answer466
viewsA: I can’t center the title
The problem is that you are not setting the header display. To solve this problem just add flex:1. In case your code would be: static navigationOptions = { title: 'Start', headerStyle: {…
-
4
votes2
answers330
viewsQ: Is it possible to have an app with multiple apps inside?
We are thinking about developing several apps to solve problems, and each app solves the problem of a sector. To avoid the user having to download the apps separately, we thought of making a Bundle…
-
2
votes1
answer1390
viewsA: Variable value change in React-Native
It is necessary to create an element in the state in its component. Following example: import React, { Component } from "react"; import { Button, Text, View } from "react-native"; class App extends…
react-nativeanswered Felipe Avelar 9,507 -
1
votes1
answer505
viewsA: How to create dynamic components in React Native?
The problem is that you are calling the function as soon as you create the component. Try to replace in the components the: onPress={this.setState({ rating: element })} for: onPress={() =>…
-
1
votes2
answers2901
viewsA: How to take the value of select
The problem is not in collecting the value of select, but in the fact that you are creating a new scope for the variable area, as I point out @Virgilionovic. Here is an example of an applicable…
reactanswered Felipe Avelar 9,507 -
4
votes1
answer107
viewsA: Feed from the list c#
The problem is that you only create an instance of the object Ti01() and keeps inserting it several times, just changing the information. The keyword new has the role of creating a new object (or…
-
2
votes1
answer182
viewsA: I want to add a key to my Javascript code on P5.js
Reading the documentation of P5, the problem is that you are sending a boolean, comparing event.key == 87, when in fact you just have to compare the direct value using the P5 keycodes. Try replacing…
javascriptanswered Felipe Avelar 9,507 -
-1
votes1
answer1135
viewsA: C#, what are methods, classes, and objects?
Estates: Set of characteristics of a given class. Methods: Class behavior would be equivalent to functions in a structured programming language. Builder: Initializes an object with past properties.…
-
2
votes2
answers703
viewsA: Problem comparing Strings in Java during the while loop
The problem is in the comparator you are using. Equality comparison, in java, should only use comparators == or != for primitive types. Since String is a class and not a primitive type, the correct…
javaanswered Felipe Avelar 9,507 -
10
votes2
answers609
viewsA: Difference between ?. and ?? in C#
Let’s go in pieces: The ?. is to avoid comparisons of the type obj != null ? obj.prop : null, that is, he will verify that what he has before the interrogation is different from null, for example:…