Posts by Ricardo Pontual • 21,129 points
751 posts
-
1
votes1
answer92
viewsA: How to get this.data from an input with onkeyup
Use the getAttribute to obtain the value of the attributes: https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute function atualizaAdicionados(e){ console.log(e.value);…
-
3
votes1
answer169
viewsA: What does this symbol mean in javascript?
That one $ a shortcut to using Jquery, which can also be run using jQuery. If you don’t know what it is, it’s a library javascript. See in this example the operation: $("#btn").click(function () {…
javascriptanswered Ricardo Pontual 21,129 -
1
votes1
answer55
viewsA: Where to delete records that were entered a certain time ago
Use the function DATE_SUB() to calculate the difference of 5 minutes date, thus: WHERE dt_ponto <= DATE_SUB(NOW(), INTERVAL 5 MINUTE); The INTERVAL can be HOUR, MINUTE, etc, and as is DATE_SUB,…
-
1
votes1
answer73
viewsQ: What is a "multi-target" Nuget package?
My question is about generating a "multi-target" Nuget package, what would that be? I know that the package is compiled in one version target, .Net Framework 4.5, Core 2.0, etc. I even researched…
-
0
votes2
answers86
viewsA: Consult the last 3 days in which there was record in the table
If it is the last 3 days, it would be easier to say "date greater than current date - 3", which in an SQL command would be: WHERE DataOp > CURDATE() - INTERVAL 3 DAY Okay, I’ll leave the previous…
-
3
votes1
answer97
viewsA: group by semester/year PHP
To separate by semester, you need to generate this information in SELECT. Taking the logic of your query, you can do IF(MONTH(data) <= 6, 1, 2) semestre. This will generate "1" when the month is…
-
0
votes1
answer33
viewsA: Code only works for one of the divs
You can do this using only css: .btn:hover { background-color: #c3c3c4 } .btn-ant { background-color: black } .btn-pro { background-color: black } .btn-close { background-color: white } <div…
-
1
votes1
answer110
viewsA: Add "required" attribute after change in "select"
You can add the attribute using attr and remove with removeAttr, since you’re using jQuery. See the example below. I added an id to the email and a form tag for this example:…
javascriptanswered Ricardo Pontual 21,129 -
3
votes1
answer44
viewsA: There is performance loss by using alias on oracle
Aliases do not impact the performance of a query. Aliases refer to tables and columns, being possible to execute the query without them, so they do not impact the execution, since column and table…
-
0
votes1
answer56
viewsA: Display BD text in a div considering the HTML tags contained in this text
Change the <%= row.artigo %> for <%- row.artigo %> The difference is that the <%- passes the data exactly as it is, in its "raw" format, without doing any parse or encounter, and as…
-
4
votes3
answers464
viewsA: What is a Guard clause?
Safekeeping clause is a clause that allows you to validate a variable, usually an input, and ensure that it has a value that you can use in the code. It is not a business validation, for example if…
-
0
votes1
answer30
viewsA: Filter an array within another array (Ionic)
In this case, as you need to search an array within an array, you need to do another filter to search in "Equipment", but in this case, you have "some" equipment with the desired codmat, so we can…
-
0
votes2
answers131
viewsA: I am training the basics of Javascript and need help in a To-Do List
The @user140828 answer is right, it fixes code issues and correctly adds/removes items. I would just like to make a suggestion upon his reply, which would be to add the link that removes within the…
-
3
votes1
answer68
viewsA: BETWEEN error day 31
The problem with your query is that quotation marks are missing. No quotes is done a mathematical operation, but this does not make it does not specifically bring the day 31/05/2020, maybe there is…
-
2
votes2
answers55
viewsA: Add several selects
Do a subquery with the 2 selects (you can use union to join them), and then sum from that sum: WITH totais AS( SELECT SUM(ms.valor) as valor FROM risco1.margem_solicitada ms WHERE ms.codigo =…
-
3
votes1
answer123
viewsA: Javascript line breaking is not working
The @Sergio suggestion is perfect, I’m writing this answer just to clarify the behavior of HTML in relation to spaces... What happens is that, in the case of your example, HTML is ignoring breaks…
-
1
votes1
answer25
viewsA: Test for the absence of duplicate tuples
This syntax is used in oracle, to the sql-server use distinct. This subquery can be used with exists, since the distinct is part of the select, then the query would look like this: select distinct…
-
3
votes1
answer50
viewsA: Difference between conventional SELECT and INNER JOIN
This depends on the bank engine. Semantically speaking, the JOIN is clearer, but from the performance point of view you need to see the query execution plan. I set up this table from your example…
-
1
votes2
answers148
viewsA: Immediate sum within input - Javascript
In your case you have two conditions to update the sum: click on the checkbox (when you check/uncheck) or when you change the value (sum if the checkbox is selected). So I thought of a change event,…
-
3
votes2
answers253
viewsA: Is it OK to use a switch inside a for?
There’s nothing wrong with wearing one switch within a for. For his example, he wants to make a conditional validation, if it were not a switch, would need for example to use a if, and in that case…
-
0
votes2
answers36
viewsA: Change the content a Span as the same Class in a table - jQuery
Your code already had everything you needed. See that to change the line style, you used the this with reference, which represented the button, then used parent() to get into the td, another…
-
1
votes1
answer43
viewsA: Is giving this error qdo try to add data in table - 00928. 00000 - "Missing SELECT keyword
Your problem is you’re using ; as a value list separator, and the right thing is to use , (comma). The ; in this case is working as finalizer of the command, so it error saying expect a SELECT…
-
-1
votes1
answer154
viewsA: MYSQL - add column and calculate days late of a date and sort by the longest delay
Responding based on the comment, just use a MAX where calculates the days difference (delay): SELECT SUM(valor) AS total, MAX(DATEDIFF(CURDATE(), vencimento)) as atraso FROM tb_fatura WHERE…
-
4
votes2
answers104
viewsA: Difficulty in interpreting Arrow functions that return Arrow functions in Javascript
Now I understand... I saw this in a course, this resource is called curry or curryng. Basically it’s used when a Function receives more than one parameter and instead of passing all parameters…
-
3
votes1
answer141
viewsA: How to change the button(<button>) from "View password" to an image (<img>)
You can set an image as background of the button, like this: function mostrarSenha() { document.getElementById('senha').type = 'text'; } .btn-senha { background:…
-
1
votes1
answer816
viewsA: Create SQL SERVER database
Just join the two commands, it can be done like this: INSERT INTO NomeDaTabela (cli_id, Cli_TotalCompras) SELECT c.cli_id, SUM(vp.vpr_valorunit) Cli_TotalCompras FROM vendaProduto vp inner join…
-
1
votes1
answer50
viewsA: SQL - Command for general classification
To do this, group the values using group by, to delete the repeated ones, for example: SELECT user_id, server_id, max(user_record) user_record, max(date_record) date_record FROM user_ranking GROUP…
-
1
votes1
answer90
viewsA: How to use . click on jQuery after return from ajax
When we dynamically add elements to the DOM, using the on() from Jquery to map the event. More here in the documentation: https://api.jquery.com/on/ Look at this example: $('body').on('click',…
-
1
votes1
answer62
viewsA: getElementByClassName + classList.add does not work
"getElementByClassName" does not exist, has getElementsByClassName which returns an array of elements, so you need to iterate over these elements, using for or foreach for example. I added an…
javascriptanswered Ricardo Pontual 21,129 -
2
votes1
answer112
viewsA: Mounting ranking with sorting criteria with array
I think the function sort is more practical for this. Basically she does foreach in all elements, passing two by two to compare, where we should: return -1 if the first is smaller return 1 if the…
-
0
votes2
answers120
viewsA: Do not allow the Curl command to download my entire website. Is it possible?
It turns out that the url you tried to access has a redirect, and the curl returned that first response that found, without treating that redirect. Try the correct url, for example: curl…
-
0
votes2
answers55
viewsA: How to remove an array from within another array by filtering those that have the X value in a specific key in Nodejs?
Hey, I don’t think you did your research, because filter and map can do this in a very simple way: var array = [ { "id": 1, "nome":"Jonh Doe", "city":"NY", "status":"Single" }, { "id": 2,…
-
2
votes1
answer43
viewsA: Visible index or not?
This setting makes the index "invisible" to the query optimizer, in other words, when running a query, this index will be ignored by the optimizer when trying to mount the best plan to run the…
mysqlanswered Ricardo Pontual 21,129 -
2
votes1
answer56
viewsA: What "status code" to use when there is no data in the body of a POST request?
If you made a request that is not valid, the answer is from group 4xx. It could be a 400 "Bad request", or "Invalid request". More details of the 4xx errors can be seen here:…
http-statusanswered Ricardo Pontual 21,129 -
1
votes1
answer52
viewsA: What event says that a radio button has been deselected within a radio input group?
You can use for this an event that happens before the change, which is the mousedown: $('[name="teste"]').on('mousedown keydown', (e) => { console.log("evento mousedown/keydown, valor atual: " +…
-
7
votes1
answer328
viewsA: What is the difference between using appendchild and insertAdjacentHTML?
appendChild inserts a html element to the gift, at the end of the list of children, so you need to create an element: let aBlock = document.createElement('block').appendChild(…
-
2
votes1
answer29
viewsA: Javascript onchange does not work for Combox
Use the Binder .change jQuery that works perfectly, although they do the same thing as your code according to the documentation: As the . change() method is just a shorthand for . on( "change",…
-
0
votes2
answers865
viewsA: Calculate total amount and total SQL Server value with three tables
This happens because the GROUP BY groups the equal fields, and in your case the totals are not. When we use stapling functions ( SUM, COUNT, etc), these do not need to be in the GROUP BY, only the…
-
1
votes1
answer41
viewsA: Create mysql user in Trigger
Cannot execute some commands like CREATE USER inside a Rigger house. Here is a list (in English) of some restrictions: stored-program-Restrictions.html To create a new user you will need to insert…
-
6
votes1
answer263
viewsA: What is the logical port of the user in PHP?
Physical ports are the physical connections of devices, such as a RJ-45 connector from a router or modem. Logic ports are gates of logical connections identified by a number, which serve to connect…
-
-1
votes1
answer22
viewsA: Convert query to RAW query
Use the method toSql(): https://laravel.com/api/5.7/Illuminate/Database/Query/Builder.html#method_toSql It is a method of Query Builder, you can use it like this: $user.ToSql();…
-
5
votes4
answers1037
viewsA: What is reverse proxy?
First it is interesting to understand the concept of Proxy. The Proxy is a layer (middleware, server, any implementation that creates that layer) between two points. This is a broader concept, can…
terminologyanswered Ricardo Pontual 21,129 -
0
votes3
answers99
viewsA: List with Jquery, second JSON index
As I commented, ocorridos is an array, so you need to access each element of the array in order to list its contents. The same thing for oque which is also an array. You can do this for example…
-
7
votes2
answers138
viewsQ: What is the Enumerable Zip in . NET?
I was making a code to combine two lists, and looking to improve discovered the method Zip of the interface IEnumerable. At first I thought it was some algorithm to "zip" a list/array/etc., but I…
-
9
votes3
answers1553
viewsA: Return the index of the largest element in an array
Your code has several problems: in the for to know the size of the array you need to use array.length: you need to start the larger variable just before starting the for; you need to see if the…
-
1
votes3
answers50
viewsA: Error while uploading files
"or insert into the database or store the pdf file in the specified folder" Yes, because of the die it for processing and does not insert. This validation can be simpler, so try instead…
-
3
votes1
answer133
viewsA: Convert string to Datetime with . Parseexact()
The hour format for 24h is "HH", capitalized, using this will work: DateTime inicio = DateTime.ParseExact(Console.ReadLine(), "dd/MM/yyyy HH:mm", CultureInfo.InvariantCulture); The "hh" format is…
-
0
votes2
answers42
viewsA: insert value into a Json data request
Access as an index: var x = { "id1": { "nome": "João", "sobrenome": "Medeiros" }, "id2":{ "nome": "Mário", "sobrenome": "Freitas" }, "id3":{ "nome": "Joana", "sobrenome": "Cunha" } }; var num=1…
-
0
votes1
answer815
viewsA: How to make a POST with "Multipart/form-data" using C# in Console applications?
I tidied up your code, look how it turned out: using (var client = new HttpClient()) { var fileContent = new ByteArrayContent(File.ReadAllBytes(path)); using (var content = new…
-
1
votes1
answer65
viewsA: Select items and sort objects list
Having the data you want, in your case the repositories list, you can use the sort() to order, and the slice() to take only the first 3 items of the array. Take this example: var lista = […