Posts by Piovezan • 15,850 points
395 posts
-
15
votes4
answers314
viewsQ: How do I know if I am programing procedurally in object orientation?
How to know if I am programming in a procedural style in an object-oriented language?
-
7
votes1
answer586
viewsQ: Do Java 8 streams and streams bring more benefits than concision?
The only benefits I understand in Amble and streams Java 8 is code saving and, as the case may be, better expressing the author’s intention. That’s all? Is there any example of code that uses one of…
-
1
votes1
answer41
viewsA: Error compiling code in eclipse
Your mistake is on this line: c1[10].Menu(); The array c1 has size 10, that is, its valid positions are from 0 to 9, but you are trying to access the tenth position.…
-
4
votes1
answer195
viewsQ: TDD improves the design?
Some people say that TDD (Test Driven Development) is responsible for improving design of the project classes. Others say this does not happen or is not necessarily true. TDD by itself, without any…
-
1
votes0
answers113
viewsQ: What’s wrong with Java?
What are the problems and limitations of Java? You can work out Java, but with thoughtfulness and knowledge of the cause, without being carried away by the emotional. Preferably citing which…
-
17
votes4
answers1286
viewsQ: How many parameters should a method have?
What is the maximum number of parameters a method should have? When one must consider that there are too many parameters? And what to do in that case? Tupiniquim and object-oriented version of the…
-
5
votes1
answer109
viewsQ: Have the functional features of Java 8 made any Pattern design obsolete?
It is said that functional programming makes certain design patterns (thinking of the Gof) unnecessary. There’s even a presentation showing it somewhere (I’m not looking now because I’m on cell…
-
2
votes1
answer52
viewsA: Thread does not run
Is missing give start() in Thread. Do so: Thread thread = new Thread() { ... }; thread.start();
-
11
votes1
answer780
viewsQ: What is Feature Envy?
What is Feature Envy? Why is it considered a bad smell of code (code Smell)? What are the advantages of avoiding it? She must always be avoided?
-
9
votes3
answers289
viewsA: Condition Yoda, good reason to use?
Java uses something similar for comparisons involving a literal string (between quotes) or another already instantiated object: if ("Mario".equals(nome)) { The utility is to save a null reference…
encoding-styleanswered Piovezan 15,850 -
0
votes2
answers700
viewsA: How to disable a java button without removing its color
From what I understand the setEnabled(false) changes the appearance of the button even, there is no way. But try it like this: private void Button1_1ActionPerformed(java.awt.event.ActionEvent evt) {…
-
6
votes3
answers1255
viewsA: What is SRP and how is it used?
(Part translation of this answer - accept feedback on translation). Principle of Single Liability Throw away whatever you believe that this principle means. Robert C. Martin officially defines this…
-
1
votes2
answers106
views -
2
votes1
answer97
viewsA: Problem performing a Java INSERT language
The executeUpdate() is correct. Java displays the error but it seems the problem is SQL and not Java. You tried to enter a record without informing the id_perfil, that by default SQL is trying to…
-
5
votes4
answers724
viewsA: Java: When to use Interrupt vs flags?
Threads can go into standby mode and wait for a condition to continue. In the case of wait() this condition is a notify() or notifyAll(). In the case of a sleep() is simply that the time of "sleep"…
-
2
votes1
answer195
viewsA: Start a thread again
Yes, you need to finish the threads. More than that, you should declare your Horse instances within actionPerformed(), so that each click creates and runs new threads: iniciar.addActionListener(new…
-
6
votes3
answers3385
viewsA: What are asynchronous processing and synchronous processing?
Asynchronous processing in the context of your question is a processing that takes a certain time to execute and (typically) at the end of this processing the graphical interface needs to be…
-
6
votes2
answers3452
viewsA: Instantiating interface - What’s the point?
Java allows instantiating anonymous classes that implement a certain interface. It’s as if you say "create a class, no matter what its name, as long as you implement the interface I am reporting".…
-
1
votes3
answers1005
viewsA: Recognition of sound patterns
A good way to do it but that requires a little prior familiarization with the concept of Artificial Neural Networks would be to extract from the sound a vector (or two separate vectors) containing…
-
1
votes2
answers614
viewsA: Interface and inheritance for the Java connection class
The comment was going to get too big so it turned out to be an answer. I’m not sure I understand the issue of creating objects all the time, but unless you’re doing batch operations it’s best that…
-
5
votes2
answers2043
viewsA: Reading String until you find a certain character
Do so: String str = "432d+321"; int posicao = str.indexOf('+'); if (posicao >= 0) { str = str.substring(0, posicao); } System.out.println(str); // Imprime 432d…
-
1
votes1
answer2561
viewsA: How to catch an http GET replay using Httpurlconnection java.net?
If I understand correctly you’re wanting to see the headers of your request response. For this use methods HttpURLConnection.getHeader...(), as an example getHeaderFields(), which returns the key…
-
8
votes1
answer4636
viewsA: What does alpha testing, beta testing and production mean in Google Play Developer Console?
There is not much difference between alpha and beta testing except for the fact that you start with a small group for alpha testing and move on to a larger group for beta testing. Production is the…
-
8
votes1
answer101
viewsQ: Pros and cons of securing an interface contract through a subclass
This article presents an interface IList<T> containing the methods Add(T item) and Count(). The contract of that interface expects that when an item is added, the method Count() reflects the…
-
12
votes1
answer191
viewsQ: Is it correct for a method to make the same exception for two different reasons?
I’m practicing TDD simulating an alarm system. Alarm centers work connected to sensors that detect intrusion (opening a door or window, or movement within a room, for example). They have a fixed…
-
3
votes2
answers479
viewsA: Competition and memory sharing between Threads
In my experience it is not common for you to have two independent lists requiring synchronized access to an object. It may be evidence of a violation of the Single Liability Principle. But this is a…
-
4
votes1
answer1148
viewsA: How to set the key and value of an object creating an instance and put the values in the map?
The key and value types of your Map do not match what you are trying to insert into it. Map is a type of collection that holds keys and values, with the goal of you locating a value through your…
-
4
votes1
answer1045
viewsA: URI Online Judge - 1168 - Java
In one look over I found three errors. I don’t know if they are the only ones. You’re just taking a single amount v. You should take n values v. I mean, there should be something like this: int n =…
-
3
votes1
answer102
viewsA: Mysql with android
Sqlite is the internal bank of your Android application. To access a Mysql on an external server you can use JDBC but it is not recommended to do so for several reasons. The right is to call Web…
-
2
votes1
answer101
viewsA: Collection for stock use
You need to create a relationship between a key and a value. In this case, you need to map products to their respective quantities. Who does this in Java is the interface Map. Its simplest…
-
12
votes2
answers10012
viewsA: What are Network Sockets and Websockets?
Sockets are the ends of a communication between two processes (applications) through a network of computers. In the operating system these ends are resources that the system creates upon request of…
-
5
votes2
answers4510
viewsA: What is the difference between Activity, Fragmentactivity and Fragment?
I was going to reply through a comment because my knowledge in this aspect is limited, but it would get very large. The difference, if any, is between Activities and Fragments. Performance I believe…
-
19
votes3
answers16110
viewsA: What is the difference between web server and application server?
An application server is simply a server, in the sense of the client-server architecture: a process that serves one or more client applications that send you requests. Put to run a process that…
-
1
votes1
answer35
viewsA: A service can be killed by android?
Contrary to what the documentation seems to suggest, to free memory the system does not kill Activity It is the entire process of your application. Usually the services are killed together because…
-
2
votes2
answers2837
viewsA: How to clear a vector?
"Clearing" the vector in this case is not exactly possible, because it is guarding integers and not references that could receive the value null. The most you can do is assign a neutral value (for…
-
2
votes3
answers182
viewsA: Foreign value when printing array
A compact way to print the array as desired is to make use of the utility method Arrays.toString(): System.out.println(Arrays.toString(arrayRegioes)); Will be printed [*, adm, r1] instead of the…
-
5
votes1
answer228
viewsA: Maven Web Application with Github Repository and Hosted in Openshift
I believe it’s simple: Sign in to your Openshift account Click on Add application Choose the Wildfly version you want to use In the box Source code, enter the URL of your Git repository. If you do…
-
2
votes2
answers235
viewsA: Why don’t all commands work with pipe?
As a matter of fact, no programme is obliged to process data from stdin (that is, via keyboard or pipe). A program can be built to handle data from a predefined file, read a port, or simply do…
-
2
votes1
answer111
viewsA: Best format to work with sum of money in android
There is a. Try to work with the class Bigdecimal, that was designed for this type of situation. It’s better than working with float or double.…
-
1
votes1
answer226
viewsA: Pass data between Activity Android
In your case I would recommend that in the method onResume() from the first screen you searched the data stored in Shared Preferences and displayed them. That way, when you are on the second screen…
-
3
votes4
answers607
viewsA: Object orientation - How to find the right abstractions?
Object-oriented design: historical context and current situation In the early 90’s there was an explosion of methodologies for developing applications oriented to competing objects, many with own…
-
2
votes1
answer451
viewsA: JAVA Query with ACCESS - Slowness
Ucanaccess uses a HSQLDB "mirror database" which by default is stored in memory and should be recreated when your application opens the Access database. This involves copying data from Access tables…
-
4
votes1
answer134
viewsA: What should I study?
Let me give you an example of a possible way to do it, so you have an idea of what you need to learn (in addition to the basics of Java and Android): Photos and their notes need to be stored…
-
1
votes3
answers1794
viewsA: Java - Palindromic string inversion
Remove all spaces from the original sentence before reversing. You can do this with the following command: entrada = entrada.replace(" ", "");
-
2
votes1
answer103
viewsA: How to stop Handler inside an asynctask
As AsyncTasks are not made to match with Handler. You can do what you want (update screen elements each time an error occurs while connecting to Amazon) with only one AsyncTask, without needing a…
-
18
votes4
answers607
viewsQ: Object orientation - How to find the right abstractions?
Actually the question I’m trying to ask is exactly that: How to identify classes in an object-oriented system?. However, I would like to ask for two additions to the accepted answer. She seems to…
-
6
votes1
answer572
viewsQ: DDD - What is a complex domain?
It is often said that DDD (Domain-driven Design) best applies to complex domains. What characterizes a complex domain? (please be more specific than "it has complex business rules"). What would be…
-
1
votes1
answer33
viewsA: Problems importing with LWJGL
I guess it didn’t work out 'cause there were a few missing import static. Try adding this snippet at the beginning of the file Main.java: import static org.lwjgl.glfw.GLFW.*; import static…
-
9
votes4
answers1204
views -
5
votes3
answers1999
viewsA: Is it possible to develop mobile multiplatform using Java?
Look here: http://mobile-frameworks-comparison-chart.com/ The moment I searched, I found three frameworks: eMobc Kendo UI Mono for Android But this is no guarantee that the native language is…