Posts by Taffarel Xavier • 1,327 points
72 posts
-
0
votes4
answers1125
viewsA: Run PHP function to insert data into DB daily at specific times
For linux users (Ubuntu 18.04, tested version) Let’s go to a practical and real example: 1st Step) Let’s create a table named logs in your database. CREATE TABLE `logs` ( `id` int(11) NOT NULL,…
-
2
votes1
answer45
viewsQ: Interaction with multidimensional array in php
I have that data: $answers = [ 'text-1626173297126' => [ 'Capítulo teste', 'Juarez Neri Antônio Pereira', 'CAVALEIROS DA LUZ' ], 'text-1626173306001' => [ 'Pedro Ds', 'RenGraminhani', 'CAR…
-
-3
votes1
answer66
viewsQ: Dynamic mask for CPF, CNPJ and CEI fields
Hello, I looked for this doubt in the questions, but I could not find it. Well, I would like to make a field to have the masks of CPF and CNPJ and CEI. depending on the number of characters typed.…
-
0
votes1
answer92
viewsA: Using Eslint in VS Code
First, we need to know which pattern you’re going to use, but come on. Create the . eslintrc file globally AS: Linux: root@USERNAME > code .eslintrc.json Windows:C:\users\USERNAME\document(o?)s…
-
1
votes1
answer25
viewsA: I want to make a function that receives a parameter n and returns the sum value of all terms from 1 to n
You forgot to return the sum out of the repeat loop. You should declare the variable out of the loop and fill in on it, as I did below. There are other ways to do this, but as you asked, as I put…
javascriptanswered Taffarel Xavier 1,327 -
1
votes1
answer63
viewsQ: Problem when trying to rotate a triangle using the javascript canvas
Guys, below, I have the following codes in a basic structure using html, css and javascript. I tried anyway, but I couldn’t rotate the triangle in the middle when the user slides the input range.…
-
0
votes2
answers58
viewsQ: Content is not being saved to the file using the Printwriter class
The file, in fact, is created, but without the content it should have. Method Program: String program() { return "import java.io.*;\n" + "import javax.swing.JOptionPane;\n" + "\n" + "public class…
javaasked Taffarel Xavier 1,327 -
-2
votes1
answer48
viewsA: Help with array and map
Using assignment via dismantling, a new ES6 mechanism, try the following: $('#gerar').on('click', () => { //O segredo está aqui: (...) var selecionados =…
-
1
votes1
answer40
viewsA: Textarea similar to a Text Editor ex: VS Code
If that’s what I understand, there’s the ACE Editor. Its implementation is easy, this link here: 1, you can check your manual, which is all very simple. In addition, you can use several different…
reactanswered Taffarel Xavier 1,327 -
0
votes3
answers20750
viewsA: How to add option for a select by Jquery/Javascript
Using the function map and the atribuição via desestruturação: //Array normal: var cidades = [ 'São Paulo', 'Rio de Janeiro', 'Bahia' ]; cidades.map(item => {…
-
1
votes1
answer460
viewsA: Define attributes in columns <td> in html table, with javascript
Based on official documentation common date. and on this topic How to add attribute in TR and TD? and createdRow [Inspect the table below when executing the code, and you will see that the…
-
1
votes3
answers102
viewsA: Javascript performs the function without the button being clicked
Actually, there was a syntax error. I fixed it, see the demo below: let btn = document.getElementById('btn1'); let texto = document.getElementById('teste'); function mudaTexto(){ texto.innerText =…
-
1
votes1
answer121
viewsA: Each input="file" Jquery does not validate
Note that I’ve found out about the file array. The problem, apparently, is here: var size = this.files[0].size;. See: with this, you only get the first file. And you must validate in all files, not…
-
1
votes1
answer104
viewsA: How to generate javascript functions within while
Make the following changes: Altere of: <input id="vol-control" type="range" min="0" max="100" step="1" oninput="SetVolume(this.value)" onchange="SetVolume(this.value)"></input> To:…
-
1
votes2
answers43
viewsA: Take a label by Parent() or id and replace
According to the documentation of Twig, using the control flow if, try the following: {% if quote.text == "0,00" %} {{ quote.title }}</label> {% else %} {{ quote.title }} - {{ quote.text…
-
0
votes2
answers737
viewsA: How to get the value and label of a datalist using jquery?
Very simple form: //Listando apenas um valor, clicando sobre o option: $("#estabelecimento").on('change', function() { var _this = $(this); $('#listaEstabelecimento').find('option').each((index, el)…
-
0
votes1
answer228
viewsA: Do a while in a javascript input and record
Take a look: you are trying to submit a form containing multiple entries. To do this, you must use an array. The secret is here: var incremento = -1; //etc. cell1.innerHTML = "NOME"; cell2.innerHTML…
-
1
votes1
answer66
viewsA: POST not receiving form input
You must find the entrance of the type file, in your case, images, using the global matrix $_FILES, nay $_POST. See this page for more background:…
-
2
votes1
answer143
viewsA: Session variable is empty when loading page set in <form action=""
To recover the id, which in this case is a key in the session, and not in the GET or POST matrices, you must save it in the sessão, and you’re not doing it, so the mistake. In fact, your mistake is…
-
0
votes1
answer2839
viewsA: Ajax request with Node.js and express
The problem is here (using Jquery 3.4.1): contentType: false, // NEEDED, DON'T OMIT THIS (requires jQuery 1.6+) processData: false, // NEEDED, DON'T OMIT THIS https://api.jquery.com/jquery.ajax/ I…
-
1
votes1
answer98
viewsA: Confirmation butao and only after ajax sends the request
See if it works: //Seu botão, no HTML: $('#btnEnviar').click(function() { $.confirm({ title: 'Confirm!', content: 'Confirma a eliminação?', buttons: { confirm: function() { $.alert('Vai enviar a…
-
1
votes1
answer107
viewsA: How to point links to site root without using . htaccess
Translated PHP $ _SERVER ['DOCUMENT_ROOT']: In this kind of scenario, it’s always best to create a file config.php and save it in the root directory. In the configuration file, you set some…
-
3
votes2
answers102
viewsA: Ajax POST using a variable and an object
The first mistake is here: name: 'Nome Candidato', contents = { 'email': '[email protected], 'formacao': 'superior completo' } Because, apparently, you’re trying to send an object, however, the…
-
2
votes1
answer2013
viewsA: Sort HTML table using Javascript?
Try the following: function sortTable(table, dir, n) { var rows, switching, i, x, y, shouldSwitch, switchcount = 0; switching = true; /*Faça um loop que continuará até nenhuma troca foi feita:*/…
-
1
votes1
answer1092
viewsA: React with Material-UI: Changing component colors
Try: First, take a look at this example: https://stackblitz.com/edit/react-bd92xq import React from 'react'; import { render } from 'react-dom'; import { MuiThemeProvider, createMuiTheme } from…
-
1
votes1
answer43
viewsA: Pass city name from Javascript to PHP in google maps
Basic example using Ajax: Note that seu-arquivo-php.php is where you’ll be requesting. var geocoder; //Variável Criada var nomeCidade; if (navigator.geolocation) {…
-
1
votes3
answers41
viewsA: Assign new items in an array without rewriting the whole code
If that’s what I understand, which is to add data to the array, you can: //Adiciona um valor ao array com a chave `CURLOPT_OTHER` $options['CURLOPT_OTHER'] = 'OUTRO VALOR'; If you want to add as…
-
1
votes2
answers141
viewsA: Variable receiving only 1 single fetch value, how to fix?
You should fetch all data from the SQL query using, for example, the PDO fetch (but it could be another too), so: you can concatenate an entire column into a single variable, within the loop, in…
-
1
votes2
answers141
viewsA: Onfocus function in Select2 input
In your case, use the event: select2:opening, added to your code below. Select2:Opening is fired before the drop-down menu opens. The Select2 will trigger some different events when different…
-
3
votes3
answers67
viewsA: Knowing which element triggered the event
Very simple form: $('.class1, .class2, .class3').click(function(ev){ console.log(ev.target.className + " disparou o evento"); }); <script…
-
1
votes2
answers38
viewsA: Doubt about site pagination component
The name is breadcrumb. REFERENCE: https://fezvrasta.github.io/bootstrap-material-design/docs/4.0/bootstrap-components/breadcrumb/ https://getbootstrap.com/docs/4.0/components/breadcrumb/…
-
0
votes2
answers69
viewsA: Separate Coordinate String in Array with separate Lat Long?
Try the following: <?php // $re = '/\[.*?\]/m'; $str =…
phpanswered Taffarel Xavier 1,327 -
0
votes2
answers52
viewsA: PHP page inside a PHP page
There are many ways to do that. The first (that I like best) and several companies use is using XML Httprequest :https://www.w3schools.com/xml/xml_http.asp. Using this technique, it is possible, for…
phpanswered Taffarel Xavier 1,327 -
1
votes1
answer43
viewsA: Use the form action correctly
First of all, the ideal for data insertion is to use the method POST. Although this is also my opinion, according to W3schools, programmers prefer POST to GET. Thus, try: echo '<form…
-
2
votes4
answers130
viewsA: String Manipulation in Javascript?
Another way: //Duas linhas: var wcalcAlm = ('0140').split(""); console.log(wcalcAlm[0] + wcalcAlm[1] + ":" + wcalcAlm[2] + wcalcAlm[3]);…
-
2
votes1
answer1186
viewsA: How to remove "Uncaught Syntaxerror: Unexpected end of input" from Javascript
You have syntax errors: The correct is: length, that is, the length of the array cidades and the length of each item in that same array. var cidades = ["São Paulo", "Criciuma", "Curitiba", "Itajai",…
-
2
votes2
answers408
viewsA: How to identify if a number has been entered in the vector
The first thing you should do is create the variable, which you you wish to find, in this way: //Número procurado: int numeroProcurado = 25; Second, create the booelana variable that you will…
-
2
votes1
answer37
viewsA: Doubt with JAVA regular expression
If that’s what I understand, since the function group() returns a string, you can do the following: import java.util.regex.Matcher; import java.util.regex.Pattern; //Classe de demonstração para…
javaanswered Taffarel Xavier 1,327 -
3
votes5
answers43935
viewsA: What is a Table Test? How to apply it?
Function table test Reduce. Suppose the following use of reduce has occurred: > [0, 1, 2, 3, 4].reduce(function(Acumulador, valorAtual, indice, array) { return Acumulador + valorAtual; }); // 10…
-
0
votes6
answers50339
viewsA: Indent code in Visual Studio Code
Just to add up-to-date information: To update the part: editorTextFocus && !editorReadonly, you must click with the right-click on the line and choose the option: Change When Expression or…
visual-studio-codeanswered Taffarel Xavier 1,327 -
1
votes3
answers51
viewsA: Add values of fields in jQuery
I made the comments in the lines added. You must create a function to convert this format 25,000.00 on a valid floating, as some friends have done here. As you were adding a new html, that part…
jqueryanswered Taffarel Xavier 1,327 -
0
votes1
answer673
viewsA: How do I scroll through the Select list
You can go through the element option of your select and make an iteration in it using, for example, the repetition loop for. It has multiple attributes such as value or text. value takes tag value…
-
1
votes3
answers1785
viewsA: Put multiple variables in an Alert()
If that’s what I understand, you want to concatenate strings. In javascript, there are several ways to do this, for example, the traditional way is to use the symbol +. Using your reasoning, try:…
javascriptanswered Taffarel Xavier 1,327 -
0
votes1
answer72
viewsA: When I execute the command $ code . the terminal of the following message
If you have installed VS Code again, see if the Visual Studio Code folder is on: C: users{username} Appdata Local Programs Microsoft VS Code By default, VS Code is installed in this folder. I took a…
visual-studio-codeanswered Taffarel Xavier 1,327 -
8
votes2
answers3176
viewsA: WEB project organization standard (HTML, CSS, PHP)
First, there is no 100% sure way to standardize a project, what you have there are some pre-established standards by the community, which claims to be the best or the most accepted, until there…
-
0
votes1
answer57
viewsA: The program is not finding the main (main) method of the setup class
There are syntax errors in your code, so consider the following changes to run it: Alter: import java.awt.; import java.awt.event.; import javax.swing.*; import java.util.Random; To: import…
javaanswered Taffarel Xavier 1,327 -
2
votes1
answer109
viewsA: Apply maskMoney to dynamically added fields
The problem is, when you add only $('.money').maskMoney();, at the beginning, it only works for the elements that are loaded in the page update. So, to solve this problem, you must, at every time…
maskmoneyanswered Taffarel Xavier 1,327 -
1
votes2
answers467
viewsA: How to put a json returned from an API within a select?
Try this code: //data var d = {"installments": {"1": {"installment":1,"amount":1000,"installment_amount":1000}, "2": {"installment":2,"amount":1000,"installment_amount":500}, "3":…
-
1
votes2
answers131
viewsA: How to include a Refresh in window.open with _Parent?
Yes, it is possible. Try this code: let myWindow = window; myWindow.open("resultado.php","_parent"); myWindow.location.href="#"; But there are other ways to do it.…
-
0
votes1
answer54
viewsA: How do I make the checkbox have the value of the database id corresponding to the record that was marked?
document.getElementById('btnSaveInDb').onclick = function(){ let checkboxs = document.getElementsByClassName('checkbox-class'); let dataForm = []; for(let k = 0; k < checkboxs.length; k++){…
phpanswered Taffarel Xavier 1,327