Posts by Isac • 24,736 points
820 posts
-
1
votes1
answer2656
viewsA: Vector Union in C
The problem is that your union finding code is not correct, both in terms of logic and implementation. Actually doing a loop/loop of 0 to 19 with x: for(x = 0; x < 20; x++) And then test vector…
-
3
votes1
answer4313
viewsA: How to delete the contents of a file in c?
To delete the contents of a C file just open with the mode w: fopen(caminho_para_o_arquivo, "w"); Now in your case it turns out you’ve opened it previously with a+: void main(){ ... arquivo =…
-
1
votes1
answer37
viewsA: Word split with find_if
i should be 0 and j = 7, no? These are in fact the values. If we look at how the i: i = find_if(i, str.end(), not_space /*<--not space aqui!*/); Watch out for the not_space, soon as it starts…
-
1
votes3
answers722
viewsA: Format String to "00:00:00"
The logic you are using is not right because it tests each portion of the time in exclusion. It tests if the seconds are less than 10 to put the "0" but if that is the case you no longer see the…
-
1
votes1
answer68
viewsA: Problem with javascript code
The simplest solution to your problem is to ensure that for all songs stop when you will play a new one. To do this you can scroll through all the buttons stop by javascript and calling its…
-
1
votes2
answers880
views -
4
votes1
answer443
viewsA: How does each value that can be used in the CSS "Transition" (Transition-timing-Function) attribute work?
Transition timing Function The transition-timing-function defines how a transformation is applied over time. Whether it is applied consistently or faster/slowly in a given part. Example: Imagine…
-
0
votes1
answer54
viewsA: Generate numbers based on the index in the array
Whether to create random in ranges of 20 values can do it with a for instead of manually as you are doing. Yes, because even though I’m using a for the fill that you have is manual, because it…
-
4
votes2
answers1185
viewsA: How to Read this json with PHP
The json that presented has no arrays is all objects, so it makes no sense to use foreach to traverse. To access the fields you are trying to access in the code you can do so: echo "numero:…
-
2
votes1
answer1320
viewsA: JAVA - Generate a random & scrambled word
To make it work just call the method scramble, that is not to be called. I could do it with: public static void arrayword () { ... System.out.println(scramble(new Random(), random)); } And although…
-
1
votes1
answer138
viewsA: Doubts about functions
The functions you have are not being set/called correctly, just as there are other small construction errors. At the top the function has been defined deposito to receive a value: def deposito(dep):…
-
0
votes1
answer318
viewsA: Calculator Androistudio
The best thing for what you want would be to use a array for the EditText and a loop/loop to traverse and perform the multiplications if they contain values. Following this idea, would be like this:…
-
2
votes1
answer1263
viewsA: Create python dictionaries using lists
The if you are using: if palavra[:] in dicionario: Test whether the palavra writing exists in the dicionario as a whole, which is not what you want. The solution is to analyze letter to word and…
-
1
votes1
answer60
viewsA: Options from select with Closest
To get the options you have just change the selector of the Jquery for $("#test>option") that picks up all the labels <option> within the <select> test. However for in your case it is…
-
0
votes1
answer29
viewsA: Window resizing and mouseover and mouseout events
The problem is that the events of mouseover and mouseout when the window gets smaller, otherwise they stay there. This is done through the function unbind jquery. In your code would enter the part…
-
3
votes1
answer33
viewsA: Repeated results from the database
The way you’re doing, with rand(1,4) by php: $sql = 'SELECT * FROM `questoess` WHERE IdPergunta=' .rand(1,4); You will have to make multiple queries to the database and would have to store the ids…
-
3
votes3
answers2288
views -
0
votes1
answer753
viewsA: Center an image inside the div
An easy and modern solution is to use flexbox. In this case it would apply to your div external as follows: .conteudo-externo { ... display: flex; /*aplicar flex*/ justify-content: center;…
-
1
votes2
answers106
viewsA: How to make menu appear as mouse scroll
Complementing the answer of Matthew, I leave here an example as simple as possible but that allows to see the menu to work when it does Scroll up and down. To do so I also used scroll to detect when…
-
2
votes3
answers373
viewsA: Array overriding elements
You use the last object Atributos created within the registraReclamacao(): Atributos atributos = new Atributos(); public void registraReclamacao() { atributos.setNumeroIdentificacao(... And just…
-
2
votes2
answers130
viewsA: split an integer number into c++
The right thing to do var3 % 100 to catch the 23 We must not forget that the % (module) gives the rest of the division and so picks up what could not be divided. Example: 1223 / 100 = 12 If we do 12…
-
4
votes4
answers123
viewsA: Is there a smaller way to resolve the question below? and know if it is correct
Its resolution is correct yes, however it can reduce, optimize and improve a little: Can make arrays without being of fixed size, using a variable or a constant. It does not need to make two…
-
0
votes1
answer214
viewsA: Reallocate My Structure Size in C?
Although your doubt is not very clear I chose to answer in it, even to try to help in some points of logic that do not seem to me to be correct. I start by indicating that there are several small…
-
2
votes1
answer146
viewsA: Scroll over an object and its properties
Access to the object through obj.engine.functions.init() is correct. The problem is in the code within the function init: init: function () { return this.lang.hi; } Who uses the this as if it were…
-
0
votes2
answers999
viewsA: Locate id within json array[]
The logic you’re using to find the player works, only access to the field accountId is that it is not correct, this obj[prop].accountId. Makes a foreach in participantIdentities means that each…
-
12
votes1
answer332
viewsA: New vs Override
The difference is that if the method is declared with new is not polymorphic whereas with override is. Soon override gives a new implementation to the base class method, and new it is as if it were…
-
11
votes3
answers2941
viewsA: What is a View on Android?
What is a View on Android ? The concrete definition is the same class, as can be seen in android source code : public class View implements Drawable.Callback, KeyEvent.Callback,…
-
1
votes4
answers127
viewsA: Javascript Concatenation between Arrays
To complement the existing answers to the original problem with a different solution, I put here one using map, join and split. It will be shorter at code level but probably less efficient: const…
javascriptanswered Isac 24,736 -
0
votes1
answer90
views -
4
votes2
answers1091
viewsA: Operation of the new operator
Firstly, I would point out that: ponteiro->metodo(); Corresponds to (*ponteiro).metodo(); And that’s what they call syntactic sugar, that is, a more convenient way for the programmer to do the…
-
0
votes1
answer43
viewsA: Chained list returning empty outside function
The problem is in these two instructions, within the function LerArquivo: void LerArquivo(ListaVertice *lv, ListaFace *lf){ ... lv = InserirVertice(lv,x,y,z,idVertice); ... lf =…
-
5
votes1
answer5438
viewsA: How does the map function work?
Map The function map maps the elements of an array to a new array with the result of a function applied to each element. Taking the example of the documentation, we can consider an array of numbers…
javascriptanswered Isac 24,736 -
20
votes3
answers2716
viewsA: How to prove the asymptotic order of an algorithm?
I’m going to give a short answer regarding only the proof, although Jefferson has already spoken (and very well) of complexities, domains, associated notations, etc. Prove that a function c.g(n)…
-
1
votes1
answer62
viewsA: Change signature and parameters of some functions
what are the implications of this change ? The implications are few. In fact much of the pure lists implemented in C use only the structure representing the node: typedef struct estr { char letra;…
-
2
votes2
answers1092
viewsA: Separating small strings from a giant string
The simplest solution would be even using the function strtok of the library of c, which lets you read word by word based on a tab. My answer is all the same as in the documentation except that I…
-
1
votes1
answer41
viewsA: Prevent repeated Ivs from displaying
Your code is showing several divs random of the target class at a time because it has a for from a given number to 0. As a solution to your problem you can store in an array those that have not yet…
javascriptanswered Isac 24,736 -
1
votes2
answers381
viewsA: How to create several variables of the same type without repeating conditions?
You already use one for to list all categories, why not use another to check if the category is the one you want ? That one for would look like this: for (int i = 0; i < i1.categoria.size();++i){…
-
4
votes2
answers471
viewsA: Question using while
The problem is that you are not reading the option within the do while, then there’s no way out of this do while, generating an infinite loop. The standard you can apply is: char op; do { //leitura…
-
4
votes3
answers6300
viewsA: How to add numerical values inside a C string?
The function atoi to convert an entire string to number and not each character. To convert a character to number just use the ascii table and subtract. If you have the character '2' and want to keep…
-
1
votes3
answers121
viewsA: How can this be improved? (It’s just a little game)
An optimization possibility is using arrays. A two-dimensional array can be constructed with the series of numbers shown per question, then with a loop for each of the elements of this array is…
-
0
votes1
answer573
viewsA: Problem calling base constructor in inherited constructor in C++
You are using constructors to receive a string on main: int main() { ... Terrestre t1("t1"); But in the class constructor there is no such definition: Terrestre() : Veiculo(nome) Is Terrestre() that…
-
1
votes1
answer1274
viewsA: Method that returns how many levels has a Binary Tree
So much height with the amount of elements are much easier doing recursively using an algorithm Depth First Search (DFS), thus: public int nivel(Node no){ if (no == null) return 0; return…
-
1
votes1
answer99
viewsA: Create an int variable that recognizes numbers in time format
Separate consideration should be given to cases where the timetable is changed from one day to the next. In your code if the time is 1730 as 0100 so if we consider the hours 1800 he will enter the…
-
1
votes1
answer3516
viewsA: Sort a matrix in C
Sorting function has two problems. One is merely visual, the part where you print the copy before ordering: for(i=0;i<(lin*col);i++){ printf("%d ", vetor[cont]); } Notice that it’s showing…
-
1
votes1
answer130
viewsA: Seg Fault using strcat and strcpy
Most of the changes I made were guided by the compiler’s warnings, something we should never ignore. I will try to quote them so that the logic that guided the amendments is clear: Warning: Passing…
-
1
votes1
answer26
viewsA: Mainactivity error :non-static method set(int,int)
The problem begins in the import that is not correct. On top the Calendar is being imported with : import android.icu.util.Calendar; When the code being used of Calendar refers to the library…
-
5
votes1
answer411
viewsA: Help with using JS delay or setTimeout
If you want two animations in different elements to be done in sequence you have to call one in the completion function of the other. If we have the excitement fadeIn of a <p> and we want…
-
2
votes3
answers300
viewsA: Code for reversing sequence of non-vowels ending with zero status
The logic you are using makes sense, and answers the problem, but there are several details of the implementation that are not correct. Starting with the knot reversal: void inverterNvs(NO*…
-
2
votes1
answer574
viewsA: Error generating C calendar
There are some bugs that need to be fixed: The array of months with missing value The array month_days you are using: int month_days[] = {31, 28, 31, 30, 31, 30, 31 ,31 ,30, 31, 30, 31}; You do not…
-
1
votes2
answers216
viewsA: Formulario with calculus
You can do the calculation you want within the methods change of each of the datepickers to be calculated each time the person changes one of the dates. The most direct way would then be to create a…