Posts by utluiz • 72,075 points
957 posts
-
12
votes4
answers2297
viewsA: Is it correct to use a table in the page layout?
Table vs Tableless To table or not to table? That’s the Question. Whether or not to use tables on a web page depends on your goal when representing certain data. Once upon a time the tag…
-
1
votes1
answer1060
viewsA: Join several Arraylist in one collection
Understand the requirements From the information available, I could not understand how the information is read and how exactly it should be displayed. It is a common mistake for programmers to try…
-
7
votes1
answer10051
viewsA: What is the difference between @Postconstruct and the constructor?
When using frameworks that manage the lifecycle of your classes, as is the case with Spring, it is always important to understand that an instance managed by the framework is not just any instance.…
-
1
votes1
answer129
viewsA: Help with Arraylist
The problem By logging out you can see that you are reading 3 Xmls, each with two clients. In the program, you call the generation routine three times and within that routine you have a loop for…
-
1
votes2
answers2709
viewsA: How to create a connection to the H2 database using Spring Data?
The original error is not exactly your configuration. See below: Not an Managed type: class Marlinalarme.Objects.User That means your class User is not a JPA entity. Somehow you must be trying to…
-
10
votes1
answer1098
viewsA: Programming Resta-Um using Monte Carlo Method
Define a data structure At a high level, you basically need to define a proper dice structure to represent the board for the Game. In the case of Java, it can be a two-dimensional array with the…
-
12
votes4
answers1166
viewsA: What are the differences between Generic Types in C# and Java?
From my point of view, the main difference is that in Java, you can understand that the purpose of generic classes is only to provide a certain level of security at the time of compilation,…
-
4
votes2
answers377
viewsA: Alternative to Exists()
I don’t understand exactly how your process works, because maybe there is a better way, but some things that could help are: When using EXISTS, do not need to select any field, you can do SELECT 1…
sql-serveranswered utluiz 72,075 -
1
votes1
answer134
viewsA: Configure Relational and Non-relational Databases in the same project with Spring-Data + Hibernate
Using class-based configuration and annotations it is possible to split the configuration of each Spring Data JPA repository and its respective DataSource in a separate configuration file. This…
-
2
votes1
answer130
viewsA: in.createNativeQuery executes first than in.persist and now?
The problem is caused because many of the common operations are stored in a sort of memory queue, which is usually downloaded to the bank at once when closing the EntityManager. Hibernate thus tries…
-
2
votes2
answers862
viewsA: Reading PDF with Defaultstreamedcontent. How to close it?
For what I found in this matter of Soen and see in the implementation of the class DefaultStreamedContent, Stream is never closed through the method close. You also cannot close it within the method…
-
1
votes2
answers201
viewsA: Why does Tree not come with a value, but with the name of the object in memory?
What is being displayed is the result of the method toString of the objects placed in the tree, because of the following: <h:outputText value="#{cat}" /> The above code instructs JSF to…
-
53
votes13
answers20263
viewsA: What makes a language to be considered low/high level?
A picture is worth a thousand words Computational abstraction Thinking about an approach to differentiate high and low level languages from the point of view of who is programming, the language…
-
6
votes1
answer723
viewsA: Creating a Java Interpreter for android?
Compiler vs. Interpreter There is no problem in creating interpreters for a given language or a subset of it. Your approach is correct within some conditions: Your interpreter really meets your…
-
2
votes1
answer276
viewsA: Custom Photos and Attachments in Wordpress
Use an attachment plugin To link files to the post you can use a plugin like this. I have not used this plugin and there are others, so search well and choose one of them. These attachment plugins…
-
14
votes3
answers1771
viewsA: Code comments when working in a group
Golden Rule Comments should be avoided whenever possible. How not to need to comment One of the ways is to adopt standards or conventions that facilitate the reading of the code. For example, the…
-
17
votes9
answers10435
viewsA: My city zip code, where can I find open, updated and reliable source?
Unfortunately, all available information points to the answer that there is no ZIP database that is open, up-to-date and reliable. According to the Wikipedia the Post Office created and maintains…
-
1
votes1
answer476
viewsA: Web Service Java in Openshift using Tomcat 6 (Jboss EWS 1.0)
Whether it’s Openshift or any other environment, you need to make your implementation available using some SOAP protocol implementation. The library Apache Axis2 is the most used on the market. Even…
-
3
votes2
answers93
viewsA: Repeater for many lines
Let the user know that it is not possible to load or display "all on a single screen". Let’s get to the numbers Making a rough estimate, if each record in the database occupied an average of 512…
-
2
votes1
answer1136
viewsA: java.lang.Noclassdeffounderror: org/apache/Commons/httpclient/Httpexception
The Apache Httpclient 3.x is an old version and should be replaced skin Apache Httpcomponents. Analyzing your settings I noticed that you mixed the two versions of the Apache libraries. Maven will…
-
1
votes1
answer199
viewsA: Load/read/use jar file via web
It is possible, but it is a complex and delicate task, not recommended for most cases, and it has several limitations. Basically, you can load new classes manually, for example, through the method…
-
0
votes1
answer77
viewsA: Fail to delete using eclipselink
I don’t have all the code to state 100% what the problem is, but it seems to me that your class DivisionService is trying to update the entity Division received by the controlling being. Probably…
-
4
votes2
answers1914
viewsA: Multiple JDK/JRE
You may have several versions of Java installed, but software doesn’t always find the right version. Most will try to find Java based on the environment variable path of your system which usually…
-
6
votes2
answers4825
viewsA: How to apply the Singleton pattern correctly?
Its first form is "more correct", that is, without testing in the method getInstance. The book Effective Java (Effective Java) has discussed this issue deeply for many years. Let’s see some points…
-
2
votes1
answer963
viewsA: assign a function to a key on the keyboard
There are two basic ways to do this. KeyListener in the components The first is to add a KeyListener to its components to capture the keyboard events, check the keystrokes pressed and take the…
-
5
votes2
answers1998
views -
2
votes2
answers2828
viewsA: CURSOR vs table variable type
Cursors vs Table in memory Cursors are almost always sub-optimal in relation to performance, but there are exceptions and depending on the case may not be significant to your problem. In all the…
-
3
votes1
answer403
viewsA: index with regular expression using variable
There are different ways to do this and it will depend on your goal. First, to ignore the accents you can use the solutions of this issue indicated by mgibsonbr to remove the accentuation of both…
-
4
votes1
answer87
viewsA: Communication between JAVA reporting software and main PHP software
Yes, there are better ways, after all anyone could see the parameter in the URL in the browser or in a login log and know the "secret" of that user, who ends up working as a password. One simple but…
-
8
votes2
answers220
viewsA: Alternative to create a new method in a String object?
Why shouldn’t you do it Changing a basic language class (whatever) to implement a simple requirement like this is a big mistake. The Java language purposely prevents for security reasons that basic…
-
4
votes4
answers14217
viewsA: How to create/maintain "global variable" in java? To log in
Avoiding global variables or maintaining a global state to store information as a logged-in user is good for a number of reasons, but requires care with the application architecture. A great…
-
4
votes1
answer1211
viewsA: How to include a jar when running a Java file per command line
Define libraries without changing Java It is not recommended to define a classpath global. May cause unwanted side effects in other programs. To avoid repetition, create a file shell script…
-
1
votes2
answers4191
viewsA: When do I use Pathparam or Queryparam?
As already explained by @mgibsonbr, each annotation reads the parameters of different locations. However, it is important to understand that the Jersey framework implements the JAX-RS API, which is…
-
2
votes1
answer326
viewsA: Authentication and external redirection to wordpress sites
A way to automatically authenticate a user in Wordpress is through the method wp_authenticate() of the API. When the user logs into the main site, you need to give a include in Wordpress and run the…
-
1
votes2
answers1419
viewsA: Attach file . js inside other . js
I made an example that might help you. You can see what the code does in the following comments, but basically it generates a certain number of times the same fields and applies the mask to them at…
-
3
votes4
answers6834
viewsA: Find character in string
This calls for a specialized function. Well, I quickly developed the following: function nthstrpos($haystack, $needle, $nth) { $count = 0; $pos = -1; do { $pos = strpos($haystack, $needle, $pos +…
-
3
votes1
answer741
viewsA: Update all schemas with multitenancy architecture
I can think of several options to solve this problem: 1. Use a migration library This is my favorite option, because I can’t imagine Hibernate applying automatic changes in production. You can adopt…
-
2
votes1
answer182
viewsA: Application error in Heroku
The message Driver not found log indicates that the postgre driver is missing from your classpath.
-
1
votes1
answer223
viewsA: Configuring SVN in Amazon EC2 - User authentication is not requested
I know practically nothing of this configuration, but watching the line: Anon-access = read From your configuration, I have the impression that you have activated the read mode for anonymous access,…
-
1
votes3
answers354
viewsA: Return the last entry of different Postgresql objects
It would be something like: SELECT C.*, E.* FROM CARRO C JOIN EVENTO E JOIN E.CARRO_ID = C.ID AND E.DATA_HORA = ( SELECT MAX(DATA_DATA) FROM EVENTO E2 WHERE E2.CARRO_ID = E.CARRO_ID ) The…
-
1
votes1
answer203
viewsA: sp_executeSQL for each record of a table
"Manual" comparison of the structure No need for dynamic SQL, at least in case you know the database names. To identify tables that exist in one and do not exist in the other, or vice versa, use the…
-
1
votes1
answer314
viewsA: Avoiding dump for Mysql users
A user can be created with read permission (select) specifically for certain tables and this does not imply in giving access to the entire database for it. According to this answer Server Fault, to…
-
13
votes4
answers2538
viewsA: Should exceptions be used for flow control?
Maturity of Design Design many variables depend on code: experience, context, language support and probably others. Particularly, in several situations I end up experiencing different ways to…
-
3
votes1
answer102
viewsA: How to keep a Javascript Function in the DOM even after a page load from another page?
I wouldn’t advise keeping the information on one funcion. It would be better to modify the code and store only the necessary keys. Also, Storage location is not recommended to store session…
-
6
votes4
answers10421
viewsA: How can I get a date (day, month, year, time, minute, and second) converted into milliseconds in Java?
The @Maniero response directly answers what was asked. However, I will add some more details on the millisecond question. Date The class java.util.Date represents internally the date using the…
-
4
votes2
answers581
viewsA: Location of a point within the arc range
There are two ways to do this. 1. Kicking The simplest way is to kick coordinates (px, py) and check that they are within the desired area. To make this check, do so: Calculate the distance from the…
-
2
votes2
answers6436
viewsA: How to call a function of another JS file keeping the context of the current function?
I do not recommend using global variables. Let’s look at some possibilities to avoid this. Solution using an object as parameter An object { ... } is a flexible way to pass multiple parameters when…
-
1
votes2
answers339
viewsA: CAPTCHA in stateless API
A captcha consists of a challenge in order to prove that there is a human behind an action (requisition) within the system. In general, the procedure stateful of a captcha is to generate and store a…
-
21
votes2
answers10012
viewsA: What are Network Sockets and Websockets?
Websockets and Sockets are both client-server communication protocols, but although they have certain similarities (besides the name), they are distinct specifications for different purposes as…
-
8
votes1
answer158
viewsA: Why does Facebook’s XHR request have that code?
TL;DR Yes, it is to avoid a very specific type of attack based on Json requests on different domains. A type of attack According to an article from You’ve Been Haacked, one of the attacks in this…