Posts by utluiz • 72,075 points
957 posts
-
1
votes1
answer322
viewsA: How to update the result field based on criteria?
If the idea is to update the table with the results, just do a UPDATE with a CASE: UPDATE ALUNO SET RESULTADO = ( CASE WHEN MEDIA >= 7.0 AND FALTAS / CARGA_HORA <= 0.25 THEN 'APROVADO' WHEN…
-
2
votes2
answers798
viewsA: Syntax error when creating table in Postgresql using Hibernate
Postgresql has the convention to use lowercase characters to represent identifiers, i.e., object names (schemas, tables, views, functions, procedures). It’s good practice to follow this. When…
-
3
votes2
answers594
viewsA: Managing dependencies with Maven in an offline environment
There are two main options to work offline on your computer using Maven. Download everything in advance Maven dependencies are in the folder .m2 within your user directory. If you know you will work…
-
6
votes3
answers1337
viewsA: In what order is a Set stored? Random?
Although TreeSet sort the elements, the decision to use this implementation should not be made just in case you need to sort the list at a time. By instantiating a TreeSet, HashSet or LinkedHashSet…
-
5
votes3
answers25526
viewsA: How to delete a character within a string?
The implementations of the other answers nay have a hidden error. Only moving later characters does not solve the problem Follow suit: Type a word up to 10 letters: abcdefg Type another word up to…
-
4
votes2
answers90
viewsA: Problems Embarrassingly Parallel?
Some classic problems of relatively simple and good parallelizing algorithms are: Calculation of Pi using the Monte Carlo Method Consider the following image with a square and a circle whose…
parallelismanswered utluiz 72,075 -
2
votes1
answer73
viewsA: Cache control for a specific file
Analyzing the documentation of mod_expires it seems not possible to differentiate files except by type. Alternatives I can think of are: Use an extension other than js to the specific file and…
-
5
votes3
answers2269
viewsA: What is the most efficient way to select items from a table?
General considerations on data processing First of all, it is important to mention that in most cases there is no form of data processing that is faster for any data volume. When we adjust…
-
4
votes2
answers4941
viewsA: How to capture keyboard action without pausing the C++ program?
Can’t do this with pure C++ as it depends on the operating system and console used. (Source) An alternative is to use the function kbhit() available in the library conio.h. It checks if any key has…
-
4
votes1
answer561
viewsA: Two pages using the same Servlet
It is possible to use the same Servlet for multiple actions. A simple way is to put an attribute name on each button and then check in Servlet, in the parameters of request, which button was…
-
2
votes1
answer87
viewsA: Memcached + Tomcat authentication
The Memcached documentation has a page about SASL authentication, this being the recommended solution for the above scenario. The setup seems to be simple. Just look at the How-To available. I don’t…
-
1
votes1
answer58
viewsA: What Doctype do I use in Primefaces?
If you are in version 5 or higher, you can use <!DOCTYPE html> to HTML5. The very one showcase does this, in addition to emphasizing in the item Components that the components are HTML5…
primefacesanswered utluiz 72,075 -
3
votes2
answers1393
viewsA: Macro, Capture MOUSE and KEYBOARD
If I understood correctly, the idea of making a Macro would be to automate a task, as if it were a user using the computer. The Java API provides the class Robot to do so. It contains methods that…
-
1
votes1
answer1033
viewsA: Pull results from two Mysql tables with PHP class
Let’s focus on your main code, which generates the table loop. Tag error Right at the beginning, you print a <tr>. But it’s before the while, then the tag will be missing for the next lines.…
-
2
votes2
answers2126
viewsA: Multiple LEFT JOIN and slow search
Adding some comments (@Zull, @jean and @Earendul) with some more information, I’ve put together a set of actions that should help improve performance: Remove the * and select only the fields really…
-
19
votes1
answer37878
viewsA: Xms, Xmx, XX:Maxpermsize, XX:Permsize - What’s the difference?
Dynamic memory The parameter Xmx defines the bad amountxDynamic memory ima that the Java Virtual Machine will allocate to store object instances, variable values, among others. It is important to…
-
2
votes2
answers96
viewsA: Search performance involving multiple disks
As Wédney said, the improvement would be minimal. In fact, I don’t even know if there will be a real gain, after all I don’t believe that SQL Server can read the two tables in parallel or…
-
3
votes1
answer589
viewsA: How to capture a Mysql query from a given table in real time?
If you have the paid version, there is Enterprise Monitor. In the "poor" version, you can activate the General Log, but cannot enable or disable by database. With the log active, you have the option…
-
1
votes1
answer840
viewsA: Erro em relacionamento Manytomany no Hibernate
This error refers to cases where a query performed in JPA or Hibernate uses the fetch Join in more than one relationship. The joins "normal", Lazy and Eager, bring the related lists in commands…
-
1
votes1
answer618
viewsA: Problem sending datasource list to sub reports
If there is not a very large amount of data, so there are no difficulties in storing the entire list in memory, you can pass any collection of objects to the report through the…
-
1
votes2
answers1483
viewsA: persistence.xml for development and other for production?
If I understand correctly, you want a dynamic bank access using an architecture multi-tenant. There are several exits. Personally I would use Spring to define different profiles as dev, uat and…
-
14
votes2
answers23564
viewsA: Is it possible to run a Javascript function in PHP?
PHP does not know Javascript PHP cannot directly call a Javascript function because PHP is interpreted on the server side. PHP does not see a code there, it simply copies the text character by…
-
1
votes1
answer56
viewsA: God x jQuery Mobile class
The problem with the analogy The analogy between a class with a screen that uses HTML structure cannot be made from 1 to 1. By dividing responsibilities between classes and methods you have a…
-
4
votes1
answer611
viewsA: How to access data from a Hashmap in another class
Making the map available First, it is necessary to define some way to retrieve the map that is in the Classe1. There are several ways to do this... 1. Instance attribute The map could be put into an…
-
1
votes2
answers1978
viewsA: In Postgresql, is there a difference between running a dump or exporting?
The three forms serve somehow for backup. SQL Dump is the most flexible way, but the text file can get very large as the database grows. For import and partial export, consider the command COPY,…
-
0
votes2
answers1198
viewsA: 404 error of a Spring MVC application
I downloaded your Github project and tested the application without any changes: worked! It’s probably a Tomcat configuration problem or something related to the running environment. I used JDK 7…
-
1
votes2
answers762
viewsA: It is possible to track the . js files that are called when running a Jquery event
Except by debugging line-by-line, there is no way to predict the dependencies of a given function or chunk of code because they are solved dynamically. If there is no eval involved, it would be…
-
7
votes3
answers2035
viewsA: Interface or Abstract?
Conceptually there is no difference between a interface and a purely abstract class, that is, with all abstract methods. With respect to changes, the abstract class would implement a…
-
1
votes1
answer536
viewsA: Find out which Primefaces component performed an action using jQuery function
I don’t know if it’s exactly what you expect, but when dealing with some event (like onclick) an element within a datatable, you can use the following Javascript code to retrieve the id table:…
-
8
votes1
answer1659
viewsA: How to handle security in a REST application with Spring?
With Spring, the recommended protection method is to configure the Spring Security to take care of the authentication and authorization. Authentication To the authentication, there are ready methods…
-
1
votes1
answer161
viewsA: Framework (Java) for Opening remote sessions for executing Unix-based Server commands
I’ve used the jsch to make build and deploy remote. Unfortunately I don’t have the source code because it was in a company where I no longer work. What I can say is that it works, but it is very…
-
1
votes1
answer84
viewsA: Simple_form disabling selection item according to registration situation
To documentation on Github contains an example of simple_form with a helper of Rails 3, which then allows you to pass a hash of additional attributes for each option. Behold: <%= f.input :role do…
ruby-on-railsanswered utluiz 72,075 -
2
votes1
answer725
viewsA: Problems with selectOneMenu
Without analyzing the application details, I can’t tell you why the item is not selected. However, I suggest that instead of selecting by the ID of an object (which may be null), create a Converter…
-
1
votes1
answer194
views -
2
votes1
answer336
viewsA: Debug/running non-stop server
This nay is a feature present in the IDE or JVM, but there are some techniques that can be used in practice. Comment on the code While in debug mode, stopped at breakpoint, comment the lines you do…
-
8
votes4
answers935
viewsA: Step-by-step operation of binary search algorithm
Pedro Rangel’s approach to representing binary search is to partition the list into sub-lists where the index is redefined. It’s pretty intuitive the way he played it. There is another approach that…
-
2
votes1
answer275
viewsA: Hibernate Boot
You probably have the configuration property hibernate.hbm2ddl.auto in some configuration file. Just remove or comment on the above setting so that Hibernate no longer checks. Apparently, second an…
-
0
votes2
answers845
viewsA: I can’t get the value of an input to compare within a _Construct
As @Papacharlie said, the mistake Undefined variable is caused because the local variable $tipo may not be properly defined if the code within the IF not executed. However, if the idea is to put the…
-
3
votes5
answers35403
viewsA: How to align a footer element always at the bottom of the page?
Keep the footer always at the bottom, when the content is smaller than the page, and so that it adjusts its position as the content gets larger, can be done using an element div as wrapper of the…
-
3
votes1
answer1738
viewsA: Lazy Load Onetomany
The mistake LazyInitializationException is one of the most common and misunderstood by those who use Hibernate. Like the LazyInitializationException occurs The important thing to understand the…
-
5
votes1
answer3184
viewsA: Size of a Java + Hibernate String
The default size of text fields is 255 characters, but you can switch to more as well as less. One way to do this is by using the annotation @Column JPA, specifying the attribute length. Example:…
-
3
votes2
answers1318
viewsA: Problem when passing polluted bean to controller and insert in BD using Java with Spring mvc
The problem seems to be caused because you have a "complex type" CategoriaProduto as an attribute of Produtobeing mapped to a simple value field, i.e., the"combo" whose option value is based…
-
2
votes1
answer178
viewsA: Alternative Methods for Application Server Storage
Memory caching is quite common. You can use tools like: Memcached: used by Youtube and Wikipedia. Works with several platforms and not only Java. Independent of an application server. Apache Java…
-
6
votes1
answer7135
viewsA: How to call the Arrays.Sort (array, new methodoOrd()) method in Java?
To order a array of objects in Java, ready class methods are generally used java.util.Arrays. Being T a certain object type (class), the most common method contains the following signature:…
-
1
votes1
answer422
viewsA: Validation of input triggering 400 error with Spring MVC
You need to look at the URL to which the form is redirecting. Your tag <f:form> points to the relative URL updateCategory, while it seems that your controller method points to a…
-
4
votes2
answers6417
viewsA: What are the advantages and disadvantages of generating HTML on the client or server?
What is the requirement? The competition of the web makes more and more the differential of the applications is in the usability or UX (User Experience). Interaction and response time are priority…
-
3
votes1
answer5323
viewsA: Error "Transaction is required to perform this Operation" when inserting, editing, or deleting - Wildfly
Use transactions Note the methods that make any insertion or change in entities with @Transactional. JPA requires a transaction context to make these changes. This is a recurring problem. Finding…
-
2
votes2
answers1762
viewsA: Pass JSP model to Springmvc controller
In accordance with the Taglibs documentation, the attribute path of tags <form:*> must receive an attribute from a Java Bean to make the Binding, that is, the methods getter and Setter shall…
-
20
votes6
answers1117
viewsA: Algorithm against Brute-force
Warning: I’m not an expert on security or this kind of attack. Cookies and Session do not resolve Cookies and Session nay are suitable places to place this type of security. Cookies are the…
-
11
votes3
answers3275
viewsA: Algorithm for faster route calculation between two points in parallel Cartesian layers (3D)
In a very simple way, connecting the floors by an edge, creating a kind of three-dimensional graph seems to me the most appropriate solution. The algorithm, however, must be customized according to…