Posts by Isac • 24,736 points
820 posts
-
1
votes1
answer56
viewsA: How to create a function with matrix and then use it in the main int by substituting values from another matrix?
If you just want the function to change values in the matrix tabuleiro does not need to have a kind of feedback and can simply leave as void. It also simplifies itself once you no longer need the…
-
4
votes2
answers117
viewsA: Check and uncheck Checkbox items
Looking at the specification of ids in the W3C sees that ids not only have to be unique, but must contain at least one letter. You are breaking these two rules. Your Ids have repeated ids: <div…
-
2
votes1
answer323
viewsA: Loop validating days of the week in PHP
I suggest building the checkboxes already with the date values you want. This makes it much easier to interpret the PHP side. For this you can build an array with the days of the week in text…
-
1
votes2
answers881
viewsA: Problem running str_pad in PHP
has to do with coding and does not affect the problem of str_pad. You can fix it by setting the encoding utf-8 which would be the most appropriate or even using the special encoding for that letter…
-
1
votes3
answers76
viewsA: How to judge all typed numbers? Only the latter is being judged and displayed
If you can’t use vectors, which would be the best solution to the problem, you can pass the prime verification logic into the while who reads the numbers. You can also make some adjustments to the…
-
0
votes1
answer84
viewsA: Print table value
On the ground nome in $_SESSION was not assigned on the login validation page, so it will not work. Build this field based on what comes from the $row["nome"]: if ($row > 0){ session_start();…
-
3
votes3
answers69
viewsA: How could I read a 3-digit value and print them on the screen reversed in C?
You can use an integer-based solution by applying splitting and splitting: int x = 123; while (x > 0){ //enquanto tem digitos printf("%d", x % 10); //mostra o ultimo digito com resto da divisão…
-
1
votes1
answer656
viewsA: assignment to Expression with array type
When you try to pass the array to the new allocated structure: maxHeap->array = array; // Assign address of first element of array The guy from maxHeap->array doesn’t play with the guy from…
-
1
votes1
answer211
viewsA: How to remove the first key that involves all values from a JSON
If I understand correctly, you are trying to visually format the object that came out of a JSON. For the formatting you want you can: Call the Stringify with a specific spacing Cut the first and…
-
3
votes3
answers285
viewsA: Give Hide/Show and show only contents of the clicked item
If I have understood correctly what you want to do, you can simplify your logic by using only the function toggle jquery. For this you only have to start from the element where you clicked and…
-
1
votes1
answer66
viewsA: When you click, I want to define the phrase through the indexes
If you want to place different phrases in a sequential way you can use a field in the class to know where you are going and increase as you show: Public class MainActivity extends AppCompatActivity…
-
4
votes1
answer662
viewsA: Mark all checkbox with pure js
The problem is in getting the elements to mark as checked, here: function all_check(marcar) { var itens = document.getElementsByTagName('checkbox'); He’s trying to get all the tags <checkbox>,…
javascriptanswered Isac 24,736 -
1
votes2
answers83
viewsA: Swap Button for Auto Sum
To have a code to be interpreted when you type you can use the event keyup which you can listen to directly on the html label: <input name="campo1" id="demo4" onkeyup="soma()"><br>…
javascriptanswered Isac 24,736 -
2
votes2
answers208
viewsA: Slidedown from bottom to top
The slideup although it may seem the solution just hides the element, as we can see in the documentation: Description: Hide the Matched Elements with a Sliding motion. And so it will not serve for…
-
0
votes2
answers76
viewsA: C++, Program does not resolve all Instances!
As a mere curiosity, I show another way to solve the problem, using arrays for percentages and positions, thus avoiding the switch. To make it even more interesting I chose to remove almost all…
-
2
votes4
answers102
viewsA: How to create a button that randomly selects 3 out of 5 numbers
I suggest you build an array with the elements that are yours inputs of the kind checkbox. Then make a loop for the amount of elements you want to draw and check each element drawn and remove from…
-
0
votes3
answers2592
viewsA: Switch when hovering the CSS mouse
Personally I think it’s best in your case to have the links from the menu with display:block and occupy the entire space of the item. This gives better user experience as the clickable area is the…
-
0
votes2
answers139
viewsA: Sort equal rows
I suggest using the formula PROCV. You can build a sheet with the following columns: Referencia | Tradução PT | Tradução EN Something like: In which the Tradução PT and Tradução EN are obtained by…
-
2
votes1
answer32
viewsA: Generate Separate Length for each object
As @Sergio has already said forEach already supports the index, ie the position of each element in the array. The possible parameters for the forEach sane: (valorCorrente, indice, array) Applying in…
javascriptanswered Isac 24,736 -
4
votes4
answers106
viewsA: What’s wrong with my class function to diminish the value?
Problem The problem has to do with comparing equality in floating comma values. This becomes a problem because the representation for several of the values is not exact which ends up giving…
-
1
votes1
answer2659
viewsA: C++ program error: "[Error] expected Primary-Expression before 'F1'"
The line where this error is shown is as follows: printf("\nNúmero de Ocorrências: %i", ocorre(Fila F1, &X)) That actually has several mistakes: The ; The guy Fila is not indicated in function…
-
3
votes2
answers997
viewsA: Manipulating lists in Python
You are looking for the function extend that adds an iterable to a list. To apply it you need to use a loop/cycle that runs through your initial lists. Lista_A =…
-
9
votes1
answer3485
viewsA: CPF generator in Javascript
The biggest improvement to be made in your code is to transform the two functions of generating the check digits into one, since they are almost equal. It also has several other details of both…
-
1
votes2
answers83
viewsA: Accessing variables from a struct
I start by saying that you are accessing the incorrect value in the: (*depois).agora = 20; *depois.agora = 20; For the structure horario doesn’t have the field agora, so would have to switch to one…
-
3
votes2
answers179
viewsA: Perform multiple GET with Xmlhttprequest
For what you want the ideal will be to create an array of names and as you go through it makes ajax requests creating and configuring the objects XMLHttpRequest: const url =…
javascriptanswered Isac 24,736 -
5
votes1
answer5475
viewsA: Recover password in PHP
Problem The problem with the system you have is that anyone can recover another person’s password as long as they know that person’s email and the URI the site uses for retrievals. If I wanted to…
-
5
votes5
answers4681
viewsA: How to make a Rigger for a SEM jQuery event?
Another way will be using the dispatchEvent, that implies previously creating the object that represents the event. const botao = document.getElementById("button"); botao.addEventListener('click',…
-
1
votes1
answer95
viewsA: Difficulties picking up values within an array
What you are trying to do does not make much sense. You are storing all rows coming from the table in an array: while($row = $agendamentos->fetch(PDO::FETCH_ASSOC)) {…
-
2
votes2
answers280
views -
1
votes1
answer137
viewsA: Set associative array key
Although I didn’t set all the rules that mattered, because the validations of the Laravel are quite complete and allow many other things not mentioned, such as, unique, min, max, digits, etc... I…
-
1
votes2
answers299
viewsA: Inserting elements in a dynamic list
The problem here is related to your previous question, and its Lista versus Lista*. The Lista for typedef is already a pointer criar_lista should return only Lista and not Lista*, otherwise it would…
-
2
votes2
answers491
viewsA: Dynamically provide buttons
If you want to show x TextBox, depending on a value, you can create an array to store and assign the Visible correct for each one through a loop/loop. This way it becomes a little more flexible and…
-
6
votes4
answers6957
viewsA: What is the difference between i++ and ++i?
For the example shown in the loop for both the preincrement: for (int i = 0; i < 10; ++i) { Like the post increment: for (int i = 0; i < 10; i++) { They end up being the same, resulting only…
-
1
votes3
answers1242
views -
1
votes1
answer16507
viewsA: How to print a string from a string array in C?
Problems Let’s start by analyzing the problems in the code. If he was trying to create a vector of 2 strings, as indicated in the comment, so the size did not go right as it was declared as char…
-
3
votes2
answers220
viewsA: Hide/Show in Ivs according to subclasses
The problem is you’re trying to apply the class exibir to topics, when the ones you want to show are the <div> conteudo who doesn’t have the class topic. However the Jquery already provides…
-
3
votes1
answer438
viewsA: Print on dynamic list screen
If the dadosAluno is not a pointer so is accessed with .. The printing function should then be: void imprime_lista(Lista* li){ while (li != NULL) { printf("Nome: %s ", li->dadosAluno.nome…
-
1
votes1
answer442
viewsA: Draw between user-defined options
The idea is to draw by the amount of elements of your vector and not by the numbers that are there. Imagining that you have a vector with [45,3,40,12,2] must draw lots of 0 to 4, which are vector…
-
1
votes4
answers449
viewsA: When the textbox is null, the button will be off
That logic doesn’t work because when the TextBox is empty she has the property Text as empty string ("") and not null. So just slightly change your logic: private void textBox1_TextChanged(object…
-
1
votes2
answers2715
viewsA: Calculating interest with javascript
The calculations you indicate are relatively simple, just keep the values in variables or constants and using in the following operations, since they are chained. In my example I used Array…
-
0
votes1
answer33
viewsA: I need to return the parsing result of the XHR request to the Class scope
The problem is that the ajax call is asynchronous, so there is no way of knowing when it will actually run and consequently return the value. And in the line where I would normally try to get the…
javascriptanswered Isac 24,736 -
5
votes3
answers211
viewsA: How to take data from an object and do mathematical operation with another object in C++?
As I suspect that the concept of distance itself was not very clear, I leave here my contribution, just as a complement to the already quite good answers from @Victorstafusa and @Lacobus. So I…
-
10
votes1
answer179
viewsA: Is it possible to work with Javascript Enumerators?
Javascript does not have native Enumerators but is something that can implement with relative ease. Example: const corSemaforo = { VERDE: 0, AMARELO: 1, VERMELHO: 2 }; let cor = corSemaforo.VERDE;…
-
3
votes3
answers54
viewsA: Date does not receive value more 30 days
The method you are using to add days, the plus(), is not the correct one. This one is for adding milliseconds, as the documentation indicates: public Datetime plus(long Duration) ... Parameters:…
-
13
votes3
answers26954
viewsA: Python maximum and minimum
To the minimum it has the function min and to the maximum has the function max. They can be used over 2 (or more) values, the question case: menor = min(2,8) # 2 maior = max(2,8) # 8 Or about an…
-
2
votes2
answers107
viewsA: I can’t add value in Array
There are some things you need to fix: The value of i in the cadastrarProduto which makes you always in position 1 with only one name. When cancels the prompt reads null which is also to be added to…
-
2
votes1
answer73
viewsA: Segmentation fault, Stack in c
There are some small errors in the code: The comparison in fila_Vazia is made with only one = thus: return head=NULL; In function insere_Fila the new node allocation is not correct: novo =…
-
2
votes2
answers60
viewsA: I am creating a comment system in PHP, but in the conclusion of the work I came across the following error:
His instruction of insert got a quote " the more in the middle. As it is divided into two lines it becomes more difficult to see. Lack also ( and ) between the fields being inserted, nome,…
-
4
votes2
answers169
viewsA: How to read data from a file in c and treat as a string?
To be able to read everything you need to know first how many bytes the file has. What you need to do is: Position yourself at the end with fseek and flag SEEK_END Find out what byte it’s in ftell…
-
1
votes2
answers439
viewsA: Tag html inside a string displayed one character at a time
To achieve the desired effect you can modify the addition of characters so that: When will add and catch '<' just add the whole tag When you remove and catch '>' removes the whole tag These…