Posts by Danizavtz • 2,246 points
169 posts
-
0
votes1
answer208
viewsA: Angular, Appcomponent and Appmodule error, not importing
To solve the problem, in the file app.component.ts it is necessary to remove the line: import { AppComponent } from './app.component'; That way everything should work again.…
-
0
votes2
answers4627
viewsA: Removing Characters from a String (JS)
Just retrieve your string, and remove all comma occurrences, and all point occurrences, replacing with the empty string. It is possible to do this using the following code: const valorstr =…
-
0
votes2
answers85
viewsA: How to calculate 2 inputs with comma and appear in a third input?
To be able to do this calculation it is necessary first to replace point to comma. In order for the number to be in a standard format the IEEE 754 which is the international standard for floating…
javascriptanswered Danizavtz 2,246 -
0
votes2
answers36
viewsA: Archive being written in several lists!
The problem is that when registering you are saving everything on the same line. For code to work it is necessary to save using line break (assuming you want to read the file per line in the…
-
1
votes3
answers137
viewsA: Problem reading readline keyboard input on R
From what I understand of your code, when the program asked the question Escreva sua idade: You did not enter a valid integer (for example, enter a string a or just type <enter>), but this…
-
-1
votes1
answer77
viewsA: Problems pushing to Github
Maybe your repository is sending unnecessary things you can see in the log that there are more than 400Mb to be sent to github. In total there are 472.59 Mib to be sent. Try to review what you might…
-
1
votes1
answer39
viewsA: Displaying the database error in fetch
To display error 400, you need to use the method catch, which has the resolution of the Promise in case there is an error in making the request. An example using your code is the following: function…
-
0
votes1
answer48
viewsA: How to save data to a file?
To solve this problem, you must create a file, and write the output of your print in the file. In my example inputdata would be your data array with open('data.txt', 'w') as f: for linha in…
-
10
votes3
answers758
viewsA: Random choices in a Javascript array
Could implement as follows: choices[Math.floor((Math.random() * choices.length))]
javascriptanswered Danizavtz 2,246 -
0
votes3
answers86
viewsA: vuejs returns student object null when trying to search student by id
To solve this specific problem, in your catch block, you should treat the data to get an expected return. Here’s an example of what the block catch would look like: .catch((error) => {…
-
1
votes1
answer44
viewsA: How to put 2 conditions in the same if?
To put two conditions on the same if just use the operator and if (velocidade1>=80 && velocidade1 <100){ alert("Velocidade alta, considere diminuir!") }…
javascriptanswered Danizavtz 2,246 -
1
votes1
answer30
viewsA: Why does the ELSE Condition validate even if it is True?
The use of your parole is wrong. From what I understand, a possible solution to your problem would be: let valor=prompt("Digite um número:") if(valor<20){ alert("Valor menor que 20") } else…
javascriptanswered Danizavtz 2,246 -
0
votes1
answer119
viewsA: Javascript: Problems running a function. How to improve code?
Here is a possible solution to your problem. function buscarDivisivelPor(a, b) { for (let i = 0; i < a.length; i++){ if (a[i] !== 0 && a[i] % b === 0) { return a[i] } } return "Nenhum…
-
1
votes1
answer94
viewsA: Be displaying the data on the front end with Node.js
It is possible to achieve the expected result using the following standard. From what I understand, you want to display the result of two tables on the same web page. Using your code as an example,…
-
2
votes2
answers640
viewsA: Code gets all white in VS Code, no syntax highlighting or suggestions
To change this setting just modify how the file is recognized by Vscode. To make that change: Click on: select language mode In the text box that opens type: html Press enter The text must be in the…
visual-studio-codeanswered Danizavtz 2,246 -
0
votes1
answer14
viewsA: How to transition a Jira through a Jira endpoint call
Error 415 is usually related to the type of call that was made, when the server cannot serve the request in the requested format. According to the documentation you provided. You may have missed…
-
-1
votes1
answer47
views -
1
votes1
answer19
viewsA: How to search by parameters
When I wish to make an appointment by query params, I use the following code. getMedicos(especialidade): Observable<Medico[]> { return this.http.get<Medico[]>(this.medicoUrl, { params: {…
-
3
votes1
answer191
viewsA: What type used in Postgre to save a large currency field in the format of 000,000,000,000.00
postgres may use a custom currency type. The largest capacity for a custom type that we can represent of the type float (with 2 decimal places) is the following: create table pagamento( id serial…
-
0
votes2
answers87
viewsA: How to use rowCount to limit the number of records in a postgresSQL database using Node js?
To implement the desired behavior, vc can do the following flow: exports.countElements = (req, res, next) => { const sql = 'SELECT COUNT (*) FROM segunda'; postgres.query(sql, (err, result) =>…
-
1
votes1
answer45
viewsA: java.lang.Nullpointerexception error even with instantiated and initialized object
You must access the attributes setar attributes through the "setters" of the class. In addition, you must set the attributes before accessing the variables. In your example, before accessing the…
-
2
votes2
answers7986
viewsA: Make a Program that reads three numbers and shows them in descending order. Python
Hello, a different way to solve is by using listas and for. follows an example: lista = [] qtd = 3 for i in range(qtd): elemento = int(input('Digite um numero: ')) lista.append(elemento)…
-
1
votes1
answer411
viewsA: How to protect routes at angle 8?
The correct way to restrict routes is to implement the interface CanActivate, which should be used in a routeguard. The tutorial I used to implement this behavior was this.…
-
2
votes1
answer70
viewsA: How to put color in text
It is possible to put the color in the elements as follows, for the color red, yellow and blue just put the following functions: //vermelho printf("\33[1;31m"); printf("Hello World"); //azul…
-
0
votes1
answer64
viewsA: Error Python with PIP
The correct way to install dependencies using Pip is via a file .txt. To generate this file you need to run the command: pip freeze > requirements.txt After running this command just do the…
-
0
votes1
answer44
viewsA: Set value within an object equal to the previous value
You could use the spread operator (...): An example: const obj = {a: 1, b: 2}; const obj1 = {c:3, ...obj}; or try if you are using an older javascript version Object.assign(): const obj = {a: 1, b:…
-
2
votes1
answer256
viewsA: Scroll through a list inside another List
This error occurs because you are trying to scroll through a number. Using his example, he tries to iterate the elements 'spam' and '1'. As they are not a list, the error occurs. One way to solve…
-
0
votes1
answer24
viewsA: How to make changes on a usurious registered with the PUT method?
Here is an example of update code using mongodb. But this same logic can be used for relational databases. usuario.routejs. const router = require('express').Router(); const userController =…
-
0
votes2
answers543
viewsA: How to generate random numbers without rethinking in Java?
Another possibility to implement: import java.util.Scanner; import java.util.List; import java.util.ArrayList; import java.util.Random; class Main { private static Scanner scanner; public static…
-
1
votes2
answers70
viewsA: Which files should be ignored by Git in a Mongodb database?
To solve this specific problem it is necessary to create a file .gitignore at the root of your project’s directory and add the directory data/ as a line from this file. $touch .gitignore &&…
-
0
votes1
answer210
viewsA: How to correct this NODEMON error?
This error is not related to nodemon. nodemon failed to load the modules due to build failure. Have an error in file Taskvalidation line 7. Missing to add double quotes (") in your string. where…
-
0
votes1
answer20
viewsA: Implementing view
If the data type of the column data_solicitacao date is necessary to cast in order to compare the values correctly. In your query you have a data_request (date type) and are trying to make a…
-
3
votes1
answer27
viewsA: Vuejs: no-unused-vars
In the scripts section of your Vue code, you should add the key components. As follows: <template> <div> <LeadInfo></LeadInfo> <Container></Container>…
-
1
votes4
answers747
viewsA: Get the most frequent and least frequent element from a list, plus the largest and smallest
In python, when we have a list and want to know the highest value, we can use the max method. Follows the documentation for reference. So, using your code, to find the highest value, we can simply…
-
0
votes1
answer75
viewsA: Group and add arrays with equal properties
A way to implement using ties for is the following: const x = [{produtoId: 5, quantidade: 10}, {produtoId: 6, quantidade: 20}, {produtoId: 5, quantidade: 7}] const y = [] let inserir = true; for…
-
-2
votes1
answer41
viewsA: I’m developing a python R.A. generator, and I’m having trouble printing a sequence
The desired result can be achieved using the following function: print('R.A.: {} {} {} {}'.format(lote, tipo1, sequencial1, digital_root ( num ))) # R.A.: 28 0100 00921 5 I hope I’ve helped.…
python-3.xanswered Danizavtz 2,246 -
-2
votes1
answer113
views -
-2
votes3
answers71
viewsA: How to work with files and database in a way that is possible to consist
If you use database, it is possible to do all this in a block transaction of the database, when there is any failure in any of the previous steps, just make a rollback. Otherwise, commit. If you use…
-
2
votes1
answer44
viewsA: How to make a python program capable of executing the ifconfig command and displaying its output on the screen?
Hello, to achieve the desired result, just use the module subprocess Follow an example: import subprocess subprocess.call(["ifconfig"]) ifconfig is a linux command that lists network interfaces. To…
-
0
votes1
answer286
viewsA: Change values in the html page using javascript
Hello I will make an example here of how could be the solution, but there are several ways to solve the problem. In my example I added id in the following elements, you should possibly use id in all…
-
0
votes1
answer180
viewsA: I’m having doubts about how to insert several elements into the database by mysql.
One way to solve using your code is by using the f-string python 3. Simply modify your code to: import mysql.connector cnx = mysql.connector.connect(host='localhost', user='root',…
-
1
votes1
answer25
viewsA: My Node.JS keeps running in the old version
According to the documentation, just add the line: "engines": {"node": "10"} In his package.json…
-
0
votes1
answer198
viewsA: Use variable obtained via input and declare in URL
One way to solve using the code you developed is to: Within the function getGit() do the necessary routines, as you already use the attribute id, I’ll make an example using the id of the input…
-
0
votes2
answers217
viewsA: Nodejs and Mysql: Query 3 columns
One way to put this validation is to do it via database, just configure the respective columns to be of the Unique type. By entering the database will already do this validation for you. You can…
-
1
votes1
answer50
viewsA: How to create a test for a function with a service inside?
I don’t know the details of the implementation but it would be a way to force the error. For the examples of my attempts I will highlight only the excerpt I modified in relation to your code: One…
-
0
votes1
answer657
viewsA: Javascript Console.log (beginner)
One way to resolve is to put the quotes around the string you would like to print. const endereço = 'Rua dos Pinheiros' console.log(`Eu moro na "${endereço}"`);
-
2
votes2
answers52
viewsA: I’m not finding the highest value in a list with random values
Another more pythonic way to respond is by using the function max which is provided by python. from random import sample lista = sample(range(0, 200), 50) print('O maior elemento é:…
-
0
votes1
answer54
viewsA: Find at least one result within a mongoDB array
According to the documentation to achieve the desired result just change the operator $all for $in A possible solution would be: const posts = await Posts.find({ tags: { $in: user.tags } });…
-
2
votes3
answers1081
viewsA: error install virtualenv in python
If you use linux, you should install the virtualenv for apt-get Follow the command for installation: $ sudo apt-get install virtualenv After installing virtualenv it is possible to use Pip. To start…
-
0
votes3
answers1305
viewsA: Validate element in Selenium Webdriver
When I needed to implement a logic similar to this one I used the Expected Conditions in conjunction with Webdriverwait. I used Selenium for python. But this is the idea. That number 10 is the…