Posts by Isac • 24,736 points
820 posts
-
1
votes3
answers379
viewsA: Problem with onkeyup input
Do a test for the amount of characters the field has before ordering the data, only when it has at least 1 character written: // FUNÇÃO PARA BUSCA LOJA function buscarLojas(valor) { if(valor.length…
-
3
votes1
answer156
viewsA: Associating stack with struct in C++
The mistake that gives is: no match for 'Operator<<' in 'Std::Cout << stack_register.Std::stack<_Tp, _Sequence>::top That says the handwriting operator << does not know how…
-
1
votes2
answers529
viewsA: Printar content in list format with jquery ajax
Its placement on the screen always replaces the previous one: $('#oi').html(resultado + "<br>"); You have to add instead: $('#oi').html($('#oi').html() + resultado + "<br>"); Assuming…
-
0
votes1
answer978
viewsA: Determine the largest prime number after a value is given using while function
There are some problems with your solution. The increment in the cycle was being done right at the beginning so I would analyze an extra element, in: while y<=n: y=y+1 To know if a number is…
-
2
votes1
answer725
viewsA: Save only day and month in mysql DATE field with php?
Personally I would keep with the current year in format of Date. The Mysql has date functions to remove only the month or day from a date so it can do all the calculations in the same, and if for…
-
10
votes4
answers299
viewsA: What does the "do" function do in Javascript?
This is simply a loop/loop do while, but only with a line of code soon does not take the keys { and }. Normally it would be written like this: do { //codigo a repetir no laço/ciclo } while…
-
2
votes4
answers1576
viewsA: Pass value to another page
To send the values to a php page you can include a form and specify the page in the attribute action form. The choice of the plan can be like this in a check box, built through the label select.…
-
3
votes2
answers281
viewsA: What does the term typeof module mean in javascript?
typeof is a javascript operator that allows you to see the type of a variable. "object"==typeof module Or usually written as typeof module == "object" checks if the module variable is an object. The…
javascriptanswered Isac 24,736 -
5
votes2
answers6394
viewsA: Sum of even numbers and multiplication of odd numbers in a range
Multiplication gives zero because it has not started: int X=0, Y=0,somapar=0, cont=0, impar; Once it will multiply it should start the impar with the neutral multiplication value, 1: int X=0,…
-
3
votes5
answers2432
viewsA: Take the last position of a split()
With the split divide, and then take the last with length-1 and joins with the whole array except the last one, using the slice to cut the last and the join to unite everything again with spaces:…
javascriptanswered Isac 24,736 -
1
votes1
answer483
viewsA: Chat like php and ajax in real time
Yes it is possible through AJAX. For a simple chat version you can make a block of javascript that makes a request AJAX to X database in X seconds through function setTimeout and only get…
-
2
votes1
answer87
viewsA: Question system in php
A simple solution for what you want to do is to have a page that loads a question by a parameter of query string and in the validation of the question redirects to the same page changing only the…
-
0
votes2
answers1521
viewsA: Test for prime number
In order for the test to be correct you really have to cycle through all the elements in the middle: int i; for (i = 2; i < numeroDigitado ; ++i){ //percorrer do 2 até anterior do que foi…
-
1
votes1
answer713
viewsA: Remove only one value in the array
For this is found the position with the function array_search: $posicao = array_search('18',$arr); And then remove this position with the function unset: unset($arr[$posicao]); Or doing it all…
-
1
votes1
answer190
viewsA: Autocomplete jquery doubts
To test if it does not exist, it is better when the user submits the form with Enter. In this case it is tested if the value that the user entered is in the data array and if it is not the url.…
-
1
votes1
answer224
viewsA: Code being performed only when double-clicking?
The problem is that even though the elements start to hide the property display.style of each of them begins empty, then passes to none and only then shows. That’s why you have to double-click to…
-
0
votes1
answer647
viewsA: How to manipulate a vector of structs in an external function? Follow example
The vector is passed as if it were a vector of another normal type like int for example. Thus: void func(struct informacoes arr[]){ //fazer algo com o array de informações } int main(){ struct…
-
0
votes2
answers65
viewsA: PHP update com for
It is necessary to confirm that you have the correct initialization of the object $stmt that has to come from the object representing the database connection: $mysqli = new mysqli($servidor,…
-
1
votes3
answers165
viewsA: Numbers smaller than the average
As a complement to the existing responses, I present a streams and Amble, that will make the printing of below average values in a more compact way. Average: double media =…
-
2
votes2
answers413
viewsA: Reverse
Using the new Java 8 and Ambdas stream features just do: int[] numerosInvertidos = IntStream.range(0, numeros.length) .map(i->numeros[numeros.length-i-1]).toArray();…