Posts by Gustavo Sampaio • 1,180 points
38 posts
-
2
votes1
answer66
viewsA: How do I check if there is a number in a string?
The function input returns a string. So the first test works, because the method isnumeric belongs to the class str. However, Python does not perform type conversion to make comparisons as certain…
pythonanswered Gustavo Sampaio 1,180 -
1
votes6
answers37862
viewsA: How to remove characters from a string?
Another alternative would be this: string1 = "chocolate" string2 = "oca" result = ''.join(char for char in string1 if char not in string2) # 'hlte' print(result) I mean, we created a Generator…
-
1
votes3
answers3761
viewsA: Async/Await returning Promise{<pending>}
First, let’s try to understand certain concepts. How to create and use Promises? In Javascript, when you will create a Promise using the default constructor, you pass a function that has two…
-
2
votes1
answer374
viewsA: Textinput formatting problem in React Native
What I think is causing this distortion of the components by the appearance of the keyboard, is the use of percentage values as a measure. Similar things happen in web: .window { width: 200px;…
-
0
votes1
answer86
viewsA: How to mock a constant object in Jest
As suggested in the comments, you can choose to use the manual mocks. Using manual mocks Basically, you could create, within the resource directory that you’re importing, another directory called…
-
2
votes1
answer95
viewsA: Validation test works with numerical values but not strings
First of all, let’s notice some things. Two objects are not necessary when one belongs to a subclass of the other According to what you put in the question, the class Pessoa inherits (extends) the…
-
7
votes2
answers187
viewsA: How does regular expression with double range work?
Character class When you use character class notations - the notations between brackets ([]) - Are you saying that: capture a character that is within that character set. When you use the -, you are…
regexanswered Gustavo Sampaio 1,180 -
2
votes2
answers429
viewsA: Passing parameter navigation from stack navigation to child component
Hook useNavigation An alternative, besides the one given by @Lucassouza, is to use the hook useNavigation. Like the documentation itself says, it is most useful when you do not want to pass the prop…
-
1
votes1
answer226
viewsA: Provider Flutter: Exception Caught by widgets library
The problem that is occurring may be related to the expression I pointed out in the comments. That is, the following expression is inadequately written: FishNotifier fishNotifier =…
-
1
votes1
answer133
viewsA: cannot read Property 'Join' of Undefined - React
At least in the code snippet posted on your route to POST /shops, looks like you’re doing: return res.json({ shop: [] }); That is, at the end of the insertion of the new store, you simply send as a…
-
4
votes1
answer1251
viewsA: How to use the Assert statement?
First of all, let’s just put a little context. Debugging mechanisms during development It is often necessary, during the development of an application, to add certain debugging mechanisms in order…
-
2
votes1
answer106
viewsA: Trying to get data from the Mongodb bank
Although you are declaring the function asynchronous (using the reserved word, or keyword, async), you are not using the functionality that this type of function offers to wait for the result to be…
-
1
votes1
answer99
viewsA: I’m creating flap by the pygame and the animation is not working well
First of all, let’s understand how things work in Python. Definition of code blocks As you may already know (but it costs nothing to remember), in Python, the code blocks for certain structures (if,…
-
4
votes1
answer101
viewsA: Generics <? super T> and <? extends T>
Using as a basis that answer, that I even posted in the comments, I can bring to this situation saying the following: When you declare the method containsSame, thus: public boolean…
javaanswered Gustavo Sampaio 1,180 -
2
votes2
answers185
viewsA: How to take data from an array and distribute within a method?
I suggest, in that case, you use Prepared statements, both present in the PDO as in the OO interface of Mysqli, to avoid the famous SQL injections, which may indicate the vulnerability of your…
phpanswered Gustavo Sampaio 1,180 -
0
votes1
answer60
viewsA: Problems in incrementing a score / counter
I think the problem is in the code part of the function checker: function checker(input1, input2) { scoreCopy(); let valueA =0; let valueB=0; const score = { a: valueA, b: valueB }; //... } Every…
-
1
votes2
answers67
viewsA: Dynamic array in php for pg_insert()
With the method you were initially trying, it is also possible to get the expected result. However, using the for on account of the fact that array, in the example, you will have 6 items, the for…
-
1
votes1
answer621
viewsA: keycode - Javascript
When you create a function that is used as callback of an event, you must be attentive to the arguments that are passed to it. Every function that is executed in an event takes as argument an object…
javascript-eventsanswered Gustavo Sampaio 1,180 -
1
votes2
answers194
viewsA: validation in IF Jquery
From what I understand, you want to add the Eventlistener simultaneously in the elements that have the Ids: animate, animateServico, animatePortifolio. You can do this by simply adding the other Ids…
jqueryanswered Gustavo Sampaio 1,180 -
3
votes1
answer115
viewsA: How to find the lists that have a certain desired item
You are getting a different result because the algorithm you are using does not do what you are wanting. In the code, you check whether the index element 2, from sublist in position i, is equal to…
-
1
votes1
answer206
viewsA: How to use the value of a variable to define an object key?
In Javascript itself, an object can be created in two ways: // Forma 1 let obj1 = { name: "Fulano", age: 37 }; // Forma 2 let obj2 = { "name": "Fulano", "age": 37 }; That is, the key can be set with…
-
1
votes1
answer644
viewsA: Error using chatterbot in python ('chatterbot' is not a package)
That problem has already been reported and resolved in Stackoverflow in English. This may be caused by the fact that this file you are running, or some other file that is in the same directory, has…
-
2
votes3
answers386
viewsA: Change tab title with script, how do you do?
You can take the product name in two ways: by querySelector, or by himself getElementsByClassName (which you have tried to use). Fur-picking querySelector You can use a query to get the <h1>…
-
3
votes2
answers944
viewsA: PHP/JS - How to display an Alert() with the value of $_SESSION
I didn’t get full knowledge of PHP, but from what I’ve learned, I can say that the problem lies exactly in the fact that you’re trying to get the value in an HTML file, which you can’t "access"…
-
1
votes1
answer199
viewsA: How to bring an image of a website in the Node API request?
The only way I could find it was this: app.use((error, req, res, next) => { res.status(error.status || 500); res.send(`<img src="http://http.cat/${error.status || 500}" />`); }); That is,…
-
2
votes2
answers106
viewsA: HTML - is it possible to determine the content of an input?
If you want to set a default value for the input: yes, it is possible. You can use, as @Maycon said, the attribute value, not only for input textas well as for Submit inputs, radio inputs, among…
htmlanswered Gustavo Sampaio 1,180 -
0
votes3
answers194
viewsA: "break" does not finish execution as it should
Actually, Pycharm only runs, through Python, what you did, so the error is in the code. The first error that occurs is: if the user type correctly 'S' or 'N', he’ll never get into the while ask not…
-
1
votes2
answers39
viewsA: Print only the first and last date
Instead of just passing the data of the string response, you can save it inside arrays, and these arrays, you save it inside the array per. Thus: per.push([json[i].data_inicio_f,…
-
0
votes2
answers259
viewsA: AJAX request function that returns another function for JSON object manipulation
By the utterance of your question, I think you’re behind defining the famous, callback. You can find a definition for callback in that reply by @Sergio himself Stackoverflow in English: Callback is…
-
2
votes3
answers69
viewsA: Help with select in MYSQL
You can give a select sorting by the two columns you wish to use as a criterion. If I have understood correctly, you wish to give this select on the table Cliente. That way it would look like this:…
-
0
votes1
answer64
viewsA: Prompt still not running
One of the causes that might be preventing code execution has already been pointed out by @Isac: the method prompt returns a string. Therefore, if you want to test as a number, you can use the…
javascriptanswered Gustavo Sampaio 1,180 -
1
votes3
answers1204
viewsA: How to change the image of a button like Javascript?
The method getElementById really could be used. But, as the name says, it will only pick up an object through the object id, IE, you would have to add an id for each button, or image - which…
-
1
votes1
answer74
viewsA: How to insert anchors for my page?
If your button CONTINUE READING... is an element <a>, just add the attributehref, directing to the news page in question, as @hugocsl said. Already if it is an element <button>, you can…
-
1
votes1
answer91
viewsA: Null input via keyboard in a variable receipt via Javascript
When converting null, or an empty string, with parseInt, the assigned value will be Nan (Not-a-Number). Therefore, the safest possible way to test if the user has not entered any value is by using…
-
1
votes2
answers75
viewsA: image does not appear in javascript
The Javascript image builder is actually called Image. In your code, you put new image() instead of new Image(), with a capital "I". I hope I’ve helped!…
javascriptanswered Gustavo Sampaio 1,180 -
0
votes1
answer792
viewsA: How to remove a dropdown from within a list
There are two ways to remove an item from within a list: Through command del By the method remove Commando del Let’s say we have the following list: listadetuplas = [(1, 2, 3), ('a', 'b', 'c')]. To…
-
5
votes3
answers115
viewsA: Why doesn’t this equation compile?
According to what you have provided, the error is happening because of the math.cosh(2x). In a "written" mathematical equation, this 2x would be the equivalent of 2 times the variable x, or, in this…
pythonanswered Gustavo Sampaio 1,180 -
2
votes3
answers1858
viewsA: HTML does not recognize jQuery (imported or internal)
Try to remove the attribute type="text/javascript" of tags script jQuery. This may be what is preventing. In fact, it is not mandatory, as the site says W3schools, because Javascript is the default…
jqueryanswered Gustavo Sampaio 1,180