Posts by utluiz • 72,075 points
957 posts
-
6
votes3
answers3107
viewsA: How to send strings in the URL via JS or jQuery?
Stick to the pattern The character encoding to send in a URL or in the body of a request is not so simple and may vary as the case may be. If the problem was only with the URL, a simple replacement…
-
17
votes2
answers7197
viewsA: Advantages of using Object-Oriented PHP? Where to use?
TL;DR Object Orientation (OO), regardless of the language and how much it adheres to the theory, can bring the same benefits, the main ones being related to code organization, ease of maintenance…
-
3
votes4
answers334
viewsA: Advantages of Inner Class
Note: this is a complementary response to @ramaral. The notion of being careful with memory leakage is real and very important. However, after reading the two cited articles I would say that, at the…
-
4
votes1
answer52
viewsA: Is it necessary to repeat dependencies (JAR)?
Yes, if project B depends on the library it should be included in the classpath both during compilation and during execution. Something that needs to be understood in Java is that having one of its…
-
26
votes5
answers7178
viewsA: What is the advantage of using recursive functions?
TL;DR All recursive code can be translated in an iterative form, but some algorithms are naturally recursive and more easily represented in this way. Think, for example, of going through all the…
-
5
votes1
answer235
viewsA: Popular via builder with Hibernate
The cited article talks about the unnecessary use of getters and setters. This concept is correct and the subject has already been discussed here by some people, including me, for example: Getters…
-
1
votes1
answer45
viewsA: Site interacting with local system
Some browsers implement specific hardware access mechanisms. In the case of Chrome, there is a API to access USB and other devices. Then you could write an extension to perform the operations you…
-
2
votes1
answer189
viewsA: How to generate default values with JPA Hibernate
Until the last time I checked there was nothing in the JPA specification about data load, that is, some standard to insert values in the tables automatically. Specifically Hibernate has a…
-
2
votes1
answer319
viewsA: Mysql queries always busy
Although without specific details, it is possible to understand the problem: one or more tables in your database is spending most of the time blocked (locked). Next question: what makes a table…
-
2
votes3
answers867
viewsA: Does not parse the bootstrap datepicker for dd/mm/yyyy - 400 Bad Request (POST)
You are using Springmvc and need to tell it what date format to expect for this field of your model. It is possible to do this simply and specifically for the field using the following annotation in…
-
1
votes2
answers127
viewsA: Can I use tools.jar in the Classpath of my Java project?
You need to add the tools.jar to classpath if you want to make use of the classes. Such a file contains classes used for developing Java programs, such as Java compiler classes. It is also…
-
8
votes2
answers867
viewsA: What is the difference between the terms "extension" and "component"?
Software Component Component software is a logical entity that groups together a set of related functionalities. It is usually composed of one or more interfaces that define which services (methods)…
terminologyanswered utluiz 72,075 -
7
votes3
answers630
viewsA: Indications of use of cookies?
What would be the indication to use cookies? Any information you want to be sent back to the server in the next request, regardless of the type of request. See, when we think about what this solves,…
-
2
votes1
answer1232
viewsA: Very heavy Tomcat log
There are several possible reasons, which usually mix. The most common are: Independent log levels. It may be that the general log is INFO, but for some classes or applications is different. Check…
-
2
votes2
answers305
viewsA: Error in web system authentication
There is no mistake. The Hibernate message is because it is showing the query being executed, since you have set it up like this through the show_sql. "Error in authentication" is your own message…
-
8
votes3
answers1767
viewsA: What prevents an array from being initialized with a variable size in C?
In a simplistic way, a array in C is nothing more than a pointer pointing to an allocated memory region whose size is the result of multiplying the amount of elements by the size in bytes of each…
-
2
votes1
answer56
viewsA: Statistics for remote requirements collection
TL;DR Use the same methods you would normally use, but put more effort into keeping communication effective. Challenges of distance communication All material and all people I’ve worked with, even…
-
5
votes2
answers1106
viewsA: How do I work with a String with parameters?
Strsubstitutor Another suitable option for simple variable substitutions is the StrSubstitutor apache Commons. Example: Map valuesMap = HashMap(); valuesMap.put("animal", "quick brown fox");…
-
1
votes1
answer162
viewsA: Use of Swing in Java EE
TL;DR Not, when speaking in Java Web, especially in Java EE, interfaces are built using HTML, CSS and Javascript. But this is not the whole story... Java Applets It is actually possible to some…
-
0
votes2
answers91
viewsA: Secure authentication between different systems
Remote access Whether source and destination server are on different networks and access to each other is remote, via internet, the most recommended is to use authentication via certificate. On the…
-
6
votes2
answers8715
viewsA: What is the use of using foreign keys?
TL;DR Foreign keys are all about maintaining data consistency. Restrictions Defining a foreign key creates a link between a source table record with a destination table record. In general, if a…
-
29
votes4
answers6194
viewsA: Best practices for naming functions
TL;DR This is a topic whose personal opinion influences a lot, but there are some general good practices that can be extracted for nomenclature and standardization of methods. Standard Each language…
-
6
votes2
answers1164
viewsA: Java: Understand working Wait() notify() notifyAll()
The problem has nothing to do with wait or notify, but with its blocks synchronized. See, the behavior of synchronized blocks is the guarantee that only one thread at a time is running for a given…
-
1
votes2
answers74
viewsA: I wonder if every time I create an object in java it initializes a Thread
The most basic way to create a thread (thread) in Java is creating a new instance of the 'Thread' class and calling the 'start()' method, after which the 'run()' method of the instance will be run…
-
7
votes1
answer6420
views -
23
votes1
answer2146
viewsA: What is a chain of methods?
TL;DR Chaining of methods is a technique that makes it possible to execute several methods on an object within the same instruction (usually separated by semicolon). Such methods, in general, have…
-
2
votes2
answers997
viewsA: Possibility to schedule threads in Java to run at different times
There are several answers on how to handle timers in Java: /a/96621/227 /a/6861/227 /a/71244/227 In this particular case it seems appropriate to me to use a Timer to schedule the execution of a task…
-
2
votes3
answers790
viewsA: Increase Precision with Bigdecimal Java
My suspicion is that the input values are approximate and therefore causing the deviation in the final result. For example, the value 2.79E+00 seems to have been printed in scientific notation with…
-
2
votes1
answer103
viewsA: How to create an application from a Maven file?
Your teacher can have used a Archetype of Maven, that is, an archetype, prototype or design model. Archetypes are actually special Maven projects that can be used to generate Maven projects. An…
-
6
votes3
answers959
viewsA: Why does calling System.gc not guarantee running the Garbage Collector?
TL;DR Because Garbage Collector (GC) is more of a concept than just an algorithm or set of classes or API. Every warranty limits how it can be implemented. Let’s go in pieces... Why call the…
-
3
votes1
answer80
viewsA: View recursive calls in eclipse
boar There is something similar. There is a project called boar leveraging Java classes to capture method call information. The project has no frequent maintenance, but since the Java platform in…
-
6
votes1
answer323
viewsA: What are build cache structures?
The term build cache structures is probably just an expression used in the other question, not really a specific name of some technique or technology. However, when it comes to the performance of a…
-
5
votes4
answers3972
viewsA: java.lang.Noclassdeffounderror: org/slf4j/Loggerfactory
The mistake java.lang.NoClassDefFoundError is one of the exceptions core of Java, which occurs at runtime when a class existing could not be loaded due to the lack of another class it depends on or,…
-
2
votes1
answer2831
viewsA: What are Java daemon threads and when to use them?
Daemon threads are interrupted when the thread main, the one that executes the method main, ends running and the program ends. If a thread nay is daemon, the Java process remains active and running,…
-
0
votes1
answer295
viewsA: Trouble with Hibernate
Remove the attribute tipo in your class Cliente. The annotation @DiscriminatorColumn is enough. If you need to specify a numeric field, add the attribute discriminatorType=DiscriminatorType.INTEGER…
-
3
votes1
answer247
viewsA: Class aggregation and attribute ratio
TL;DR It depends on the point of view, but in general aggregation in a class model occurs only when there is an attribute. Class structure In general, when we talk about class diagrams, we are…
-
1
votes1
answer1412
viewsA: How to create a new Build.Radle?
TL;DR The message is recommendation, not obligation, but worth using Gradle in the project. Gradle Gradle is an automation tool for build, that is, of the processes involving your code for…
-
9
votes1
answer40
viewsA: Is there a problem using HTML 5 attributes instead of jQuery or Javascript?
Technically, no problem. Mainly in relation to safety. By this I mean that both validations are made in the user’s browser and nay represent security at no level to the system, other than a reminder…
-
7
votes1
answer527
viewsA: Threads Server Client
Create the two threads The first thing wrong with the code is that it creates a single thread to handle in and out. Basically, you need the ListenerSocket (with only one n) to re-read the in and…
-
4
votes2
answers223
viewsA: Static constants
Daria NullPointerException if it were a.sound. It’s strange, but in doing a.DOG.sound you are accessing DOG statically as if it were Animals.DOG.sound. In general, Java allows access to static…
-
6
votes1
answer187
viewsA: Persist "pieces" of a tree (large) in parallel
Parallelism challenge The first thing to keep in mind when thinking of parallelism is the dependence on each task that potentially can be performed in parallel. Of course, not everything is black…
-
4
votes3
answers1978
viewsA: Creation of a database for each user
Depends on scale or volume It all depends on the scale of the product. When the scale increases, many design decisions are counter-intuitive. By scale I don’t just mean the volume of data. And scale…
-
4
votes1
answer385
viewsA: Read file when it exists in directory
I set up an example based on the Watchingservice API. The comments in the code explain what each command does and should give a good idea of how to process the files within a scenario similar to the…
-
6
votes3
answers1738
viewsA: Is it possible to test only specific classes?
TL;DR Yes, it is possible to run tests selectively with junit, but how you do it depends on how you start such an execution. Different ways to run tests The simplest way to perform unit tests during…
-
2
votes1
answer35
viewsA: Grab a plugin selector
It seems that there is no more way. To documentation even gives an example where a plugin that needs to know the selector should receive it repeated as a function parameter. Statement example:…
-
3
votes2
answers993
viewsA: Operation of variables by reference
If you want to get an idea of how references work during the creation of an object and when you pass a reference by parameter, I suggest taking a look at my answer to the question Pass-by Object…
-
4
votes1
answer71
viewsA: Check the compatibility of my app with browsers
The only way to ensure compatibility is testing the application on all versions you support. Where I work, at Atlassian, this is done through automated tests with Web Driver and different instances…
-
3
votes1
answer245
viewsA: Data Truncation with Hibernate
The error message leaves no doubt: the system is trying to enter the record in the database, but is sending more characters in the field rua than fits in that field. Your entity does not specify the…
-
2
votes1
answer366
viewsA: Java: Problems with Wait() and notify()
As described in documentation, to use wait and notify you need to synchronize the object on which you are running the methods. Example: synchronized (obj) { obj.wait(); } In your case, if you are…
-
5
votes1
answer393
viewsA: Is it correct to declare GET/SET methods within a STRATEGY class?
TL;DR Not it is necessary to declare getters and setters for no object unless you intend to use them. That being said, there are several things you need to understand about Java, Object Orientation…