Posts by Anthony Accioly • 20,516 points
346 posts
-
2
votes1
answer1481
viewsA: Configure Spring applicationContext by taking advantage of other configuration files
TL;DR: Use what you can / want from your application server The more components of the Application Server you use, the simpler your configuration will be. You do not need to repeat settings.…
-
2
votes4
answers642
viewsA: Prevent user from saving information in the bank
Use the method IsNullOrEmpty (despite the check to null be irrelevant according to commenting of @star). Additionally maintain a flat structure of ifs.If you will really validate everything by…
c#answered Anthony Accioly 20,516 -
1
votes1
answer44
viewsA: Create style and not style xhtml css
Use CSS: Style sheet: .destaque { font-weight:bold; } HTML: Compras<span class="destaque"> .com</span> Also note that html has title tags <h1> <h2>, etc, and that these tags,…
xhtmlanswered Anthony Accioly 20,516 -
1
votes1
answer245
viewsA: Problem with Primefaces running glassfish
Pedro, your problem, by description, has nothing to do with Primefaces (as you said, accessing locally everything works). With Glassfish default settings you should be able to access the server…
-
1
votes1
answer320
viewsA: Jlist Custom Cellrender
Lucas, making my comments a response as promised. Yes you are on the right track. There is material about ListCellRender in the official Java tutorial. You can find the sample source code here (it…
-
1
votes1
answer124
viewsA: Java Database Authentication generated by Asp.net MVC 5(Generate passwordhash in Java equal Asp.net MVC 5)
Assuming you use the PasswordHasher . NET side pattern, as per that SOEN post the whole magic of the algorithm happens in the class Rfc2898DeriveBytes (algorithm implementation PBKDF2 using Hmac…
-
14
votes1
answer12035
viewsA: Operation of the Spring Framework @Transactional
The annotation @Transactional demarcates transactions (you can start nested transactions, propagate transactions to other layers, etc.). The transaction is an isolated work unit that takes the…
-
2
votes2
answers465
viewsA: JSP Dynamic Change in Jboss AS 7.1
Make an exploded deploy (i.e., with a folder and not War / Ear). How to do this depends on your deploy mechanism and type of artifact. For a Maven-managed web project for example you would do this…
-
13
votes1
answer9490
viewsA: What is the difference between TRUNCATE and DELETE + CHECKIDENT?
In terms of performance TRUNCATE is more efficient. The main reason for this is that the command does not write line by line deleted in the transaction log. In the case of SQL Server the command…
-
1
votes2
answers505
viewsA: Passing Different Object Types to a Tablemodel
The project Beantablemodel exists for that purpose. If you need Features a little more advanced I recommend the project Glazed Lists (apart from having a TableModel and keep elements synchronized…
-
2
votes2
answers52
viewsA: The action is being applied to several elements, rather than one
In addition to relying on ids or numbered classes, you can also take advantage of the HTML structure itself: $(this).siblings('li.p-relative').children('div.buscaAvanHoverDiv').slideDown(); This…
jqueryanswered Anthony Accioly 20,516 -
3
votes1
answer878
viewsA: How to go from one to one element in the Carousel?
You can solve the problem only with CSS. I based myself in this example and in Soen’s reply. The idea is to take advantage of the absolute positioning of Carousel and reposition it purposely to the…
-
1
votes1
answer1581
viewsA: Align a `<span>` in the vertical center of a `<li>` without changing the rest of the text
My original solution was wrong, I did not read that the goal was to centralize the span vertically. In this case the solution is to make the li is displayed as table, and that both the span as to…
-
5
votes2
answers1470
viewsA: What is the real meaning of using ε-transitions in NFA?
Exactly. Transitions Epsilon allow state change without consuming input string characters. This feature coupled with the possibility of changing to more than one state at the same time characterizes…
automataanswered Anthony Accioly 20,516 -
3
votes2
answers649
viewsA: Java alternative to code-Climate
There are several well-known tools for static analysis and quality inspection of code in Java. Among them: Checkstyle: Very interesting to validate code conventions and Javadoc. Names, number of…
-
1
votes1
answer1016
viewsA: JSF datatable how to fill columns with List<List<Integer>?
Create an auxiliary object representing lines: class ExtratoLinhaVO implements Serializable { private Integer demandaEmAberto; private Integer demandaEmProcesso; // Demais variáveis, getters &…
-
1
votes1
answer633
viewsA: How to collect statistics in Oracle Metadata tables ?
As my comment, in current versions of Oracle (>= 10g), the statistical analysis functions for the optimizer are done with the package DBMS_STATS, in general but these statistics are not the…
-
5
votes1
answer152
viewsA: Calculate the time a car was parked
The null characters (\0) in each of its strings. That is, each of its vectors must have up to 3 characters: char linha[MAX], hora_i[3] = "", min_i[3] = "", hora_f[3] = "", min_f[3] = ""; It is…
canswered Anthony Accioly 20,516 -
5
votes1
answer147
viewsA: How ajax does to identify classes
If you post to the URL teste.aspx/InsertData containing the body {categoria:categoria } and request headers (for example, with the client Postman), you will receive a reply in format JSON. Who does…
-
8
votes3
answers1922
viewsA: What is the appropriate amount of changes to a commit?
TL / DR: There are no rules. However projects open source -> presence of pull requests and patches -> minor commits trend, which can be easily reviewed by other developers. Commercial projects…
-
5
votes1
answer169
viewsQ: Common predecessor in a graph of commits
I ran into another interesting problem during an interview. Unfortunately I’m also not sure I found a great (or good enough) algorithm. I thought to share to see if anyone knows a classic solution…
-
12
votes1
answer655
viewsA: Alternatives to the (anti-)standard Entity-Attribute-Value
This is a typical use case for Nosql tools, especially for family tools document-oriented databases (like the Mongodb). Other possible / complementary alternatives are tools Enterprise search (like…
-
5
votes1
answer180
viewsA: Generic type in Java
You are inheriting without specifying generic types: Operation extends Expression -> R sem tipo Scalar extends Expression -> R sem tipo InversaoEscalar extends Operation -> T e R sem tipo…
-
2
votes3
answers1032
viewsA: Return the "period" size of a bit string
A week after the "30 minutes exercise" I finally managed to reach a solution using bit manipulation. This algorithm continues to be brute force; but it achieved the best times as my tests (on…
algorithmanswered Anthony Accioly 20,516 -
15
votes6
answers7191
viewsA: How to put default (default) arguments in a Javascript function?
Just as a curiosity (since the standard that is still valid is the version 5). The Ecmascript 6 (alias Harmony) includes one proposal for syntax for parameters with default values. You can try it…
-
2
votes1
answer406
viewsA: Authentication in Java EE
On an application server like Glassfish or Jboss we could solve this using standard security mechanisms. All you need to do is create a Connection pool, one JDBC Realm and implement form…
-
12
votes3
answers1032
viewsQ: Return the "period" size of a bit string
Recently I did a very interesting online test (from Codility). Unfortunately this test was timed (30 minutes) and I ended up not being able to reach a satisfactory solution to one of the questions.…
algorithmasked Anthony Accioly 20,516 -
2
votes2
answers2686
viewsA: Running JAR by Browser
The JNLP does not execute the code on the server, it is a protocol done exactly to allow the distribution of applications to clients (i.e., among other features, JNLP allows a client to download and…
-
3
votes1
answer107
viewsA: Debug Java in Eclipse, excluding classes/packages
Yes, they are called Step Filters. You can access the settings in: Java > Debug > Step Filtering The button (Shift+F5) enable / disable filters (in perspective Debug).…
-
2
votes1
answer225
viewsA: javax.el - Implementation of Glassfish
For typical web applications Use the available implementation on the application server. If you are developing a web application to be published on Glassfish (or any other application server), you…
-
5
votes1
answer166
viewsA: Problems with mouseenter() and mouseleave()
Um... If the divthat should appear / disappear is always the next element after the link, use the function .next(): $('.show_post').mouseenter(function(){ $(this).next().stop().fadeIn('fast'); })…
-
5
votes2
answers345
viewsA: SQL Server 2005 and line version control
Yes, this is the path I would take even for auditing issues (of break I would also use a field to identify the user who made the change, but that’s not the case). For SQL Server 2005 you can use a…
-
10
votes2
answers296
viewsA: What’s the difference between downcase and downcase!
Ruby exclamation marks are used to indicate "dangerous" methods. In the case of the method downcase! it modifies the object itself. Another notable example is from exit (which gives chance for the…
rubyanswered Anthony Accioly 20,516 -
17
votes2
answers2787
viewsA: What is syntax sugar and how does it work?
Literally, syntax sugar is a type of construction made to "sweeten" the code, ie do something in a simpler way. Considering his example of for-each. Before Java 5, the new "sweetened" construction…
-
2
votes1
answer4585
viewsA: Apache permission on Windows 7
In the archive httpd.conf search for the following entry: <Directory /> Options FollowSymLinks AllowOverride None Order deny,allow Deny from all # linha padrão, geralmente causa do problema…
apacheanswered Anthony Accioly 20,516 -
3
votes3
answers7029
viewsA: Insert PHP into div with Jquery (.html)
TL;DR - Include the php files that define the connection in link2.php. The .load() jQuery will only work when you can make a direct request to link2.php and receive the desired html fragment. You…
-
1
votes1
answer501
viewsA: Jqgrid: Frozen column
Frozen columns cannot be edited inline. That’s a limiting known to jqGrid. That said you can always enable editing through forms. In particular you can call the form in the event in case of double…
-
3
votes1
answer81
viewsA: Doubt about jquery code
The problem is in the code $(".div_2").css("display", "nome");, you meant none. Additionally see that jQuery has convenient methods for displaying and hiding elements, respectively .show() and…
jqueryanswered Anthony Accioly 20,516 -
1
votes1
answer1896
viewsA: Ignore . classpath and . project on Github
Assuming you accidentally committed the files .classpath and .project they will continue to be tracked regardless of the file .gitignore. If that’s the case do the following: git rm --cached…
-
47
votes2
answers4053
viewsA: Is it wrong to use class inheritance to group common behaviors and attributes?
Well, let’s start from the academic definitions of the development pattern SOLID, and in particular of The Liskov Substitution Principle illustrated by mgibsonbr in reply which gave rise to that…
-
9
votes1
answer7812
viewsA: Sort table column datatable through query
Main options (assuming for example that the id be the first column of the table and the nome be the second): During the construction of the table Use the configuration parameter aaSorting.…
-
12
votes1
answer57581
viewsA: How to use mod in C C++?
The MOD operator is the %. int n = 40; if (n % 2 == 0) { cout << num << " é par"; } Additionally see std::modulus…
-
1
votes2
answers1085
viewsA: Save image after upload
Vanilson, I know this question was asked over a month ago, but I decided to help people with the same problem. The solution Change the scope of @RequestScoped for @ViewScoped in the Managed bean and…
-
2
votes1
answer1189
viewsA: How to get Paramentro in a C# sent from Android web service
From your code it seems that you have already learned to implement the interface KvmSerializable to map complex objects to XML and vice versa. Otherwise, see this example from Wsdl2code (which, by…
-
0
votes4
answers1996
viewsA: Naked Domain in Registro.br not redirecting to www
Try to use @ (or leave blank) the Name field setting (where you are using example.com.br) for all 4 records A pointing to Google ips. Also, if you haven’t already, enable the configuration of Naked…
-
1
votes1
answer1372
viewsA: Eclipse update vs new installation
Well, since there was no answer I will share what I have accumulated knowledge. Before updating always backup your installation and your Workspace. In my specific case the upgrade to SR2 version of…
eclipseanswered Anthony Accioly 20,516 -
0
votes1
answer1757
viewsA: FB.login and pop-up blocking
Answering my own question for future references. Really the call to FB.login has to be done directly from the click or browsers block the pop-up login. However reading the question "Facebook login…
-
6
votes5
answers844
viewsA: What is the shortest and most performative way to write Fibonnaci in Javascript?
Closed formula version (source): function fib(n) { var sqrt5 = Math.sqrt(5); return Math.round(Math.pow(((1 + sqrt5) / 2), n) / sqrt5); } Pre-calculating the root and a fixed term: function…
-
1
votes1
answer1079
viewsA: "Lookup failed" error when using a Glassfish Custom Resource
In the object properties remove the property stage and enter a property value. (The only property for simple types). Within the topic, the convention for jndi names is slightly different from the…
-
2
votes1
answer1757
viewsQ: FB.login and pop-up blocking
I have a usability problem when requesting extra permissions on Facebook. According to Facebook documentation the function FB.login should only be called after a click as most browsers block open…