Posts by Laércio Lopes • 4,352 points
169 posts
-
1
votes1
answer42
viewsA: How to format number in 2 decimal places
Using the function toFixed in its calculation. function calcular() { var p = parseFloat(document.getElementById('peso').value); var e = parseFloat(document.getElementById('estatura').value);…
javascriptanswered Laércio Lopes 4,352 -
1
votes1
answer65
viewsA: Format money value from database
Using the function number_format. Following example: $numero = '2199.99'; echo number_format($numero, 2, ',', '.'); // Resultado: 2.199,99 Documentation:…
-
6
votes2
answers1125
viewsQ: What current languages are used for Windows application development?
What current languages are used for Windows application development? I would like to know which ones have dependencies, like Java that needs to install JRE or some . NET that need you to install .…
-
2
votes2
answers337
viewsA: Laravel 5.8 find with column name other than "id", how to do?
You should then use the method where. If the code column has unique values instead of $produto = Produtos::find($id) use $produto = Produtos::where('codigo', $codigo)->first() You’ll have to…
-
1
votes1
answer1323
viewsA: Carrossel de imagem javascript
The function size() has been removed since version 3.0 of jQuery as per documentation. Instead, to check if there is the next image you can use length. The verification shall be:…
javascriptanswered Laércio Lopes 4,352 -
1
votes1
answer109
viewsQ: Creation of Trigger that saves information on file
I need to save in a TXT file all the closing codes made in a Postgresql database. The table closures has the following fields: codigo | data | nome -------|------------|--------- 1 | 2019-08-01 |…
-
1
votes4
answers196
viewsA: How to mark and uncheck div (by checking and unchecking Checkbox) with jQuery
Assuming you can have more than one div checked, just check with the if if the clicked element already has the class with the method hasClass. If you have click remove class, if you have not added.…
-
6
votes4
answers99
viewsQ: Simplify value localization in arrays in PHP
I have the arrays as below: $records = [ ["id"=>"1", "name"=>"Alpha"], ["id"=>"2", "name"=>"Bravo"], ["id"=>"3", "name"=>"Charlie"], ["id"=>"4", "name"=>"Delta"],…
-
3
votes2
answers851
viewsQ: Keep changing font color with CSS only
I have this link that shows/hides the menu of the site, I want to draw the attention of the users for it changing the color of the font, it is possible to do only with CSS? setInterval(function(){…
-
0
votes1
answer36
viewsQ: SQL for specific page
I’m making my own paging code from a table of records, and in my case I don’t want only the requested page to come by AJAX instead of all pages to be manipulated by Javascript. The information of…
-
2
votes3
answers1077
viewsA: How do I send my form along with another variable via AJAX POST to PHP?
I believe that the simplest solution is to continue using the facility that serialize() offers in a form, can create a <input type="hidden" id="pendente" name="seu-name" > and put the…
-
2
votes3
answers116
viewsA: URL does not display symbols
This happened because it is necessary to encode the characters < and > for %3C and %3E respectively in order to be able to transmit them over the Internet. A URL can only have ASCII characters…
-
3
votes1
answer490
viewsQ: Generate JSON with header and detail of multiple records
I have the following tables: orcamento storing information under the heading of the budget; orcamentoItens that stores budget items; itens that stores the details of the items. (I’ll put the…
-
2
votes2
answers31
viewsQ: Is it a problem to remove class that an element does not have?
I have an application that at certain times I need to remove and add classes from an element by Javascript. $('.elemento').removeClass('minhaClasse') $('.elemento').addClass('minhaClasse') Currently…
-
2
votes1
answer147
viewsA: Pull content from within a table to text boxes within the modal
You can get the table row values from the action button on the same line with $(this).parents('tr').find('td').eq(*índice*).text(). parents('tr') reaches up to the <tr> ascending from…
-
2
votes0
answers37
viewsQ: Facilitate quantity change in input number
By placing a <input> with type="number" in an HTML form, viewing the page by a PC the field shows the arrows up and down, but in Mobile appears the keyboard to type the number, I wonder how I…
-
0
votes2
answers45
viewsQ: Sum selected items
I have a select showing products that can be inserted in a table by clicking the button + . Previously when values were displayed in the format as in the database (9999.99) I could calculate the…
-
3
votes3
answers336
viewsA: Catch Fatherless Children in a MYSQL hierarchical structure
You can check all the records you have parent_id that is not on the same table using NOT IN. Heed You said it’s the same table, but you’re putting different names in the query, pai and filha.…
mysqlanswered Laércio Lopes 4,352 -
0
votes2
answers604
viewsA: Command prompt with React-Native
How did you tag prompt and cmd, believe that the Operating System is Windows, so in the command window you do not need to have to access one folder at a time, can access directly. Assuming it’s on…
-
0
votes1
answer182
viewsQ: Format currency to select from JSON
I have this select that loads the options coming from a JSON. I would like to show the values that are placed in select in Real format (999,99) but even using the response functions of this question…
-
2
votes1
answer746
viewsA: Rounding in SQL
It is possible to truncate the numbers after the decimal point with the function TRUNC but if the value is up to 488,999 the result will be 488. The query would be: TRUNC((A.PESO * 20),0) See…
-
4
votes2
answers1000
viewsA: How to get the pid of a windows process right after the process is run
It is possible to do a search on the return of the utilities tasklist and wmic with the command for, in both it is necessary to pass the name of the process. In the examples below I set the app…
-
10
votes3
answers2746
viewsA: How to write HTML as text within a div?
How you want to change the content of a <div> from HTML to text can use the function below: The code below is checking the attribute data-content to switch from HTML to text or vice versa.…
-
-1
votes4
answers1004
viewsA: What are the batch commands/variables. Example [%username% or %groupname%]
In Windows the command SET already returns the environment variables. Here returned me: ALLUSERSPROFILE=C:\ProgramData APPDATA=C:\Users\Laércio\AppData\Roaming CommonProgramFiles=C:\Program…
-
0
votes1
answer51
viewsQ: Set primary keys in sequence
I have the table empresas as an example: cod | nome ----|---------- 3 | Asterix 7 | Lunar 13 | Coimbra Fortunately the table of companies currently has no reference in another table, I would like to…
-
1
votes1
answer82
viewsA: Binding with PHP and Postgresql
The error is being shown because the parameter :marca is not in your SQL. You can remove the line below that will solve the problem. $cadastrarMarca->bindValue(":marca", $nomeMarca);…
-
1
votes1
answer41
viewsA: A field in table 1 related to 2 fields in table 2
If in the table webConference will always have the reference of an employee you can do only the JOIN. In cases where two columns refer to the primary key of another table can do the Query giving a…
-
4
votes2
answers3180
viewsA: Finish process and open again by . bat
You have already put the necessary command to finish the program, which is the taskkill, now just missing by a start before the file path to boot it again. Your batch would look like this: taskkill…
-
3
votes1
answer402
viewsA: Tooltip is not set inside the modal
I’m only posting so you can see that it’s working to see if you’ve done something different. The tooltip appears when you place the mouse on the check button inside the modal.…
-
2
votes4
answers440
viewsA: How to Fill in the field when the field is empty in PHP?
I believe that the simplest way to make it work is by making a conversion, putting (double),(float) or (real) before the value is assigned. Your code would look like this: $examesEquipamentos = [];…
-
1
votes1
answer582
viewsA: Error returning a query’s value with php and ajax (Request failed: parsererror)
Convert JSON with $.parseJSON(response) and remove the dataType: "JSON" of $.ajax. being like this: function buscaCliente() { var cnpj = $('#cnpjCliente').val(); $.ajax({ url: "buscaCliente.php",…
-
5
votes2
answers150
viewsA: Add values from a select when repeat client id
You need to use the group by of SQL. For the result you want to query would be: SELECT nome, SUM(valor) valor FROM clientes GROUP BY nome…
-
0
votes2
answers453
viewsA: Creating HTML with Jquery and Json
If you want to put the content of each JSON item into different div’s as is the code, you should use the method append() instead of html(), should add the divs for Javascript too and using classes…
-
1
votes1
answer102
viewsA: A loading appears while loading Jquery content
You can place an image or an element made with CSS to appear while the data is loaded, after it is loaded just hide the page element. In Javascript you will have to put the callback done() which is…
jqueryanswered Laércio Lopes 4,352 -
0
votes1
answer105
viewsQ: preventDefault does not work in Browsers for Mobile
In computer browsers I can prevent the default anchor action normally, but using in most mobile browsers does not work. I need that when clicking the link the browser does not direct to the link…
-
2
votes3
answers1235
viewsA: How to get the element id
In cases where you have several elements with the same class, but want to get the ID of the element that triggered the event, must use this (Pure Javascript) or $(this) (jQuery), in the example…
-
0
votes2
answers535
viewsA: Store diverse information in a batch notepad
You can save variables to files with the extension .bat. To save the value of variables in a file named VAR.bat it is necessary to clear the information from it in case they exist with the command:…
-
1
votes1
answer68
viewsA: How to show a vector without going to another page
There are many ways to do this, it is possible to create elements on the same page and it is also possible to update element information on the page, which is the most common to do. I thought it…
-
1
votes2
answers66
viewsQ: JOIN with LIMIT in Query
I have the following tables with the information below: RESERVATION: id| checkin | checkout | titular | valor --+------------+------------+---------+-------- 1 | 2018-09-01 | 2018-09-02 | BOOKING |…
postgresqlasked Laércio Lopes 4,352 -
1
votes2
answers36
viewsA: Different titles for each slideToggle
You can use the function each iterate in the array of elements you selected and use the index of each element, in my example I put the index+1 because it starts with 0. See the code working:…
-
2
votes1
answer547
viewsA: How to Make a checkbox not selected if there is no previous checkbox selection?
A function can be made for when you click on a checkbox check if it is checked, if it is enabled the next one, otherwise disable the next one and uncheck also even disabled. Initially it is best to…
-
0
votes2
answers149
viewsA: Fill in the value of the select field using the enabled checkbox
The 52 value can be passed by argument if you use the function at another time. How the next names of the select tags should follow the sequence lineatura you can put as per the code below: function…
-
1
votes2
answers264
viewsA: How to print the selected name in the Bootstrap confirmation modal?
Your HTML has two elements with the same client ID, they cannot have two elements with the same ID in HTML and the ID must be only one parameter, you have put id="cadastrar_arquivos submitBtn…
-
2
votes2
answers44
viewsA: Column 'discount' cannot be resolved. How to use a column that is the result of a calculation to calculate another column in the same query?
Based on your Query, it is not better to do it the way below? Select price, col2, col3*7.5 AS desconto, (price*(col3*7.5)) AS finalprice From tab1.
sqlanswered Laércio Lopes 4,352 -
3
votes3
answers354
viewsA: on('change') shoot every click
You can listen to the click on select event, but this event is triggered before selecting any option. If you want to put so that something is done as soon as the user has chosen an option, even if…
jqueryanswered Laércio Lopes 4,352 -
1
votes2
answers128
viewsA: batch files - find current file directory
At the beginning of the code you can save the directory that the batch file is with the command: set backDir=%cd% And then go back to him with the command: cd %backDir%…
-
5
votes1
answer187
viewsQ: Include HTML in HTML without affecting SEO
I’ve seen a lot of ways to include a file HTML within another HTML, so much for Javascript as by the tag <object> of HTML5. These include types negatively affect page SEO? Content included in…
-
2
votes3
answers2371
viewsQ: Download all columns of all tables containing a text
I would like to find out which are all columns of tables in a database in a way that it is possible to search a word in these columns. Let’s say I have a database I don’t know the structure of but I…
-
1
votes1
answer72
viewsA: Detect width of Scrollbar
Get the width of scroll Through this reply I saw that it is possible to create a div hidden, other div within it with scroll and through the difference of the two know what is the width of the…
javascriptanswered Laércio Lopes 4,352 -
0
votes2
answers113
viewsA: Keep menu item disabled
It is possible to disable the default action by Javascript. With jQuery: $("a[href='cadastrar.php']").click(function (e) { e.preventDefault(); }); With native Javascript: var el =…
htmlanswered Laércio Lopes 4,352