Posts by Isac • 24,736 points
820 posts
-
2
votes1
answer135
views -
0
votes2
answers197
viewsA: How to pass id to delete function
The biggest problem, as @Dvd had already said, is the fact that an html element is missing to encompass each new line that is inserted, because the fields are inserted in a following way, ending up…
javascriptanswered Isac 24,736 -
4
votes3
answers6982
viewsA: Calculate the standard deviation of a vector
The standard deviation formula has to be squared away, which is not in yours. See this formula withdrawal directly from wikipedia: In which (xi- x)² is raised to ² In this formula the i begins in 1…
-
3
votes2
answers3764
viewsA: mysqli_select_db() expects Parameter 1 to be mysqli, string Given
Note the error you give to the function mysql_connect: Fatal error: Uncaught Error: Call to Undefined Function mysql_connect() .... This is because in the environment that is running it does not…
-
2
votes2
answers764
viewsA: Count sequence and number distance in an array
To find the shortest distance between each number you just need to compare the number on which you go with the front number, and if it is larger than the calculated distance so far, update it.…
-
0
votes2
answers80
views -
6
votes1
answer2667
viewsA: How does it work to use a vector of type struct ? (C++)
Let me start by saying that, just as @Ricardopunctual indicated in the comments, in C++ you don’t need to include the word struct the use of the structure. In addition, the <vector> something…
-
1
votes1
answer79
viewsA: Toggle icon with Jquery
The quotes you’re putting “ are quotes from a text editor like Microsoft Word for example, not the right quotes for Javascript or any code. In the code the find("glyphicon") that has is unnecessary…
-
1
votes1
answer103
viewsA: Miscalculation
The problem has already been indicated by @Vitorstafusa in the comments, which is the fact that the division results in an infinite periodic decimation, in the method divide. If you consider a…
-
3
votes1
answer1195
viewsA: Catch the mp3 audio duration
Estate duration and event loadeddata The duration of an audio element in html is obtained through the property duration, that gives the sound time in seconds: const som1 =…
-
0
votes1
answer109
viewsA: How do I calculate the percentage of the right number of answers?
For the success test you are taking, only one correct attempt will be accounted for due to the break that has in the for. This makes the calculation have to be done only considering the failed…
-
0
votes5
answers7645
viewsA: Javascript number stack pairs
The problem is that concatenation is always done, because it is outside the if: if(j%2 !=0){ //e devia ser ==0 para ser pares msg += ""; //devia estar a juntar aqui o numero aqui } msg += j + ", ";…
javascriptanswered Isac 24,736 -
0
votes3
answers1416
viewsA: Disable field if another one is filled
You can simplify the logic you are using for a direct assignment based on comparing the number of characters written in the codigo. Can know the number of characters by accessing length of value…
-
5
votes2
answers2051
viewsA: Matrix multiplication in Java
java.lang.Arrayindexoutofboundsexception Means you are accessing a position outside the validated array positions. In your case it happens here: mab[3][2] = (ma[3][1] * mb[1][2]) + (ma[3][2] *…
-
0
votes1
answer271
viewsA: Take value from a cell in jquery
I start by indicating that the id you’re putting in the first <td> line is not correct as it will generate several lines with ids repeated. In html the attribute id has to be unique on the…
-
0
votes2
answers39
viewsA: Scalate a value in a given range
The idea is to make a ratio between the two scales, being these: 0 to 255 -40 to 40 Note that the scales do not have the same basis, and so we can adjust by adding 40 to a scale -40 to 40 that gives…
-
2
votes1
answer627
viewsA: List simply chained and unordered
The main error that causes your program to fail is in imprime_lista who tries to print nodes by not being sure they are not null: void imprime_lista(lista *li){ ... aux = li->inicio; //pode…
-
0
votes1
answer386
viewsA: Keep selected SELECT OPTION after update
The if that has in the echo is being interpreted as text. echo "<option value='premorc.php?fnc=".$fnc."&ans=".$linha."&bandorc=".$band."' if ($bandorc==$band){ echo 'SELECTED';} '>" .…
-
3
votes1
answer997
viewsA: Disable Radio Button from a table based on an input value
To get the logic you want you need to use a if, which tests whether the number you go to is part of the numbers that activate the radio buttons. For this you can even use an array with the values…
-
1
votes1
answer102
viewsA: Picking Strings from other Activitys
To transfer information between activities you must use Intent, which has several methods to add and get information. To add information you must use the method putExtra, that has several overloads…
-
0
votes1
answer908
viewsA: overlay text in background
To achieve this effect you need to: Do not apply such a large width dimension to the image (at least here in the snippet) Remove the margins of each div within the flex so that they stay together…
-
2
votes1
answer563
viewsA: How do I not print repeat numbers?
Can solve the problem, added only to vetC whenever you know that the element does not yet exist in vetC. To simplify we can start by building a function that does the checking: int existe(int*…
-
2
votes2
answers224
viewsA: Run css when loading Javascript CSS page
The function getElementsByClassName returns a list of items that have the specified class, and not only 1. You can try to access the first one for example using [0]:…
-
0
votes2
answers128
viewsA: Music on the website page
To make the audio starts automatically just use the attribute autoplay. If you don’t want to look like a player just remove the attribute controls: <audio autoplay> <!--agora com autoplay e…
-
3
votes2
answers943
viewsA: C# - Random primes?
As @Thiago has already said, it has in fact missed putting the dividers back (the variable div) to 0 at the end of while. However structuring with functions ends up being simpler and this problem is…
-
0
votes1
answer46
viewsA: Add value of Childrens nodes to value of parents in array recursively
In order for the sum to work in such a vast and nested array it has to be recursive, as already indicated in the question. The detail is that it has to be done from the end to the beginning, so the…
-
5
votes2
answers791
viewsA: How does the Sort method work?
The function sort of Array sorts the array based on the function passed. The documentation says that if in the function the value returned is less than 0 then the value a goes to the beginning,…
javascriptanswered Isac 24,736 -
1
votes1
answer50
viewsA: How to place a popup at a particular page location
The test you have in Jquery tests whether the user has reached the bottom of the page: if ($(window).scrollTop() >= ($(document).height() - $(window).height())) { We have to:…
-
4
votes1
answer421
viewsA: How to check if a button is visible?
If it is visibility you need to test you can use the method getVisibility view-class. The method exists in the class View but how Button derives from View, can use it directly. The code would look…
-
6
votes4
answers236
viewsA: Comparison syntax referring to the same variable
Why programming languages do not allow doing so when we want to refer to the same variable? The main reason, as I said in the commentary, is because each comparison has to have 2 operands, one left…
-
10
votes1
answer1156
viewsA: What is the functionality of the "heapify" method of the heapq module?
Heap Before you realize what the method is for heapify has to understand how a Heap. For documentation of Heapq from Python we see that the implementation uses a Heap Binary as min-heap. A heap of…
-
1
votes1
answer45
viewsA: Object Keys of a JSON is saving the last value
The problem lies in the way the Object.assign works. This method overrides all properties in the object that already exist and adds all those that do not exist. See a small example of this…
-
3
votes2
answers485
viewsA: Function . ajaxComplete() performs several times
The problem is that you are registering multiple click functions in the same element. Consider the following code, which illustrates your problem: $("#b1").click(function(){ console.log("B1");…
-
0
votes1
answer177
viewsA: I learned to pass a vector as parameter, I would like to change and return the vector (vector_y1) to main, is there any way to do it without allocating? Please
I would like to change and return the vector to main When you pass a vector to a function you’re actually passing the pointer to the first element. Consider the following example: void muda(int…
-
2
votes1
answer837
views -
2
votes3
answers203
viewsA: Combine arrays
Making a solution in the style of @Vinicius, but using ES6 syntax would be much more compact. For this you can use forEach and Arrow Functions. Take the example: const v1 = ["A","B","C"], v2 =…
-
1
votes1
answer50
viewsA: Divs fade into a loop?
In your code the problem is that all setTimeout start at the same time, so the waiting ends simultaneously. When you want to chain animations in Jquery you should use the complete function, which is…
-
4
votes1
answer3943
viewsA: How to compare vectors in C
There are some problems with your code: char palavra[4]="arroz"; Reserved space does not play with saved size for(i=1;i<=len_palavra;i++) This for is with <= instead of < only if (letra[0]…
-
2
votes1
answer286
viewsA: What is the function of this code snippet? Data structure (List)
Starting from the beginning: The structure: struct Node{ int num; struct Node *prox; }; This creates the structure for each node in the list, which will have a number and the pointer to the next…
-
4
votes1
answer462
viewsA: Search for disordered word sequence from a list in text
Even the "a" is showing up I don’t know why! The code as is passes in every word of lista and see if it exists in the text. And it doesn’t have to exist as a loose word, just exist in the middle and…
-
2
votes2
answers1689
viewsA: Change the color of a word in a still-editing textarea
Just as a complement to the @Dvd response, I show a very simplistic (and some flaws) example of how I could implement color changes of certain words using <div> with contenteditable=true:…
-
2
votes1
answer52
viewsA: Second command does not work
Commands do not work in a row because they are in a structure if else, then only one of the commands will be interpreted. In your example, if you entered the: if c == '/tutorial': Then you won’t be…
-
3
votes3
answers218
viewsA: Dictionary does not return all possible words
The main problem is in the function that compares words, the procString: int procString (const struct dicionario lingua[],const char procurar[], int numPalavra){ //busca a palavra no dicionario bool…
-
0
votes2
answers1735
viewsA: Install PHP plugin for Atom editor
Assuming you are asking for a plugin for Blade Templating Engine in Laravel, There are several in Atom. One that I use and works well is the Laravel-Blade: Not only marks the syntax with the correct…
-
0
votes1
answer106
viewsA: Distinct number problem in java
To ensure that not that the user does not choose repeated values the easiest is to even create a method that checks this and call it within the while to the invalid number. Such a method would be:…
-
3
votes1
answer1077
viewsA: How to read a list of serialized objects saved in a java file?
To read a list of objects in the file you have to use a loop/loop in the reading part and go adding the read objects to a list: List<Address> addresses = new ArrayList<Address>();…
-
2
votes1
answer90
viewsA: Problem with switch C
The main problem is naming a new element in the list: void insChild(LIST* l, char name[]) { ... NO* new; ... new = (NO*)malloc(sizeof(NO)); new->child = name; //<---aqui Being child a pointer,…
-
1
votes1
answer57
viewsA: Numpy delete method doing strange thing
The delete numpy library removes a sub-array based on the index and not the value of the element to remove. In your example what you want to do is: lista = np.delete(lista,0) #indice 0 a ser…
-
4
votes1
answer211
viewsA: How to reference mat[x][y] in pointer notation
Vector vectors with dynamic allocation are basically Jagged arrays. The initial vector will become a pointer vector, pointing each of its boxes to another vector. The following figure illustrates…
-
3
votes1
answer1766
viewsA: How do I do vector product by matrix and between matrices?
Matrix Product Before making any code you need to know how the product works between matrices. Considering two matrices A and B, the matrix product is made by multiplying each value of a line of A…