Posts by Giuliana Bezerra • 3,707 points
133 posts
-
2
votes2
answers157
viewsA: Is capturing Nullpointerexception bad practice?
There are two main types of exception: verifiable and unverifiable. The checkboxes (Exception) are the ones that Java forces you to deal with because the user must be able to recover from the…
-
16
votes6
answers12128
viewsA: Error typing GIT PUSH
git is already giving you the solution. Uses the command: git push --set-upstream origin master Where origin is the name you put when you used the command git remote add, and master is the name of…
-
1
votes1
answer163
viewsA: Python Source with subprocess
The problem is that the variable inputfile_1 that you use in subprocess.Popen was defined only in the scope of the main definition. To work you would only need to declare it as global or place this…
-
0
votes1
answer326
viewsA: Select bestsellers in related table
Now how would I filter this by the date that is on the orders table (ex: WHERE data > 2015-01-01)? For this just do the Join with the table that has the date and check the condition in the clause…
-
1
votes1
answer178
viewsA: load value in empty front form without starting with 0 [java] Thymeleaf + spring
To solve just initialize Entity with null value, so nothing will be displayed. Simple like this. // Inicializa integer com valor igual a null. Integer entity = null;
-
1
votes2
answers286
viewsA: Use of the REST question mark
It is possible to use the "?" in the URL, but you would have to replace it with its encoding: %3F. In that case, your URL would be: meuservidor/buscar/%3F Similar behavior is adopted when the URL…
restanswered Giuliana Bezerra 3,707 -
6
votes1
answer100
viewsA: Effect of ajax on button
The "ajax" option basically says if there will be a Submit of the page when the action of the button is triggered and consequently the new rendering of all its components. In your case, the update…
-
2
votes3
answers504
viewsA: Javac command with more than one packaged class
Note that you are only compiling JAVA files that start with the name planets (planets*. java): C: Users marci_000 Documents OCA exercicios>javac -d bin -cp src com scja Exam planetas*. java;src…
javaanswered Giuliana Bezerra 3,707 -
1
votes0
answers101
viewsQ: High availability git repository configuration using Helix and Zookeeper
I need to set up a cluster to maintain the high availability and synchronization of a GIT repository configured by KIE Workbench. The scenario I have is this:: VM Machine 1 - 192.168.33.50 - Ubuntu…
-
0
votes1
answer52
viewsA: Invalid "required" attribute
The problem is because you are using Java 6. required is only supported from Java 7, according to documentation. So to work, you’ll need to use at least Java 7. Source:…
-
0
votes1
answer74
viewsA: Programming Android Studio
Java does not allow two classes in the same package to have the same name. What you should do is rename one of them. Another constraint is that more than one public class can only be declared in the…
-
3
votes1
answer812
viewsA: Traverse array and locate a character other than a number
There are several problems in the code snippet. Come on: 1 - char [] digitos = new char[3]; If you want an array with 4 elements, its size needs to be four, its maximum index is 3, as it starts from…
-
1
votes1
answer1197
viewsA: SELECT to filter null value?
The left Join block needs to have an alias. Modify your query by adding an alias as follows: left join ( select * from venda t3 inner join itemvenda t4 on (t4.venda_id = t3.id) inner join produto t5…
-
2
votes1
answer47
viewsA: Nullpointerexception when trying to obtain Java compiler instance
This problem occurs when you run the code with a JRE and not a JDK. To solve, you need to inform the JDK path in the property java.home. One way to do this programmatically is to directly inform the…
-
0
votes2
answers37
viewsA: Inclusion of method in own class
Methods describe behaviors of objects that possess it. If the client registration behavior is inherent to the administrator, the administrator should have the method. Despite this, it is interesting…
oopanswered Giuliana Bezerra 3,707 -
1
votes2
answers88
viewsA: Credit card in android app
There are advantages and disadvantages to every approach: 1- Save to APP: Perks: No need to write information because they are saved directly on mobile; Partially offline. Disadvantages: Changing…
-
2
votes1
answer112
viewsA: Error while doing image url GET on Json Android
The problem is that you are passing a URL and trying to convert it to a JSON object. A String that you must pass to the getJSONObject must be in JSON format. In order for the URL to be converted…
-
0
votes1
answer551
viewsA: Vagrant shared access between team
Then, just use a private network ("private_network") and a public key for access via SSH. For this, you would write in Vagrantfile: config.vm.network :private_network, ip: "58.147.128.0" On the…
-
2
votes2
answers855
viewsA: Modeling launches using customers and suppliers
My suggestion is that instead of you creating a Customer and another Vendor table to associate them directly with Launch, you create a table that represents an abstraction of them associated with…
-
2
votes1
answer279
viewsA: Error trying to insert data via JSF-Bean Error
The problem is here: @ManagedBean(name="UsuarioBean") By default, the name of the mbeans is the name of the class with the lowercase initial, but you have overridden it by indicating the uppercase…
-
5
votes1
answer124
viewsA: How to use a concrete class method created from an interface?
As much as your object is built as Advogado he is declared as IPessoaFisica which makes accessible only the interface methods IPessoaFiscia. To gain access to the method Advogar you will need to…
-
0
votes1
answer2317
viewsA: Configure JDK in Android Studio
Android Studio uses the JAVA_HOME variable to get the Java version. You need to use the command below informing your respective Java location: export set JAVA_HOME=/usr/lib/jvm/java-8-oracle/ That…
-
6
votes3
answers1181
viewsA: How to create a filter from the words/phrases of interest to filter a particular wave from a "List"?
Since you are using Java 8, you can use the lambda expressions. An example of how it would be possible to use them is: List<Vaga> vagas = criaVagas(); List<Vaga> vagasFiltradas =…
-
1
votes1
answer62
viewsA: Keyboard opens when I call my Loginactivity, how to solve it?
It is necessary to modify the property android:windowSoftInputMode of your activity. You can do this on your Androidmanifest as follows: <activity…
-
2
votes1
answer135
viewsA: Error accessing method in Managedbean
Your problem is here: <h:commandButton value="Remover" action="#{controllerAluno.removerAluno(item)}" /> You should not call methods the Managed Bean passing parameters. The call references…
-
10
votes2
answers6860
viewsA: How to number the alphabet and add its letters getting a result for each written word?
What your code is doing is simply printing what someone types. You need to add the sum logic and mapping of the alphabet. For this, you can make the following modifications: 1- Create a method that…
javaanswered Giuliana Bezerra 3,707 -
2
votes1
answer804
viewsQ: How to create Debian startup script by modifying environment variables
I need to elaborate a startup script that modifies the resolution that Debian puts by default. I currently have the following shell script that does the job: export…
-
0
votes2
answers166
viewsA: Doubt in the implementation of Actionlistener
For you to know which button triggered the event, you can use the getSource of ActionEvent: String comando = ((JButton) e.getSource()).getText(); if (isComandoSalvar()) //Chamar comando salvar else…
-
25
votes1
answer412
viewsA: What is fuzzy logic?
Fuzzy logic is a logic that differs from boolean by working with a value scale and not just with the binary scale true and false. This scale of values determines the degree of relevance of an…
-
2
votes1
answer294
viewsA: Error, I cannot save in bank using Hibernate
Using this Maven archetype you will need to create the file hibernate.cfg.xml within the Resources test folder (src/test/Resources). This is because the resource file loading context is different…
-
1
votes2
answers67
viewsA: Problem in the printing of a vector
The problem is that on my output it looks like this: proof. Vector@89cf1e When you have the vector printed with the System.out.println(lista) is the name of the object and the Identity hash code…
-
2
votes1
answer796
viewsA: How to treat exception in a Webview?
One way around this problem is by using a WebviewClient to handle error reception: webView.setWebViewClient(new WebViewClient() { @Override public void onReceivedError(final WebView view, int…
-
2
votes2
answers899
viewsA: Pass data from one Activity to another without starting it?
You are starting the same Activity more than once, one without the information you wish to pass on and the other with that information: //Segunda Tela //Recebo as Informações e repasso para a…
-
2
votes1
answer85
viewsA: Calling method inside a getter
Methods get has a single purpose: to return values. They cannot be responsible for any more complex processing than just returning a value. Like the scanHtmFile is a method that initializes an…
javaanswered Giuliana Bezerra 3,707 -
1
votes1
answer54
viewsA: Nullpointerexception when comparing two String arrays in java
Your problem is here: //IMPRIMINDO O RESUMO DA VENDA PARA CONFIRMACAO for (i = 0; i < 20; i++) { for (int j = 0; j < 20; i++) { //O ERRO DO NULLPOINTER OCORRE AQUI NESTE IF{ You are…
-
1
votes1
answer208
viewsA: Access my application without the version number
Uses the Maven-Assembly-plugin: <configuration> <finalName>app</finalName> <appendAssemblyId>false</appendAssemblyId> </configuration> Put this in your pom that…
-
1
votes1
answer337
viewsA: Eclipse Maven | lambda | use -source 8 or Higher to enable lambda Expressions
The code of your pom.xml should also reference java8. It would look like this: <build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId>…
-
0
votes1
answer406
viewsA: How to order records correctly using DISTINCT
Change to look like this: SELECT DISTINCT DTCAD, DSBEM FROM TAB ORDER BY DTCAD DESC What is happening is that when you put the distinct by denomination the phone that is repeated disappears because…
sqliteanswered Giuliana Bezerra 3,707 -
2
votes1
answer230
viewsA: Spring and EJB have the same features?
No, they have different purposes. Spring is a framework that works with dependency injection. The goal is to facilitate the creation of objects leaving it to specific providers and not to the…
-
0
votes1
answer191
viewsA: Enconding problem: JSTL fmt
No use just changing the encoding on the tag fmt if the displayed information is saved using another encoding. Checks the encoding used in the database or language files you are using to load the…
-
3
votes1
answer211
viewsA: What is the best practice for instantiating a class in Java?
To know the best alternative, you would need to know if your object will be used by all fragments. If so, it would be interesting to create an abstraction common to all fragments (e. g.…
-
3
votes1
answer33
viewsA: Consultation Entity without its Associations
Yes, it is possible. Relationships only exist to facilitate the retrieval of information related to an entity. Without them it would be necessary to design the queries explaining joins and therefore…
-
0
votes1
answer1191
viewsA: property "Hibernate.hbm2ddl.auto" value="update" is not working with postgres
Checks the permissions of the user you set up in persistence.xml. The error is complaining about the impossibility of finding a standard postgres table, the pg_class that belongs to the postgres…
-
2
votes1
answer485
viewsA: Create JPA project without persistence.xml?
You have no way to get rid of persistence.xml completely, because you need to have at least the name of a declared persistence unit: <persistence> <persistence-unit name="nomeDaPU">…
-
2
votes3
answers3385
viewsA: What are asynchronous processing and synchronous processing?
It is not necessary to implement an Handler, but it is necessary to create a separate asynchronous processing thread to update the graphical interface. You can do this in a very simplified way using…
-
1
votes1
answer2491
viewsA: Send email with java
The best API for this is the Javamail. To use it you will need an email provider (for the example I mention it would be one of gmail). For example, the email sending code using SSL would look like…
-
1
votes1
answer185
viewsA: Insert website data into sqlite
The problem here is the following: You are allocating the SAME object in the list. Look at this: Disciplinas disciplinas = new Disciplinas(); ... for(int i=0;i<jsonArray.length();i++ ) { ...…
-
5
votes1
answer175
viewsA: Is it possible to reverse the changes from just one commit file?
Yes, there are 2 ways to do this: 1- Specifying the file commit revision number: git checkout revisao nomedoarquivo 2- Specifying the number of revisions you want to revert the file (number of…
-
0
votes1
answer436
viewsA: Exception in thread "AWT-Eventqueue-0" java.lang.Indexoutofboundsexception: Index: 0, Size: 0
Your problem is here: while( i <= grava.getListaMateria().size() The comparison of the value of i must be < and not <=. The correct one would be: while( i <…
-
6
votes1
answer2120
viewsA: List the 10 Best Selling Products
The best-selling items would be those most present in the item_sale table. In this case, you would only need to create the SQL query by sorting the items by the sum of quantity per product, i.e., by…