Posts by Anthony Accioly • 20,516 points
346 posts
-
0
votes1
answer108
viewsA: jQuery Reverse conflict
See that your links are outside the element <li>: <a href="noticias.php"><li>Notícias</li></a> <a href="#"><li>Logística</li></a> When you call:…
-
0
votes1
answer191
viewsA: Performance difference in creating FK Mysql
According to comments, I have no knowledge of the subject, and have never taken the time to measure performance investigating this kind of detail. However, the question "Is there any Reason to Worry…
-
8
votes1
answer796
viewsA: How to bring the total of each column in Footerrow from a jqGrid?
At a glance in this example. Basically you should add a function loadComplete at the jqGrid to feed the summary line: loadComplete: function () { var $self = $(this); var somaCanceladas =…
-
48
votes3
answers33382
viewsA: What are the HTTP request methods, and what is the difference between them?
GET: Requires a representation of the specified resource (The same resource can have multiple representations, for example services that return XML and JSON). HEAD: Returns the headers of a response…
-
2
votes2
answers1874
viewsA: How to put buttons/titles with different design/style in C#?
You’re looking for the Windows Presentation Foundation (WPF), the Microsoft solution for rich applications. But bear in mind that there is a steep learning curve for developers Winforms. If you have…
-
4
votes1
answer1449
viewsA: Error inserting into Hibernate database
How I would model the problem. Database Would remove the PK id_produtoIngrediente completely. It allows the same ingredient to be repeated for a product, which does not reflect your business (each…
-
2
votes1
answer859
viewsA: Transfer ownership of a "Property" from Google Analytics?
Zuul, unfortunately it seems that in your case you use the same account to manage properties of several clients. If that is the case it seems that there is no way to transfer ownership of the…
-
2
votes2
answers997
viewsA: How to get the reference of the selected class in Eclipse Package Explorer?
Unfortunately, the possible variations make the code to get the selected class a bit complex. Your selection may contain one or several files, as well as more abstract concepts like "Project" or…
-
4
votes2
answers1163
viewsA: When to use instance variables vs parameters?
Some interesting references on the subject: SOE - Parameter vs. Member variables Main Points: Class variables are considered object state Using an instance variable implies maintaining state between…
-
7
votes2
answers1163
viewsQ: When to use instance variables vs parameters?
Assuming that a class A use a class B (directly or through an interface C to uncouple A of C). Making it clear that A and B are independent parties, i and.., the relationship between the two classes…
-
0
votes1
answer1372
viewsQ: Eclipse update vs new installation
Taking advantage of the SR2 release hook from Eclipse Kepler (now on the 28/02) I am opening a topic to discuss a problem much like "Should I do a new clean installation or upgrade of my operating…
eclipseasked Anthony Accioly 20,516 -
1
votes2
answers185
viewsA: How to make an IO "equivalence" in Java and C++?
You can use the printf :) C / C++ printf("Foo %.01f", fooTest); Java System.out.printf("Foo %.01f", fooTest); Of course this is a specific case for double, how you are using a generic type would be…
-
4
votes1
answer181
viewsA: JAXB - Tag repeating, instead of nesting
As your class ObsProducao is just a wrapper for a String, you can eliminate it completely: @XmlElementWrapper(name = "ObsProducao") @XmlElement(name = "sDsObservacaoProducao") protected…
-
9
votes8
answers16873
viewsA: How to invert a string in Javascript?
While I know this question has good answers, both for the usual case and for more exotic cases involving surrogate pairs. I think it’s fair to mention that there are libraries to solve this problem.…
-
2
votes1
answer1130
viewsA: CDI @Inject Named bean in another named bean
Use the annotation javax.faces.view.ViewScoped JSF 2.2 instead of the traditional javax.faces.bean.ViewScoped and everything will work correctly. In fact, it is recommended to discontinue the use of…
-
19
votes4
answers3235
viewsA: Is there a Website/API to host photos on the web?
Besides Flickr, here are some of the many popular options: Imgur: An extremely popular service (wikipedia article) to host photos. Displays a API REST with JSONP and XML support. The API is free for…
-
11
votes4
answers17336
viewsA: How do I copy commits from one branch to another?
Get the SHA1 from the first commit you want to move. You can do this with: git checkout master git log # Cria o branch apontando para o HEAD git branch nomedobranch # reseta o master descartando…
-
3
votes2
answers599
viewsA: How to make Hibernate "realize" that the value of a column was set by the database
Hibernate has a proprietary annotation to handle generated values, @Generated. She’s little known, but she does exactly what you want (official documentation). // Valores gerados tanto em inserts…
-
2
votes1
answer490
viewsA: Get components that are inside a xhtml file
You need a parser. While the JDK has the Documentparser, he is legacy and hitched to the Swing Apis. My recommendation would be Jsoup // Trate exceções no código real File input = new…
-
4
votes2
answers927
viewsA: Objectoutputstream only saves the first object
The problem is that the ObjectOutputStream writes a header to the file. When you open new output streams this header is written several times in the middle of the file. The classic solution would be…
-
2
votes1
answer129
viewsA: Querydsl with Abstract class
Well, assuming that QDadoLidoGraficoDTO: is a concrete class inherits from the superclass DadoLidoGraficoDTO (whether it is abstract or not) has a constructor with three parameters (compatible with…
-
2
votes2
answers2488
viewsA: Updating values in a Listview
As your code is not showing how you urged the Listview can’t be sure if you’re using a adapter standard or your own adapter. Assuming you’ve implemented your own Listadapter (inheriting directly or…
-
10
votes7
answers43303
viewsA: How do I know if a variable is of the Javascript Number type?
Well, Paulo Roberto posted the correct answer - and what he certainly had in mind when he asked the question - to find out if a variable "contains" a number. Some of the other answers have tried to…
-
8
votes1
answer1077
viewsA: How to run a group of suites in Junit?
Nothing stops you from creating a suite of suites: @RunWith(Suite.class) @SuiteClasses({ com.package1.MySuiteA.class, com.package2.MySuiteB.class }) public class RunAllTests { } Reference: Launch…
-
0
votes6
answers1639
viewsA: Remove an undetermined number of " " in a column in the database
Since this problem is quite simple, if you do not want or can not install an external library for substitutions with regular expressions, here is an adaptation of that function of Narcodes. The only…
-
2
votes5
answers6040
viewsA: What tool to use to convert a visually developed UML to code?
To OMONDO continues distributing Eclipseuml for new versions of Eclipse, unfortunately there is no trial for these products, you will need to test Eclipseuml with Eclipse Galileo or earlier…
-
18
votes6
answers9431
viewsA: When should var be used in Javascript?
I will make a transcription (with slight adaptations in italic) of an answer user’s kangax in SOE which, in my opinion, is the best reference on the subject we have (surpassing the answer accepted…
javascriptanswered Anthony Accioly 20,516 -
11
votes2
answers341
viewsA: First-class functions: Why should input types be counter-variants?
My (pragmatic) answer to the question: The reason it is only safe to return a subtype of the return type of the original function (+R) it is clear by analyzing a concrete case: whereas Gato is a…
-
14
votes2
answers341
viewsQ: First-class functions: Why should input types be counter-variants?
To demonstrate the problem I will use Scala code (although this is a rule formalized by Luca Cardelli). trait Function1[-A, +R] { def apply(x: A): R } In Scala this means that a function with an…
-
11
votes4
answers3728
viewsA: Java client library for REST web services
Another good option is the Resteasy of Jboss. In addition to implementing the JAX-RS 2.0 Client standard (i.e., it is possible to make calls with the same code @utluiz demonstrated for Jersey), the…
-
5
votes2
answers3152
viewsA: Build generation in the Maven project
There are several plugins to do what you want. A quick Google search returned to me: Build Number Maven Plugin Just set up the plugin: <plugins> <plugin>…
-
9
votes4
answers4319
viewsA: String concatenation in SQL
You are searching for capabilities of full-text search (that since Mysql 5.6.4 also work with Innodb). ALTER TABLE sv_users ADD FULLTEXT INDEX (userNome, userSobrenome); And for the consultation:…
-
28
votes2
answers1666
viewsQ: Why should the main method dispatch the creation of the GUI to the EDT in a swing application?
According to the Java specification, much of the Swing API is not Thread-Safe and shall rotate in the Event Dispatch Thread. Like, after initializing the GUI events are fired from within of the EDT…
-
6
votes3
answers2292
viewsA: How do I leave a "Default" language on Github?
Github tries to infer the language of the repository through libraries Linguist. Unfortunately as far as I know there is no automated flow to change the language of a repository. At the top of the…
-
3
votes2
answers673
viewsA: How to quickly recover a large PHP array?
In addition to Nosql options and a layer of Memcached as noted above, a second option would be search engines. This type of problem has characteristics that I would treat with indexing. You will…
-
11
votes6
answers36799
viewsA: How to read a text file in Java?
Just Listing Some Other Methods: Class Files in Java 11+ (recommended) String texto = Files.readString(Path.get("dados.txt"), StandardCharsets.UTF_8); The Trick of the Scanner: String texto = new…
-
5
votes1
answer1584
viewsA: Form with a "file" type field arrives at the server with "$_POST" empty
In accordance with the PHP manual the proper way to handle upload in POST methods is using the global variable $_FILES. // Uma vez que o nome do seu input file é img $_FILES['img']['tmp_name'] In…
-
4
votes3
answers2673
viewsA: How to make "case-insensitive" comparisons in Sqlite?
To switch between comparisons case insensitive and case sensitive there is a key to configuration: PRAGMA case_sensitive_like=OFF; About removing accents, I found that reference with a Function that…
-
16
votes1
answer776
viewsQ: HTTP cache headers in Servlets
I would like to know if there are libraries or solutions to treat requests containing headers as Last-Modified, If-Modified-Since, If-Range (for download summary), If-None-Match, Cache-Control,…
-
13
votes1
answer443
viewsQ: Is an immutable Enummap thread safe?
An immutable map built on top of a EnumMap could be used in multi-thread environment or there is some risk of competition problems? public enum MyEnum { VALUE1, VALUE2, VALUE3, VALUE4; } private…
-
6
votes1
answer394
viewsQ: Efficient data structure for high color concurrent problem
As part of a test I was asked to develop an application to manage high Scores in environments with high competition. This application should not persist on disk or use libraries and frameworks…
-
11
votes2
answers2459
viewsQ: Criteria API - Hibernate vs JPA 2
I will try to phrase this question in the least opinionated way possible in the spirit of stackoverflow in English. For a new project I need to make the decision between using the JPA 2 or Hibernate…
-
6
votes1
answer7768
viewsQ: When to use a Unique constraints vs unique indices on Oracle?
Is there any kind of good practice and/or recommendation when creating unique vs indices constraints on the Oracle? When I should wear one and when I should wear the other? Is there a situation…
-
10
votes4
answers1546
viewsQ: How can I optimize a recursive method for finding ancestors?
I have a class Pessoa who owned relationships for his father and his mother (these at any time may be null). On a particular piece of my code I need to find out if one person is an ancestor of the…
-
15
votes4
answers805
viewsQ: How to use Simpledateformat in concurrent environments?
The class SimpleDateFormat is not thread safe. I recently had problems with class instances SimpleDateFormat in static context being used by multiple threads concurrently in a web application.…
-
5
votes1
answer112
viewsA: How to use SBT 0.12 and 0.13 at the same time?
In the archive project/build.properties you can add a line with the desired sbt version. sbt.version=0.12.0 So you can install the latest version of sbt but keep the compatibility of projects that…
sbtanswered Anthony Accioly 20,516