Posts by utluiz • 72,075 points
957 posts
-
49
votes4
answers25411
viewsA: What is addiction injection?
Injection of Dependencies is a type of Control Inversion and means that a class is no longer responsible for create or seek the objects on which it depends. This serves to decouple classes, avoiding…
-
138
votes4
answers42803
viewsA: What really is DDD and when does it apply?
Domain-Driven Design or Domain Oriented Design is an object-oriented software modeling standard that seeks to reinforce OO-related concepts and best practices. This comes in contrast to the common…
-
11
votes1
answer1324
viewsA: What do the security modules commonly used in bank websites do?
A couple of years ago I had problems with the Safety Module of Banco do Brasil and did some research on the subject. I warn you that I am not an expert in security, nor do I have knowledge about the…
-
41
votes2
answers3902
viewsA: Tests, TDD, Unit Test, QA and similar. What is the difference between concepts about tests?
Software Testing Using the terms of Wikipedia: It is the research of software in order to provide information about its quality in relation to the context in which it should operate. This includes…
-
21
votes2
answers1652
views -
4
votes2
answers383
viewsA: Getting around the problem with hot Java development?
Hot Code Replacement Oracle’s traditional JVM enables hot code replace to some extent since version 1.4, when it was still from Sun. If you were connected in debug mode (debug) through a suitable…
-
75
votes3
answers4535
viewsA: Why shouldn’t we use Singleton?
TD;DL A lot of the controversy occurs due to the lack of a contextualization. I don’t see anything that unbuttons the Sigleton pattern when used in the correct context. Yes, it can cause a lot of…
-
7
votes2
answers7797
viewsA: Remove duplicate objects from List<Minhaclasse>
Use a class that implements a set (Set), as Treeset. Provide a Comparator in the constructor that uses the ID. The classes that implement Set only allow distinct elements, using as a parameter the…
-
6
votes1
answer176
viewsA: Profundidade Array
If I understand your question correctly, you can use a recursive function that increments one counter each time you find one vector within another. Take an example: public class ProfundidadeArray {…
-
5
votes1
answer242
viewsA: Attempt to update registration ID not allowed with JPA and Eclipselink
There are two alternatives (I know) for this situation. Method XGH Recover the connection object (Connection) Update via JDBC Perform a find() to retrieve the new object Method POG Perform a…
-
27
votes5
answers7447
viewsA: How to prevent spam in contact forms without using CAPTCHA?
A warning Not requiring server validation means controlling the user’s browser. This implies that any solution will be easily circumvented with minimal Javascript knowledge. Another possible attack…
-
13
votes3
answers2459
viewsA: How useful are Java Annotations?
The most basic concept is: annotations are metadata. It is additional data that you relate to classes, methods, attributes, parameters and variables. Data can be used in time of compilation and…
-
45
votes6
answers64346
viewsA: What is the difference of API, library and Framework?
The formal definitions are already in other responses, so I’m going to try a more pragmatic approach. API in general is the set of interfaces, classes and methods available to you to use in a…
-
17
votes3
answers1922
viewsA: What is the appropriate amount of changes to a commit?
It is not ideal to measure a commit by the amount of file or by your perception of the size of the changes. In the ideal world, a commit should contain one, and only one, new functionality or a…
-
1
votes1
answer368
viewsA: How to embed multiple classes into one in CSS?
TL;DR In pure CSS there is no inheritance. Classes? Although we use the term "class" for a type of CSS formatting element, in fact the term is an overload and does not correspond to the concept of…
-
24
votes3
answers24286
viewsA: What is the difference between <div> and <Section>?
Without going too deep, some elements of HTML 5 have function semantics. Look at the example provided in the specification quoted in the question: <article> <header>…
-
4
votes1
answer169
viewsA: Common predecessor in a graph of commits
I think your solution is not so great. The biggest issue is that it is not necessary to assemble two batteries of products. I made an alternative solution just a little more optimized (in theory,…
-
57
votes3
answers96047
viewsA: What is the use of a static or final variable in java?
Response of the type "Learning by Examples". Visibility Modifiers The word-reserved private modifies how other classes in your program can see a class or class attribute. Classes For classes, we can…
-
6
votes4
answers243
viewsA: Within a decision structure, does the order of terms change the outcome?
The order can change the result in languages where there is operator overload. Differences with overloaded operators In C#, for example, you can create a specific implementation for the comparator…
-
8
votes1
answer1504
viewsA: How to open a file in MS-Office with Javascript or PHP?
In a company I worked for once because of a client’s requirements, a team needed to implement a tremendous gambit contract generation solution in client, more specifically, in the browser via…
-
6
votes4
answers6030
views -
2
votes2
answers1812
viewsA: Why compare Enum with an Enum Object
The problem with valor.equals(TipoAlteracaoValor.ALTERACAO_VALOR) is that if the parameter valor is void, then you will receive an exception NullPointerException for trying to access the method…
-
3
votes2
answers144
viewsA: Windows registry access by javascript?
According to this response in the OS, for Chrome is not possible. In Firefox, the documentation says it is possible through XPCOM using the API nsIWindowsRegKey which has been introduced in Firefox…
-
3
votes1
answer2814
viewsA: Via java reflection, set and take values of inherited variables
There are parts of your code, like the methods getFieldNameByHeader and getConstValues, which may be the cause of the problem. On the other hand, I see no glaring errors in the code posted, other…
-
0
votes3
answers1665
viewsA: Test automation on web pages
Once I created a web testing framework, which is actually a wrapper for Selenium, for a company that works with JSF. The problem with JSF is exactly the one pointed out by Elias in the first item on…
-
6
votes2
answers6653
viewsA: Mysql Commands out of Sync; you can’t run this command now
From what I saw about the mistake in documentation and in the SOEN, the lib mysqli cannot maintain two queries results (result set) open at the same time. Each time a query is executed, it is as if…
-
2
votes2
answers567
viewsA: Java server disconnects idle users after 5 minutes
In addition to defining the timeout, as already explained by Paulo’s reply, it is interesting to implement a mechanism to automatically reconnect the user in case of oscillation of the Internet…
-
4
votes1
answer1169
viewsQ: Selectonemenu of Primefaces selects an item by pressing a hot key with CTRL
I have JSF forms with some keyboard shortcuts, for example, CTRL+S triggers Submit to save data. The problem is that when a key combination is pressed into a field <p:selectOneMenu>, the first…
-
13
votes4
answers1866
viewsA: How do Stringbuffer() and Stringbuilder() behave?
The hierarchy The classes java.lang.StringBuffer and java.lang.StringBuilder have exactly the same interface extend java.lang.AbstractStringBuilder, which has two main attributes: char value[]; int…
-
16
votes3
answers1131
viewsA: String and its efficiency
The hierarchy The classes java.lang.StringBuffer and java.lang.StringBuilder extend the abstract class java.lang.AbstractStringBuilder and have exactly the same interface. Analyzing the code of the…
-
2
votes1
answer423
viewsA: Jboss log reading
The bad news You will have to read the entire file to recover the last lines. The good news With the Java Collections API classes it is easy to recover the latest N lines. Procedure First, declare a…
-
31
votes3
answers1710
viewsA: What is the role of architecture standards in object orientation?
The most important thing when it comes to software architecture is to understand the mechanisms used in each of the layers, their benefits and impacts. The standardized models serve as a reference…
-
3
votes1
answer20770
viewsA: Create Object Array in java and access objects directly
To do this you must define the generic type of ArrayList, thus: public class MemoriaView extends JPanel { private ArrayList<BlocoView> listadeBlocos; public MemoriaView(){ super();…
-
3
votes2
answers4044
viewsA: Theme only on a Wordpress page. Is it possible?
Plugins for multiple themes Without involving programming, there are at least two plugins to do this: jonradio Multiple Themes Page Theme I didn’t use any, so I suggest you test and see if any of…
-
2
votes1
answer634
viewsA: If I use "provided" libs on the application server (wildfly), do I gain performance?
In theory you can have several benefits when using to share the same libraries among the various applications: Less use of memory, since there will be only one instance of each class in the shared…
-
8
votes4
answers1643
viewsA: Is it really necessary to define constraints in the database?
As the answers have already said, it depends on the scenario you are in and the requirements of the application. But one thing I would like to add is that in cases where it is not necessary to have…
-
5
votes1
answer892
viewsA: How to create Cover in a Report using iReport
When I had the need to add any pages in reports or even join several reports, the way was to join the documents with iText. This is not POG! POG is using a tool for a different purpose than the one…
-
5
votes5
answers3306
viewsA: Form submission security in HTTP header
Reading the excellent response from @jsbueno and also remembering a similar question about password encryption in Javascript’s @mgibsonbr, thought of a hypothetical solution with the use of a token.…
-
17
votes3
answers1131
viewsA: Open/closed principle - how to understand this?
First of all, didactic examples are not applicable to all real situations. It’s up to you to understand the principle and apply wherever it brings real benefits to your project. On the Open/Closed…
-
1
votes1
answer349
viewsA: Layout management issues with Miglayout
I cannot validate this solution now, but according to the example of the section Merging and Splitting Cells of Guide to the Miglayout (page 2), to make a "col span", change the line:…
-
3
votes3
answers1032
viewsA: Return the "period" size of a bit string
At first I considered applying the algorithm of Detection of Floyd cycles, also known as the "turtle and rabbit" algorithm, but the problem seems to be simpler than that. Logarithmic complexity…
-
1
votes1
answer523
viewsA: How to Generate/Calculate the Value of Binomial Poisson and Normal Tables in Java
Apache Commons Math library provides mathematical and statistical implementations, including Poisson Distribution. Take a look at the documentation to see the possibilities of use:…
-
20
votes3
answers5026
viewsA: How to identify classes in an object-oriented system?
TL;DR Do not mix the Analysis of the problem with the Design (project) of the solution, nor with the Technological Implementation. Analyzing An analyst is the professional responsible for…
-
4
votes1
answer275
viewsA: Mysql Transactions written in the same table
Depending on the case the second transaction will be blocked until the first one is over. Some Engines mysql as the Innodb withstand lock per record (Row-level Locking), while in others the crash is…
-
1
votes1
answer272
viewsA: How to open link contained in Javadoc by Eclipse?
You can put a link to any URL with the tag {@link URL}. See the documentation. Then just put the file on any server and put the URL. Probably can’t do relative to the class or project.…
-
23
votes2
answers7111
viewsA: What to do if client can be both PF and PJ?
There is no absolute answer. Depending on the scope of the application, the business domain and requirements, concepts of Cliente and Pessoa can vary enormously. The first step in solving your…
-
1
votes2
answers2135
viewsA: How to replicate elements dynamically?
This is possible by manually creating an array of items to be displayed by ngRepeat and associating an event ngChange to the field to then regenerate the vector and update the list. Consider the…
-
45
votes7
answers20768
viewsA: How to protect source code?
I believe that the point is not to protect the source code itself, as many have said. However, I want to highlight this issue of protecting sensitive data. Robust applications and systems should not…
-
6
votes2
answers1701
viewsA: Selenium problem with get!
Be careful when updating the Firefox version. Look before the changelog Selenium and see what the latest compatible version. Unfortunately, as Firefox is changing a lot of version, it is complicated…
-
1
votes1
answer279
viewsA: How to view/hide content from a page according to the "HTTP status" of the site?
Since you are using an Embed frame, through the API javascript, to control the Player, then probably the callback onYouTubeIframeAPIReady() is never invoked with the video locked. I do not know the…