Posts by Daniel Mendes • 6,211 points
247 posts
-
2
votes2
answers178
viewsA: Format output in txt file
Santana, since you want to keep the data on the respective lines, I thought using a list of vectors would be an alternative: def verificaPrimo(num): if int(num) < 2: return False else: for n in…
-
1
votes2
answers306
viewsA: Print only palindromic words
Santana, using your example, I made some changes to get the result you say: I closed the file after using the same The function obtemPalavras started to return a list of words found in the file, and…
-
0
votes1
answer46
viewsA: Toggle CSS Classes
Good afternoon Lucas, below a way to disappear with the DIV when clicking on Completed Tasks, is basically the same code, the toggle method is given as true/false parameter to display or not.…
-
0
votes1
answer54
viewsA: Incorrect position when using import file
Breno, one way to put the text of the file in the textarea is as follows: var leitorDeCSV = new FileReader() window.onload = function init() { leitorDeCSV.onload = leCSV; } function…
-
2
votes2
answers158
viewsA: Take element from a string
Ericki, has how and there are numerous ways to do this, below two examples of how this can be done: var string = "Hello [background]image.png[background] World!"; //Pegando o valor com regex found =…
-
1
votes1
answer580
viewsA: What would be the equivalent of while in python?
There is no "do while" in Python, there are ways to do something very similar, using the options already existing in the language. Example: condition = True while condition: # Corpo do laço…
-
0
votes1
answer49
viewsA: How can I complete this function in Javascript?
Diego, if I understand correctly, one of the ways to implement this function is the following: function retornaEnderecoUsuario(endereco) { return 'O usuário mora em ' + endereco.cidade + ' / ' +…
javascriptanswered Daniel Mendes 6,211 -
0
votes1
answer678
viewsA: Take data from a.txt file and store it in a list
Eduardo, below an example of how the function for reading the TXT could be implemented (leTxt), I tried to maintain the same pattern of the function that you put as an example for writing data to…
-
0
votes1
answer233
viewsA: CRUD in Python - Search() function?
Milena, the open function is generating exception by not finding the file. The idea is you check the existence of the same before trying to open: def buscar(): n = input('Digite o nome do contato a…
-
0
votes1
answer42
viewsA: Variable sum does not take the value within the loop!
Rennan, it turns out your accumulator Somadosprecosdasmercadorias is receiving the value of the product but does not keep the previous value... To keep the values in the accumulator, you can use the…
-
0
votes1
answer49
viewsA: Debbuging no Node js
William, you need to change the way Vscode will debug the program. This is an example of Launch.json to debug with both Chrome and Node: { "version": "0.2.0", "configurations": [ { "type": "node",…
-
1
votes3
answers76
viewsA: I can’t get the algorithm to ask for a certain range of values
Dexter, there are several ways to do this, a very simple way, is to create a condition that stays in the loop and doesn’t increase its control variable: i = 1; menor = 9999999; total = 0;…
-
1
votes2
answers136
viewsA: Make histogram in Python
Mauro, import is really necessary. The error is no for inside the Counter, you sent the list and not the list item: import collections grades = [83, 95 ,91, 87, 70, 0, 85, 82, 100, 67, 73, 77, 0]…
pythonanswered Daniel Mendes 6,211 -
1
votes1
answer34
viewsA: Problem with Python Dictionaries
Bryan, the problem is only at the moment of incrementing the value of the already existing key, the correct is +=: def main(): insereDic() def insereDic(): frase = input('>>>') for i in…
pythonanswered Daniel Mendes 6,211 -
1
votes1
answer44
viewsA: Audio on the same page. Play at each other
Carlos, use the event play in place of the event click: $(function(){ $("#audio1").on('play', function(){ var pe = $("#audio2").get(0); if(pe.paused == false) pe.pause(); }); $("#audio2").on('play',…
áudioanswered Daniel Mendes 6,211 -
1
votes1
answer43
viewsA: Create elements with Json information
Tadeu, the error is only in innerHTML, because it is a property, not a function: https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML Fixing that part, your code worked: function…
-
2
votes1
answer470
viewsA: Python pile
Tatiane, your first if seeing the value of i is incorrect, and its verification in the second if, it is necessary to be isolated with parentheses, see a possible correction: def balanceada(string):…
-
2
votes2
answers964
viewsA: Show array elements in random order
Look, I found the following problems: Uppercase K in the array index Add + 1 in the Random, this can access a non-existent array position numeroPeople.length, it’s already a number, so you can’t…
javascriptanswered Daniel Mendes 6,211 -
0
votes1
answer23
viewsA: Use of the resizeto() javascript method
Opa, this method works Fernandes, but only in windows that you yourself initiated: <!doctype html> <html lang="en"> <head> <meta charset="UTF-8">…
-
0
votes1
answer52
viewsA: Get back empty nodejs + firebase
Erikson, the firebase get is being asynchronous, so you give the Return even before the business array is filled. You can pass getEmpresas to return a Promise, then when using this method, you do…
-
1
votes1
answer57
viewsA: code appearing as text
Maycon, your code has a snippet that displays the query if the user is admin: if ($_SESSION['HoopsUser'] == 'admin') { echo $sql; } I believe this is the reason to display the code in HTML, remove…
-
4
votes3
answers903
viewsA: How to assign Fetch value to a variable
Thiago, when you work with requests, usually they have asynchronous behavior, because of that you can not perform this direct assignment. An option would be to work with async/await, it would also…
javascriptanswered Daniel Mendes 6,211 -
4
votes1
answer714
viewsA: What are the differences between "checkout, revert and reset"
Well, I’ll try to describe how I know and use, because macros information, you find several around, after all GIT is extremely used. revert - It does the informed commit rollback, basically a…
gitanswered Daniel Mendes 6,211 -
1
votes1
answer41
viewsA: How to use a variable as part of a command?
Helder, I believe you want to replace the value present in the Count variable in the string, there are several ways to do this in Python, below some examples: count = 1 print(f'ip address…
-
2
votes2
answers167
viewsA: Calculator in javascript+ Html no Quit result
Dude, you just misspelled the property value, you left as values. The right thing to do: var numero1 = parseInt(document.getElementById('n1').value); var numero2 =…
-
2
votes2
answers141
viewsA: Help in Portugol (se e senao)
Torricelli, to keep the program running until the user enters the invalid number, the code can be as follows: programa { funcao inicio() { inteiro base,altura,area logico continua = verdadeiro…
portugolanswered Daniel Mendes 6,211 -
0
votes3
answers562
viewsA: Math library
Fábio, all are functions that return only the whole part. trunc = Returns only the entire part of the number, ignoring the decimals Ceil = Returns only the whole part of the number, rounding up…
-
1
votes2
answers112
viewsA: Separate a string into blocks according to similarity
Diovana, I made the following code to solve the problem, in it has some comments explaining how the code works: def conta_letras(string): #Pego o tamanho da string para verificar string vazia e…
pythonanswered Daniel Mendes 6,211 -
1
votes1
answer187
viewsA: Use column in oracle subquery
Igor, then use WITH to create this query, it is a great way to work with subquery: WITH MESES (MES) AS ( SELECT LEVEL AS MES FROM DUAL CONNECT BY LEVEL <= 12 ) SELECT (SELECT A FROM (SELECT 1 AS…
oracleanswered Daniel Mendes 6,211 -
1
votes1
answer76
viewsA: Popular and select a Select (Dropdowlist) option - jQuery - json
Wagner, following the example provided, scrolls to receive bank_id as a parameter in the function and mark Selected as the bank id is equal: function pupulateBank(array, bank_id) {…
-
1
votes1
answer35
viewsA: Difference between Jsviews and Jsrender?
Jsview is a data bind lib, while Jsrender is a template lib. Jsrender renders HTML using a template, while Jsviews that is built on top of Jsrender allows two way data bind. https://www.jsviews.com/…
javascriptanswered Daniel Mendes 6,211 -
1
votes2
answers135
viewsA: Make words of an uppercase array - jQuery
Wagner, as your wordUpperCase array contains only uppercase letters, you need to perform the search by performing toUpperCase: if (wordUpperCase.indexOf($.trim(word).toUpperCase()) != -1) { words[i]…
-
2
votes1
answer1288
viewsA: How do I delete a commit from github history?
Lucas, try to follow these steps: git checkout --orphan latest_branch git add -A git commit -am "commit message" git branch -D master git branch -m master git push -f origin master I have done that,…
-
4
votes2
answers5329
viewsA: The difference between req.params and req.query
Edgar, as far as I know, params are the parameters of your endpoint URL, while query are the parameters sent after query(?). For example, in this URL, it would look like this:…
node.jsanswered Daniel Mendes 6,211 -
1
votes1
answer54
viewsA: How to make input mandatory via javascrip
The required is inside the input, but your input must be inside a form, below an example, if you have doubt, take this excerpt and make a test: <form> <input required type="email"…
-
1
votes1
answer43
viewsA: How can I write the generated data in different lines?
The simplest way to do this line break is by using n: def esc(): arquivo = open(nameet.get(), 'r') conteudo = arquivo.readlines() conteudo.append(etmat.get() + '\n') arquivo = open(nameet.get(),…
-
0
votes1
answer28
viewsA: Problems in the execution of a function
It turns out that its function numpar has no return when the number is not even, as it does not have an explicit return, it will end up returning None. A possible solution is to make your function…
-
0
votes2
answers1959
viewsA: how to wait for a finished method to execute the next in angular?
JS is asynchronous, you can work with callback for this, the first method takes the second method as argument, after the processing of the first, it terminates by calling the second: function…
-
2
votes2
answers84
viewsA: Why doesn’t my if return true?
You are already using the src property when you take the element, but the src property can bring the absolute path from the image, so try to do a contained one (includes): <script> var img =…
javascriptanswered Daniel Mendes 6,211 -
2
votes1
answer38
viewsA: Wrapping Ivs with a class inside a repeat loop
You can create a function and call twice: <?php function colunaDiv($className, $primeiro, $ultimo) { echo '<div class="'.$className.'">'; for($i = $primeiro; $i <= $ultimo; $i++) { echo…
-
1
votes1
answer85
viewsA: Save click on localStorage
Oops, try it this way: <button class="texto">texto 1</button> $( document ).ready(function() { var savedText = localStorage.getItem('click'); if(savedText) { $('.texto').text(savedText);…
-
1
votes3
answers85
viewsA: QUERY LEFT JOIN - MYSQL
As already mentioned, the OR of your query must be generating the problems, always try to use the OR condition between relatives: SELECT `permission`.`visible`, `menu`.* FROM `tb_permission`…
mysqlanswered Daniel Mendes 6,211 -
0
votes1
answer99
viewsA: Javascript function returns Undefined instead of Boolean value
Paul, it turns out that your function returns a Boolean as the consumption of a service, so it stays with an asynchronous behavior, you would have to work with async/await or refactoring the code in…
-
1
votes1
answer75
viewsA: If no search by value
Hudson, check if it works as follows: valor.ToUpper().Trim().Contains("PROTHEUS") Or valor.ToUpper().Trim().Equals("PROTHEUS") Otherwise, check if this string actually has the current value,…
-
2
votes2
answers73
viewsA: Select MAX with the Unix Timestamp field
Levi, since this is an int field, the MAX will suit you perfectly, can continue using this way.
-
0
votes2
answers817
viewsA: Update to numbering in column order
Danilo, if this has not generated an infinite loop, you should have another line inside while adding @COUNTER to itself plus one: SET @CONTADOR = @CONTADOR + 1 Another important point, is that your…
-
0
votes2
answers302
viewsA: Should I create a container for each site/app or can I put them all in the same one?
I recommend this creation as there is also the possibility that you can reuse some container already created, to climb only one specific site you can work with the Docker-Composer and thus isolate…