Posts by Murillo Goulart • 3,391 points
135 posts
-
0
votes1
answer174
viewsA: Setting for date and time field
I suggest unifying these 2 attributes in one field only, using the type originating from Java 8: @Getter @Setter private LocalDateTime dhOcorrencia; In addition to various benefits, such as…
-
13
votes5
answers12535
viewsA: Why is Varchar(255) widely used?
The VARCHAR by definition has variable size, but you can not put the size you want there, as answered above. This 255 is the maximum size allowed for the column, which in the case of the Oracle, the…
-
1
votes1
answer80
viewsA: Full Text Index for Database facing Ecommerce!
Mysql does not automatically recreate FULLTEXT indexes. Deletions of records that have columns with index of this type are saved in auxiliary tables, used as a filter to return the results of…
-
0
votes2
answers82
viewsA: Relationship problem Manytomany - Java
His method toString() doctor is not printing the list of pacientes. You can concatenate using join, as follows: @Override public String toString() { return "Médico [idMedico=" + idMedico + ",…
javaanswered Murillo Goulart 3,391 -
7
votes2
answers820
viewsQ: What is type and state inheritance?
Recently in a Java simulation, I came across a question related to inheritance classification, which I had never seen before. Taking the opportunity, I will separate into topics, so that the answer…
-
0
votes2
answers122
viewsQ: How to safely store AWS credentials in a Java application?
I have a Java Desktop application that is distributed to customers. I need, from now on, send data from this application to Amazon S3. For this you need to set the credentials AWS (accessKeyId and…
-
0
votes1
answer65
viewsA: ec2 aws does not respond to installed application
You need to create a rule in Security Group to release port 8080 externally, as shown below:
-
0
votes2
answers1719
viewsA: Application boot with Windows
You can create a service in Windows as follows, on the command line, running as administrator: sc create meuServico binPath= "java -jar C:\to\my\service.jar" start= auto ^^ ^ espaço||aspas espaço|…
javaanswered Murillo Goulart 3,391 -
4
votes1
answer6483
viewsQ: What is the most appropriate way to batch test ERRORLEVEL?
I’ve seen several forms of testing ERRORLEVEL in batch scripts. Some of them are dangerous and others are wrong, but sometimes go unnoticed. Below are some examples I know: Dangerous: the test works…
-
1
votes1
answer258
viewsA: Assign a function to Jcombobox
You must create and link a Listener amending the JComboBox: class ItemChangeListener implements ItemListener{ @Override public void itemStateChanged(ItemEvent event) { if (event.getStateChange() ==…
-
3
votes1
answer288
viewsA: Doubt use of Sequence - Oracle
So you won’t be using the SEQUENCE. You must add to the command INSERT as follows: INSERT INTO Texto (nome,valor,datacadastro,dataatualizacao,textoid) VALUES…
oracleanswered Murillo Goulart 3,391 -
3
votes1
answer119
viewsA: Redo the Spring cache?
Something that could be done is to use cache expiration (@CacheEvict) together with the scheduling (Scheduled), as below: @Configuration @EnableCaching @EnableScheduling public class CachingConfig {…
-
7
votes7
answers19300
viewsA: Increasing modal size using bootstrap and html
The modal bootstrap has the following size options: Large (large) - 900px max <div class="modal-dialog modal-lg"> Small (small) - Maximum 300px; <div class="modal-dialog modal-sm">…
-
3
votes1
answer152
viewsA: Firebird GEN_ID() function equivalence in ORACLE
In the Firebird there are the generators. Already in Oracle there are sequences. To create it you must do: create sequence seq_tabela_exemplo; You can even set multiple settings: create sequence…
-
1
votes1
answer269
viewsA: Spring MVC + Maven + Bootstrap Problem
You need to configure Spring to serve your static resources. This can be done programmatically or via XML. Class of Java configuration @Configuration public class SpringConfig extends…
-
0
votes2
answers397
viewsA: Use of Enum in the case of a switch
I will run the risk of being negative by running away a little from your question, but suggesting a better solution to your problem. How about forcing in Enum the declaration of an action for each…
-
1
votes2
answers120
viewsA: Sum of values taking into account 3 table fields
I first did the grouping to select only the largest revision and then the sum of these records: select sum(totals) from quotations where (part_id, alternative, revision) in (select part_id,…
-
8
votes1
answer3851
viewsA: How to generate secure tokens dynamically
There is the pattern JSON Web Token (JWT) - RFC 7519 - defining a compact and independent mode for transmitting information securely between two parties in JSON format. These data can be checked for…
-
1
votes2
answers158
viewsA: Query to return specific values
Utilize REGEXP_LIKE, as follows: SELECT * FROM IDENTIFICACAO_PESSOA WHERE NOT REGEXP_LIKE(IDENTIFICADOR, '^[0-9]{3}\.[0-9]{3}\.[0-9]{3}\-[0-9]{2}$');
-
1
votes2
answers138
viewsA: Stream Manipulation(java 8)
You can try something like this by returning a Stream: Stream<String> linesByPipe = Files.lines(caminho) .map(line -> line.split("\\|")) // Quebra por '|' Or so, returning one List:…
-
3
votes1
answer2145
viewsQ: What is the difference between scalability and elasticity?
Until then my understanding between the terms is somewhat confusing: Scalabidade: increase system capacity as demand increases; Elasticity: increase or decrease system capacity as demand; But that…
-
-7
votes4
answers11718
viewsA: What are the differences between web application and desktop application?
Web Flexible, can be accessed from any browser device; Depends on Internet connection; It has infinite screen height, scroll being a feature widely used; Does not require permissions to execute;…
-
-1
votes1
answer954
viewsQ: Manytomany mapping with additional column
In my study project, aimed at controlling football matches, I have the following entities: Gambler Name; Departure Date of implementation; Gols pro; Goals against; I still need to record the goals…
-
2
votes1
answer108
viewsA: How to use plunker codes in my applications?
You need a server to run Angularjs. A very simple option is Nodejs, through its module http-server. Installation: To install globally type: npm install -g http-server. Execution: Enter the project…
angularjsanswered Murillo Goulart 3,391 -
0
votes1
answer57
viewsA: URI Rest with Httpservlet
Get the map with all parameters sent on request through the following code: Map pathVariables = (Map) request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);…
-
0
votes2
answers9290
viewsA: How to Check whether the date is valid or invalid?
Using the Java 8 API, you can test with LocalDate and the parse method as follows: public class DateValidator { public boolean isValid(String date) { try { DateTimeFormatter formatter =…
-
1
votes2
answers283
viewsA: Play Audioclip with . wav in another JAVA package
If you have a directory from the project root, the correct path is: "sons/audio.wav" Note that you are without the bar. I recommend doing tests with the class File, creating a file and taking the…
javaanswered Murillo Goulart 3,391 -
0
votes1
answer81
viewsA: How do I get multiple columns of a table to reference a foreign key from another table?
Below is the command for columns 1 and 2 (the others must follow the same logic): alter table "USE".UPGRADE add constraint SLOT1_FK FOREIGN KEY ( SLOT1 ) references "USE".MODS(M_ID); alter table…
-
2
votes1
answer56
viewsA: Error printing a single variable
The variables belong to the Variables object, so you need to create an instance of it to access the variables in the instance OR change the variables to static: Option 1: Creating the instance…
-
2
votes1
answer319
viewsQ: What are the options to initialize a final variable in a Java class?
Given the class below, what are the boot options for the variable ANGLE, since final can be initialized only once? class Triangle { public int base; public int height; private final double ANGLE; }…
javaasked Murillo Goulart 3,391 -
2
votes1
answer1002
viewsA: Import decimal with comma
It is possible to settle with replace: SELECT *, CAST(REPLACE(AlturaOrig, ',', '.') AS DECIMAL(5, 1)) AS Altura FROM OPENROWSET(BULK 'C:\Minha_Pasta\meu_arquivo.csv', FORMATFILE =…
-
-1
votes1
answer1266
viewsQ: How to convert sysdate to milliseconds in Oracle?
How to convert sysdate for milisegundos directly on Oracle? I need to give the same result as the code below in java, but directly in query: String s=df.format(Calendar.getInstance());…
-
-1
votes6
answers615
viewsA: Regular Expressions with Java Patterns
I suggest the following regular expression: Pattern pattern = Pattern.compile("(aa|bb)"); See the test online.…
-
1
votes2
answers1142
viewsA: How to Change the Language of Netbeans IDE On Mac?
Navigate to the Netbeans installation directory: C:\Program Files\NetBeans 8\etc Opens the file netbeans.conf and look for the line with the key netbeans_default_options:…
-
4
votes1
answer1323
viewsQ: What is Delayedexpansion and why is it not enabled by default?
Usually when creating a batch that uses any code block, such as loops for or if, we ended up going through this problem and then we discovered the need to set EnableDelayedExpansion. Codes like this…
-
0
votes1
answer259
viewsA: Group items with a date difference of 10 minutes between you
Here I am considering that your field data is TIMESTAMP: SELECT data, usuario_id, count(usuario_id) FROM tb_log WHERE … GROUP BY UNIX_TIMESTAMP(data) DIV 600, usuario_id…
mysqlanswered Murillo Goulart 3,391 -
7
votes2
answers118
viewsA: Why does comparing different objects return true?
Java, to save memory, maintains a cache of some objects, and every time a Boxing is made (transformation of primitives into Wrappers) he reuses them. The following objects are kept in the cache: All…
-
4
votes2
answers118
viewsQ: Why does comparing different objects return true?
First code: Integer i1 = 1234; Integer i2 = 1234; System.out.println(i1 == i2); //false System.out.println(i1.equals(i2)); //true Even though it seems that primitive types are being used, they are…
-
0
votes3
answers853
viewsA: Nodejs Forever Not for
Use the following command to kill processes on linux with a given name: pkill 'forever' Then just start the process you want again.
-
2
votes1
answer968
viewsA: Change APACHE port / TEAMVIEWER
In the archive /etc/apache2/ports.conf, changes the door: Listen 8079 So in the file /etc/apache2/sites-enabled/000-default.conf change the first line: <VirtualHost *: 8079> Restart the…
-
1
votes1
answer32
viewsA: Select - Time comparison does not work
Use the function TEAM(): select nome, local, hora_inicio, hora_fim, data_inicio, data_fim from agenda where TIME(`hora_fim`) <> '00:00:00';…
-
3
votes4
answers220
viewsA: How many Strings are created in the codes below?
In total, over the proposed code, 16 Strings are created, as added comments: 1: String s1 = "s1"; // Objeto 1 colocado no Pool 2: String s2 = new String("s2"); // Objeto 2 e 3, um literal (que vai…
-
1
votes1
answer250
viewsA: Modeling of parcels and fiscal notes
I suggest creating a column of value for the invoice, which is the sum of all the plots, ie a denormalization. So every time you go to record a receipt, you’ll add up the installments and record the…
databaseanswered Murillo Goulart 3,391 -
3
votes3
answers207
viewsA: Unsigned in the primary key increases my chances?
Increases yes! Furthermore, I consider it important to examine whether this level of compaction is really necessary for the column. You are working with limited devices, with little disk space,…
mysqlanswered Murillo Goulart 3,391 -
2
votes1
answer686
viewsA: How to return status code from Java Resteasy request
You can return javax.ws.rs.core.Response in his method: return Response .status(Response.Status.OK) .entity(f) .build();
-
4
votes3
answers122
viewsQ: Why does the code print 0 instead of 5?
Why does this code print 0 instead of 5? class B { private int b; public int getB() { return b; } public void setB(int b) { b=b; } } class A { public static void main (String[] args) { B b = new…
-
2
votes1
answer356
viewsA: Configuring git for local network
Git is not quite as you think. It is a decentralized, non-centralized version control system, as you are apparently doing, sharing network files. You may even have a git server on your network, but…
gitanswered Murillo Goulart 3,391 -
3
votes3
answers377
viewsA: Hibernate works OK, but does not finish the process
Already tried to close the service Registry, thus? package testehibernate; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.service.ServiceRegistry; import…
-
0
votes2
answers695
viewsA: How to give the option for the user to choose the destination folder in BATCH?
Use the say in a loop for to go through the returned directories: @echo off rem Habilita a expansão de variáveis de ambiente atrasada setlocal EnableDelayedExpansion echo. echo ** Pastas…
-
2
votes1
answer996
viewsA: Division by zero into double = Infinity result
The float and double types implement the IEEE 754 standard, which defines that a division by zero should return a special value "infinite". Launching Exception, as in int type, would violate this…