Posts by Marcos Alexandre • 1,284 points
56 posts
-
-1
votes1
answer28
viewsA: I do not know what to do, I’m making a table of results for an exercise and says that is giving error in line 4
You need to convert the input to some numeric type. Because the default is to return string # a função float abaixo faz a conversão de tipos a = float(input ('Primeiro número: ')) b = float(input…
pythonanswered Marcos Alexandre 1,284 -
0
votes1
answer17
viewsA: Hide a radio button when clicking another radio button
If you want to allow multiple selections, you should not use the Radio Button Because his idea is that you choose only one. I suggest you use Checkboxes for that. I also suggest that hide the…
-
1
votes2
answers24
viewsA: How to apply different effects at the same time?
If you place the two icons on a parent element, you can use the :hover of the parent to activate both icons. #icone-1, #icone-2{ width: 24px; height: 24px; background-color: yellow; border: solid…
-
0
votes2
answers35
viewsA: Switch between css classes with only 1 code
To make sure you have removed the other effects before applying the next ones, I suggest you remove the effect classes. Also, to simplify the function, simply create the classes that indicate effect…
-
0
votes1
answer16
viewsA: Error: Object of class Student could not be converted to string
Your error is in the last line. Note that you used the dot (.), the string concatenation operator. With this, the interpreter tried to convert the object to string in order to concatenate with the…
-
0
votes1
answer29
viewsA: Autocomplete dropdown menu
You need to call the autocomplete function for a array which contains the concatenation of all arrays race: const todasRacas = [...racasP1, ...racasP2, ...racasP3]; //aqui, todos os elementos dos 3…
-
0
votes2
answers86
viewsA: How can I simplify these two functions?
To create a function that disappears or linhas or colunas, the function should receive a parameter indicating what it should add. From there, a conditional chooses which parameters to add, as well…
-
0
votes2
answers54
viewsA: Can someone help me subtract one list from another?
Do verification by lista_inicio and store all elements that are not in the lista_chamada: def compara_chamada(lista_i, lista_c): return [i for i in lista_i if i not in lista_c] lista_inicio = ["1",…
-
2
votes3
answers74
viewsA: Display warning message when typing numeric value
If you want to restrict the value to be entered to say R$ 100,00 (or any other value), you must compare the content of the input with 100 (or the desired value) and display the alert. In the case…
-
0
votes1
answer42
viewsA: Select JS data
You need parse the result and with it, access the desired field: var url = 'https://economia.awesomeapi.com.br/last/USD-BRL' var xhttp = new XMLHttpRequest(); xhttp.open("GET", url, false);…
javascriptanswered Marcos Alexandre 1,284 -
0
votes2
answers39
viewsA: Change value of FALSE TRUE column
Dear, The syntax is UPDATE [table] SET [field] = [value] WHERE = [criteria]; Below how it would look (whereas the 'Boolean' you say is the value’t') update produto set permite_venda = 't' where…
-
0
votes1
answer37
viewsA: CKEDITOR - HELP!
Dear, Considering what you described, I believe that the initialization of the Ckeditor is occurring prior to the loading of the data. That is, when you try to initialize, this element does not…
-
0
votes1
answer14
viewsA: Listing duplicate data when performing SQL and performing . load()
Hello, it seems that you are not cleaning the table before reloading the data. Try to create a TBODY after the THEAD and give the .append() on it (after cleaning it): <!-- tabela --> ...…
-
0
votes3
answers47
viewsA: How do I make a DIV appear when positioning the mouse on top of an img?
Hello... Maybe the suggestion below will help. Basically the strategy is as follows: The button that has the menu is actually the menu itself that will expand. To ensure performance, it is set to an…
-
0
votes1
answer53
viewsA: Read a specific line in Javascript
Simply make a split by line breaks \n. You will get an array of all lines of text. The contents of the 3rd line will be at position 2: const textoLido = `CLIENTE: FULANO DE TAL DANFE: 123456 CÓDIGO:…
-
0
votes1
answer42
viewsA: Take the separate background gradient values and save to a new array
I think that solves your problem: Using a regular expression to identify the contents of each rgb(R,G,B), where R, G and B are numerical values: From these, iterate for each string rgb(R, G, B) and…
-
2
votes2
answers79
viewsA: Regular expression for validating string and int in php
Hello You need an ER that contains the static part and the variable: In your case 'ES-' is the static part and the digits are variable. Since you need an integer after the '-', then use the ' d' to…
-
3
votes1
answer44
viewsA: How to reallocate the input(color) color palette box?
Initially, I believe that. As seen in MDN, which I translated (elementary) below, the information is that the component is stylized and displayed by the browser, and we can not change them.…
-
1
votes1
answer22
viewsA: I can’t inform you that any results were found inside a javascript search/filter
To show the first line (#not-found"), you need to know how many elements the filter returned. If this number is 0, simply display the #not-found line. Follows the code. var $rows = $('#table…
-
5
votes2
answers48
viewsA: How to create a View with 2 tables with different columns in SQL?
Hello... What matters is that in UNION, all returns are equal in quantity and type, so in columns that do not exist, put null, or a default value. For example: select tipo 'pessoa' , nome ,…
-
1
votes2
answers45
viewsA: How to show the error message of validating a data on the screen with append?
Hello, Disregarding other possible flaws, I believe the problem lies in the function print_r. According to the documentation, it prints the contents of the variable in a "human readable" manner. But…
-
1
votes2
answers44
viewsA: Mysql table return with PHP foreach
Hello, the function fetch() PDO returns an element and puts the pointer on the next, if you want all, use the fecthAll(): <?php include_once('evento/action/conexao.php'); $database = new…
-
4
votes5
answers120
viewsA: Merging an array with an object array
You need to iterate through all 'Applications' elements and for each of them to check all 'Apis'': let apis = [{id: "1", name: "api 1"}, {id: "2", name:"api 2"}, {id: "3", name:"api 3"}]; let…
-
2
votes2
answers74
viewsA: Dúvida Postgresql
Hello... In this passage Count(p.gallery) the total, ',')' Remove the 'as total'. It’ll stay that way: ... count(p.galeria), ',') And you can give a nickname to the final result: ...…
-
0
votes1
answer45
viewsA: Prevent user from typing street type
There are several strategies for this, below one that should help. //Pego todos os tipos que existem const tipos = document.querySelectorAll("#tipoLogradouro option"); //Pego o input com a…
-
4
votes1
answer71
viewsA: place the result of each iteration of the cycle in html for
Hello, The problem is in two places: You are creating a new variable days. It is an empty vector, returning length = 0; The way to create the elements is wrong. const cost =…
-
1
votes2
answers354
viewsA: How to separate items from an object array by dynamic types?
Use the filter to check each item, and choose by type (or other property) You must pass a callback, which will check each element of the array. If this callback returns true, the element will be…
-
3
votes1
answer112
viewsA: SELECT in two different tables with variables of the same name
You need to use a middle name alias to return it: SELECT DISTINCT andamento_processual.licenciamento_cod, andamento_processual.inter_simplificada_cod, andamento_processual.inter_pretendida_cod,…
-
0
votes2
answers56
viewsA: How to return only the last maintenance line of each equipment?
You can use a CTE to select only the last maintenance and then use in JOIN, it gets more semantic. Example (remember to fit existing tables): Here a sqlfiddle: with ultima_manutencao as ( select…
-
0
votes3
answers70
viewsA: First decrement in Javascript with post-decrement operator ("number-") differs from "number - 1"
This happens because there is a difference in using the operator -- (or ++) and the other way (x + 1 or x - 1). The difference is this: how much do you use the ++ (or --), the order in which it…
-
0
votes1
answer56
viewsA: Take value in Currency and remove "." and "," from an input field?
You need to divide by 100, because by taking out the comma, you’re adding zeros to the right: $campoValorMax.addEventListener('focusout', (event) => { $valorMax = event.target.value;…
-
0
votes1
answer47
viewsA: Add JSON array value in PHP
Hello, Utilize json_decode to get a PHP variable containing the values. From there, itere for the variable and sum all the elements: $meu_array = json_decode($json); $soma = 0; foreach($meu_array as…
-
2
votes2
answers62
viewsA: Separate and print Object items in HTML
Hello... It seems that the error is here: ocument.getElementById("demo").innerHTML = obj.value + ", " + obj.uri" ... <br>" Note that you parsed the obj that has a property 'items'. The right…
-
0
votes1
answer26
viewsA: How do I print the conditions results inside the php index?
Hello, Make sure the code below answers. Note that ifs have been drastically reduced, and that if you want to add new profiles and conditions, just extend the multidimensional array. //escolhendo…
-
0
votes1
answer27
viewsA: How to establish a communication, in the same file, between multiple PHP tags
Hello... If you want to keep the object '$conta1' between requests, you will have to save it somewhere, possibly in this case, the ideal is the superglobal $_SESSION. Do the following: // no começo…
-
0
votes1
answer37
viewsA: List table with increasing numbers with pagination
Hello, You can also bring straight from the database using the function row_number(): select -- o 'order by' abaixo deve ser o mesmo ... -> row_number() over (order by ranking) sequencia , * from…
-
1
votes1
answer210
viewsA: URL Friendly: How to insert a php variable into a URL
Hello, What is happening is the following: the url apache received is not compatible with the regular expression of the rule you passed. That’s why she’s expecting a text that contains: 1) the site;…
-
1
votes1
answer91
viewsA: how to decrease ifs? in python
Hello, Try testing the extremes first: For example, all heights less than 1.20, and within that, all weights. And also for weights: less than 60, or more than 90. Example: alt = float(input("Digite…
-
13
votes1
answer250
viewsA: In how many milliseconds is the drag event fired?
Hello, Ondrag events (as well as others of the same type, dragstart, dragenter, etc.) implement the HTML5 specification 'Dragevent' interface. This interface defines various events and how these…
javascriptanswered Marcos Alexandre 1,284 -
-1
votes1
answer63
viewsA: Save data to a variable inside the for in Laravel
Hello, What’s happening is that you’re overwriting the variable every time. To transform into an array, use the brackets '[]'. Look below path = array(); //inicializando o array (boa prática) public…
-
1
votes1
answer88
viewsA: Adding several inputs with same id jquery or Avascript
Hello, I created a jsfiddle to exemplify, but below follows a function that does this. function calcularFinal(){ soma = 0; numeros = document.querySelectorAll('#produ') .forEach((elemento) => {…
-
1
votes1
answer816
viewsA: Create Countdown timer in javascript
Good morning, You need to set a range of 1 second so that a function is called constantly. To do this, use setInterval; Try something like that: var tempoEmMinutos = 15; var expiracao = new Date(new…
htmlanswered Marcos Alexandre 1,284 -
0
votes1
answer49
viewsA: SQL returning empty, if($id == "" or $id == null or $id == 0) but only falls on Else
Hello, The error happens because you have no record in the database. Thus the function does not return an array but a primitive. What causes an error in trying to access index '0'. Check if the…
-
2
votes1
answer40
viewsA: How to select the last option in a dynamic drop-down list
Hello, You can use 'Document.querySelectorAll': document.querySelectorAll('#pagarme-installments option:last-child').item(0).selected = true In querySelectorAll we use the CSS selector syntax. In…
-
0
votes1
answer150
viewsA: Postgresql: Select between dates + time
Hello, From what I understand, you give a date from which you want the interval of 24h (or 1) day after the chosen time. Try to use the interval: select * from movimentos where true -- obeservar que…
-
0
votes1
answer87
viewsA: How can I decrease the level of complexity of this function?
welcome to the Stackoverflow. A simple solution to this would be the use of regular expressions to identify the groups that form the phone number: ddd, first and second parts. For example (11)…
-
1
votes1
answer225
viewsA: Save checkbox fields that are displayed through a WHILE with PHP?
Hello, Try modifying a little to send the ID of each task: When generating the checkboxes ... while ($cont = mysqli_fetch_array($resultado)) { ?> // Os registros são exibidos como checkboxs... //…
-
1
votes1
answer38
viewsA: Elements of a PHP table appear repeated and others do not appear
Hello... The problem is in the SQL query. You are asking the database only courses with registered teachers (through the INNER JOIN), so that everyone comes (even without teachers), use the LEFT…
-
0
votes1
answer39
viewsA: Error inserting data in mysql and php
Hello, It seems to me you’re not assigning the return of fetch for no one. On the lines: if (!$sql -> fetch() > 0) { echo"Login e senha ja existem"; return false; } Do the following: $linhas =…
-
0
votes1
answer37
viewsA: How could I do to pick up every day of the current month?
Good morning, From what I understand, you want all the records for a given month. If that’s the case, use something like this: base_cliente_comprou (ID) AS ( SELECT * FROM tb_pedido INNER JOIN base…
postgresqlanswered Marcos Alexandre 1,284