Posts by igventurelli • 4,441 points
166 posts
-
0
votes1
answer81
viewsA: identify Nullpointerexception
Something tells me the DAO class is called produtoDAO. Starting from this premise, in the method main() you do: produtoDAO.registrarItem(produto);. By doing this the static method registrarItem() is…
javaanswered igventurelli 4,441 -
0
votes2
answers492
viewsA: String counter in Arraylist
To count the number of occurrences of the same object/record in a list you can use the static method frequency() class Collections. You need to just do: int qtdDado1 = Collections.frequency(dados,…
-
3
votes1
answer52
viewsA: Loop code not satisfied
The problem is in the scope of the variable codigo. In fact, this code does not compile. The variable codigo exists only in the scope of do. Thus, the while(codigo.length() != 12) won’t work.…
-
0
votes4
answers482
viewsA: Comparing Strings using Arraylist
The problem is here: dados.get(++x) ++x is different from x++: Post Increment (x++): the post-increment happens after the current expression ends. For example: assuming that x = 1, if you do…
-
2
votes0
answers44
viewsQ: File . java without class signature
I was taking a look at primefaces code, when I came across the following situation (buttontemplate.java file): import java.util.List; import java.util.Map; import org.primefaces.util.HTML; import…
-
3
votes1
answer141
viewsQ: Is this some kind of "Anonymous Implementation"?
Since there are no instances of interfaces, what the code below does with the interface Comparator? Collections.sort(obj, new Comparator<T>() { @Override public int compare(T t1, T t2) {…
javaasked igventurelli 4,441 -
0
votes2
answers221
viewsQ: Boot Block
I’m studying for certification. The book says that the declaration order of attributes and initialization blocks should be considered. Scenario #1: while doing so: public class Teste { {…
javaasked igventurelli 4,441 -
6
votes1
answer313
viewsQ: What is Data Mining?
Well, the title says it all: What is Data Mining?
terminologyasked igventurelli 4,441 -
13
votes1
answer265
viewsQ: What does "Run on the JVM" mean?
Languages such as Scala, Kotlin, Clojure and others "run on JVM". What does that mean? What the JVM provides for them? The extent to which they are "dependent" on the JVM? They only run on the JVM?…
-
16
votes3
answers582
viewsQ: Maven Module vs Java 9 Module
Besides the fact that Maven works with jars and Java 9 with "modules", what is the difference between the modularization system of the two? Why would I stop modularizing my systems with Maven to…
-
2
votes2
answers665
viewsA: Setting up Github
You can simply install the Github Desktop and follow the instructions within it.
-
3
votes2
answers65
viewsA: Is it a bad idea to automatically versize classes with Jibx?
I personally see some reason to consider this nay is a good idea: The less code, the better. Frameworks exist exactly so we don’t have to create code and more code if someone (or something) can do…
-
4
votes2
answers137
viewsQ: Constants of non-priminal types
In Java, constants are declared with sequences of Keywords static and final. When we have public static final int UM = 1; "makes sense to "call it constant, since its value cannot be changed. Now,…
-
1
votes2
answers62
viewsA: Doubt in the method declaration
So I’d like to know the difference between using As it is shown, inside a code block (method) where there is no other variable called maxmarx, none. Now, if you had a local variable called maxmarx,…
c#answered igventurelli 4,441 -
1
votes1
answer7956
viewsA: How to work with Log in Java?
Java has some frameworks of logging, being the Log4j the most famous of them. Like any framework, a previous configuration is required for you to use it, but in the case of Log4j is very simple.…
-
5
votes1
answer1139
viewsQ: JSF is specification or framework?
In Javaee’s Github there is the repository javaserverfaces-spec that in his README.md says: Javaserver Faces (JSF) is a JCP Standard technology for Authoring Component based user interfaces on the…
-
3
votes4
answers806
viewsA: Assignment of Java Arrays
You can just do: String nomes[] = {"Pedro", "Diego", "Ana", "Carlos"}; String comparar[] = {"Juliana", "Pedro", "Ana", "Luiz"}; Set<String> s1 = new…
-
5
votes1
answer649
viewsA: Do I need to close the connection in each query?
My question is, I really need to open and close the connection to every controller call? Database connections are usually stateless. I mean, open up, do what you gotta do and close up. I…
-
6
votes1
answer113
viewsQ: Why do constants in the File class not follow the constant convention?
The convention for Java constants says that a constant should be declared with uppercase letters only and words should be separated by underscore (_). The declaration of a constant is made by the…
-
4
votes1
answer173
viewsQ: Initialization of attributes
Is there any difference between initializing an attribute like this: public class Turma { private List<Aluno> alunos = new ArrayList<Aluno>(); } Or so: public class Turma { private…
-
2
votes3
answers321
viewsA: Why give new in class attribute?
I don’t understand why I give new already in the attribute. You are not obliged to "give new" in the declaration of the attribute. People do this to prevent an instance with a null attribute. For…
javaanswered igventurelli 4,441 -
1
votes1
answer218
viewsA: Check if there is a file in a particular jsf rendered folder
The attribute rendered is Boolean. Do something like: @ManagedBean public class TesteMB { private File arquivo; private boolean arquivoExiste; public boolean getArquivoExiste() { return arquivo !=…
-
4
votes1
answer5876
viewsA: Java Import all classes from another package
I would like to import into package B all classes of package A It is impossible to import classes into another package. This does not exist. It is only possible to import classes from a package to a…
javaanswered igventurelli 4,441 -
3
votes1
answer878
viewsA: Passing an Array of Strings to a preparedStatement?
This problem has no solution. The Sqlserver driver for Java does not support fetature to include arrays. This exception is released when the driver you are using does not support or has not…
-
0
votes1
answer159
viewsA: Update warn change
You can use a Trigger After Update. In it you can recover the old value and the value through the syntax :OLD and :NEW. With this Rigger you can do whatever you want: insert data into some other…
-
5
votes1
answer86
viewsQ: How to know which exception can be cast in C#?
If in Java I invoke the method void cadastra() throws SQLException for example, I will be required to add a block try catch or to "relaunch" the exception that can be launched by this method. That…
-
6
votes2
answers269
viewsA: Understand error message
Heap Heap is the place (memory space) where objects created in Java are allocated. In the heap only objects are allocated. Methods and other stops are stored elsewhere. To heap is divided into two…
javaanswered igventurelli 4,441 -
1
votes2
answers591
viewsA: In a Textbox, with the property Multiline true, character n does not change line
To break the line in the Textbox you must do \r\n
c#answered igventurelli 4,441 -
2
votes1
answer466
viewsQ: RMI equivalence (Java) in C#
What is the equivalence of RMI (Remote Method Invocation - Java) in C#?
-
1
votes1
answer659
viewsA: Insert data into table with jsf,Hibernate jpa
Since you didn’t post your view code, I took the liberty of creating some code snippets: cadastraCliente.xhtml <form> <p:inputText value="#{clienteMB.cliente.nome}" /> <p:inputText…
-
3
votes2
answers2088
viewsA: Where to change the name of the project?
This varies depending on the server. Tomcat The context root in the project properties. For this, access the project properties (ALT + ENTER) and select Web Project Settings: Jboss In the case of…
-
1
votes1
answer191
viewsA: Java WEB Paging
Your question is quite generic/broad so it is not possible to give a very concrete answer. Thus, follow some observations/answers and all assume that it has no defined technology: I do the paging in…
-
0
votes2
answers580
viewsA: Redirecting JSF pages
I confess I never rerouted the systems I worked on by mapping them through faces-config.xml. I’ve always done right by action. To do for action just return the page name to do the forwarding or…
-
5
votes5
answers23968
viewsA: How to get and format current date and time?
To recover the current system date and time you can do: Date dataHoraAtual = new Date(); String data = new SimpleDateFormat("dd/MM/yyyy").format(dataHoraAtual); String hora = new…
-
1
votes3
answers1762
viewsA: Recover logged in user
When the user logs in, you can add it to the HTTP session: HttpSession session = (HttpSession) FacesContext.getCurrentInstance() .getExternalContext().getSession(true);…
-
4
votes1
answer60
viewsA: Xamarin Forms change commit
This has nothing to do with Xamarin or . NET. This is directly related to your source code versioner. I believe you’re using git, right? There is a file called .gitignore which is in your local…
gitanswered igventurelli 4,441 -
3
votes2
answers121
viewsA: Working with C#; images
Your question is very wide/open. It is difficult to answer assertively (probably why you are receiving negative votes). Simply put, you can use the component PictureBox winforms. It is very easy to…
-
2
votes1
answer76
viewsA: Help in SQL ORACLE query
You can do it like this: select tabela.familia as familia_titular, nao_titular.familia as familia_nao_titular, tabela.nome, nao_titular.nome, nao_titular.cep from tabela, ( select familia, cep from…
-
0
votes1
answer268
viewsA: java.lang.Nullpointerexception error using Scanner
You’re doing it like this: try { System.out.println("Taxa Venda:..:"); taxaVenda = entrada.nextDouble(); g1.setTaxaVenda(taxaVenda); } catch (IllegalArgumentException e) {…
javaanswered igventurelli 4,441 -
0
votes1
answer111
viewsA: Nullpointerexception error while saving object
The error happens because the variable cadastroHistoricoService is not initialized or injected at any time. Therefore, by doing this: public void alterarPrevisao() { /* Trecho de código omitido */…
-
0
votes2
answers453
viewsA: Inserting data using JPA
Target Unreachable, identifier 'UsuarioMB' resolved to null In xhtml, more specifically in EL, you should reference your Managedbean with lower case letter. You’re doing it like this:…
-
-2
votes1
answer118
viewsA: System for legalized market
If legalize means being able to market licenses, the first thing to do is to start a company. For this, look for an accounting office and explain to them what you want to do. They have the know how…
-
1
votes1
answer157
viewsQ: Deploy Heroku Maven project with multiple modules
I have a Maven (web) project composed of a packaging project (packaging = pom) and several modules. I want to deploy that project in Heroku. Doubts: Where should get the Procfile? In the packaging…
-
0
votes1
answer435
viewsA: Put dynamic theme Primefaces
You can do all this paperwork on ManagedBean. For example: Usuariomb: @ManagedBean @SessionScoped public class UsuarioMB { private String templateSelecionado = "templateDefault.css"; private String…
-
0
votes1
answer505
viewsA: Save Intellij Project as . java
Contextualization Java is a language object-oriented. An object-oriented language is composed of classes and interfaces basically. Every class (and interface) in Java is a text file with the…
-
2
votes1
answer699
viewsA: Ignore files from target folder
In the archive .gitignore include the syntax */target/*. This causes git to ignore everything inside any folder called target Worth reading from official documentation of git about the .gitignore.…
-
1
votes2
answers1088
viewsA: Delete in more than one table with an SQL?
Are your tables related? There is a foreign key in the column IdUsuario on the table areausuario? If yes, you can use on delete cascade, as explained by @Sidon. Otherwise, you can execute two…
-
1
votes2
answers99
viewsA: Datatable data is not displayed, even with loading of Arraylist running correctly
If you are using the attribute lazy="true" it is necessary to process data modeling with the class LazyDataModel. The attribute lazy makes the pagination "real", that is, makes each change of the…
-
1
votes2
answers804
viewsA: Java jsf image
Remove your pages from the folder WEB-INF. Leave them inside the page Paginas Web. whereas the archive LojaRoupas.jpg is inside the folder imagens: in the attribute library remove the folder…
-
0
votes2
answers1134
viewsA: Concurrentmodificationexception how to proceed?
You can use the interface Iterator<T> to iterate the list you want to modify. Instead of doing for (Evento e : objeto.getEventos()) { }, do: Iterator<Evento> iterator =…