Posts by Murillo Goulart • 3,391 points
135 posts
-
2
votes1
answer57
viewsA: 'mvn clean Compile package' runs Phase Compiler 2 times?
Yes, the command mvn clean compile package will run the Phase Compile twice. This can be easily checked in the Maven log, as example below, in the excerpt maven-compiler-plugin:3.3:compile that…
-
1
votes1
answer847
viewsA: Java - Query Spring with current date
According to the Java Persistence API specification, there are predefined functions CURRENT_DATE, CURRENT_TIME and CURRENT_TIMESTAMP. The detail is in the use of it, that does not take parentheses,…
-
2
votes1
answer1864
viewsQ: Download multiple Amazon S3 files
Situation I have hundreds (and even thousands) of small files (~50KB) on Amazon S3 separated into Buckets per day. Problem I need to download through my Java application delivering to the front end…
-
1
votes2
answers2039
viewsA: List Services via CMD
You can use the clause where, as follows: wmic service where 'name like "FirebirdServerDefaultInstance " or name like "SQLServerAgent"' get displayname,name,state…
-
0
votes2
answers1331
viewsA: How to change the vertical grid line size of a Jtable?
If you want spacing within the cell, you can use an edge on the cell. Note that you can use different sizes for left, right, up and down; In the example the spacing was placed 10 on the left and…
-
2
votes2
answers343
viewsA: Is there any way to know which tables have Bytea type fields in a Postgresql database?
Make the following inquiry: select table_schema, table_name, column_name from information_schema.columns where data_type like 'bytea'
postgresqlanswered Murillo Goulart 3,391 -
1
votes2
answers50
viewsA: Problem with batch comparisons
Remove the quotation marks: if %VARIAVELVASO3NO1% GEQ 10 ( set/a CONTEUDOVASO3=%CONTEUDOVASO3%-%QUANTIDADELIVREVASO1% set/a CONTEUDOVASO1=8 goto JOGOVASOS )…
-
4
votes2
answers488
viewsA: Best way to relate two tables
Need to have an intermediate table to make relationship N:N: Table groups_roles: +----------+---------+ | id_group | id_role | +----------+---------+…
-
1
votes1
answer550
viewsA: Spring Boot Project with 404 error
I guess the Spring Boot scan isn’t seeing your endpoint. For this, the main class needs to be at the root of the project, package package com.iape.cobranca. Put the class CobrancaApplication in this…
spring-bootanswered Murillo Goulart 3,391 -
0
votes1
answer234
viewsA: What encryption does Bitlocker use?
Bitlocker uses the XTS-AES (Advanced Encryption Standard) algorithm to encrypt the data. It was built on Windows 10 (build 1511). By default the key is 128 bit. It is possible to set to 256 bit in…
windows-10answered Murillo Goulart 3,391 -
1
votes1
answer204
viewsQ: How to map REST request response
I am consuming a REST API with RestTemplate and it does not follow good practices, such as using HTTP status codes, for example. Response in case of success: { "435": { "Codigo": "435", "Tipo": "",…
-
17
votes1
answer632
viewsQ: What are the main differences between Kotlin and Scala?
It is already clear differences between Kotlin and Java, such as: More concise (up to 40% code reduction) Null Safety Type inference Data class Interoperable with Java However, all these features…
-
2
votes3
answers582
viewsA: Maven Module vs Java 9 Module
Maven Modules are separate code libraries that are added to the project as dependency. As a final result, we have a project composed of several modules that run on top of the traditional Java…
-
0
votes2
answers270
viewsA: Send email by java
You must set TLS instead of SSL: try { SimpleEmail mail = new SimpleEmail(); mail.setFrom("[email protected]", "Teste"); mail.setSubject("E-mail exemplo"); mail.setMsg("E-mail de exemplo");…
javaanswered Murillo Goulart 3,391 -
0
votes1
answer188
viewsQ: Refactoring for Spring Data returning List<Object[]>
I came across a project where I have several methods in Repository of this kind: @Query(value = "SELECT " + " i.uf, " + " i.cidade " + "FROM Imovel AS i " + "WHERE i.ativo = 'Sim' AND " + " EXISTS…
-
3
votes3
answers82
viewsA: Does anyone know how to do this character in HTML? ( photo below )
I’ve seen websites that implement this arrow through the icon library Font Awesome. To be more specific, it’s this icon: http://fontawesome.io/icon/angle-down/…
html5answered Murillo Goulart 3,391 -
0
votes1
answer158
viewsA: DYNAMIC ROLES with Spring Security?
You need to have a permissions table to be used by Spring Security, as simplified as the example below: User @Entity public class User implements Serializable { private static final long…
-
0
votes1
answer311
viewsA: Repository - Record Filter according to user permission
A simple possibility, which is based on the authenticated user, not needing to create more endpoint, is to filter the repository, as an example below: Controler @RequestMapping(value = "/clientes",…
-
2
votes3
answers856
viewsA: How to copy a local git repository?
There is a git command for this, called git archive. It is possible to export the repository to zip file, for example, with the following command: git archive --format zip --output zipfile.zip…
gitanswered Murillo Goulart 3,391 -
1
votes2
answers1184
viewsA: Differences between System.out x System.err x System.in?
System in. Standard input of type InputStream, usually connected to the keyboard in terminal/console oriented programs. System out. Standard output of type PrintStream. Usually sends the data saved…
javaanswered Murillo Goulart 3,391 -
0
votes3
answers1204
viewsA: Create bat to move files returned by findstr
Utilize for to browse your search result with findstr. Create a batch findtags.bat with the following content: @echo off rem Garante que as variáveis de ambiente tenham escopo local setlocal rem…
-
9
votes3
answers1700
viewsQ: Embedded (Embedded) or external (traditional) application server?
There is currently a tendency to deploy Java applications as an executable jar on embedded server (Embedded server). There are very popular frameworks aimed at this approach as Spring Boot and Play.…
-
2
votes3
answers856
viewsQ: How to copy a local git repository?
It is already common knowledge that it is not good practice directly copy the physical files (mdf, etc.) from the database. Therefore, there are specific routines that generate external files that…
gitasked Murillo Goulart 3,391 -
0
votes2
answers2948
viewsA: How to check if a windows service is installed, if you are starting the service via batch file
Below is a suggestion using the native program sc, used for communication with the Windows Service Manager. @echo off setlocal EnableDelayedExpansion set SERVICE_NAME=myservice rem Verifica se o…
-
0
votes0
answers143
viewsQ: Is Browse really a multithreaded application?
Once, in the discipline of Distributed Systems, the teacher asked a question and he himself answered: What multithreaded application example is widely used by everyone? Browse (browser), since…
-
4
votes3
answers2718
viewsQ: What is the correct way to pass the pagination data in Sponse REST?
In more robust applications, where a table can have millions of records, it is important to implement paging in a REST API. I have seen in some projects two ways to return pagination information…
-
1
votes1
answer11399
viewsQ: How to remove a directory in Windows even if it is in use?
I have a database service running in a known directory C:\meuBanco\exe\ and now I have developed an updater of this service, which performs the following steps: For service Excludes the folder exe:…
-
-1
votes1
answer295
viewsQ: Why is it mandatory to initialize a final variable when an instance is built?
In a certification review, I came across the following code: public class Initializer { static int si = 10; int i; final boolean bool; } It generates build error in variable declaration final…
javaasked Murillo Goulart 3,391 -
1
votes1
answer34
viewsA: What does the Object clause define in Scala?
The statement object introduces the object called Singleton, which is a class that will have only a single instance. The above statement builds both the class called Counter and its instance, also…
scalaanswered Murillo Goulart 3,391 -
1
votes1
answer5444
viewsQ: How to map entities with composite keys in JPA?
I have a system where all tables in the database have a column empresa, which is part of PRIMARY KEY. In the client table, I have a column id (autoincrement), which together with the empresa form a…
-
0
votes4
answers5515
viewsA: Dockerize Java Web App: Maven + Tomcat + Docker
I will assume that you have an IDE and minimal resources to compile your Java project into it. One of the changes I propose is to use the Spring Boot and use embedded Tomcat, which will simplify…
-
3
votes3
answers447
viewsQ: How to disable the merge message in git pull?
Every time I git pull, git opens the text editor requesting a message for the merge commit. However this message is already loaded (as in the example below) and I simply save and close the window to…
gitasked Murillo Goulart 3,391 -
9
votes4
answers12426
viewsQ: How do I detect a mobile device in Javascript?
I have a web application with Angularjs, where I need to know if the user is on a mobile device to improve their experience, putting buttons to make calls, send message, etc. I have a directive that…
-
3
votes1
answer3368
viewsQ: Implement Runnable or Thread Extension?
In several Java projects, I’ve seen these two ways to create Threads: With implements Runnable: public class MyRunnable implements Runnable { public void run() { //Código } } //Iniciada com uma…
-
2
votes1
answer93
viewsQ: How to remove from Git a file that was tracked and is now in . gitignore?
I have a file that was tracked by git, but now he’s on the list of .gitignore. However, this file keeps being displayed on git status when it is changed. What to do to make the git completely forget…
gitasked Murillo Goulart 3,391 -
2
votes1
answer536
viewsA: Overloaded Constructors: Instance Initializer
This is a good explanation: Instance initializers are useful alternatives to instance variable initializer when: The startup code should capture exceptions; Perform extensive calculations that…
-
0
votes1
answer34
viewsQ: What does the Object clause define in Scala?
Studying some projects, I found an intriguing code, where in addition to the clause class that defines an object, already known from Java, there is the clause object, unknown to me until then.…
scalaasked Murillo Goulart 3,391 -
5
votes1
answer2380
viewsA: Extract data from a BLOB field in Mysql
Use the CAST for CHAR, as follows: SELECT CAST(user_data AS CHAR(1000) CHARACTER SET utf8) FROM user WHERE user_id=1
-
2
votes2
answers137
viewsA: Prevent classes from changing the state of objects
You must create immutable classes where the state of the object cannot be changed after its creation. String is an example of unchanging class, among many others. public final class Person { private…
-
3
votes6
answers1694
viewsA: Why not use a Boolean parameter?
Using boolean parameter shows that the function does more than one thing. public static String render(PageData pageData, boolean isSuite) throws Exception { return new…
-
2
votes6
answers12128
viewsA: Error typing GIT PUSH
There is a shortcut that can be used: git push -u origin master The parameter -u means your local branch will be configured to track the new branch master created in the repository origin. If the…
-
6
votes1
answer329
viewsQ: How are expressions evaluated in Java?
Reading some references it was possible to understand the basic, but not enough to decipher the following code: public class Expression { public static void main(String[] args) { int s = 5; s += s +…
-
0
votes2
answers1055
viewsA: JPA spring boot custom data does not work
When using an aggregation function such as sum it is necessary to do the group by. You can also remove the value argument that the default already assigned when there is only one argument; I’m not…
-
3
votes3
answers3141
viewsQ: How to monitor a file in real time on Windows?
When deploying services and applications to servers, be able to monitor the log seeing all the updates as soon as they occur, greatly facilitates this task. On Linux, I use Tail which only loads the…
-
1
votes1
answer10500
viewsA: Create script to run program by passing only part of the name
Save the content below as exec.bat: @echo off setlocal set EXECUTAVEL= for %%i in (%1*.exe) do set EXECUTAVEL=%%i if /i not "%EXECUTAVEL%"=="" ( echo Executando "%EXECUTAVEL%"... call "%EXECUTAVEL%"…
-
2
votes2
answers2947
viewsQ: What is Mobile and Ubiquitous Computing?
What Mobile and Ubiquitous Computing Means? What are its main characteristics? What are the main areas of application?
terminologyasked Murillo Goulart 3,391 -
0
votes2
answers1259
viewsA: Sort Collection
Utilize features of Java 8, as method References, to simplify the work, as follows: List<Evento> eventos = objeto.getEventos(); eventos.sort(Comparator.comparing(Evento::getHorario)) In this…
-
1
votes1
answer315
viewsA: Doubt on how to use Shift in Java
Binary is just a representation. You can use shift with decimal, hexadecimal, etc, as shown in the example below: int i = 7; int x = i >> 1; int y = i << 2;…
-
2
votes2
answers402
viewsA: On the RSA cryptography
The RSA cryptography uses (does not generate) a key pair, a public key that can be known by all and a private key that must be kept confidential. That’s why it’s called a toilet. Every encrypted…
-
3
votes1
answer1674
viewsQ: Comparison between FTP and HTTP for file transfer
An issue that puzzles me is about transferring binary files over the internet. I have experience in using FTP, which eventually went through firewall issues on clients. Another issue advocated by…