Posts by Isac • 24,736 points
820 posts
-
5
votes3
answers294
viewsA: Transform Set<Integer> into Set<String>
You can simply use a loop/loop that passes across all elements and converts them one by one to the type you want, thus creating a new one Set of this type. Conversion to String is made by calling…
-
1
votes3
answers96
viewsA: How to keep a div always active
Every time you have too much repeat code means you’re not doing things the right way and you end up making it harder later when you need to change or maintain the code. You can refactor the code a…
javascriptanswered Isac 24,736 -
1
votes2
answers597
viewsA: How to remove an object from an array, if it exists, with json string
Since the test of existence is based on the id can use map to catch him only the id and indexOf. This gives -1 if there is no or a positive index when there is. Example: //Essa é a minha oldlist,…
-
1
votes1
answer265
viewsA: by checking whether the date of an Edittext is greater than the date of another Edittext
Assuming the dates of the two EditText are in format dd-MM-yyyy can do the following: EditText editData1 = (EditText)findViewById(R.id.meu_edit1); //id para o seu 1º EditText EditText editData2 =…
-
2
votes1
answer98
viewsA: You need to double-click the button to add input dynamically with jquery
The problem is on this line: $('#addr' + i).html("<div><input type='text' name='cirurgia' value="+i+"></div>"); Who initially tries to go to the element #addr0 define the html,…
-
1
votes1
answer27
viewsA: I can’t get an array
Look at the structure of the information in the API you are using: { "page": 1, "total_results": 1, "total_pages": 1, "results": [{ "original_name": "Everybody Hates Chris", "id": 252, "name":…
-
1
votes2
answers730
viewsA: How to pass two arguments in Javascript’s onclick function, programming in PHP?
Personally I think that in your case it is simpler to write html as html and put only what comes from php with <?= <?php $id = $_POST["id"]; ?> <button type="button" class="btn btn-link…
-
1
votes1
answer136
viewsA: Count how many times each element appeared with another in an array
You can use a foreach to get to the sub-array to be analyzed, and then use two for to check each element in their neighbors: $a_controle = Array('A','B','C','D','E','F'); $array_final = Array(…
-
3
votes2
answers222
viewsA: File In C language
The fscanf return: The number of elements read and assigned to variables 0 if you could not associate any element EOF, which corresponds to -1 if you have reached the end of the archive In this case…
-
1
votes1
answer161
viewsA: Javascript does not work
For your code to work, you only have to remove the <!-- who is in the second <script>: <SCRIPT LANGUAGE="javascript"> var now = new Date(); var mName = now.getMonth() +1 ; var dName =…
-
2
votes1
answer760
viewsA: How to remove non-numeric characters?
A string must always end in \0 to be correct, which he lacked put in function apenasNumeros: void apenasNumeros(char *texto, char *dest) { int i, j; int length = strlen(texto); j = 0; for ( i = 0; i…
-
0
votes1
answer41
viewsA: Sequence of execution of tasks
We start in function setup defining the value of y and calling the function fn: float w = 2.2; float y = 3.0; void setup(){ y = 2.0; //alterar o y global float x = fn(w + y, y); //resulta em fn(2.2…
-
3
votes1
answer657
viewsA: Use two code::Blocks at the same time?
To be able to have multiple Codeblocks open at the same time you need to uncheck two options: Settings > Environment > Allow only one running instance Settings > Environment > Use an…
codeblocksanswered Isac 24,736 -
1
votes2
answers572
viewsA: Remove duplicate array element
For the logic you are trying to implement you can go through all the arrays you have inside the main and for each of them check if it contains the value you are looking for using the function…
-
1
votes1
answer3440
viewsA: Like leaving a div next to each other?
One way to place them side by side is with float:left. I take this opportunity to say the property left has no effect on static positioned elements such as yours, and that display:block is the…
-
1
votes3
answers447
viewsA: Problem in the use of malloc and realloc
I start by responding to some of the things you put in the comments: Another thing I’ve seen is using the NULL boot that I don’t use In some cases it becomes necessary, when the code tests if…
-
2
votes3
answers1435
viewsA: Call functions for ajax request inside callback
It keeps returning undefined because the ajax requests are asynchronous, so they are only executed much later, however the function has already ended because it did not wait for the request to be…
-
1
votes1
answer162
viewsA: How to modify dynamic matrix?
The problem in the code shown comes in the function Alocar. When does m = ... within the function Alocar is changing a copy of the pointer in the main what makes the main continue without being…
-
1
votes1
answer52
viewsA: How do I show the book with the most pages?
Failed to update the book with more pages inside the if, and the else it also makes no sense to be otherwise the message "Nenhum Registro Encontrado" can appear several times. For the same reason…
-
2
votes1
answer48
viewsA: Problems with recursion in c
The recursion you want to make boils down to the following logic: Check if the item you go to is larger than the k and account for 1 if or 0 otherwise Call the same function recursively for the next…
-
3
votes1
answer1325
viewsA: Passing objects by c++ reference
To do the same in C++ it is common to pass a pointer to the object in the class constructor. The same example could be encoded like this: class Folha { public: void Marcar(){ cout<<"Marcar de…
-
2
votes2
answers349
viewsA: Dynamic matrix creation that stores broken text
From what you pointed out in the comments, you’re trying to split a string in small strings according to a separator, what is commonly called split. In the case presented the separator to be…
-
4
votes1
answer362
viewsA: How to sort array structures based on the rank of the songs?
The problem is in swap values of the vector, which only rank of each element to be ordered. In order for the exchange to be done as a whole, you can exchange elements of the structure directly:…
-
3
votes2
answers215
views -
3
votes1
answer334
viewsA: How to hide the vertical line shown in the Android Studio editor
To hide or show the line go to: File > Settings > Editor > General > Appearance > Show right margin…
android-studioanswered Isac 24,736 -
2
votes1
answer1155
viewsA: Make the text appear when clicking the button and the image specifies it?
The most direct solution for what you want is to create an id array with the ids of each image and that correspond to the texts in the array frases: private String[] frases = { "O CACHORRO E BOBO",…
-
5
votes2
answers191
viewsA: What is the best way to sort lists in Java?
There are many ways to sort, either by hand or already using done functions. And there are several types of sorting algorithms. Each can be better or worse depending on the purpose and type of data…
-
2
votes2
answers443
viewsA: Leaked triangle with css
One way to do what you want is to apply the inverse rotation on the child element (the <span>), and place their position as absolute, and that of the father as relative. Following example:…
-
1
votes1
answer75
viewsA: Select Child after using querySelectorAll
For the specified html you can use the selector you have specified li.ui-artist-related__artist > a to get to the links. After each link gets to the image that is inside it using the property…
-
1
votes2
answers167
viewsA: The whole name doesn’t appear
Place scanf("%s %s" reads two words for two different variables and not just one. If you want to read several words for one string and end only at Enter can change the reading to:…
-
0
votes1
answer75
viewsA: Error while running C program
There are several problems in the code presented. %c is to read a caretere. To read a string you must use %s The declaration of a variable of the structure type struct informacao_sobre_os_filme;…
-
2
votes3
answers69
viewsA: Program does not meet expected flow by reading and printing input
Missed the & in reading the values in scanf. This is necessary because the scanf receives the location in the memory where you have to put the read values, which is what the operator &…
-
0
votes1
answer30
viewsA: "Less" value is removed
To withdraw values less than 4 characters can use the function array_filter you are already using by passing a function with the appropriate logic. Since the array values are numerical, filter the 4…
-
0
votes1
answer171
viewsA: Can anyone help me assign value to the positions of this matrix with pointers?
The printf is not displaying the element you have just saved: m[i][j] = 0; //Inicializa com 0. printf("%d",m); //<---aqui Switch to: printf("%d",m[i][j]); The m It’s a pointer to a pointer, not…
-
0
votes1
answer136
viewsA: Optimize Java code
You can do the tests all in a row with ifs which are very short and readable. You only need to directly test the length of each of the EditText and create the error message if 0: void…
-
1
votes2
answers67
views -
1
votes1
answer512
viewsA: Sorting by name and number plate
The function OrdenaMatricula was very close to working. It only has the pointer increment aux in the while wrong and missed using the nome and the nota. You can modify it to: void…
-
2
votes2
answers85
views -
1
votes1
answer44
viewsA: Select database data within another while?
Imagining that on the table eventos the field data is of a date type, we can then get the amount of events per day by changing the query to use a GROUP BY in the days: SELECT DAY(data), count(*) as…
-
1
votes1
answer33
viewsA: Dictionary running all keys instead of just one
The construction in switch It calls the functions as it defines the various possible values, which makes it execute the 4 existing operations. Can fix this easily by making the switch just construct…
-
3
votes2
answers631
viewsA: Update div with checkbox value marked
If you want div to be updated when you check and uncheck checkboxes you need to use the event change. In this event you have to go through all <input> and put its value if the attribute…
-
3
votes1
answer568
viewsA: Fill out a form with Json data in jquery
According to the json structure you navigate to the description by doing: objeto.items[0].volumeInfo.description Example: const json = `{ "kind": "books#volumes", "totalItems": 1, "items": [ {…
-
3
votes3
answers236
viewsA: char print returns random character
You are trying to read a word/phrase: The program should read a word (or phrase) and the printf show the word (or phrase) But then uses %c indicating the character (only one): scanf("%*c",…
-
1
votes2
answers2838
viewsA: Dropdown menu with javascript
The if that it has is not complete and instead of the else call for startMenu() should apply the style reverse, which is the none: ex1.style.display = "none"; You can also generalize logic to any…
-
17
votes2
answers1370
viewsA: How does code obfuscation work in Javascript?
The \x only indicates the character to be displayed in hexadecimal format and corresponding to the ASCII table. Of documentation: \xxx the Latin-1 Character If we have \x61, we can look at the ASCII…
javascriptanswered Isac 24,736 -
2
votes2
answers214
viewsA: List values of an array in a spinner, and when selecting an item print its value from another array
The parameter position gives you the position of View in the Adapter and subsequently the position of the chosen element in the array passed to Adapter. So you just need to access at the same…
-
1
votes4
answers410
viewsA: JS countdown - How to insert a "zero" in front of numbers smaller than 9?
A very simple solution is to use the function padStart of String, that guarantees you the size and filling with zeros. Take the example: let horas = 2; let minutos = 8; let segundos = 9; let relogio…
-
1
votes1
answer83
viewsA: How to get whole value of textbox and convert to whole? Javascript
The ids cannot only have numbers. It must have at least one letter, as you can see here in the W3C documentation: and must contain at least one Character In addition, the code as it is interprets…
-
5
votes2
answers92
viewsA: How to make a function that takes two integer vectors and returns a boolean value?
The error it gives you is due to lack of variable initialization encontrou. Assign a value when declaring it: public static bool verificar(int cont, int m1, int m2, int[] Cobertura1, int[]…
-
1
votes1
answer39
viewsA: Hide content and change size of other
To exchange classes you want you can use the function removeClass to remove the old class and function addClass to add the new. Something like: $("#hide").click(function() { $("#content").hide();…