Posts by Isac • 24,736 points
820 posts
-
1
votes1
answer141
viewsA: Perform three functions in the same setInterval
To execute the atualizaLeilaoCancelado() every 5 minutes the simplest is to individualize this call in a setInterval separately with the respective range value: function updateLeilaoCancelado(){…
javascriptanswered Isac 24,736 -
0
votes1
answer1916
viewsA: Warning: initialization makes integer from Pointer without a cast [-Wint-Conversion]
Note that the printf works but the formatter is %s. This means that the value it has in row[0] is actually a string, or being more exact, a pointer to an array of characters. Since it is a pointer…
-
1
votes1
answer255
viewsA: Something equivalent to the sstream library from C++ to C
The problem is that the fgets also reads the \n and stores in the buffer reading. You can resolve this by manually removing the \n that was the last caretere read: fgets(username, 25, stdin); size_t…
-
2
votes2
answers40
viewsA: Concatenate Radio Elements
You can start by grouping the values of the radios into an object using the group name as key. To simplify you can directly add the value of <span> next, resulting in something like: { grupo1:…
-
1
votes2
answers94
viewsA: How to create an element with child without adding it?
It is impossible with father.appendchild(son) because it is necessary that father be in the document before adding a child That statement is not true. You can start by checking documentation, and…
-
4
votes3
answers384
viewsA: Does anyone know how I do this effect on the background of this div?
The image that allows you to do this checkered feat is a point only, with some transparency: https://static.musiocdn.com/img/dot-overlay.png?45a8ea7a65f7 She’s put on top like overlay <div…
-
2
votes2
answers456
viewsA: Count words in Array
Another possible solution would be to use reduce. It is not as compact as a line, but ends up being simple and even similar: let nomes = ['thiago','carlos','pereira','thiago']; const totais =…
-
1
votes2
answers912
viewsA: Python: find product of the highest value of each matrix list
To calculate the highest value of each row you can use the native function max. It can either receive the various values or a list of values: >>> max(1,2,3) 3 >>> max([3,5,1,6,2])…
-
2
votes2
answers91
viewsA: Help with String algorithm
Even without regular expressions you can do what you want with relative ease using the method indexOf of String and the Overload indicating only from a given position. To make things clearer, I…
-
1
votes1
answer66
viewsA: How to return to initial value after an event change
All you need to do is re-assign the variable inicial to 0 at the event change of your <select>: function resultadoPag(pagina){ vPag = pagina.value; inicial = 0; //só colocar mais esta linha…
-
2
votes1
answer939
viewsA: Discover hosts from the network
You cannot read the ip as whole because it has several . by the means, which is actually the error that appears in the image you placed. The easiest is to even treat ip as an integer list. And for…
-
1
votes1
answer100
viewsA: Application Bubble Sort with random vector
I’ll assume the idea is to practice using pointers. In this case some things are missing and others are incorrect, and the code should look like this: int main() { int j,aux,i; int *A=(int*)…
-
5
votes6
answers751
viewsA: Numbers and your friends
Javascript (108 105 102 101 bytes) N=1500,x={},r=[];for(i=1;N-++i;){s=0;for(j=i;--j;)x[i]=s+=i%j?0:j;x[s]==i&s!=i?r.push(i,s):0}alert(r) This version uses a support dictionary to keep the…
-
2
votes1
answer1259
viewsA: Output in two columns
I would start by simplifying and making the code more Pythonic before even starting to break into columns. For this you can use list comprehensions for the construction of the list of adjectives, as…
python-3.xanswered Isac 24,736 -
1
votes1
answer57
viewsA: General total does not sum
The problem lies in its numerical checking function IsNumeric: function IsNumeric(input) { return (input - 0) == input && input.length > 0; } The .length about a Number will give…
-
2
votes1
answer34
viewsA: Retrieve date between two dates
I suggest you take advantage of builder of Date passing the value of the date that has added up to 1 day. The constructor will make the corresponding adjustment at the end of the month, thus moving…
javascriptanswered Isac 24,736 -
3
votes2
answers688
viewsA: How to save an object (JSON) by copying in Javascript
For a single copy (Shallow) of an object can use Object.assign: var copia = Object.assign({}, sessao); See how it already gives the result you expect: var sessao = {"num":"1"}; var vetorSessoes =…
-
0
votes1
answer24
viewsA: Function to search character
The problem is that your first if does not cover the second. The way it is (indenting correctly): for (int i=0; i<text.length()-1; i++) { if (text.charAt(i)==c) count=count+1; if(count==n) index=…
-
5
votes1
answer342
viewsA: Picking up positions of a word within a text
An easy way to build the result you want is to use the second parameter of the indexOf which allows you to indicate from where you are searching. Of documentation: arr.indexof(searchElement[,…
-
4
votes1
answer246
viewsA: Replace by ignoring tag and returning as string
To be treated as html it has to be assigned with the function html: var texto_original = $("#texto").html(); $("#texto").html(texto_original.replace("texto","<b>texto</b>")); <script…
-
1
votes1
answer44
viewsA: Reading values from a string
The error indicates that sscanf has to receive a const char* as the first parameter and not a string how are you doing. View the function signature sscanf: int sscanf ( const char * s, const char *…
-
2
votes2
answers501
viewsA: Group and add json return data with jquery
To reduce the array by leaving only one entry for each question, distinguishing through the nr_pergunta, can use the function reduce. For each element look for if it exists, and if it already exists…
-
1
votes2
answers346
viewsA: Simulate event click tag list Span
In order for it to work as it wants it has to play at each interval a different sound, and not directly using the dial $('.audiospeak') that hits every sound. The solution I put gets all the Audios…
-
0
votes1
answer68
viewsA: How to print only numbers that repeat between two different progressive formulas?
Using the same technique I used in your previous question can reach the desired result. The technique involves using two increment variables, one for each formula. And with these increase only the…
-
3
votes1
answer85
viewsA: How to print only numbers that repeat between two different formulas?
A considerably simple solution is to use two variables in the for one for the copas3 and another to the copas7, instead of being the variable a for both of them. So it can always increase the one…
-
1
votes1
answer85
viewsA: Does anyone know why you made a mistake?
The problem is that the scanf read only the data that was indicated and not the line break typed, which will be just what the fgets will read next. A robust solution is to read the integer also with…
-
1
votes1
answer2186
viewsA: Chained List (insert at end)
In function inserefim has some adjustments to make: celula **fim; the end pointer does not need to be double, a single pointer is sufficient which simplifies the code Missed in the else back point…
-
2
votes1
answer460
viewsA: Select2 does not work on my pc but works on jsfidle
You can only access page elements after it is fully loaded. For this put your code inside: $( document ).ready(function() { //aqui }); Or in its most compact and common form: $(function() { //aqui…
-
1
votes1
answer134
viewsA: String comparison does not work
By what appears in the Log: onResponse: "ERROR" To String that has in status It’s already got quotes in it which makes the if: if(status.equals("ERROR")){ Never give true. To resolve can change the…
-
0
votes1
answer66
viewsA: I need help using the bigmoney.js plug.
Include the plugin First you have to start by including the plugin and particularly the file bigmoney-all.js: <script src="bigmoney-all.js"></script> If you are working with Node JS you…
-
0
votes1
answer619
viewsA: Print matrix elements in C++
The size set for the matrix frutas is not correct: char frutas[20][4] First specified 4 when you have 5 fruit. And besides it is inverted and should be: char frutas[5][20] Remember that it is an…
-
3
votes3
answers8071
viewsA: ASCII in Python
A more flexible solution for when you have to make many changes in string is to store it as a list using list: texto = list("o seu texto aqui") This makes when you show your content, it appears as a…
-
2
votes2
answers1697
viewsA: Doubt Random.shuffle() returns None(inside print)
For documentation sees that random.shuffle shuffles the list itself and returns no value: (..) Shuffle the Quence x in place. (...) Starting from a concrete example of a list of notes: l =…
python-3.xanswered Isac 24,736 -
0
votes1
answer44
viewsA: Program Crashing at random
You need to hit a lot of things in your code: In the list builder you are doing setNext about the No inicio that was not even instantiated: Lista() { quant_el = 0; inicio->setNext(NULL); //<--…
-
2
votes1
answer1322
viewsA: Vector of objects in Python
In a normal chained list each node has an attribute that represents the next node only and not a list: class Nodo: def __init__(self, valor): self.valor = valor self.prox = None If in your…
-
0
votes2
answers121
viewsA: Chained lists
There’s a lot of things you need to fix: To be able to insert you have to pass a pointer to the pointer of the main here: int inserir(celula **ini); Otherwise you won’t get the pointer on main when…
-
2
votes2
answers758
viewsA: Count radio inputs that are :checked
If you only want to count how many inputs for half and integers are selected you can do it all at the expense of the selector. For this you will need to include in your selector: [type=radio] to…
-
1
votes1
answer244
viewsA: Cipher of César, Error in the displacement of letters
To shift to the right you have to add up instead of subtract. Still the problem persists, which is to reach the limit of the alphabet and begin to catch other characters of the ASCII table than…
-
0
votes2
answers66
viewsA: regroup values of an array into a new array
Follow an alternative using only one for and the object for the Asons. No for creates each of the keys for the Asons if they don’t exist and then adds each episode to the Ason episode array. var…
-
1
votes2
answers89
viewsA: Standard value in Spinner+ generated from the database
Giving only another alternative to the @ramaral solution, you can use a Overload of the method Add which you were using which you also receive the position where you will add. The signature of this…
-
0
votes1
answer123
viewsA: In Bluej Class Random IDE, limit start and end values
The mistake you make is because the method setSeed is void and so does not return any value which makes it can not do .nextInt() then on the void.…
-
2
votes2
answers172
viewsA: how do I leave my button in the marked menu?
For your example to work on live snippet just need to cancel page navigation action with event.preventDefault() var menu = document.querySelectorAll("#menu > ul > li > a"); for(var i = 0; i…
-
0
votes1
answer57
viewsA: How to highlight items from a <li> list, changing the position regardless of where it appears
If you want to show highlights at the top then you need sorting. Assuming only part of the information that is in html, you can sort with the sort based on the result that comes from a Jquery…
-
1
votes1
answer1888
viewsA: Counter up to a specific number
It is really a question of mathematics. My resolution proposes to increase the right amount in each timer, so that they all end at the same time. For that it is necessary: Know the total time of the…
-
5
votes2
answers56
viewsA: how to use bind, call or apply in this context?
... has some way of referencing this to Counter without assigning to a variable ? Yes, using a Arrow Function instead of a normal function. Read in the documentation will see that the Arrow Function…
javascriptanswered Isac 24,736 -
1
votes2
answers130
viewsA: Suggestions for code improvement
Our format is not quite code review, this applies more to what exists in the English version of Code Review, Still, here are some of my improvement tips that you can make: Avoid…
-
1
votes1
answer61
viewsA: Problem showing result in php when there is only one entry in the BD
In his if is reading the first row of the resulting table and right after when it will enter the while reads the second line without using the first: if ($resultado = mysqli_fetch_array($salva)) {…
-
1
votes1
answer526
viewsA: Change an attribute of a base class by the derived class C++
There are some errors in your code: vector(string) Names; should stay vector<string> Names;. To make it work you have to import the respective libraries: #include <vector> #include…
-
1
votes2
answers283
viewsA: Concatenation of items from a nested loop array
The real problem is ifs using i when they should use j: for (var i = 0; i < a.length; i++) { var c = ['[']; for (var j = 0; j < a[i].length; j++) { if (i < a[i].length - 1) { // ^--- aqui…
-
1
votes1
answer529
viewsA: Organize Json file
Since it is an object and not an array you have to sort by the keys. To get the keys you can use the method keys object passing the commands as parameter. Then sort the keys using the method sort…