Posts by utluiz • 72,075 points
957 posts
-
2
votes4
answers6579
viewsA: Resize image
There are basically two approaches to working with different image sizes on the site, for example: small, medium and large. Resizing on the server Your system should receive an image setting a…
-
8
votes6
answers1170
viewsA: Why is it not possible to define an interface with static methods?
I turned my comment into response due to size. The problem seems to be perfectly solved by uniting the concept of the design pattern Factory Method with the Singleton, that is, a method that…
-
3
votes1
answer81
viewsA: Doubt with dynamic layouts
Beget views dynamics, according to certain parameters, is a challenge in any language. There are basically three main approaches to dealing with this: Scripts The approach of mixing scripts with…
-
13
votes3
answers1335
viewsA: Why is it bad practice to use Javascript inline?
The biggest problem of using CSS and Javascript inline is to mix different kinds of things in one place. HTML is a markup language for defining abstract elements. CSS is made to define visual…
javascriptanswered utluiz 72,075 -
0
votes2
answers1726
viewsA: exclusion of a database object with jpa 2 and jsf 2
Error probably occurs because the object produto is in condition detached, that is, outside the context of Entity Manager. It is important to know that you cannot pass any object to JPA. If that…
-
1
votes3
answers86
viewsA: Setting a Field for a Proxy
The problem is that you are creating a proxy for IClasse and trying to put on a property like Classe2. Just to remind you a little bit of polymorphism: you can assign a more specific type to a more…
-
11
votes1
answer4234
viewsA: When to use RUP and when to use Agile?
I consider the question to be valid and relevant, but I have to admit that this goes a little into personal opinion. Developer’s View As I am primarily one developer, I have difficulties in seeing…
-
3
votes3
answers603
viewsA: Multithread in web application
Not to recreate the ThreadPoolExecutor each request, place it in the user’s session. Example: //valida requisição //... ThreadPoolExecutor tpe = null; //evita problemas com duas requisições…
-
14
votes5
answers1347
viewsA: Singleton or class and statics?
Cleaning up a mess in a project [Singleton standard] was used to instantiate classes that loaded data into memory when the program was started. In fact, the Singleton nay serves to start data at the…
pattern-designanswered utluiz 72,075 -
3
votes1
answer856
viewsA: Spring MVC in HTML pages without JSP
1 - You can use data sent by Spring Controllers in HTML pages (using HTML5 tags), not to use JSP? It is not possible to use pure HTML, since the output generated with controller data must be…
-
1
votes1
answer877
viewsA: How to reference a jar from another project in Eclipse
iReport (at least in versions I know) cannot use Eclipse variables. However, you can adopt a standard in your team using environment variables. Each developer should be responsible for creating and…
-
14
votes5
answers2310
viewsA: Why are other encodings used besides UTF-8?
Relatively recently several operating systems did not support UTF-8. There are still many applications from this time in use and, in many cases, companies will not bother to update them just for…
-
6
votes2
answers157
viewsA: You can distribute program with GPL License along with GPL
Alert: I have no deep knowledge of licenses and laws, so please do not consider this answer to be final from a legal point of view. When in doubt, consult a specialized lawyer. The GPL license FAQ…
-
9
votes1
answer631
viewsA: What’s the difference between web MVC and desktop/mobile MVC?
Consider the image: She describes the relationship between the parties in the MVC model. Note the arrow notification. MVC for desktop/mobile In the version desktop/mobile that works where Model,…
-
7
votes2
answers1272
viewsA: What does it take for a system to support a locale?
I worked in the internationalization and localization of some systems in Java. I didn’t get to use languages very different from the Western ones, like the ones written from right to left, but I…
-
2
votes1
answer1051
viewsA: Processing of database exceptions
Restrictions added to the database should not be the primary application source for the validation rules, but only an additional guarantee. Using JPA, you can use the Bean Validation API with…
-
21
votes5
answers29209
viewsA: Reset to input fields after Ubmit with Jquery
Clearing all fields of a form: $(':input','#form') .not(':button, :submit, :reset, :hidden') .val('') .removeAttr('checked') .removeAttr('selected'); Resetting the initial values of a form:…
-
4
votes2
answers1073
viewsA: Concatenate table name loop sql server
You can run any dynamic query on SQL Server using the routine sp_executesql. Example: declare @i int declare @sql nvarchar(500) set @i =1 while @i <= 5 begin set @sql = N'INSERT INTO TABELA' +…
-
4
votes2
answers1225
viewsA: Maven + Spring MVC + JSP project, how to share view files?
There are several ways to do this. Putting resources inside a jar Some frameworks (such as Primefaces and GWT) do this because it makes it easier to share static resources available on the…
-
3
votes2
answers4163
viewsA: How to change between texts according to time?
I have prepared an example with setInterval: $(document).ready(function() { //textos a serem exibidos var textos = ["texto 1", "texto 2", "texto 3"]; //exibição inicial var atual = 0;…
-
6
votes1
answer4700
viewsA: Uniting several SQL queries in a single query
Solution "naive" You can use UNION as long as you keep the fields equal, leaving the unused ones empty. Example: SELECT b.natureza as natureza, COUNT(*) AS total, '' as tag, '' as seq FROM tabela1 a…
-
42
votes2
answers14652
viewsA: How to make the initial budget for a software project?
Scope and Pet The budget of a software project is directly involved with the ability to define the scope and estimate the effort needed to develop the solution. And any analyst with a minimum of…
project-managementanswered utluiz 72,075 -
7
votes1
answer5016
viewsA: Include jar file in Maven project
There are several ways to solve this. Keeping your repository The ideal is to install the jars in a repository of your company/home. For this you need a server with Artifactory or Nexus. The…
-
1
votes1
answer108
viewsA: Inter-yard injection
Every jar you own Beans CDI to be injected must have a file beans.xml in the briefcase META-INF, in accordance with documentation. It can be an empty file even. Try to put it in the two Jars.…
-
2
votes1
answer649
viewsA: Spring Framework in modular design by Apache Maven
Spring configurations can be distributed among the projects, each configuring its respective components. This ensures the possibility of unit testing in each module. Some modules will have…
-
0
votes3
answers1097
viewsA: Automatic file upload
Event forms and uploads (single or multiple) are a usability problem. Due to security restrictions, you cannot set the file name to be sent programmatically. So, if it is necessary to update the…
-
1
votes1
answer54
viewsA: After moving a post to the recycle bin, the Metabox values disappear when I restore the post
You are going through the same problem described in that matter (in English). It’s probably a bug on the theme caused because the function save_post is called without the data of the post when the…
-
14
votes4
answers58057
viewsA: What is the purpose of @Override?
Superscript or Override The superscript of a method occurs when a daughter class implements a method that already exists in a mother class, changing (overwriting) existing behavior. Example: public…
-
10
votes1
answer1846
viewsA: What is the difference between "action based" and "Component based" MVC?
Frameworks Component Based Frameworks Component Based maintains synchrony between the states of components of view and your server-side data model. When the user interacts with the screen, the…
-
2
votes1
answer1864
viewsA: Message "301 Moved Permanently" began to appear suddenly
This looks like a reverse proxy poorly configured, which is redirecting calls to the web server incorrectly. Given your HTML code and the Spring Controller method, plus the information that the…
-
7
votes2
answers2661
viewsA: What are the advantages and disadvantages of using transaction explicitly
Implicit transactions In this mode, the server will ensure that all operations are performed within a transaction. In general they are used so that the developer does not have to worry about the…
-
11
votes4
answers1443
viewsA: Should an enumeration be constant in the lifetime of the solution?
TL;DR Assuming an enumeration used to map domains defined in the business rules of a system, it does not need to be constant, but must respect the business rules and, if necessary, change along with…
-
8
votes1
answer2476
viewsA: Why is Pattern Open Session In View considered an anti-pattern?
What is Open Session In View? It is a standard used with frameworks of Object-Relational Mapping like Hibernate and other JPA implementations. An object managed by a JPA framework is known as…
-
5
votes1
answer915
viewsA: Validation of business object avoiding/reducing use of if’s and Else’s
You could use a Enum validate or return a validator to reinforce that each type of employee properly implements the validation. I have prepared a simple example, below... interface…
-
19
votes2
answers3305
viewsA: How to best treat exceptions in Java?
Note: I will focus specifically on Java and the good practices I know, because this reply from @Maniero (and others) already address very well the issue of exceptions in general. I consider in the…
-
7
votes2
answers1124
viewsA: When is it worth paying for Sqlserver or Oracle?
It is possible to scale databases Open Source (SQL and Nosql) as much as a commercial version. An example of this is the Mariadb, replacing Mysql for high scalability and performance applications.…
-
2
votes1
answer197
viewsA: What is the difference between Hotdeploy and Publish, Start and with
Start and Debug The option Start will initialize the server and, as a consequence, the applications that are associated with it. It is the equivalent of Run for Javase. If you want to debug the…
-
2
votes2
answers178
viewsA: How do I get the values of a date in the "dd/MM/yyyy hh:mm" format and compare it to the system date after setting it in this same format?
A generic solution to compare any parts of a date with only one parameter could be like this: public class ComparadorData { public static boolean compareByPattern(Date d1, Date d2, String pattern) {…
-
4
votes2
answers351
viewsA: How to find the installation location of a package via SSH?
According to this answer of the site Superuser you can use the command dpkg with the parameter -L, thus: dpkg -L <nome-do-pacote> And to see where the source code is: apt-get source…
-
28
votes3
answers8167
viewsA: When to use recursion and when to use loops?
The answer depends a lot on the context. Situations where recursion is used When the performance is equal to or greater than the iterative version of the code There are several situations where…
-
7
votes2
answers660
viewsA: CDN vs. join JS/CSS
If I use jQuery and Bootstrap CDN, for example, I will be increasing the number of requests It’s not like that. First, the request will only be made once and then the browser will cache the script.…
-
7
votes1
answer1315
viewsA: Compare prices taking into account units (kg, g)
You can do this using an Object-Oriented approach to encapsulate the complexity of these accounts. Building a Product Model First you can create a Enum for each measuring scale. For example, for…
-
5
votes2
answers1269
viewsA: Which Pattern is used to validate business rule?
The most commonly used pattern (even without knowledge) is the Service Layer (Service layer). Design Pattern Service Layer The architecture of an application is usually divided into layers ranging…
-
22
votes3
answers1026
viewsA: What problems can a global state entail?
TL;DR The problem with a global state is that most of the time you discover that it shouldn’t be so global. A global variable is like a dark alley that you use as a shortcut to get somewhere more…
-
7
votes2
answers3360
viewsA: Best practices for creating and reviewing procedures
TL;DR In my experience, the best way to ensure proper updating of a system as a whole is by versioning all artifacts, including those from the database, into a version management system (SCM), and…
-
4
votes1
answer627
viewsA: Do one page websites appear in search engines?
TL;DR Yes, single-page websites appear in search engines, but in general it takes a lot of extra effort to do this. Traditional pages x dynamic Search engines index various types of content, mainly…
-
14
votes2
answers5822
viewsA: What is aspect-oriented programming?
In summary, the Programming Oriented to Aspects or Aspect-Oriented Progrmming (AOP) is a programming model that enables the proper separation of responsibilities, considering functionalities that…
software-engineeringanswered utluiz 72,075 -
3
votes3
answers220
viewsA: How to build a differentiable for a Generic class?
The intent of your code is confused. But if I understand correctly you want to store the type of entity and not an instance of it. So just make your builder like this: public abstract class…
-
1
votes1
answer320
viewsA: impact of a high heap memory on the JVM
The memory size will impact the running time of the Garbage Collector, but not directly. Time will depend on the amount of objects allocated. GC scans all references and marks objects that are still…
-
2
votes1
answer891
viewsA: Operation with Factorials from thehuxley.com website
To realize the sum of the elements of the series it is not necessary to calculate factorial nor powers, just keep control variables for this. For example, 3! = 3 x 2 x 1 and 5! = 5 x 4 x 3 x 2 x 1,…