Posts by Danizavtz • 2,246 points
169 posts
-
1
votes1
answer49
viewsA: Deploy Node application in Heroku with ES6 modules?
In his file package.json you’re forgetting to put the word node or nodemon. Notice carefully the following line you are declaring: "start": "--es-module-specifier-resolution=node src" As it should…
-
2
votes1
answer27
viewsA: Mongodb not recognizing command when someone writes something in front
One way to solve it would be by doing the split of the message before making the query in mongodb. The split() method divides a String into a list of substrings, place these substrings in an array…
-
0
votes1
answer127
viewsA: < Error while consuming api using REST Debugger >
Since it was possible to make the request successfully via Postman. To try to solve this specific problem, one way is to click the button headers hidden on the Postman interface. Check which headers…
-
0
votes1
answer145
viewsA: Using IF ELSE JINJA2 Python and Flask
According to the code provided there are some adjustments to be made. To use a conditional if command in the Jinja template language, we must use the equality command, this way we must use the…
-
0
votes1
answer19
viewsA: Problems writing converted uuid from Binary(16) to csv file
It is possible to use the package uuid to transform bytes into a string, or a representation of a UUID. Follows documentation. Take the example: import uuid a =…
-
1
votes1
answer47
viewsA: How not to repeat information in a js Node file
One way to solve the problem is to not use the appendFile. Using your code, simply modify the appendFile for the function writeFile Follow an example: const fs = require('fs'); let data = null try {…
-
0
votes1
answer79
viewsA: Nodejs: In a controller method, how to perform two different model functions?
One way to solve it is by using a INNER JOIN. Here is an example of what a query would look like to solve this problem: module.exports.showAutorNoticias = function(application, req, res) { let id =…
-
0
votes3
answers64
viewsA: Python checking if the number is Float
One way to solve the problem is to put the user in a loop until the input is possible to be represented as a float type value. Follow an example: def lerNumeroFloat(): while True: try: numero =…
-
4
votes2
answers139
viewsA: What’s wrong with my code?
In your code, you are using the function getElementById, this way one should use the id of the elements to access them via javascript, just change this line to use the id of the element 'res': var…
-
1
votes1
answer130
viewsA: Update only in fields that have content other than null - Node with Mongoose
One way to solve the problem is to use the function find before updating the data. The find function will give you the values that are already filled in for the item you want to update. These values…
-
0
votes1
answer30
viewsA: Static no Django
After deploying the application, you need to execute the command: python manage.py collectstatic Thus the data of the Static folder will be copied in the proper places (configured in your…
-
1
votes2
answers73
viewsA: How to find strings within an array
Another way to solve this problem is by using a loop structure for in conjunction with the method startsWith javascript. Follow an example: const chave = ['idCard1', 'idCard2', 'idCard3', 'oi',…
-
0
votes1
answer23
viewsA: Request get Failing
You need to resolve the password before you can use the value. Here is an example: async asyncData (context) { try { const { data } = await context.$axios.$get('/vagas') return { vagas: data,…
-
2
votes1
answer53
viewsA: Delete repeated lines
One way to perform this routine is to break the task in two. This way, I would write first the select that solves this problem. I believe it is ready according to the code that posted. SELECT a.id,…
-
2
votes1
answer70
viewsA: How to print elements from a stack?
You need to add the method strip(). To remove whitespace at the beginning and end of the generated strings. A possible solution, using your code, would be: def __repr__(self): r = "" pointer =…
-
2
votes2
answers463
viewsA: Cannot find module 'body-parser'
Using the express version >= 4.16.0 is no longer necessary to install the body-parser to use the express. Follow the pr link with the merge: https://github.com/expressjs/express/issues/2211 That…
-
0
votes3
answers269
viewsA: How to Restart a Python Program?
An alternative to solve this problem is to place your code within the function restart_program, follows an example: def restart_program(): a_1 = float(input('Primeiro Termo: ')) a_2 =…
-
1
votes2
answers655
viewsA: Docker Compose + Postgres + Nodejs + knex API Connect in Bank
There are some problems with your knexfile.js. The recommended default lib to use with knex is lib pg Then you would have to modify in your file the client line to have the value: client: 'pg', This…
-
0
votes1
answer35
viewsA: Sqlite is not creating a table
By the code being displayed in the error message, you are trying to make an insertion in the table table. But you are creating a table with another name. The code snippet of the Insert is not in the…
-
0
votes2
answers176
viewsA: Extract XML file from a ZIP file
One possible solution to this problem is not to save the file in the zip and do the direct conversion to json before creating the zip. With the lib xml2json you can achieve the desired result. Using…
-
0
votes2
answers96
viewsA: How to stop a Quarkus application?
The correct way to stop an application is by using the Docker commands. These commands must be executed in the bash (shell) [telinha preta dos hackers]. The commands have been tested in linux…
-
2
votes3
answers713
viewsA: Combination of two lists in Python
Here is a possible solution to your problem: def senhaspossiveis(lpossiveis, dpossiveis): senhas = [] for letras in lpossiveis: for numeros in dpossiveis: combinacaosenha = letras+str(numeros)…
-
1
votes1
answer28
viewsA: How to resolve Templatesyntaxerror in Django?
To resolve this error remove the line that has the text: {% print(f"teste") %} If you want to print values inside your template the correct way is to put the values between two keys ({{ 'valor' }}).…
-
0
votes1
answer795
viewsA: My vscode terminal does not display the result
The correct way to execute your code would be to invoke python before the script you want to run, so we would have: python main.py We are assuming that the name of the file you want to run is…
-
-2
votes1
answer44
viewsA: Cannot POST /authenticate
Your file is ill-endowed. In case the solution was to remove the route /authenticate from within the route /registro/users. Follows the solution: const express = require("express"); const router =…
-
-1
votes1
answer52
views -
-4
votes3
answers819
viewsA: Update content of JSON file
Yes it is possible, just change the opening mode to write the file. Using your own code: with open('dados.json', 'a', encoding='utf-8') as gravar_file: #resto do código Note that in this solution…
-
1
votes1
answer246
viewsA: I’m having a bug with a bot to do operations on IQ Option
You are getting this error by trying to access an index in an array that does not exist. One way to try to solve is by checking the size of the array after splitting by value ; arrpar = x.split(';')…
-
0
votes1
answer894
viewsA: Cannot POST express error
In your html you must declare the tags name and placeholder within the tag input. Modifying your html we have the following code: <form action="/auth" class="login-form" method="POST">…
-
0
votes1
answer39
viewsA: SELECT HTML does not update after receiving data (Angularjs)
From what I understand, I could remove the concatenation from the string, and use only the second part. Your current code: ng-options="nat.Natureza as nat.Natureza +' - '+ nat.DescNatureza for nat…
-
0
votes1
answer39
viewsA: Run more than one csv file using python
One way to do it is by using the functions listdir and isfile. Follow an example: from os import listdir from os.path import isfile diretorio = '/home/usuario' lista = listdir(diretorio) for f in…
-
0
votes1
answer150
viewsA: Javascript Loan Calculator
One way to solve the problem of abstracting a select is by using the javascript gift manipulation api, the browser has several features that make it possible to do this procedure. One of the sites…
javascriptanswered Danizavtz 2,246 -
0
votes1
answer37
viewsA: Bot does not enter values within the def function, using send Keys command with the Selenium driver
If the indentation is according to the posted question, adjust your code to: def Entrar(Login, Senha): browser.find_element_by_id('Login').send_keys(Login)…
-
1
votes1
answer100
viewsA: Assign automatic email sending to a button using nodemailer
To create a route in your backend to handle email submissions, you’ll need to create an endpoint to manipulate the sending of your email. For this we will create the following steps: Create an…
-
0
votes1
answer526
viewsA: How to take a variable within a method of another class
The correct way would be to create a getter method, to be able to access the live value, from within the Player class. Follow an example: Java player. public class Player { private boolean vivo;…
-
0
votes1
answer49
viewsA: user error prevention, python code
A possible solution to your problem, would be to create a function to treat this case. It could be implementing with a stream much like what you use in your reading function gênero or asks if quer…
-
0
votes1
answer28
viewsA: Calculate column
To resolve this query using sql, you must use the function limit together with the function order by. This way your consultation would be: SELECT TimeID as 'Time', sum(if(Rodada > 0,1,0)) as…
-
2
votes1
answer40
viewsA: Object change with javascript
To solve this problem, just use the split function, the result of this operation is an array in which: at zero position will be the value "SP " in position one will be the value " Todas" So just…
-
2
votes1
answer58
viewsA: Problems instantiating objects in python
I don’t know the structure of your project, but in order to be able to invoke a class, you must be running your code on a python path. The definition of a python-path is to have a file __init__.py…
-
-1
votes1
answer128
viewsA: Need to declare an attribute in __init__
There is no written rule that you should declare the rules in your init() It’s just a matter of convention. When you declare the variables in init it is the equivalent of declaring their variables…
-
0
votes2
answers180
viewsA: How to include a html button from a php result
From what I understand, you want to copy an html element to clipboard when performing the click action. If your application handles modern browsers, these browsers have a new api that supports the…
-
1
votes2
answers69
viewsA: OFF - Is it possible to print a list value by passing its index?
A possible solution to this problem would be: distancia =[] salto = 0 while nome != '': nome = input('Insira o nome do atleta:') nomes.append(nome) if nome == '': break; for i in range(1,6): salto =…
-
1
votes2
answers368
viewsA: How to take data from a specific field in an XML,with Nodejs,and then save it in the Mongo database
If you want to use a solution that uses regular expression, you can try the following code: const entrada = `<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?> <session>…
-
2
votes1
answer84
viewsA: How to add variables concatenated into a url link?
You could try the following syntax: const email = proccess.env.EMAIL const token = proccess.env.TOKEN var config = { method: "post", url:…
-
1
votes1
answer44
viewsA: I am studying Python and using Google colab as an IDE. Using 033[m does not end the colorization. Can anyone help?
To return colors to normal, simply execute the following command: print('\033[31mOlá Mundo!\033[0m') print('Olá Mundo!') Note that in my solution I added the following command at the end of the…
-
1
votes1
answer23
viewsA: How do I make it appear in the same folder as the file that creates it?
If you want to create a file in a specific directory, just pass an absolute path for the file to be created. Follow an example: import sqlite3 nome_banco = '/Users/nomeusuario/database.db' banco =…
-
0
votes1
answer144
viewsA: My package.json is giving error!
If Voce wants to create a file package.json, Voce must execute the command: npm init -yes This will create a standard package.json. If you want it is possible to use iterative mode, to generate…
-
0
votes1
answer1372
viewsA: How to write to a txt file in Python?
To save the data to a file, just use the command open python, in it we should pass as parameter the name of the file you want to save as well as the modo how you want to open the file on file…
-
0
votes1
answer54
viewsA: I cannot add a line to a table using db.run() in sqlite3
To resolve this error: [Error: SQLITE_ERROR: near "PRIMARY": syntax error] { Errno: 1, code: 'SQLITE_ERROR' } It is necessary to correct your query that makes the insertion of the data, for this…
-
0
votes1
answer40
viewsA: How to remove part of a string to a certain point
One way to solve it is to use the index together with the method substring, to extract the necessary strings. Follow an example: const linha = "21/07/2020 16:34:42 - Adriana Gomes Carneiro…
javascriptanswered Danizavtz 2,246