Posts by Reginaldo Soares • 2,256 points
38 posts
-
11
votes1
answer123
viewsA: Method with foreach only returns false
You must use the equals to compare the contents of the string, the == test the reference. for(String divida : dividas){ return (divida.equals("0")) Want to understand more about comparisons in Java?…
-
1
votes3
answers1104
viewsA: UML, flow diagram between pages
Would be the Sequence diagram. The Sequence Diagram is one of the UML tools used to represent interactions between objects of a scenario, performed through of operations or methods (procedures or…
-
3
votes1
answer85
viewsA: Save output after applying an replace
This regular expression should help: String html = ""// seu html... String replaced = html.replaceAll("\\<(.+?)\\>(.+?)\\<(.+?)\\>", "[$1]$2[$3]"); Follow the full block by doing…
-
17
votes2
answers4679
viewsA: How to get the list of devices connected to the network
A good starting point should be this project, written in java : Android network tool: Discover hosts and scan their ports, in your Wifi/3G network.…
-
6
votes3
answers1132
viewsA: When to use finalizers and garbage collection in Java?
I would like to add about the finalize and its interaction with GC (garbage collector): They are executed from asynchronous form to the Garbage Collector thread, that other one is a Daemon Thread of…
-
3
votes1
answer1542
viewsA: Java Dictionary API
From what I understand you want an API to make calls in correct dictionaries? JWNL (uses the database of Java Wordnet Library which is mostly in English, there are versions in other languages)…
-
39
votes2
answers1301
viewsQ: How does the G1 (Garbage First Collector) work?
In the JEP-248 the definition of G1 has been discussed (Garbage First Collector) as the standard Garbage Collector on Java 9. In this period, I have heard many quotes about the G1, but very little…
-
3
votes1
answer239
viewsA: What is the difference between method annotation and attribute annotation
Although there are discussions recommendation is to use the annotation directly in the attribute, just like you’re doing. The intention of ORM, in the case Hibernate, is to persist the state of the…
-
2
votes2
answers1120
viewsA: How to compare only part of a Java String
I believe you wanted something like: String str = new String("Bruno Oliveira"); String str2 = new String("Gustavo Oliveira"); //cria array de strings usando o espaço como separador String[] arr =…
-
4
votes2
answers3840
viewsA: How to use dll in Java
You should wear one of the Java Apis available to access native code, are those: JNI (Java Native Interface) and JNA (Java Native Access). JNI is the official Java API (Oracle) and JNA is open…
-
3
votes1
answer122
viewsA: Correct form of Scala NULL checking in Java
Java 8 brings a new API to avoid verbosity and excessive "checks" to null and therefore unwanted NPE through methods indicating the lack of a possible return value. That’s the same purpose of…
-
1
votes1
answer180
viewsA: JMF, Java Media Framework, is there a replacement?
how is this framework for the most current versions of Java? Well, JMF is the default API (Java SE), last update (maintenance) can be seen on JSR-920 - JMF 2.1.1 (year 2002), being the first to…
-
1
votes1
answer690
viewsA: Hibernate SUM and MAX function
SQL Exception demonstrates error ORA-00937: SQL Error: 937, Sqlstate: 42000 ORA-00937: not a single-group group Function I believe that ORACLE has not identified the cluster by field:…
-
4
votes2
answers1216
viewsA: Compare two strings with C accentuation
The lexicographic order or Collation is very related to the language and alphabet you are using, and say is a problem the question of the appropriate choice of a Charset, has already been resolved…
-
3
votes1
answer94
viewsA: Error writing file on Android
The "problem" is in the decimal representation by the chosen table, it is known as DBCS normally allocated to UTF-8 and UTF-16; chars[7] = (char)153; The decimal-153 is part of the extended table…
-
1
votes2
answers305
viewsA: Why is this Resultset returning null?
Using a between Strings can cause many bugs, there are better ways to implement (using a like using wildcards for example). Seeing the name of the field dates it seems to me wrong even, the…
-
1
votes1
answer465
viewsA: Breaking net.vidageek.mirror.exception.Reflectionproviderexception error: Could not invoke method, how to fix?
Try to include the jar of Jaxen on the server lib of Wildfly(wildfly/x.x.x/standalone/lib/ext)…
-
12
votes3
answers12951
viewsA: Java += operator
I would like to increase the response by showing how the compiler evaluates the expression: int i = 3; long j = 7; i += j; The above expression translates to javac (J2SE 8 = 52 - 0x34 Hex) in: ILOAD…
-
3
votes1
answer587
viewsA: Error: Parameter index out of range (1 > number of Parameters, which is 0)
You must use "?" to indicate the parameters to be assigned in the Preparedstatement, in the case you explained the literal value "5" and is trying to bind, so the "Parameter index out of range".…
-
5
votes1
answer318
viewsA: How do Proguard remove a class method?
I hope I can help you after so long, follow my answer: Am I missing something? Is there any option to make the Proguard optimize and make Static inline methods? No, the Proguard doesn’t make…
-
2
votes2
answers40
viewsA: The functions do not end
A more elegant solution would be using Threadgroup. Following example: //adicionado Grupo static ThreadGroup tg; public static void main(String[] args) { // instancia de grupo de threads - ataque tg…
-
6
votes2
answers145
viewsA: CAST: difference between "(String) Arg" and "String.class.cast(Arg)"
Both run the same task, but the so-called "static" version generates more bytecode (more overhead at compile time). In practice both run the cast using bytecode instruction: CHECKCAST…
-
3
votes1
answer138
viewsA: Nashorn Project, javascript + java?
After some research, I came to some conclusions regarding my question, they were: Regarding an example of in encoding java + javascript I could find in a reference of a answer by…
-
5
votes2
answers1375
viewsA: What’s the difference between On heap and Off Heap in Java - JVM Memory
Hello @Filipegonzagamiranda, follow my view on your question; I would like an explanation determining the characteristics of On heap and Off heap Memory in Java. On-Heap Java Memory is the memory…
-
2
votes2
answers842
viewsA: How to add a JAR library to a Java project without IDE?
You must have forgotten an addiction, specifically: jcommon-1.0.23.jar (rev. 1.0.23 may vary, this comes with the latest release of Jfreechar) You find the dependency information on download page of…
-
1
votes2
answers474
viewsA: Sockets in java
Your question is very Generic, I see that the difficulty can be general as to the development of Sockets. A concise definition of Socket is: Socket is a bidirectional communication…
-
1
votes2
answers8637
viewsA: Maven build error - Could not resolve dependencies for project
The artifact in question com.outjected:simple-email:jar:0.1.2-SNAPSHOT does not exist in the repository http://repository.primefaces.org (which he is trying to find), I also checked the Maven…
-
4
votes1
answer138
viewsQ: Nashorn Project, javascript + java?
I found the approach interesting after studying more deep bytecode instruction Invokedynamic. But I have doubts about design and practical use. The javac natively will understand the javascript…
-
2
votes1
answer400
viewsA: How to Change the VM Heap Space on a Netbeans Platform Project
My suggestion is to modify directly in the netbeans configuration file: netbeans conf. You ponde meet him at: global facility: ${Nb-install}/etc/netbeans.conf or local user:…
-
6
votes1
answer357
viewsA: How to use Bilge and stream?
Follow the explanatory view of the syntax with detailed references in links: BasicDBList list = (... Implementa Collection ...) To new Collection interface (java 8) brings the default implementation…
-
11
votes1
answer255
viewsQ: Canonicalized Mapping and Weakreference
I would like someone to explain the concept (and applications) of Canonicalizing Mapping and how your reference implementation would work using Weakhashmap.…
-
2
votes1
answer689
viewsA: JPA does not persist the Object in the database
My suggestions: Inject the DAO so it can be registered by the container and have the injected dependencies. @Controller public class CadastroController { @Inject private Result result; @Inject…
-
1
votes1
answer234
viewsA: How to override the remove() method from Iterator?
In my view it would be: @Override public void remove() { if(posicao <= 0) { throw new IllegalStateException("elementos indisponiveis!"); } this.vendedores.remove(--posicao); }…
-
2
votes1
answer719
viewsA: How do I make a DAO standard abstract java class to inherit in dao classes?
Apparently you’d like to implement a Crudrepository which is part of Spring Data, but is used as a strategy for persistent entities (JPA). Since you don’t want to use any JPA files, we go to an…
-
1
votes1
answer365
viewsA: Collection Namedquery as Parameter
The correct syntax (JPQL Snippet) for IN with Collections should be written without parentheses: Query("SELECT NEW br.com.dto.LancamantoDto(m.id, r.id) \n" + "FROM Lancamento l \n" + "WHERE…
-
3
votes1
answer240
viewsA: JAVA connection to BANK
Only Wrapped Exception returned no help, the ideal would be to have all the stack trace and get the root cause. However I will indicate some possibilities, which can help those who get a…
-
5
votes4
answers1851
viewsA: Infer class type from a generic
I believe it has already been well covered by all the answers the limitations of the type Erasure which is implemented by javac, i.e., type Generico has no way to be recovered directly. My intention…
-
5
votes1
answer211
viewsQ: What justifications/implications for the removal of Permanent Generation?
I could observe that in "Java Hotspot Performance Engine" 8 Permgen has been removed, but what was the motivation for this and where was it relocated? Is there any implication in this, for example,…