Posts by dougg0k • 1,619 points
53 posts
-
5
votes4
answers4276
viewsA: Should I initialize strings (or objects in general) with null?
I do not believe that it is good practice to make explicit or not, even in cases of local scope in methods, where most of the time it is necessary to initialize. The reason is to leave open the…
-
2
votes1
answer1039
viewsA: How to make a select starting with a certain line
You can put the second value of LIMIT as larger than the table can reach or value who thinks it appropriate. Ex: SELECT * FROM tabela ASC LIMIT 1,999999999999999999…
-
3
votes1
answer173
viewsA: Arraylist Comparator JSP Object
With Java 8, there is a simple and clean solution to handle multiple comparisons. Lambda: Comparator<Empreendimento> comparator = Comparator .comparing(e -> e.getMenorArea)…
-
0
votes1
answer196
viewsA: Error while uploading files to remote server
By adding the repository remote must contain the @ between git and bitbucket. Ex: git remote add origin [email protected]:andre_sn/sfp.git If the repository was initialized correctly, the files…
-
0
votes2
answers762
viewsA: Problems to remove @Manytomany element with @Jointable
Assuming you get the id of user and permission that wants to be removed, can be done the delete manually via a query. Ex: entityManager.createQuery("DELETE FROM USUARIO_PERMISSAO up WHERE…
-
2
votes2
answers3330
viewsA: Build problem in Spring Boot project
This indicates that the same process of Spring Boot or some other application server for example can be opened using the address IP:Porta which has been set, it is not possible to use the same ip…
spring-bootanswered dougg0k 1,619 -
1
votes3
answers289
views -
7
votes2
answers9897
views -
0
votes2
answers81
viewsA: Error on Demoiselle startup
This is usually due to conflicts with plugins, in which case would need more information to identify the problem, you can check if it happened after installing some new plugin. The alternative is…
-
1
votes2
answers327
viewsA: JPQL hibernate for multiple Ikes
Could assign to the second parameter :nome2 the second part of the string of the same attribute, for example, take the second name after a space. SELECT c FROM Cliente c WHERE c.nome LIKE :nome OR…
-
2
votes3
answers2208
viewsA: Aligns navbar bootstrap text vertically
In style.css, in class search-side add the property margin-top with 15px .search-side { margin-top: -15px !important; } At first navbar define a class name as navbar-primeira and add property…
-
2
votes1
answer585
viewsA: Doubt when using Timertask
It is necessary to make the first call of the method, after that, I believe that it remains a thread running, waiting for the periods of time that was set. When testing by the method main, works…
-
3
votes1
answer758
viewsA: Formatting dates in Java
You can use date formatters from the Java API itself, for example SimpleDateFormat Ex: new SimpleDateFormat("dd/MM/yyyy").format($P{nomeParametro}) By generating the report itself Jasper Reports,…
-
2
votes4
answers1365
viewsA: Find out the type of variable in ruby on Rails
It is possible using Regular Expression, checks for character types or character patterns. Ex: [0-9] - Apenas numeros [a-zA-Z] - Alfabeto com letras minusculas e maiusculas Search for variations in…
-
5
votes3
answers38959
viewsA: How to position text within an image
Using img and label is possible that way. .container { position: relative; } #image { position: absolute; } #texto { position: absolute; font-size: 32px; left: 250px; top: 135px; } <div…
-
3
votes1
answer604
viewsA: Docker Error: Cannot connect to the Docker daemon. Is the Docker daemon running on this host?
Check if the Docker Daemon is running with the command service docker status, if you are not start with service docker start and check if the error persists. If the Docker user does not belong to…
-
4
votes2
answers3664
views -
2
votes1
answer250
viewsA: How to unify two Csss files
Commented from wro4j, You must have tried using an old version, already removed from the repository. But you will find updated distributions here, choose which one to serve you…
-
0
votes3
answers790
viewsA: Increase Precision with Bigdecimal Java
Having the value, a setScale with Round Half Up, should generate the result you want. BigDecimal valor = 123; BigDecimal resultado = new BigDecimal(String.valueOf(valor)).setScale(9,…
-
1
votes2
answers162
viewsA: Capture through the Exceptionhandler
According to the documentation, these methods will only be invoked if the exception occurs in some other method, in this case the Meumb class, to test it is necessary to create another method and…
-
0
votes1
answer1098
viewsA: Generate PDF with images on Android
There is another library called Pdfbox if you are unable to use iText. https://pdfbox.apache.org/ With iText it is possible to merge (combine), then even with new images, could be added as it…
-
1
votes1
answer163
viewsA: java programming and database connection
Your need is for a Embedded Database, is an integrated application bank that also runs next to the application. As you can see on wikipedia, there are several options, the difference is like the…
-
2
votes1
answer343
views -
0
votes1
answer70
viewsA: Indexoutofboundsexception in reading an Inputstream
Change the size added to the byte array, the set value is smaller than it should be, so as it iterates, when it reaches a certain value, the IndexOutOfBoundsException use the read method() byte[]…
-
4
votes1
answer1638
viewsA: How to set up github in Ubuntu?
Following the following steps, it’s easy to create and commit files in a remote repository. Creating the project folder, enter it from the command line, type git init git recognizes its folder as a…
-
1
votes1
answer348
views -
1
votes2
answers345
viewsA: How to translate the Mysql query that has a sum to Hibernate?
It is using HQL if you are only with Hibernate, and JPQL if you are with JPA implementing with any other tool like Hibernate, Eclipse Link and Openjpa. SELECT SUM(p.totalMercadoriaBrl) FROM Processo…
-
2
votes2
answers438
viewsA: List years in Jcombobox dynamically from certain rule
If your preference is always two years earlier, current and five years later, a solution like this, I think would solve. public static List<Integer> listaDeAnos() { int anoAtual =…
-
0
votes1
answer455
viewsA: Recover Cookies in Spring Security Authentication
It is possible to recover with an Annotation, performing Binding through a parameter. public void metodo(@CookieValue("nome") String cookie) { } To add you need a HttpServletResponse public void…
-
3
votes1
answer6763
viewsA: Unable to find or load the main file class.java
It is necessary to compile the class before running. And to rotate, in the class it is necessary to contain the main method. Ex: public class Arquivo { public static void main(String args[]) { } }…
-
1
votes3
answers3098
viewsA: How to use <f:setPropertyActionListener> with Passthrough Elements in JSF 2?
You must be using a prefix to use JSF commands. There are two other ways to generate the tag <a> Anchor, the first is with <h:outputLink><\h:outputLink> and the second is with…
-
1
votes3
answers579
viewsA: JSF + Primefaces - HTTP 404 error
Make sure that your pom.xml contains the dependency for the JSF, error shows that you cannot find the class of this API. For every Java EE specification you’re using you also need an implementation.…
-
1
votes1
answer1233
viewsA: Problem with JPA using Wildfly 9 and JTA
You are trying to make use of the init() method that is set as private, try changing to the access modifier public. In the class this being used annotations of two specifications, CDI and JSF, to…
-
2
votes1
answer401
viewsA: JSF 2.1 confirmDialog problems
There is, with example in the show case of Primefaces, it is necessary to tag confirm within the commandButton which makes the call for item deletion and just below within the tag confirmDialog…
-
1
votes2
answers377
viewsA: Doubt regarding the management of JPA with Spring in JEE server
It is possible to lookup Datasource with JNDI. There are two ways to do it programmatically. public DataSource dataSource() { JndiDataSourceLookup lookup = new JndiDataSourceLookup(); return…
-
1
votes1
answer439
viewsA: Java - How do I leave the Postgresql Permanent Connection IP?
Usually the database server is on its own server in the web cloud, so the datacenter servers have static and non-dynamic ip as the connections we make directly from home. And many of these servers,…
-
3
votes1
answer279
viewsA: How to open Jinternalframe window after login?
The Dispose method is making the frame invisible right after making the same visible. Unless it’s for another frame, I wouldn’t know with just that code. But to open after login returns true, here…
-
2
votes2
answers1783
viewsA: Error starting Tomcat 9 as a service
This error is not specifically from version 9, it is not new, it is because Tomcat has not detected or properly configured the classpath for the apache-tomcat-9.0.0.M1/bin/boostrap.jar and…
-
1
votes1
answer44
viewsA: Java - Sliding Menu
Good morning Junior It is possible using a Jscrollpane, add one or more Component(s) to it and then add it to the frame you are using, be it a Jframe or another. Ex: public class Exemplo { public…
-
16
votes1
answer1022
viewsQ: The use of immutability
Immutability What are the advantages and benefits, when to use and why to use immutability in my projects? The complexity of the implementation x time, worth it? When I should not use immutability…
-
1
votes1
answer51
viewsA: How to connect a Query to a Container?
Giullia What you’re looking for is a generic DAO to be reused with multiple entities, here’s an example public class DAOGenerico<T> { private EntityManager manager; public…
-
1
votes1
answer221
viewsA: Java - Main Class Execution Error
Accessing seems to be a class of your project, this is because Eclipse must not have recognized or set the path of your package, maybe because it has been changed, check the path of the package.…
-
1
votes1
answer756
viewsA: How to check if a server’s response returns (200 OK) in java ?
The verification can be done using Android’s own REST Apis, making a GET call from a URL and waiting for a Response, from this Response you make the logic on top of the Status Code you receive.…
-
1
votes1
answer910
viewsA: Java - How to Capture Data from Jformattedtextfield and Validate
Good afternoon Junior If the CPF has a class for representing itself, the validation can be done within its own class, have a method for checking whether the value received by Textfield is null or…
-
2
votes1
answer136
viewsA: Convert Java + Windowbuilder project to Android or Web
Good afternoon Junior Converting directly is not possible, the viewing and controller part at least will have to be rewritten to suit the API of the platform on which you will implement. Java is a…
-
0
votes1
answer252
viewsA: How to create Parameters for Ireport
The image needs to be passed as a Bufferedreader by the Map parameter, reading the image from an Image can facilitate. Should not need a check to make it optional, but check. Inside the . jrxml will…
-
9
votes2
answers8541
viewsA: web.xml is Missing and <failOnMissingWebXml> is set to true
The error is because since Packaging was set to War, Maven recognizes by default the configuration of the need for a web.xml, given the version of Servlet you are using, if it is older than version…
-
3
votes3
answers1738
viewsA: Is it possible to test only specific classes?
Good night Renan If you are using Maven, there are two ways to do this. The first is using Single Test via command line, you choose any class you want to test. mvn -Dtest=ClasseTestB test The second…
-
1
votes1
answer649
viewsA: JSF 2, CDI 1.1, Springsecurity 4: Custom login form does not redirect to page
The configuration order of the configure(Httpsecurity http) method is important, if you put/set the settings in random order, problems may occur for Spring Security to recognize. Even if this is not…
-
3
votes1
answer711
viewsA: Convert String Ex. 1.520.30 to Bigdecimal using Spring MVC @Initbinder
With Bigdecimal it is interesting to have a method to set the rounding scale and the accuracy of the value. If you are using JPA for persistence, an easy way to do this is with the @Column…