Posts by Pedro Laini • 2,547 points
75 posts
-
1
votes0
answers79
viewsQ: Run Schedule only in production environment
I have a procedure that runs every beginning of month to reset password of inactive users. This procedure changes the user’s password and sends an email notifying the new password. However, I have…
-
1
votes1
answer186
viewsA: Bigdecimal - set to null by form when input is empty
This property is for empty strings. For numbers you need to set the property COERCE_TO_ZERO as false, as you say in this answer. Just set the property this way:…
-
1
votes2
answers371
viewsA: Difficulty Mounting SQL Query with UNION with SUM
INNER JOIN ON before group by INNER JOIN CADASTRO_Cliente as CL ON CL.chave = ?.chave Also... each time you use a table inside the command, Voce should name it differently... In the first select…
-
2
votes5
answers3991
viewsA: Update list after push Angularjs
One option is to use the filter in the list, instead of processing it and displaying it modified. Similar to that answer, Voce can do the following: <ul class="media-list" ng-repeat="message in…
-
1
votes1
answer280
viewsA: Doubt database / batch control system
Create a table for history control... So your stock table will have the current quantity, and in your history table Voce will have recorded all the operations of buying/ selling products... example:…
-
1
votes1
answer132
viewsA: Selectoneradio sending only one value
You can try to do how are you here. Create a Question and Answer Map... instead of assigning the variable resposta.respostaItem, Voce creates a Map<Pergunta, Resposta> selectedOptions . That’s…
-
1
votes2
answers71
viewsA: Problem with user inputs
There is a possibility of errors in reading variables when using nextInt, nextDouble, nextFloat, etc... I think it is because the 'enter' character can be improperly converted to number, thus…
-
0
votes1
answer1665
viewsA: Create truth table in C#
You can do the following: True table combinations can be interpreted as a binary number in which each digit is a variable. Example: A | B 0 0 >> 0 binario 0 1 >> 1 binario 1 0 >> 2…
-
2
votes3
answers218
viewsA: What makes the expression "'2 pigs' + '3 horses' == '5 animals'" return true in PHP?
var_dump('2 porcos' + '3 cavalos' == '5 animais'); // bool(true) When we add a number with a string in PHP, it tries to convert the string into a number and then adds the 2 as Concatenation and…
-
6
votes4
answers971
viewsA: Select between dates in Mysql
WHERE DATE_SUB(data_atual,INTERVAL 90 DAY) >= data_entrada This returns only dates that are 90 days or more before the current date
mysqlanswered Pedro Laini 2,547 -
11
votes1
answer230
viewsA: Software development: paradigms
Why software development resembles building a building? The two processes are similar because they follow development methodologies. Methodologies are quite common strategies to be used in areas of…
-
1
votes2
answers3180
viewsA: javax.faces.Facesexception, java.lang.Nullpointerexception
#{testeHibernate.save}: java.lang.NullPointerException Within the save method you are using the variables utiliza and the utDAO You initialized the variable uitiliza but did not initiate the utDAO.…
-
3
votes6
answers650
viewsA: How to extract a variable from within a function
Within a function you have a local scope. To access a local scope variable within another location, the only way I see it is returning the variable you want. So you call the function and get the…
-
1
votes2
answers58
viewsA: I’m having a nullpointer error and don’t know how to fix
To NullPointerException happens when you try to access a member(variable or method) of a object that has the null reference. In your code if (group.getGroup().ordinal() < lowest || g == null) {,…
-
0
votes1
answer97
viewsA: Update datatable when searching for autocomplete
You need to use an ajax to update the datatable and create a method in your Bean to handle the event: <p:autoComplete ...atributos...> <f:ajax event="itemSelect"…
-
3
votes2
answers220
viewsA: Declare Set<double> - JAVA
The sets, which implement the interface Collection of Java, as ArrayList, LinkedList, HashSet, etc... do not accept primitive types. But nothing prevents you from declaring a Set<Double>…
javaanswered Pedro Laini 2,547 -
1
votes4
answers1466
viewsA: How best to pass values to attributes
One does not exclude the other. You pass the construct facilitates the creation of an object, Since you don’t need to create the object and then set the parameters in it, you can do it directly in…
-
4
votes1
answer486
viewsA: Unable to create Managed bean
The cause of the error is this: - Property utiliza for managed bean testeHibernate does not exist. Check that appropriate getter and/or setter methods exist. You need to change the name of…
-
0
votes2
answers336
viewsA: Multi-device layout display problem
To get a layout responsivo, that works in all resolutions, you need to different layout for different resolutions. Placing your layouts within a folder structure like the following:…
-
1
votes2
answers1035
viewsA: Table Completion with List
What you need to do is use the LINQ feature to create a new anonymous type and then fill in Datagridview with the anonymous type you created. List<Usuario> lstUsr = preencheLstUsr(); var…
-
1
votes3
answers12748
viewsA: Generate random numbers in an Array from 10 to 50
The "formula" is numRandomico = numMinimo + geraRandom(numMaximo-numMinimo)
-
6
votes1
answer203
viewsA: Ordering structures, why is the representation made in matrix?
That’s just seems to be a matrix, but it’s not. Each line is the vector state in step x of the sort. That is, the position of each element in the array at a given step of the algorithm. This…
algorithmanswered Pedro Laini 2,547 -
1
votes4
answers2897
viewsA: Verifies which variable is with higher value returning the variable not the value
$array[0] = 6; $array[1] = 4; $array[2] = 3; $array[3] = 9; $array[4] = 8; $array[5] = 5; $index = -1 $max_value = $array[0]; for ($i = 1; $i <=…
phpanswered Pedro Laini 2,547 -
-3
votes2
answers306
viewsA: #Region is an antipattern or a Smell code?
The #Region is used to organize your code. In a class you have attributes, getters and setters, processing methods. Suppose you want to organize your class in regions to get better organized and you…
-
1
votes5
answers860
viewsA: Why is a variable with no value considered uninitiated?
The variable is only one reference to a valor/objeto. There is a difference between declaring a variable and initializing a variable. In your example you declared the variable but did not initialize…
-
3
votes4
answers2064
viewsA: What are the main differences between Handler, Thread and Asynctask?
AssyncTask and Handler are classes used to facilitate your work as a developer. Asynctask Enables Proper and easy use of the UI thread. This class Allows to perform background Operations and Publish…
-
6
votes3
answers4676
viewsA: Is the Finally block always run in Java?
Yes, he will always be executed! The block finally is used to ensure that a code is executed after a try, even if an exception has been generated. Even if you have a Return in the try or in the…
-
0
votes2
answers797
viewsA: Implementation of Jmenubar in a Jframe
I believe it is missing to call the method repaint( ) to apply the changes on the screen
-
1
votes1
answer317
viewsA: How to convert TIMESTAMP/DATETIME to Gregoriancalendar?
Timestamp ts = seuTimeStamp; GregorianCalendar c = new GregorianCalendar(); c.setTime(ts); or, if it is Date Date d = seuDate; GregorianCalendar c = new GregorianCalendar(); c.setTime(d);…
javaanswered Pedro Laini 2,547 -
1
votes2
answers861
viewsA: Accent with Javascript Resource
Your html code has charset="utf-8". Your Resource file must be in UTF-8 format as well, otherwise it can give divergence in the charset. An alternative is to write your Resource, converting the…
-
1
votes3
answers145
viewsA: DER Student Question Theme
To facilitate your operations, you can create a history table +----------------------------------------------------+ | HistoricoPerguntas | +----------------------------------------------------+ |…
-
1
votes1
answer413
viewsA: Temporary table that Hibernate creates
Hibernate uses these Ht_tables as temporary tables to assist in operations like delete and update. In this post, the author explains that there is a problem with Letes and cascading updates, to know…
-
3
votes3
answers2559
viewsA: Is it possible to add int with str composed of text and numbers in Python?
Your question already has one reply in the English version of Stackoverflow! The operator '+' works like this: If the 2 operands are numbers: add Else: concatenates strings. If the string contains…
-
8
votes2
answers10623
viewsA: Imperative and Declarative Paradigm
Programación Imperativa Imperative Programming is a state-based concept, defined by variables, and actions that are state manipulators, procedures. By allowing the use of procedures as structuring,…
-
1
votes2
answers2446
viewsA: Select JPA and Hibernate
Let’s go to the remarks: 1st) INNER JOIN i.setor s << this JOIN is unnecessary When you map the tables and the relationships between them in Hibernate, it already performs these joins…
-
1
votes4
answers369
viewsA: Doubt in database query, error in query
Jéferson Bueno’s answer is correct! You wish to find the records that origin = 'ORIGIN' And (at the same time) destination = 'DESTINATION' And (at the same time) date = 'DATE' So you should use the…
-
1
votes2
answers68
viewsA: Is it necessary to place the element type inside the Try?
In this example, of the Oracle website, it implements the try-with-resources. Some things to be observed: This feature is available from version 1.7 of Java. It puts the type of the variable inside…
-
4
votes1
answer200
viewsA: Get widget without id
If you need the canvas inside the element #itens 1) $('#itens canvas') selects all the canvas within the element $itens 2a) To return only the first (or single) utilize $('#itens canvas').get(0) or…
-
1
votes3
answers1701
viewsA: How to represent "is-one" relationships in the logical model?
You can do the following: Cliente(..., FK_PessoaFisica, FK_PessoaJuridica ) If the Cliente for a Pessoa Física... he will have assigned Fk_person, and null Fk_person... If the Cliente for a Pessoa…
-
5
votes1
answer120
viewsA: Doubt with Servlet
Behold that link that shows example of 2 implementations. To correct alternative to your question will depend on which Requestdispatcher method you will use. It has two methods:…
-
3
votes2
answers715
viewsA: Add the 5 highest values to an array
Let’s do in 3 steps what you need. first) Your entity needs to be compared to another entity so we can sort the list. To do so, we will implement the Comparable interface and say that when comparing…
-
3
votes1
answer1028
viewsA: Organize Javascript files for a project
The organization of your files depends on the type of project, size, existing modules, etc... Try to identify if your Java functions can be grouped into different files, for example: In a project…
-
1
votes6
answers1655
viewsA: Heritage and Polymorphism
You need to understand the difference between variável de referência and objeto de referência. You see, you declared an object like this Funcionário f = new Vendedor(); What this means for the Java…
-
34
votes3
answers21607
viewsA: What are the concepts of cohesion and coupling?
These two concepts are fundamental to the Orientação a Objetos. Cohesiveness: Cohesion is indeed linked to the principle of responsibility single, which was introduced by Robert C. Martin in the…
-
0
votes1
answer137
viewsA: Problem with Viewscoped Requestscoped and Session
Using @RequestScoped, your data is only visible during the request. For manipulation of tables on a screen, I indicate the @ViewScoped, that will keep your data visible while staying on screen. Read…
-
0
votes2
answers426
viewsA: Load a large volume of data into a datatable
You can use paging in your datatable. Example: <rich:dataTable value="#{seuBB.lista}" var="obj" id="tabela" noDataLabel="Tabela vazia" rows="10"> <rich:column> <f:facet…
-
5
votes3
answers2023
viewsQ: Is there a nomenclature standard for enums?
I don’t know much about object naming patterns. I’m creating a enum who lists positions, for example: manager, programmer, attendant... There is a pattern to name this Enum? EnumCargo, CargoEnum,...…
-
0
votes2
answers184
viewsA: View formatless HTML tags from Twitter Bootstrap
You need overwrite the settings the elements are receiving from Bootstrap! How to do this? place !important in the settings you want to prioritize. Example: p { color: red !important; } Source EDIT:…
-
1
votes3
answers2056
viewsA: Layout for all screen sizes
Just create the folders on the same level as the layout and create the file inside with the same name. Android takes care of checking which size of the screen and takes the layout in the…
-
2
votes1
answer499
viewsA: dynamic "message" of p:confirm - Primefaces
Declare a variable in your bean, String message = "Confirmar?" Put an id on p:confirm, id="message" and also value="{{testeController.message}}" That part of the code {{testeController.message}}…