Posts by prmottajr • 958 points
43 posts
-
0
votes2
answers63
viewsA: Average is not being stored-C
Before the fclose(arq); call the fflush(arq);
-
-2
votes3
answers1443
viewsA: C++ - How to create a window in windows
In C++ you do not have a native window Toolkit. Each vendor has one, and has some free ones. You can try Qt which is well diffused.
-
2
votes1
answer301
viewsA: Exception divided by zero in Java
This is not so only in Java. This has to do with the mathematical representation itself. In the set of integers you cannot represent the entire division by zero. In the set of real numbers you can…
-
1
votes2
answers97
viewsA: String to int conversion
When you use Integer.parseInt may occur a NumberFormatException. How are you putting right the Integer.parseInt(tvseek.getText().toString()); this can give a problem if the text of the text field is…
-
0
votes3
answers100
viewsA: Printf does not print inside the while
Your code does not modify the Lint variable you receive as the first parameter, you create a new element and return but this is not stored and so when you print the list is empty.
-
1
votes1
answer408
views -
0
votes1
answer127
viewsA: Move the highest value of an Array to the end of it.
You don’t need the second part: for(int c = (Arranjo.length - 1); c >= 0; c--){ if(Arranjo[Arranjo.length-1] != maior){ aux = Arranjo[c]; Arranjo[c] = maior; Arranjo[c-1] = aux; }//end if }//end…
-
3
votes2
answers198
viewsA: What are the advantages of creating dll’s in the project and not putting the classes directly into it?
The most important reason has already been said: Reuse code, you allow other people to use code that is already ready which (should) decreases the time to build new systems and (should) ensures that…
-
8
votes1
answer1056
viewsA: What are layout managers and why should they be used?
We need to take some things into consideration: Originally the Java language was introduced to the world without a IDE The Java virtual machine is cross-platform, programs must run the same on…
-
2
votes1
answer384
viewsA: How to interrupt a while loop
I guess what’s not working is that the JOptionPane is above the screen and you cannot return to enter new values. Ideally you would do the following, when the user clicks on the add button you take…
-
0
votes1
answer215
viewsA: Project error: JSF does not respond or display Message
In fact the error has nothing to do with the part you are in doubt. In the error message is the following: sourceId=j_idt6:j_idt8 When we create a JSF page each component can (should) have an id,…
-
0
votes1
answer40
viewsA: I’m having trouble finding the highest number
You must start the variable maior with a value different from that already in the array, say -DBL_MAX (defined in float. h). That way you know that anything that comes will be bigger (probably).…
-
0
votes2
answers697
viewsA: Classcastexception error when trying to cast between classes
Actually we can yes downcast. If it was not possible the cast would not be set in the language. Only in your case the object in which you are applying the cast is not compatible with the type of…
-
1
votes2
answers248
viewsA: Datatable column row with more than one attribute
A datatable column will show as many things as are placed in your statement. Assuming you want to use a second index of the array shown would do the following: <p:column…
-
1
votes1
answer60
viewsA: Error while listing database data - JPA2 and Hibernate / JSF
Check the version of the Hibernate-Commons-Annotations library that is 4.0.1 while the others are 4.1.6. Another thing the line: fr.buscaTodas(); Should be: listaFornecedor = fr.buscaTodas();…
-
0
votes2
answers509
viewsA: Load data into Inputtext JSF + Primefaces
Put an id on your dashboard: <p:panel id="painel" header="Pesquisar Cliente"> And in the update use the following: <p:commandButton value="Selecionar"…
-
1
votes1
answer38
viewsA: I don’t understand this form of static variable declaration
This statement is used within a class when we want to execute some code snippet on class startup, which includes assigning something to a variable static.
-
5
votes3
answers241
viewsA: how to pass by value in Javascript
The method assign makes a blank copy, ie copies the attribute values that are from the object, but whatever reference it copies the reference value. In your example a contains two references and is…
-
3
votes1
answer93
viewsA: How do the main function inputs work in C?
You have an array of strings (char **argv) of integer size (int argc). It is important to note that the parameter of position 0 is the name of the program itself, and the next ones are the…
-
2
votes2
answers1582
viewsA: What is the difference in the syntax ptr = (int*) malloc (sizeof(int)) and ptr = malloc (sizeof(int))?
The malloc function returns a pointer to a memory without type (void*), however, normally we use this memory with a pointer of some defined type and so the first line cast to (int*) (which indicates…
-
0
votes3
answers214
viewsA: Java Mergesort sorting algorithm error
Try MergeSortClass.dividir( array, 0, array.size()-1 ); because the Arraylist size is the amount of elements, but as it starts at 0 the last valid position is size-1.
-
1
votes1
answer1610
viewsA: manipulate csv file in c++
You can use a composite approach. Up to the fourth field you use the Strtok, from then on you make a for looking for the first occurrence of quotation marks (beginning of Body), all that gathered…
-
2
votes2
answers233
viewsA: Binary search tree (Binary search Tree) and binary search (Binary search)
It’s not that it works with some changes. You can apply the binary search algorithm to any data structure that is orderly. But each data structure will have its own implementation to navigate the…
-
0
votes1
answer178
viewsA: Sending data via sockets(): :Software caused Connection abort: socket write error
Within the process methodIf you are closing the input and output variables. This should only be done, for example, after the client sends a shutdown command.
-
0
votes2
answers786
viewsA: Difference of months between two dates, without considering the day of the month
The method between nay includes the final date. Try doing: LocalDate demissao = LocalDate.of(Integer.parseInt(saida[2]), Integer.parseInt(saida[1]), Integer.parseInt(saida[0])+1);…
-
1
votes1
answer60
viewsA: Using Linux libraries
Looks like you used include libraries that define the same symbols. Search in which files the function fd_set is defined to have an idea of who the candidates for conflict are. In addition, it is…
-
0
votes3
answers337
viewsA: What’s wrong with allocating memory with new and then not erasing?
Whereas you used to auto then you should be using at least C++11 then you might consider returning a std::unique_ptr which ensures that there is only one copy of the pointer. Thus, the user of your…
-
0
votes1
answer50
viewsA: Java does not finish txt file, generates txt more than 100MB
Note that in the answer of the other question the excerpt that records the information has a "//omitted" comment because it was to join with your code. At that stretch if you remove the command to…
-
3
votes1
answer61
viewsA: Recursion problem, C language
What the function does is to call itself by increasing the string pointer, so the calls are stacked in memory, until a moment will come when the if will fail because it will find the \0 that ends…
-
1
votes1
answer576
viewsA: Error 404 apache Tomcat
You need to have a class that configures the application. Put the following code: package login; import javax.ws.rs.core.Application; @javax.ws.rs.ApplicationPath("api") public class…
-
0
votes1
answer72
viewsA: Java Server Application Client loops
A first comment is that the encryption class should start with a capital "C". About the code presented there are some things to consider: The ideal is to have one class for the server and another…
-
-1
votes1
answer114
viewsA: Open Visual C++ with arguments to compile
You can use cl.exe which is the command-line compiler of Visual Studio. Even you don’t even need Visual Studio, could use only build tools that would already do this. The first step is to open the…
-
0
votes2
answers95
viewsA: How to make Item only appear when category code = 1
One simple way to do this is in the build that returns the type listGuia, in Backbean you can check that the category is 1 and not include embargo in the list. To do this on the screen part could…
-
0
votes1
answer66
viewsA: How to decrease processing on the moon? or Muti hash?
The physics collision detection is very laborious and the Löve2d documentation recommends only using this if you are sure what you want to do needs physics (like a pinball game I did once). A simple…
-
5
votes2
answers197
viewsA: Java polymorphism
It’s not right because B is more specific than A. That would compile if you made one cast: B oab = (B) new A (); That’s because, although here is the operator new, an object that came from a…
-
0
votes1
answer97
viewsA: I can’t select multiple objects from my components
The variable serviceBean.servico.serviceServico must be a type that receives several objects, but you will also need a converter because selectItems is filled with Selectitem objects and not with…
-
1
votes1
answer149
viewsA: Customers do not communicate in the same multiplayer game in Java
The problem is that your Arena object is not Static, so it is an attribute of the Server class. This means that each time a Server object is created a new Arena object will also be created. And this…
-
-1
votes1
answer861
viewsA: How to run DOS command in JAVA with Administrator privilege?
You can create a . bat file that takes the value to be used for the DATE command and then create a shortcut to . bat. Then you must configure the shortcut to be executed with administrator privilege…
-
2
votes2
answers1470
views -
11
votes2
answers1053
viewsA: Problem of the Byzantine Generals. How to implement a solution?
The idea is to reach a consensus on some action that should be taken in a distributed environment. The problem was illustrated as follows, a group of generals must reach a consensus whether they…
-
1
votes1
answer864
viewsA: make a include of a library out of the library folder
You can put a part of the path name as follows: #include <projeto1/meuHeader.h> #include <projeto2/meuHeader.h> However, the path of these projects will need to be in the list of…
-
2
votes3
answers145
viewsA: How to embed one library into the other?
If SDL2 offers a static version of the library you can build your project by embedding SDL2 into your library, so your end-user only needs to link against your library. You can see this discussion…
-
0
votes2
answers2364
viewsA: Josephus problem (recursive)
I haven’t circled the example I won’t claim to be right or not, but let’s talk quickly about recursion. I think that’s the problem with understanding. When you make a recursive call the function…