Posts by Isac • 24,736 points
820 posts
-
1
votes1
answer228
viewsA: How to remove the first node from a list?
Removing the first node is done by changing the pointer head for NULL and dislocating in memory the Node that is there. An implementation that contemplates this scenario would be: //remover à cabeça…
-
3
votes1
answer837
viewsA: My double chained list is not ordering
What makes the ordination not work is the exchange (swap) of values within the second for that is not correct. We must not forget that an exchange of values between two variables always involves a…
-
1
votes1
answer544
viewsA: how to leave the video without the transparent background?
Bearing in mind that the <div> of youtube is inside the <div> transbox transparency is inherited, and is at most with 0.7, which is what it has. This <div> youtube may thus be more…
-
1
votes1
answer466
viewsA: Pressing the Backspace key, delete the previous input fields
I find it simpler to do all the logic directly in javascript, building all the functions of onkeyup simultaneously through a for. //apanhar todos os inputs let inputs =…
-
1
votes4
answers2929
viewsA: How do I capitalize the first letter?
Another possible solution is using map to turn the value into its capitalized and an array of invalid values to capitalize: const invalidos = ["de", "do"]; $("#capitalizar").on("click", function(){…
-
0
votes1
answer575
viewsA: Javascript Onclick
If the function is global you can access it from the object window and put it directly into onclick the element you obtained by html. Also missing was a label of <optgroup>, as well as the…
-
0
votes1
answer216
viewsA: Insert with "for" into a chained list
The problem is really in itself for. He should have another beginning instruction as well as another end instruction. In this way: //de 0 até ao tamanho - 1 para parar no ultimo for(int i = 0; i…
-
1
votes1
answer284
viewsA: Read Javascript on all Foreach items
As Anderson has already mentioned, it is imperative to exchange id for class, because we are not allowed to have id's repeated on a page. Therefore the initial generation part of html should be:…
-
1
votes1
answer336
viewsA: Number count according to jQuery page scroll!
You can use an auxiliary variable to control if you have already done the animation and test the variable before animating. Example: var animacaoFeita = false; $(window).scroll(function(){ //função…
-
1
votes1
answer478
viewsA: Jquery add and remove attribute not working
The correct way to modify css through Jquery is by using the function css. Soon to minimize: $("#chatMinimizar").click(function() { $("#chat").css("height", "45px"); //colocar a altura a 45px } If…
-
1
votes1
answer360
viewsA: Error trying to create a new Mysql table
The problem is the definition of the date: `data_compra` DATE DEFAULT CURRENT_DATE CURRENT_DATE is not supported as default value, as the documentation indicates: DEFAULT Specifies a default value…
-
1
votes1
answer293
viewsA: Hide or display button through a ifelse with data from a foreach
You can use the function empty php to test if the array has any elements: if( !empty($types_list) ) { //se não está vazio mostra echo "<a href='#myModal' role='button' class='btn'…
-
2
votes1
answer60
viewsA: Arrays in a single index
By adjusting the code that has now shown connection the connection has to pass into the for: while ($tokens = $this->selectTokens()) { foreach ($tokens as $row) { $tokenList[] = [ 'oauth_token'…
-
0
votes1
answer1280
views -
4
votes3
answers58
viewsA: Why does the use of parentheses affect a mathematical expression combined with a concatenation?
With parentheses the calculation is made first date('Y') - 20 that of the 1997 and then concatenated with the string that gives the text: You were born in 1997 Without parentheses the concatenation…
-
2
votes1
answer51
viewsA: Segmetation fault error - Problem in main code for inserting nodes in binary tree
Your use of the tree is not correct according to your last question I answered. In yours main you have: int main(){ ... nodo p3_main; When the tree must be a pointer, to work with the functions…
-
2
votes2
answers1731
viewsA: Insert elements into array of C++ lists
The problem is in fscanf and in the reading of the line terminus, the \n. In the first line works well, and reads the 4 values but in the second line, through debug quickly you see that the reading…
-
3
votes1
answer3423
viewsA: Binary Tree Implementation - C Language
There’s a lot of things that aren’t quite right. To be able to modify the root within the function a pointer has to be passed to the pointer instead of a normal pointer (more on this topic if you…
-
3
votes1
answer568
viewsA: Fatal error: Call to Undefined Function password_verify()
The function password_verify only exists as of PHP version 5.5, so you are certainly running that code in a lower version. You can confirm the version you have through the function phpinfo, calling…
-
3
votes4
answers248
viewsA: Problems with Javascipt calculator
Trying to arrange, changing as little as possible the logic would need to include the parseInt to read the values of <input> like numbers, fetch the operation that is not being brought in from…
-
3
votes2
answers243
viewsA: Mark checkbox if value equals 1
If the idea is to check the <input> with the name corresponding to what comes in the object to 1 can do the following: var permissoes ={ aCliente : null, eCliente: 1, dCliente: 1, vCliente:…
-
8
votes1
answer88
viewsA: App version updates and changes
The versionCode is not shown to users and so it is an incremental internal number to differentiate the various versions, and that allows the Android system not to let the user install an application…
-
3
votes1
answer77
viewsA: Insert function does not work
The malloc should be done with the list type and not your pointer. So: novo = malloc(sizeof(Noticia)); Must actually be: novo = malloc(sizeof(struct Lista)); Because Noticia is actually a struct…
-
2
votes1
answer139
viewsA: for em onload Javascript
The problem has to do with closures which makes all the functions of click are related to the same variable i, and therefore with its final value. To circumvent this effect just change var for let,…
-
3
votes1
answer683
viewsA: Group JSON using javascript reduce()
We can use the reduce starting with an empty array accumulator and adding to the accumulator elements that have the id different. Whenever we find a id equal we add the valor and the juros to what…
-
3
votes2
answers849
viewsA: How to pass a float without loss of value to an integer?
Only with a if can test whether the value the variable has is integer or not, by checking whether the value matches the truncated value of the variable, using the Math.floor: float f = 1.0f; if (f…
-
1
votes2
answers10163
viewsA: How to make the rest of the division of a float by a number in c?
The remaining operator of the division, the %, also called a module, can only be used between integers. In the code is being used between floats, here: if (a[l][c] % 2 != 0){ // ^-float ^-int For…
-
2
votes3
answers2942
viewsA: How to get $_POST value automatically?
I think what you want is to try to create normal variables based on the values that the $_POST has. Although that’s not a good idea because it could open up security loopholes, may do so in the…
-
2
votes1
answer592
viewsA: Change pointer address in a function
The problem is that as soon as this function ends and returns to that called, the pointer undergoes no change True because the value of the pointer has been copied to the other function, in the…
-
1
votes1
answer1173
viewsA: How to mount an array with Std::array and Std::vector in C++11?
Matrix with Std:vector To create a matrix with std::vector we have to make a std::vector within another, and to travel we can use the for : that c++11 provides: //matrix de 2 x 2 com std::vector…
-
0
votes1
answer429
viewsA: Dynamic checkbox does not show check arrow
If the idea is to do something when he stays checked or unchecked, better to use the event change and check the status of checked with .is(":checked") Example:…
-
2
votes1
answer657
viewsA: Current position in the file - C
The function fwrite writes at the current position at which the file goes and modifies that position X bytes forward according to the bytes that have been written. The current position in the file…
-
1
votes1
answer26
viewsA: Date formatter not working
The parse of SimpleDateFormat returns the date that was interpreted. So it’s supposed to be something like: Date dataInterpretada = sdf.parse(dt); And if you want to write it on Log with the…
-
4
votes3
answers7927
views -
5
votes1
answer732
viewsA: Pointer pointer to change my battery. Why should I use them?
Let us consider the following example, to make a function that changes the value of an integer. We could start with a simplistic approach (although wrong): void alteraInt(int numero){ numero = 10; }…
-
1
votes1
answer60
viewsA: How to make optgroup access a page
To be something interpreted in the click it is necessary to listen to the event onchange of the label <select>,and when it happens we change from url modifying the window.location.href:…
-
3
votes3
answers2171
viewsA: Javascript function when clicking on any class="foo"
At the moment you are only doing for the first link, the [0]. You can extend your logic to apply to all elements using a for: var elementos = document.getElementsByClassName("dia"); for (var i = 0;…
-
5
votes1
answer142
viewsA: Lambda expressions in nested classes with multiple methods
First let’s consider the type of interface that is being used in the exemplified code, a functional interface: Concept The functional interfaces (Functional Interface) were introduced in Java 8 to…
-
2
votes1
answer91
viewsA: Linked List - append and push
The problem is that the list is being started with a node, which has not been initialized relative to the data or next: node * lista = new node(); Who happened to have the data to 0 and the next to…
-
2
votes2
answers124
viewsA: Java (Android) - Mathematical Equations
You can make a function that calculates all values and go calling until you hit a valid result. First you can isolate the verification of four numbers in a separate method: public boolean…
-
1
votes2
answers377
viewsA: Unable to convert JSON List to Array in Javascript
Assuming that the responseText is exactly [{"id":"1","text":"bla bla bla"},{"id":"9","text":"bla bla bla"}] the parse works well: var ajax = { responseText: '[{"id":"1","text":"bla bla…
-
1
votes2
answers50
viewsA: How to make a script that generates a random background color on the site?
Note that the function used is plural getElementsByTagName and therefore returns an array of elements instead of an element. You can change your code to assign color to element 0 which will be the…
-
2
votes1
answer523
viewsA: How to instantiate a vector
In the menu option 1-Register Employee the quantity setting: int quantidade[] = new int[quantidade]; Must be: int quantidade = ler.nextInt(); for (int i = 0; i < quantidade; i++) { //alterado…
-
2
votes1
answer126
viewsA: Make element expand from its center
A simple solution is to use the scale instead of modifying width and height: // Função simples para animar a div com css transitions var square = document.querySelector('#square');…
-
0
votes1
answer614
viewsA: row items in a row (pointers)
The first error appears in: tailPtr = head; Inside the function lines because head does not exist, has to be headPtr or temp. Then at the end of the function desinfileira has: }tailPtr = temp; Which…
-
2
votes2
answers46
viewsA: Error in Sqlite class
Observing the error message we see that SQL is all together: SELECT _dataFROMtestsWHERE 1 When it should be: SELECT _data FROM tests WHERE 1 This consultation shall be based on: String query =…
-
2
votes1
answer287
viewsA: Item in selected combobox, display data in jTable
Comparison of java strings cannot be done with the operator == because it is a reference type but with equals. Soon this if is not correct: if ((nomeCliente.toLowerCase()) ==…
-
5
votes2
answers475
viewsA: Untreated exception (index based on 0)
When writing is done with braces, these indicate the number of the element to write. Hence this line: Console.Write("\nGenero do disco : {1}", genero); Should be: Console.Write("\nGenero do disco :…
-
2
votes1
answer70
viewsA: Problem using time and print
The problem is that end="" caches the writing in memory and only writes the content at the end of all the scripts. This can be circumvented by starting python with python -u or by setting the…
python-3.xanswered Isac 24,736 -
4
votes1
answer95
viewsA: Show a string in a Alertdialog
The variable nome is the type EditText, representing an element of the layout. To access the text it contains it is necessary to call the method getText(): dialogo.setMessage("Seu nome é:" +…