Posts by Marciano Machado • 2,154 points
91 posts
-
1
votes2
answers31
viewsA: How to create a link spacing from the same cell of a table?
Putting a space in front of each works, see the code below: echo '<td>'."<a href='../crud/select_itens_compra.php'>SELECT</a> "."<a…
-
1
votes1
answer44
viewsQ: There is performance loss by using alias on oracle
In oracle there is some performance loss, even small, when using alias for tables? Examples: select user.name from user; and select u.name from user u;…
-
-2
votes1
answer1337
viewsQ: Is there a way to add column comments in the same command as create table from Oracle?
There is a way to add column comments in the same command as the oracle create table, just as it is possible in Mysql? CREATE TABLE user ( id number COMMENT 'unique ID ' )…
-
0
votes1
answer59
viewsA: Problems with Group By on Postgresql
If you use the sum in the p.points and in the u.points solves their problem, since they are not in the group by. CREATE VIEW anuncio_points AS SELECT a.*, ( SUM(p.points) + SUM(u.points)) AS points…
-
1
votes2
answers270
viewsA: Traverse string with PHP and return searched values
I made a change in regex to the value of id and it worked, the \d takes only numeric values, and the expression {,} refers to one or more occurrences. preg_match_all('/(\[exibebanner…
-
1
votes3
answers2679
viewsA: Apply mask to an HTML table column with Angular?
Create or use a pipe like this https://github.com/mariohmol/ng-brazil: <tr *ngFor="let user of users | async"> <td>{{user.nome}}</td> <td>{{user.cpf | cpf}}</td>…
-
3
votes3
answers1178
viewsA: Uncaught Referenceerror: Chart is not defined
Check which version of the file you downloaded, in the example below I used version 2.8.0 and it worked correctly: See here the files https://cdnjs.com/libraries/Chart.js var ctx =…
-
3
votes3
answers843
viewsA: Show the amount of each alphabet letter in a String
What you can do is reverse the order of the loops, ie for each letter of the alphabet you count in the sentence how many there are, see the example below: String frase = "Daniel Henrique"; int n =…
-
1
votes1
answer72
viewsA: Validate value of a select
Use the function to val() and the event change jquery: See the code below: function validarSelect(){ if(!$('#itinerario').val()){ alert('Elemento vazio!'); } } $(document).ready(function(){…
-
2
votes2
answers81
viewsA: Concatenate string of variables
If you do not enter the IF the value of your variable is udefined. First start your variables with empty values: /* Código a ser adicionado*/ $p20=""; $p21=""; $p21=""; $p22=""; $p23=""; $p24="";…
-
1
votes3
answers211
viewsA: Delete duplicate records via php in mysql
Run the querie below: It creates sub queries by filtering first those that have duplicate value, And then add the filter by removing the lower ID. delete from hardware where hardware.id in ( select…
-
1
votes3
answers480
viewsA: Pick the date range separately by weeks of the current month
Use relative formats https://www.php.net/manual/en/datetime.formats.relative.php $dataInicial = new DateTime('first day of this month'); $dataFinal = new DateTime('last day of this month'); echo…
-
0
votes1
answer61
viewsA: Change attribute inside an objs array (javascript)
You can filter user using the function find in the first example if you want to change only one element. Or you can use the functions filter and map to make the change in more element as in the…
javascriptanswered Marciano Machado 2,154 -
4
votes2
answers3601
viewsA: How to compare two different lists in Java?
You can do this using stream: import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; public class Teste { public static void main(String[] args) { List<Integer>…
-
0
votes1
answer28
viewsA: I created the function to create calendar and says it does not recognize as fullcalendar function
Check the JS import as below: $(function() { // page is now ready, initialize the calendar... $('#calendar').fullCalendar({ eventColor: 'green', // events:events, // a variavel events não foi…
-
0
votes1
answer57
viewsA: Make Alert appear only when the page is already loaded
One of the ways is to put your Alert inside a setTimeout with team 0. setTimeout(function(){ alert('com setTimeout'); },0); <h1> texto do site <h2>…
-
0
votes1
answer49
viewsA: When I write a comment the email of all registered people appears. How do I only show my email that was logged in?
You must save the user id in the comments table, and turn it on Where as below: select comentarios.id, comentarios.comentario, usuarios.email from comentarios, usuarios where comentarios.idusuario =…
phpanswered Marciano Machado 2,154 -
4
votes1
answer55
viewsA: Meaning the "$" symbol with parentheses for values of a variable
In javascript you can use the "$" symbol as variable or function name (identifier). for example : var $ = 0; or function $(){} In the code posted, you are probably using the library jQuery, which…
javascriptanswered Marciano Machado 2,154 -
0
votes3
answers61
viewsA: Query SQL Doubt - Query using two tables
You can make a sub query used to know the purchase and sale values by parents/company, and then group by parents. select t.pais, sum(t.vendas) vendas, sum(t.compras) compras from ( select p.pais…
-
1
votes2
answers81
viewsA: Grab an inline style value
Use the jquery css function as below: var width = $("li").css("width"); // retorna: 360px width = $("li").width() // retorna 360 console.log(width); <script…
-
3
votes2
answers208
viewsA: Catch everything between line break tags
I used the following regex: \<div.*\>((.*|\s|\r|\n)*)\<\/div\>/gm See the example below: const texto = `<div class="1" >quero pegar AQUI DENTRO PODE TER quebra de linha...…
-
2
votes1
answer177
viewsA: How to compare select lines with subselect output?
Use the sub-query in select to bring the result. I added the alias to the tables so I can filter through the code I also added a Where condition to the sub-select. Select t1.* , (select…
oracleanswered Marciano Machado 2,154 -
3
votes1
answer54
viewsA: Comparing Lists in Java?
import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class Teste { public static void main(String[] args) { List<Integer> lista1 = Arrays.asList(1,2,3,4);…
javaanswered Marciano Machado 2,154 -
2
votes4
answers50
viewsA: How to redirect the user to the page they were trying to access before login was requested?
Whenever redirecting to the login screen, you pass the current page as parameter,and when logging in you check if this parameter is filled in, if you are redirecting to the page that is saved in it.…
-
2
votes1
answer75
viewsA: Difference between "==" and "=="
In javascript: == does not take the type of the variable into account, whereas the === takes the type of variable into account See some examples: var verdadeiro = '1' == 1; var falso = '1' === 1;…
-
1
votes2
answers57
viewsA: The intention is to make these two <H4> titles editable, but unfortunately I am only able to apply in the first <H4>
I added a for to iterate all tags <h4> window.onload = function() { function editTitle() { var choices = [] var titles = document.getElementsByTagName('h4'); for (var i = 0; i <…
-
0
votes2
answers59
viewsA: Query to add fields from two tables
Grouping by the fields that are important to you, according to the query below where was added the field race and color in the grouping, select COUNT(*), pessoas.nome, qualidades.cor,…
-
3
votes1
answer89
viewsA: Open and close textarea with the same button
In place of .show use the .toggle, Ve documentation here take the example: $('input[name=abrir]').mousedown(function(e) { e.preventDefault(); if (e.button != 1) { $('#comentario').toggle(); } return…
-
2
votes1
answer64
viewsA: Query SQL summing fields from one table with criteria from another
Do the Where by listing the tables as below select COUNT(*), individuos.nome, ocorrencias.data_comunicacao from ocorrencias, individuos where individuos .id_ocorrencia_ind…
-
0
votes1
answer106
viewsA: Javascript graphic
See the example below: var chart = new Highcharts.Chart({ chart: { renderTo: 'container', type: 'column', options3d: { enabled: true, alpha: 6, beta: 16, depth: 100, viewDistance: 200 } }, xAxis: {…
-
1
votes2
answers82
viewsA: Select inside the Where leaving the query too slow?
Run the query below: SELECT tbl_nfes.*, count(tbl_nfe_itens.pedido > 0) AS v, tbl_nfe_itens.status FROM tbl_nfes INNER JOIN tbl_nfe_itens ON tbl_nfes.nfe = tbl_nfe_itens.nfe INNER JOIN tbl_users…
-
0
votes1
answer41
viewsA: Web service for java desktop
You can use java.net. Example: try { String urlParameters = "param1=a¶m2=b¶m3=c"; byte[] postData = urlParameters.getBytes( StandardCharsets.UTF_8 ); int postDataLength =…
-
-1
votes2
answers942
viewsA: Hide button with jQuery
You can use Jquery’s Hide anointing. See below: $(document).ready(function(){ if(true /* sua validação se é admin aqui*/){ $('#btn-salvar').hide() } }) <script…
-
0
votes1
answer88
viewsQ: Paging appear in JSF Primafeces Datatable only when you have more than one page
How to make pagination appear only when you have more than one page, using the Datatable of Primefaces in the JSF?
-
1
votes3
answers702
viewsA: Is there any way to make Git ignore space-related modifications or line breaks?
Access to the premises ~/.gitconfig Adding the alias below [alias] addse=!sh -c 'git diff -U0 -w --no-color "$@" | git apply --cached --ignore-whitespace --unidiff-zero' - whenever add utilize git…
gitanswered Marciano Machado 2,154 -
1
votes2
answers210
viewsA: SELECT calculating note average in Mysql
Run the query below select l.id, l.nome, AVG(nl.nota) from nota_locais nl inner join locais l on l.id = nl.id_local group by l.id, l.nome
mysqlanswered Marciano Machado 2,154 -
1
votes2
answers82
viewsA: How to update an external element to p:datatable with selectionMode="single"
I solved as follows, I added the class hide-radio-selection and created a class that removes the radio-button standard and created my own radio-button, as below <p:dataTable…
-
0
votes2
answers82
viewsQ: How to update an external element to p:datatable with selectionMode="single"
I’m using the component p:dataTable of primefaces with selectionMode="single" using RadioButton as a selection. I would like when selecting a table row to update my label with the value of the…
-
1
votes2
answers63
viewsA: Change only 1 element and not the selected one
Try to pass the this as parameter when calling the informeCnpj function. For the this within the function refers to the function and not to the elemeninsira o código aquito. function…
-
3
votes3
answers1491
viewsA: MYSQL and REGEX Phone Number
Run the query: select * from tabela where comentario REGEXP '.*[0-9]{2}9[0-9]{8}.*|.*[0-9]{2} 9 [0-9]{4} [0-9]{4}.*'; See practical example on http://sqlfiddle.com/#! 9/225b6cf/2…
-
3
votes2
answers1345
viewsA: converting numbers into Select Oracle hours format
select REGEXP_REPLACE(lpad(to_char(ENTRADA),4,'0'), '([0-9]{2})([0-9]{2})', '\1:\2') from TFPPON; to_char - converts the number to text lpad - adds 0 until completing 4 numbers for cases like 07:00…
oracleanswered Marciano Machado 2,154 -
5
votes2
answers69
viewsA: Sort a Select by criteria outside the database
Look at this solution with case: SELECT funcao nome FROM responsavel order by case funcao when "GERENTE" THEN 1 when "ENCARREGADO" THEN 2 when "SUPERVISOR" THEN 3 when "AUX. DE SERV." THEN 4 else…
-
1
votes1
answer116
viewsA: Resolve/Reject play role in javascript?
The only difference is that when you use Return in the resolve/Reject you inhibit the execution of the other codes below the resolve/Reject call within the Promises body. See the example below:…
-
5
votes2
answers4293
viewsQ: Break and Continue on foreach Java 8
How to give a break or a continue in an iteration using forEach, in the example below, I could use the same forEach for the execution of the validation? List<Contratos> contratos= /* populando…
-
0
votes2
answers111
viewsA: How to identify td line to mount a dynamic data-title
Itere first the titles, then do in tr, see below: var headers=[]; $('th').each(function() { headers.push($(this).text()); // $('td').attr('data-title', $(this).text()); }); $('tr').each(function(i,…
-
4
votes1
answer1755
viewsA: Add months to a javascript date
A function was created to convert the dates: function parseDate(texto) { let dataDigitadaSplit = texto.split("/"); let dia = dataDigitadaSplit[0]; let mes = dataDigitadaSplit[1]; let ano =…
-
2
votes1
answer127
viewsA: Funcao adicionar Anos ao campo date Javascript
Do as below: function addZeroAesqueda(texto, tamanhoMaximo){ texto = texto.toString(); while (texto.length < tamanhoMaximo){ texto = "0"+texto; } return texto; }…
-
1
votes1
answer72
viewsA: Resultset object is null after Try-catch. Java
You are using the standard AutoClosable to create your PreparedStatement, in this pattern you create an instance of an obejto that implements the interface Closable on Try, whenever Try finishes it…
-
2
votes2
answers866
viewsA: Git - how to ignore files inside a folder
create a text file and save with the name .gitignore inside the briefcase in each row of the file put the file name or regex of the files you want to ignore: views-cache/* documentation:…
gitanswered Marciano Machado 2,154 -
1
votes1
answer36
viewsA: Error in javascript code
See if that’s what you’d like to do: (function() { var montante1 = null; var montante2 = null; var montante3 = null; var mes = prompt("Deseja calcular quantos meses? [0 à 3]"); mes =…