Posts by Daniel Mendes • 6,211 points
247 posts
-
4
votes4
answers1030
viewsA: Sum the n odd terms ,using Loop for ,without using list, allowed functions:input,int,print and range
There are some problems, like your range that is increasing (doubling) the amount of terms: range(n+n) To get the values, just access the loop variable, you already do this, but just print the…
-
2
votes1
answer217
viewsA: Treat File as String in Nodejs
Just like @Luiz Felipe quoted in the comments, you put the wrong encoding, but you did it twice. The first time as 'uft-8' as per your example: TypeError [ERR_INVALID_OPT_VALUE_ENCODING]: The value…
-
0
votes1
answer95
viewsA: How to make Progressbar in Kinter?
In fact the class SampleApp already has all the logic to create the window and a progress bar. You can choose to work only with this class, then remove the variable janela: import tkinter as tk from…
tkinteranswered Daniel Mendes 6,211 -
2
votes1
answer4368
viewsA: Run Selenium in Chrome invisibly (headless)
To not display the browser, you need to create a ChromeOptions and add the argument --headless. You will not need to install any library because the ChromeOptions is in the webdriver of selenium,…
-
2
votes1
answer93
viewsA: Limit number on an input - 2nd doubt
In the maximum number scenario be 10, you can change the function checa to allow the field to remain empty, thus allowing the minimum value to be deleted and the value 7 to be inserted: function…
-
2
votes3
answers167
viewsA: Why when rounding the sum of two numbers, the result is Nan?
The result NaN is due to the use of Math.round in a string. When you use the method toFixed, return is a string. numero1 = '1,10'; numero1 = parseFloat(numero1.replace(/[^0-9,]*/g, '').replace(',',…
javascriptanswered Daniel Mendes 6,211 -
2
votes1
answer36
viewsA: Consult products that have the same Cod and place in an array
The code is right, it turns out that if your query returns more than one line, you need to call the function mysqli_fetch_assoc inside a loop, to catch thus all returned lines: while…
-
0
votes1
answer40
viewsA: How to add 0 in a column?
It is possible to make a replicate of '0' depending on the size (len) of the value present in the field: concat(replicate('0', 3 - len(campo)),campo) as meu_novo_campo With your field, it would look…
sql-serveranswered Daniel Mendes 6,211 -
2
votes1
answer128
viewsA: Change color using querySelector and onmouseover
You can create the event onmouseover once you create the div: squareElement.onmouseover = function() { this.style.backgroundColor = getRandomColor(); } let btnCriar =…
javascriptanswered Daniel Mendes 6,211 -
0
votes2
answers865
viewsA: Calculate total amount and total SQL Server value with three tables
To group everything, you need to do two things in this query: Use the SUM also in the calculation of TOTAL_VALOR: SUM( dbo.tb_produto.val_produto * dbo.tb_produto.qtd_produto ) AS TOTAL_VALOR And…
-
1
votes1
answer1088
viewsA: Truncated data in Mysql
The error occurs because even the field produto_imposto accepting null, is receiving a value, a value of an empty string: ''. To correct this situation, you can choose to submit the value null to…
mysqlanswered Daniel Mendes 6,211 -
7
votes3
answers118
viewsA: Why doesn’t my program display the output values?
There are some points that are preventing your code from displaying something on the console. You use the variable idade in the conditions within the imprimirresultado, but this variable actually…
javascriptanswered Daniel Mendes 6,211 -
1
votes1
answer128
viewsA: Query data in a txt file with python Tkinter
The error message is being very specific, you are concatenating a tuple (tuple) into a string, this is not possible. To fix this very punctually, you can turn your tuple into a string, just call the…
-
0
votes1
answer152
viewsA: Convert string to XML object
You can import the library xml.etree.ElementTree and with it to parse and read the XML data. To parse, you can use the method fromstring, to find a tag, use the method find in the XML object, below…
-
2
votes4
answers333
viewsA: Bring only the values of the Python keys
As your keys in the dictionary are different, do the get putting only one of the names, will not work. If you repair well, in fact your code is looping in the return of the note key, thus printing…
pythonanswered Daniel Mendes 6,211 -
0
votes1
answer61
viewsA: Instantiating multiple objects
It is possible to work with a list, so for each CSV row you instance the class lancamento. I create a variable to contain class instances lancamento, Initiating it as an empty list: lancamentos = []…
-
1
votes2
answers244
viewsA: Is it possible to hide or change your "arrow" style from within input or datalists?
Yes, it is possible, using CSS. To remove arrows from the numeric field, do as follows: input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { /* display: none; <- Crashes Chrome on…
-
0
votes1
answer59
viewsA: Counter with float number
Your problem is in the scanf, some IDE even shows this underlined line, with a Warning, because since you are sending a float variable to it, you need to send the same reference. For this, you use…
-
0
votes1
answer74
viewsA: Error trying to save git repository log to txt (Python) file
One option, is for you to run git commands on Popen and with the return of the method, write to the file: import subprocess proc = subprocess.Popen(["git", "-C", ".", "log", "--first-parent",…
-
0
votes2
answers737
viewsA: Restarting a Python script with Input
Yes, it is possible to continue in the program without using a while or for, a way is by using the recursion. You can create a function that will be the body of your current menu: def opcoes():…
-
1
votes1
answer46
viewsA: How to collect information from a JSON file via AJAX (no use of Jquery)
Your code is practically ready, just check the status of the request within the onreadystatechange, using the property readyState, it can have the following values: 0 | UNSENT open() hasn’t been…
javascriptanswered Daniel Mendes 6,211 -
6
votes2
answers215
viewsA: How to access the lines of a file read by readlines()?
The method readlines will perform the complete reading of the file, returning a list with all lines found, and with that, it is positioned at the end of the file. When calling the method twice, you…
-
0
votes1
answer231
viewsA: I can only open png images with Tkinter
Tkinter Photoimage does not work with all image formats: https://docs.python.org/3.3/library/tkinter.html Note that the documentation highlights this part in the following excerpt: Photoimage can be…
-
0
votes1
answer304
viewsA: Entry method in Tkinter, Python
The error occurs because the return of valor.get() is empty, soon while trying to convert empty to float, you have conversion error, it is possible to simulate this same situation with the code…
-
0
votes1
answer39
viewsA: Problems with python 3
The error occurs as you are inserting the return of the method pack in the variable val, whereas pack does not have a return (None): val = Entry(win).pack() Thus generating the error:…
-
3
votes1
answer54
viewsA: How to write the following jQuery code in pure Javascript?
Variables need not be declared el and teste, only the section that concatenates the variable i in the el.innterHTML would be enough for the code to work, in fact they are not allowing the code to…
-
1
votes1
answer41
viewsA: I need help, I can’t get this script to work
The error is in the following excerpt: scroll.style.transform = 'scaleY(${value})'; See that you assign a string to the style Transform property. But actually, this should be a string template:…
-
3
votes3
answers56
viewsA: a line of my object array is missing
No item is missing from your vector, it turns out you used the method find, that returns the first item that meets your condition: const usuarios = [ {nome: 'diego', idade: 23, empresa:…
javascriptanswered Daniel Mendes 6,211 -
1
votes1
answer57
viewsA: jComboBox does not update data that is already in a . txt
A very simple way to do this is to partially isolate the code present in the method salvar in some other method, for example readText: private static void readText() throws IOException { fr = new…
javaanswered Daniel Mendes 6,211 -
1
votes1
answer306
viewsA: List count without repeating print - Python
You can use the Python Collections Counter, which will count the elements for you: from collections import Counter numero = int(input("Número: ")) freio = 0 l = [] while numero != freio:…
-
6
votes1
answer3164
viewsA: Create folder/directory with Node.JS
There are some methods within the fs that allow the creation of directories, one of them is the mkdirSync, example: const fs = require('fs'); const dir = "C:/Temp/Xisto"; //Verifica se não existe if…
node.jsanswered Daniel Mendes 6,211 -
0
votes1
answer69
viewsA: GENERATE A SELECT WITHIN A PROCEDURE
When you need to make one select within a procedure and loop it, usually working with a cursor, and the same needs to be stated within your procedure, see an example using your procedure and select:…
-
2
votes3
answers74
viewsA: Checkbox "Cannot access 'checkBox01' before initialization"
You defined the ID in the HTML elements, but at no time searched the DOM with javascript. To find the element, there are several functions, as every element has an ID, and the ID must be unique, the…
-
0
votes1
answer63
viewsA: For is not giving continue (Firemonkey)
This is happening because the TO of FOR is evaluated only the first time, so if its variable Emb_Maximo start with zero, even increasing it within the FOR, she will not be reevaluated and her FOR…
-
1
votes1
answer89
viewsA: I cannot understand this Typeerror : is not a constructor
The error is in your loop, inside the display method: mostrar(){ for(treino of this.lista){ console.log(treino.mostrar()); } } Note that in your loop, you do not declare the training variable, and…
javascriptanswered Daniel Mendes 6,211 -
1
votes1
answer250
viewsA: Dynamically generate input - html, javascript and Jquery
To create elements with Jquery, you can use the method append, and to return the value present in the input, you use the method val. Then at the click of the insert button, we take the value, we…
-
2
votes1
answer369
viewsA: Python stopped working, but I think it’s something in the code
Your code is correct, and it’s not really generating an exception, it turns out that at no point did you call the method mainloop, with this you create the entire interface and end up not displaying…
-
2
votes3
answers945
viewsA: How to get the biggest word from a string in Javascript?
There are several ways to do this, see below some examples: //String que será avaliada let string = "Bom dia a todos!"; //Declaro a maior string vazia let big = ""; //Transformo a string em uma…
javascriptanswered Daniel Mendes 6,211 -
3
votes1
answer28
viewsA: Inclusion of First Record using a select SUM
For cases like this, you can use the function NVL: https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions105.htm Using it, you generate a default value if the MAX return null, soon your…
-
0
votes1
answer1875
viewsA: Help on 2 Arrays questions
Thiago, In the first problem, it is quite simple, as the function must have the same structure as the function quantidadeDeMesesComLucro, just create the function quantidadeDeMesesComPerda, but with…
-
1
votes1
answer376
viewsA: View dialog screen to download with javascript
Hard, If you refer to the browser dialog that allows you to choose where to save the file, this is an option of the browser itself, where there is a configuration that the browser performs the…
-
0
votes1
answer78
viewsA: Display message
Rafael, To place the message 'unregistered product' if the list is empty, you can create a condition in the function lista who checks the list (compras) before performing the print loop, for example…
python-3.xanswered Daniel Mendes 6,211 -
1
votes1
answer379
viewsA: How to know the primitive type of a variable in python
Samuel, To return the variable type, you can use the function type from Python, it returns what type of variable. There is also the function isinstance, that instead of returning a type, you send…
-
2
votes1
answer707
viewsA: Is there any way to compare all item values in a python dictionary?
Nix, You can use the method keys from the dictionary to return the keys of the same and based on this perform their comparisons: a = {'valor1': 4, 'valor2': 5, 'valor3': 4} b = {'valor1': 2,…
-
2
votes1
answer1735
viewsA: Calculating the average and weighted average with For
Kioolz, You got some mistakes, let’s see one by one. Your first error is in the print line: print ("Este é o valor da soma dos produtos entre as amostras e seus respectivos pesos", PiXi)" You left a…
python-3.xanswered Daniel Mendes 6,211 -
1
votes1
answer768
viewsA: Play local video with HTML and Javascript
Robles, The way I know it, is you create the src the video with the aid of URL.createObjectURL, see an example below: $("#video").change(function(){ const files = $("#video").prop("files"); if (…
-
0
votes1
answer104
viewsA: How do I add an image to a python script using Tkinter
Gabriel, On the line you instance to PhotoImage, the image name needs to contain the extension for the program to find it, if your image is a jpg for example, you put the name with . jpg at the end:…
-
2
votes1
answer33
viewsA: Matrix in Python 3
Micro, A possible solution would be for you to print the blanks before your second for, something like that: print((num_linhas - linha) * " ", end="") With this you would generate the spaces to the…
-
2
votes1
answer152
viewsA: Callback in anonymous function returns Undefined
John, Ao uses the $.post, you are using an asynchronous function, soon it will go through this chunk of code and will not wait for the return of the API, the callback of the post is executed…
-
4
votes1
answer127
viewsA: How to include "space" on cards
Matheus, There are several ways to do this in javascript. One of them is using Template String: function cartao(titulo, nome, sobrenome) { return `${titulo} ${nome} ${sobrenome}`; } let…