Posts by Lucas Bittencourt • 959 points
47 posts
-
0
votes2
answers98
viewsA: How to create a program that checks the entry of a variable and only proceeds until it is valid (Type - Value)? Python
Hello, You just need to add a line at the end of the while to read user input again. So: while not isNumber(saldo): print("Please enter a valid value: ") saldo = input("Please enter Saldo: ") And…
-
0
votes1
answer27
viewsA: Delete position of array
Hello, It turns out that you put the current value of the order quantity into the variable size and after that, she is not changed, to correct, you can call him again: int size = pedido.itens().size…
-
1
votes3
answers338
viewsA: How to remove right edge using border-Radius
Hello, You can touch the property border of an element, specifying its side (top right, top left, bottom right or bottom left). And to do this the way you need to, put the following code under…
-
1
votes1
answer52
viewsA: I can’t reuse child class method
Hello, Turns out you’re trying to access the attribute saldo mother-class Conta. But, thinking about object orientation and visibility, these attributes can only be accessed by the class itself,…
-
1
votes1
answer66
viewsA: Send Ajax POST to another port?
Hello, To fix this CORS problem that is coming from your server, you can use the library cors, just follow these steps: npm install -s cors Now in your code node, you will import it. So: const cors…
-
2
votes1
answer54
viewsA: Problems with clicking on child elements of div
Hello, It turns out that when you send an event in an element that contains child elements that also contains events, by clicking on a child element, the event click parent element is also fired. To…
javascriptanswered Lucas Bittencourt 959 -
2
votes1
answer37
viewsA: Variable assigned to another parent variable
Hello, It turns out that when you do this, you reference one list to another, so in order for you not to create that object reference, you would have to make a copy. Just add the method copy, see:…
-
0
votes1
answer63
viewsA: How do I 'clean the results' when the user clicks ADD (activating the function Calc onclick)?
Hello, It turns out that the method appendChild always add a new child to the element. You can create a global variable called oldChild, and when calculating the sum, you check whether oldChild…
-
1
votes1
answer122
viewsA: Highlighting words from a paragraph using Javascript only
Hello, Let’s see the mistakes: You tried to take the elementp p instead of "p" When you did texto = texto.split(' ');, you tried to cut an object, not a text. For this, you could use texto =…
-
0
votes2
answers2367
viewsA: How to send a JSON object in a POST request with ajax?
Hello, Turns out you’re using simple quotes ' to open and close your string, so you could do it this way: data : '{"especie":"' + tipo + '", "gerencia":"' + setor + '", "numSGPE":"' + numSGPE +…
-
-1
votes1
answer2292
viewsA: I use vscode with Node, but it does not show my codes in js in output, I use code Runner tbm
Hello, You can press the screen F5 in the archive .js which will execute the code on Debug Console. Thus: You can run on the Console itself of your operating system as well (If using Windows, try…
-
0
votes1
answer18
viewsA: How it shows the value of a var within a java html span
Hello, Let’s start with the mistakes: Javascript is a language case sensitive, that is, the reserved word var will not be interpreted as Var. The same occurs with the Document that should be…
-
4
votes2
answers74
viewsA: I cannot use a value saved in the state of React
It turns out that the method setState acts asynchronously (and does not accept async await, only callback). So he ends up changing the value of buttonValue after the call of console.log. To solve…
-
3
votes1
answer461
viewsA: How to insert values into an empty array?
Hello, There are several ways to do this in Javascript. You can use the method push, adding elements at the end of its vector. Thus: arr.push(1); or arr.push({ nome: 'Lucas', sobrenome:…
-
1
votes1
answer136
viewsA: Assign values of an array within a specific index of another array - React JS
In Javascript could do as follows: users.find(user => user.nickname === response.nickname).socketId = response.socketId; In the React, you can use the spread operator to create a new vector and…
-
2
votes1
answer194
viewsA: I am unable to extract data from json - React-js
You’re sending cases_ids: caso.id, whereas caso.id does not exist in the scope of the function and can send this id per function parameter, thus: <button onClick={() => handleInsc(caso.id)}…
-
0
votes1
answer68
viewsA: Possibility to delete commit
Hello, You can reverse the último commit you made, as follows: Typo svn log -v -r M:N [--stop-on-copy] PATH Copy the Path of the last commit made (e. g: 6b955d0) Typo snv revert -v path to undo…
-
0
votes1
answer49
viewsA: I want to search a file with the value of a variable
Hello, You can use the following code: const image = import(`../../assets/home-images/${valor}.png`); and within a loop, pass it on the tag <img src={image} />…
-
1
votes2
answers110
viewsA: How to edit a li with Javascript?
Hello, The problem is that you can’t clean up the input after pressing enter? Well, the problem is you’re putting y = '', whereas y is the target of event of your list. For you to clear the contents…
javascriptanswered Lucas Bittencourt 959 -
2
votes2
answers190
viewsA: How do I create the variable that saves all this information and then displays it on the.log() console?
Hello, In Javascript, when you’re going to use ${variable}, you’re talking about template strings, which begins and ends with ` (crase). I made a modification to your code (and I packed a few…
javascriptanswered Lucas Bittencourt 959 -
1
votes1
answer11
viewsA: background image in div
Hello, Turns out that his div has no size, so the image does not appear! Put it like this: style="width: 500px; height: 500px; background-image: url(/assets/images/background/login-register.jpg)"…
angular-6answered Lucas Bittencourt 959 -
1
votes1
answer112
viewsA: Error while upgrading Github, pushing master
Hello, Turns out on the branch master has new items that were not synchronized with your branch master local. There in the error it says hint: 'git pull ...') before pushing again. Just give git…
githubanswered Lucas Bittencourt 959 -
1
votes1
answer107
viewsA: Undefined for the body of a request
Hello, You can make the following code in your main file (usually the index.js): const express = require('express'); const app = express(); app.use(express.json()); This allows the server to…
-
2
votes1
answer16
viewsA: Change byte value in nodes
Hello, In Javascript, the replace occurs only in the first item because it uses by default Expressoes Regulares. To get around this, you can use the following code: accountFinally =…
-
2
votes1
answer71
viewsA: Input does not accept text - React
Hello, The mistake I identified was that when you give the setValue(), you are using e.target.title instead of e.target.value and the same goes for e.target.description, since title and description…
-
3
votes1
answer189
viewsA: Python error saying that the file does not exist, but it does exist
Hello, It turns out that you are running your python file a folder before RD2, which ends up defining the project root as the folder containing the folder RD2. (I believe it’s running on Vscode) So…
pythonanswered Lucas Bittencourt 959 -
3
votes2
answers86
viewsA: What is the difference between paths starting with ". /" and "~/" ? What is a best practice?
Well, there are two ways: Terminal When talking about system directories, when using the ./, it points to the current directory, and when using the ~/, he points to the directory home/username.…
-
0
votes2
answers86
viewsA: How to delete unreachable files from windows TEMPORARY folder with a C#application
I believe you need to open the application as an administrator, so do the following steps: Click Project - Add New Item - select Manifest File (Windows only) Then a manifest file will be generated…
c#answered Lucas Bittencourt 959 -
0
votes3
answers307
viewsA: How to use if, Elif and Else
Hello, You can make the following conditional structure: n = int(input('De 0 a 10, qual a gravidade do crime?: ')) if n < 5: print('Os policiais podem resolver') elif n >= 5 and n <= 8:…
-
2
votes1
answer32
viewsA: What is wrong with my simple JS exercise?
Hello, The variable país is an HTML element, you have to use the attribute value of the object país. Try this: if (país.value === 'Brasil') {…
javascriptanswered Lucas Bittencourt 959 -
1
votes2
answers187
viewsA: Go through Array and remove words - Python
Hello, Instead of removing the elements according to the established rules, you may not even add them, so do so: for n in senha: password = n.strip().lower() length = len(password) if (length >=…
pythonanswered Lucas Bittencourt 959 -
1
votes1
answer40
viewsA: Nodejs ler json time series line by line
Hello, You can convert the data obtained from the API to JSON, thus: const data = JSON.parse(response); Right after you get the data and turn it into an object, you can put it into an array, like…
-
3
votes3
answers183
viewsA: Remove repeated elements using two lists
Hello, You can create a new list that will contain the non-repeated elements: arraySemRepeticao = [] # Lista que terá os elementos não repetidos convidados = ["Felipe", "Karen", "Matheus", "Tulio"]…
-
1
votes2
answers48
viewsA: Null Pointer Exception when trying to perform a @PUT
Try putting this: Puts @RequestParam("idCliente") int id and @RequestBody Cliente cliente public Response atualizarCliente(@RequestParam("idCliente") int id, @RequestBody Cliente cliente) throws…
javaanswered Lucas Bittencourt 959 -
1
votes2
answers4910
viewsA: Cannot GET /index.html Node JS error
Put this piece of code: const express = require("express"); const app = express(); app.use(express.static(__dirname)); But I strongly recommend serving static files inside a folder, for more code…
-
1
votes2
answers75
viewsA: Insert random elements into a Java Script array
Thus: arr.splice(2, 0, 3, 4) You can also do so: const array = [3, 4] arr.splice(2, 0, ...array)
javascriptanswered Lucas Bittencourt 959 -
0
votes1
answer392
viewsQ: Static int in class C++
Hello, the following code is showing error on the right: #include <iostream> using namespace std; class teste { static int x; public: teste () { x++; } } t1; int main () { return 0; } declare…
c++asked Lucas Bittencourt 959 -
0
votes0
answers157
viewsQ: Pause program while executing a c#code
I am in doubt in the use of threads, I want that, in a given time, the program stops responding and only comes back when I determine... Example: System.Threading.Thread.Pausa(); // Executa código…
-
0
votes0
answers25
viewsQ: Program does not appear in the toolbar on startup
Hello, I have the following error: when opening the program, its icon does not appear on Taskbar, and before that did not happen. It happened now! Here’s the image, when opening the program (Look at…
c#asked Lucas Bittencourt 959 -
1
votes1
answer591
viewsQ: Bring forward an already open program - C#
I have a program that, when trying to run, and is already open, it sends a message that it is already running, but, I wanted to know a way to bring the program forward when I try to open it. Code:…
c#asked Lucas Bittencourt 959 -
1
votes1
answer124
viewsQ: Nullreferenceexception in Winforms code
I believe it’s a bug not the code, but the compiler... When I eat this area of code, the error always goes to the next variable, or method. Behold: Part of the code: grpBoxMDeck[i] = new…
-
0
votes2
answers82
viewsQ: Working with vectors / matrices
Hello, I have the following question, I have 5 vectors string[] Defesa = { "Gigante", "Golem", "Gigante Real" }; string[] AtkTorre = { "Corredor", "Ariete de Batalha", "Gigante Real" }; string[] AP…
-
1
votes1
answer115
viewsQ: Instantiate method in Instantiated Form
Hello, I am with the following question, I have installed a new form with the following code: Form frmDialog = new Form(); Well, I want to do the following, in the form in which I instituted this…
-
1
votes1
answer279
viewsQ: Webclient C# finishing download before starting to download
I have a question, I am using Webclient in C#language, I have the following problem: I click on Download a file, and it does not start downloading, it says that downloading is already finished...…
-
1
votes1
answer164
viewsQ: Webclient.Downloadfile(Address, Filename) Doubt using variable
Well, I’m creating an upgrade system, and it’s giving error in one part WebClient web = new WebClient(); string DownloadVersion =…
-
0
votes1
answer171
viewsQ: How to put class information in an array?
To save lines of code, I do the following: PictureBox[] pic = { pictureBox1, pictureBox2, pictureBox3, pictureBox4, pictureBox5, pictureBox6, pictureBox7, pictureBox8 }; And I have a class called…
-
2
votes2
answers178
viewsQ: How to create events in a for repeat structure?
My question is the following, I am developing a program (I am beginner) in C#. The part I wanted to improve on is the following: I’m wanting to create different events in a for structure. For…