Posts by utluiz • 72,075 points
957 posts
-
3
votes1
answer736
viewsA: Jcombobox does not allow item change
This type of problem is usually caused by an incorrect implementation of the method equals() of the class representing the Jcombobox elements. For example, the following class reproduces the…
-
10
votes2
answers2445
viewsA: What is the syntax for searching with array as parameter in Mysql?
The function FIND_IN_SET() query a text (first parameter) in a comma-separated list of elements declared in another String (second parameter). Example: mysql> SELECT FIND_IN_SET('b','a,b,c,d');…
-
2
votes2
answers1611
views -
6
votes1
answer378
viewsA: Front End Access on the server
TL;DR In practice it is quite possible, especially if users do not keep opening and closing the program several times. On the other hand, it is important to consider trade-offs and certain…
-
3
votes2
answers2406
viewsA: "margin-top" and "margin-bottom" overlapping, why?
This answer aims to add some alternatives for those who need to change the default behavior of the CSS that culminates in margin Collapse. Alternative 1: hidden element (hack!) One of the palliative…
-
27
votes6
answers10949
viewsA: How to measure code performance in PHP?
As all the answers (including the question!) have said already, microtime is an option for simpler testing. However, deeper analysis requires the use of a Profiler. For example, if you have a…
-
10
votes6
answers18042
viewsA: How to make a Custom Scrollbar?
There are literally dozens of plugins of scrollbars, so the best solution is to find one that fits your needs rather than reinventing the wheel, since this is not a trivial task. In a relationship…
-
6
votes4
answers2688
viewsA: How to package and distribute a web system?
An alternative solution would be to create an installer of its own and include the sub-installations of the necessary programs. The NSIS is a good tool to do this. WAMP The first step of the main…
-
3
votes2
answers1662
viewsA: In HTML5, should null elements be closed with ">" or "/>"?
I will add a few points that I consider important on the subject. Non-null elements CANNOT be closed with /> This article is very enlightening on the subject. For example, if you send to W3C…
-
10
votes3
answers2236
viewsA: Is there any way to make a standard browser tooltip appear without putting the text in the title tag and without tooltip plug-in?
In the bootstrap page it is possible to read about the property data-title: title default value if title attribute isn’t present What does it mean: The value of the title if the title attribute is…
-
4
votes4
answers2247
viewsA: What is the iterative (non-recursive) version of the LCA (Lower Common Ancestor) algorithm
Wikipedia contains a page about Tree Traversal which includes pseudo-codes to iterate over binary tree using stacks. For example, this is from Pre-order Traversal: iterativePreorder(node)…
-
0
votes3
answers427
viewsA: How can I include the 'Submit' button in the 'POST' matrix generated by 'serialize'?
#1 Using the plugin Jquery Forms I know the question does not talk about any plugin, but an option would be to use this plugin that already comes with several ready functionalities related to…
-
1
votes3
answers2176
viewsA: Command to replace characters recursively
I’m used to Java development environments, both on Linux and Windows, so I would use a task Ant to perform cross-platform file handling operations like this. Ant is a powerful and versatile tool…
-
13
votes7
answers58283
viewsA: Regular expression for e-mail validation
Difficulties in Validating Emails Validating emails with Regex, even more via Javascript, can be a double-edged sword. Valid emails can be rejected and invalid can be accepted in most expressions…
-
18
votes4
answers2247
viewsQ: What is the iterative (non-recursive) version of the LCA (Lower Common Ancestor) algorithm
In graph theory, there is a concept called LCA (Lower Common Ancestor - Nearest common ancestor), where given a pair of nodes of a tree, one must find the nearest "father" (ancestor) of these two…
-
38
votes3
answers5488
viewsQ: How to use the current value of a variable in a more internal function?
The following code "prints" 50 times the text "Message 50" in a textarea. for (var i = 0; i < 50; i++) { setTimeout(function() { textArea.value += 'Mensagem ' + i + '\n'; textArea.scrollTop =…
-
7
votes2
answers396
viewsA: Is there a function to display the defined variables?
Beyond the function get_defined_vars(), quoted in @lost’s reply, in certain situations there is another that can be very useful. The function get_defined_constants() displays all the defined…
-
8
votes4
answers640
viewsA: Installable PHP application architecture
Good response from @Frenetic. I would, however, like to add some pointers on how to make a self-instruction. Main configuration file Like Wordpress, you will need a basic file configuration that…
-
6
votes1
answer776
viewsA: HTTP cache headers in Servlets
There is the library Java EE Cache Filter, consisting of a set of filters for handling headers. How filters can be mapped via web.xml, I believe that there should not be much difficulty in its…
-
2
votes2
answers2183
viewsA: How to set the cursor position in an editable element?
As Jordan has already responded, with a good response by the way, it is possible to locate the text inside the editor. However, use the childNodes[0] will not work if there are html tags inside the…
-
14
votes1
answer443
viewsA: Is an immutable Enummap thread safe?
What is an object Thread-Safe? It is an object that, in a given context of use, ensures secure access to data shared by several threads no unwanted side effects. These side effects usually occur…
-
4
votes4
answers8540
viewsA: How to let bootstrap tab active after clicking on pagination?
When a page is reloaded, its previous state is lost. Therefore, according to the section where you set the tab Configuração as active, the behavior you obtained, to get the first tab always active,…
-
2
votes1
answer127
viewsA: How to avoid infinite loop in the function/call that reduces the font size?
The first idea that comes to me is to limit the while to the current size in pixels, as the excerpt below: $('#wrap span').each(function(){ var $this = $(this), overflow = $this[0].scrollWidth >…
-
13
votes7
answers3681
viewsA: What are the implications of not declaring variables in PHP?
Impact on performance As many have said, there will hardly be a significant impact on performance. There will be much greater performance gains by creating better algorithms, using opcode and other…
-
5
votes3
answers1404
viewsA: How to compare HTML elements by real z-index?
I do not have an absolute answer, but I will draft some ideas on this subject. Thinking about the Usability Regarding the example figure of the question, although technically it is coherent to drop…
-
4
votes4
answers3358
viewsA: How to create an element and after a few defined seconds remove it?
An interesting way is to display the warning and remove with a fade out: $('<p id="lblAviso">Salvo com sucesso</p>') .appendTo('body') .delay(1000) .fadeTo("slow", 0, function() {…
-
8
votes3
answers7789
viewsA: Built-in form action parameter is not passed via GET
There is a conceptual problem in the code. Let’s look at the options for HTML form submission: POST <form method="post" action="painel.php"> The values of the form fields are sent in the body…
-
17
votes8
answers67841
viewsA: How to export an HTML/PHP page to PDF
While it is desirable to have a native implementation of this type of library in the language we use, it is important to consider options that can be integrated into the language without major…
-
6
votes1
answer517
viewsQ: Is there a safe way to check the loading of frames in an HTML page?
Some time ago I built a tool with HTML and Javascript to help debug a family of web applications. Basically, the tool consists of a static HTML page and a collection of scripts that load a given…
-
3
votes2
answers173
viewsA: How to force the version of a Maven plugin?
There are two options: add the desired version as a direct dependency on your project, so it will have priority in resolving dependencies. Delete the incorrect dependency. Example: <plugin>…
-
3
votes6
answers5183
viewsA: How to reverse the position of a div(and its content and attributes) with another div?
Note My initial response was simplistic and did not work in 100% of cases. I then made a rather complex implementation, but I have not yet been satisfied, as well as the other answers. I am…
-
7
votes3
answers4056
viewsA: How to get the value of the current percentage of an upload?
As already mentioned, there are javascript libraries that make the job difficult for you. In general it is not worth going into low level details as probably different versions of different browsers…
-
13
votes5
answers2401
views -
0
votes3
answers157
viewsA: Refactoring function to collect constants with a certain prefix
Taking advantage of the @Lias hook, if the non-existence of constants is something serious in your application, a more consistent alternative to error message return in functions is the use of…
-
12
votes2
answers1381
viewsA: Why does Google Chrome accuse you that jquery.min.map is missing?
A file .map allows mapping a minimized javascript file (minified) to the original file. Then we can debug a web page without needing to change the system on the server, ie: No more gambit to put the…
-
4
votes2
answers2459
views -
25
votes3
answers13164
viewsA: What are the default sizes of android images?
It is not that there are standard sizes, after all your image can occupy a corner of the screen or even a full screen. However, there are recommendations. The question is: your layout should be…
-
6
votes4
answers12949
viewsA: Return Array with name of all files in directory
Directly nay is possible because javascript running on an HTML page runs in the browser of client and does not have access to the server file system, which is usually a serious security issue. It…
-
1
votes2
answers323
viewsA: How to disable JVM domain name resolution (hostnames)?
Searching for the error message: This address was Valid earlier, but now we get ... It is noticeable that it only occurs with those who use Weblogic in some type of specific environment, usually…
-
9
votes3
answers1314
viewsA: How to get around bad rendering of a font in Internet Explorer?
There are several factors for the differentiated presentation of the sources in the various systems, especially regarding engine used by the operating system and the anti-aliasing and, in the case…
-
7
votes8
answers17582
viewsA: Use Bootstrap and Primefaces without one interfering with the other?
The incompatibility of Bootstrap with jQuery UI (on which Primefaces is based) is known. In addition, the Primefaces Bootstrap-based theme is well changed compared to the original version of the…
-
6
votes3
answers3242
viewsA: How to get the last date of a day of the week in a given month in SQL Server?
I assembled the following function which returns the last day of week within a month: CREATE FUNCTION dbo.P_LAST_WEEK_DAY_OF_MONTH( @YEAR INT, @MONTH INT, @WEEK_DAY INT) RETURNS DATETIME AS BEGIN…
-
4
votes2
answers323
viewsQ: How to disable JVM domain name resolution (hostnames)?
An application is trying to access a remote EJB. Regardless of whether the configuration uses the address servidor.empresa.com.br or an IP to access the service, an error occurs:…
-
10
votes5
answers2222
viewsA: Which libraries to develop a Restful API in JAVA?
There are several options to work with REST in Java. There is an implementation of Spring Framework (Spring MVC) and the JEE standard JAX-RS, that has several implementations, among which the ones…
-
52
votes4
answers12597
viewsQ: What are the advantages of Lambda Expressions in Java 8?
Java 8 will be released soon (March 2014) and the main Feature of this version are the Lambda expressions. One could describe, as the question says, what this feature will add in practice to…
-
1
votes3
answers2543
viewsA: Unit test with database
As already mentioned in other answers, Hibernate is able to create the database structure by adjusting the property hibernate.hbm2ddl.auto. However, the use of this feature is unfeasible in somewhat…
-
11
votes1
answer13268
viewsA: How to create a JOB on Oracle?
The Oracle 11g documentation reads as follows Jobs: A Job is a combination of a scheduled time and a program, along with the additional arguments required by the program. The example of creating a…
-
14
votes2
answers15027
viewsA: How can I refer to the heaviest queries in SQL Server?
Use this query: SELECT TOP 10 total_worker_time/execution_count AS Avg_CPU_Time ,execution_count ,total_elapsed_time/execution_count as AVG_Run_Time ,(SELECT…
-
8
votes3
answers1559
viewsA: How to condition the insertion of a record in SQL Server?
In T-SQL you can use the IF and the EXISTS. Example: DECLARE @D DATETIME SET @D = GETDATE() IF EXISTS(SELECT 1 FROM DatasBase WHERE DataBase = '2013-12-12') UPDATE DatasBase SET DataAtualizacao = @D…
-
4
votes2
answers1264
viewsA: Accentuation of request parameter in JSF page
Tomcat considers the entire request to be ISO-8859-1 by default "factory". The direct and specific solution for Tomcat is to change the server configuration (server.xml): <Server port="8105"…