All Questions

3
answers

How to ask the PDO if the insertion was made or gave an error?

How to ask $Produtos if the insertion was made or if there was an error in insertion attempt type or die of mysql ? if(isset($_POST['cadastra_produtos'])){ /////////////////////////////////// $Produtos = $pdo-&...
asked on 16.11.2014 / 00:48
6
answers

javascript loop with sleep [duplicate]

How would you make a or any loop type show the result respecting the time of 1 second for example between one iteration and another? I tried this and it did not work: for( var i=0; i < 10; i++ ){ setTimeout(function (){conso...
asked on 19.01.2016 / 19:42
3
answers

How do I replace on the last occurrence of a character?

I have a loop that assembles strings in this format: var Sabor[0] = "Mussarela, Calabresa, Cebola"; var Sabor[1] = "Mussarela, Presunto, Calabresa, Tomate, Ovos, Pimentão, Cebola"; But I would like to replace the last comma with an "e"....
asked on 30.05.2014 / 01:47
4
answers

How to alter American format dates and / m / d for d / m / y?

I bought some systems but all of them come with date fields in English, as well as the American standard: year / month / day. How do I convert to day / month / year format?     
asked on 15.07.2014 / 23:50
3
answers

Make PHP account in the order that is in the string

I need an order of calculation that is in the string to be done in the order that is in it. For example: $string = '(10*10)+(30-5)/2'; I need PHP to interpret this not as a string , but rather as a calculation and do according to what ha...
asked on 08.09.2016 / 03:00
2
answers

SetTimeOut and server traffic

I have a question. I am implementing setTimeOut() in a comments application, where every 3 seconds the div is refreshed so that new comments appear automatically without the need for refresh . It is working correctly: setTimeout(listCo...
asked on 11.01.2018 / 14:12
1
answer

INNER JOIN with 3 tables

I have 3 tables TB_ContratoCotista: TB_Contract: TB_Cotist: I would like to relate the values of the TB_Contract table with TB_Cotist but the way I got it just returns the result of the TB_Contract . What am I missin...
asked on 03.07.2015 / 19:25
3
answers

Performance "where in foreach vs if"

Which of the cases would perform best? var chaves = new list<string>(); foreach(var item in lista) { if(!string.IsNullOrEmpty(item.Chave)) { chaves.Add(item.Chave); } } Or listaValida = lista.Where(x => !string.IsN...
asked on 13.04.2017 / 17:13
3
answers

Comparison in JavaScript

Well, I want to know if my comparison can be improved, I want to leave the code shorter. const teste = function(a){ if(a != null && a != undefined && a != ""){ console.log('e diferente') }else{ co...
asked on 25.03.2018 / 05:24
2
answers

How to do bulk assignment of variables in Python?

In PHP, to do a variable assignment "in bulk" (declare it on the same line), we can do it using the list function. Example: list($a, $b, $c) = array(1, 2, 3); How to make this type of bulk assignment in Python?     
asked on 14.08.2015 / 18:02