Posts by Ricardo Pontual • 21,129 points
751 posts
-
0
votes1
answer28
viewsA: Help with Foreign Key, Mysql - Xampp
Question 1: As the error shows, he was denied access. This may be because the user who is logged in does not have permission in the table "product information", need to confirm. To see permissions,…
mysqlanswered Ricardo Pontual 21,129 -
1
votes1
answer25
viewsA: Sum of values according to value of another column
"make a sum of the quantity according to the units" To do this, use the quantity sum function, and group by unit: SELECT unidade, SUM(quantidade) FROM nome-da-tabela GROUP BY unidade "make a sum of…
-
2
votes1
answer44
viewsA: Javascript, why only Document has the getElementById() method?
"querySelector() that can be called in any element of the DOM tree, but with a huge limitation: IT DOES NOT ALLOW CHANGING THE ELEMENTS." Based on what you’re saying? querySelector applies a…
-
1
votes1
answer191
viewsA: ORA-00904: Invalid identifier, I am creating a table but this error appears, could anyone help me?
Your query has two errors, I will comment here: CREATE TABLE CARRO( ID_CARRO VARCHAR(20), MODELO VARCHAR2(10), COR VARCHAR2(10), PLACA VARCHAR2(10), ID_MARCA INT, <-- Falta esse campo, usado…
-
0
votes1
answer35
viewsA: Create a Trigger with JOIN to duplicate the data
Let’s take parts. Basically your query would look like this: SELECT wp_postmeta.post_id, wp_posts.post_title FROM wp_postmeta INNER JOIN wp_posts on wp_posts.id = wp_postmeta.post_id The problem is…
-
0
votes2
answers57
viewsA: How to make two queries using the same Mysqlconnection?
You do not need to use other Connections, just use the same, what you need is to change the command or create another, and here there is no problem, because each Command is a different operation:…
-
2
votes1
answer21
viewsA: SQL Index Unico
Your ID field should be IDENTITY. Each time an operation will be done, the "seed" that generates the next value, provides a value before performing the operation, after all, needs to have it to do…
-
2
votes1
answer59
viewsA: Convert a Double with more than 13 decimal places to String without losing values
It is rounding to an accuracy of 15 digits, which is the standard of ToString() for this type, according to the link below. But the ToString() allows you to pass formatting parameters such as…
-
0
votes1
answer19
viewsA: Fix size of specific columns
Can add to TD the overflow-x: auto; to add the scroll bar. However, if the content is greater than the widht will break the line, to avoid this, add white-space: nowrap; Finally, you can still move…
-
2
votes5
answers120
viewsA: Merging an array with an object array
Due to the numerous comments, to try to explain better I will write an answer, if you find that help is here, otherwise we can remove. I’ll take for example the answer code of @Augustovasques: let…
-
1
votes1
answer31
viewsA: How to change pagination using specified keyboard keys using javascript
Use the "keydown" event. Press the key and see if it was the desired key: // associo o evento keydown document.addEventListener('keydown', function (event) { // se for a tecla <, "clica" o…
-
0
votes1
answer63
viewsA: C# - Datagridview error occurs when column cell is empty
Need to validate if the value is null before adding, mainly because it is converting, which generates a Exception by being null. You can for example put a if before adding up: if…
c#answered Ricardo Pontual 21,129 -
2
votes1
answer120
viewsA: Error connecting to SQL Server using pyodbc
Use string without spaces, and also confirm that you have the driver installed: pyodbc.connect('DRIVER={SQL Native Client};SERVER=DESKTOP-3TFNKAR;DATABASE=Aula1;Trusted_connection=yes'); For a…
-
2
votes1
answer52
viewsA: Why can’t I instantiate a class from Linq
The message already describes the problem: 'Memberexpression' does not contain a constructor that takes 0 Arguments That is, there is no constructor with 0 arguments If you look at the source code…
-
0
votes2
answers201
viewsA: Function to check if one number is divisible by another
I will post here some comments on your code: // aqui não está usando "x" e também não está passando esse valor , então pode remover function solucao(numero) { // <- sem o "x" const resto = numero…
javascriptanswered Ricardo Pontual 21,129 -
1
votes1
answer36
viewsA: Count checked checkboxes and perform operation
You can simply count using a selector that selects checkbox type input that is "checked", like this: document.querySelectorAll('input[type="checkbox"]:checked').length It turns out that in your case…
-
4
votes1
answer166
viewsQ: What is globalThis in Javascript?
I was looking at an example of code and I came across an example that had globalThis: // timeout de 1s globalThis.setTimeout(() => alert('Olá'), 1000); The setTimeout no secrets, but had not yet…
-
1
votes1
answer44
viewsA: How to ignore capital letters in a comparison structure
Convert everything to lower or upper case before comparing, for example: If LCase(ActiveSheet.Cells(y, z).Value) = LCase("laranja") .... Another way and add to the beginning of the code the…
vbaanswered Ricardo Pontual 21,129 -
4
votes2
answers53
viewsA: How I take information from within an Array from the index
You can get this by using a combination of filter, to filter array elements with some, to check if index is in the expected index list: var indexes = [ 0, 2 ] // posição das informações na Array var…
-
2
votes1
answer92
viewsA: What is the right way or how to close persistent PDO connections in PHP?
Answering your question, according to the documentation here: https://www.php.net/manual/en/pdo.connections.php Persistent Connections are not closed at the end of the script, but are cached and…
-
1
votes1
answer20
viewsA: Separate database tables to obtain values separately
You don’t need another table, just do a query for it, grouping by year. In your question does not state which bank, to demonstrate we assume that it is mysql, query would look like this: select…
sqlanswered Ricardo Pontual 21,129 -
2
votes2
answers38
viewsA: Difficulty in calling Xmlhttprequest with pure Javascript
To complement the @Piovezan response, I’ll put together a simple example demonstrating the program flow when you have one callback or Promise. This piece of script writes on the console the points…
-
0
votes2
answers25
viewsA: Receiving data from a Table on a php page
To explain further, I will put an example: HTML: <form id="formImprimir" action='imprimirtabela.php'> ... aqui tudo que precisa ser enviado ... e esse input que vai conter o array de objetos…
-
0
votes1
answer19
viewsA: How to delete xml file with c#?
Use the File.Delete Delete() System.IO.File.Delete(@"C:\Users\Felipe\source\repos\teste\teste\conexões\" + cmbConex.Text + ".xml"); It usually validates if the file exists to avoid an error, but in…
-
2
votes1
answer121
viewsA: What is the difference between codec, file format and extension?
Let’s take an example: "image.jpg" File format: is how the data is stored in the file. In this case it is an image, which was "compressed" with JPG/JPEG compression. In many file types other than…
-
0
votes1
answer43
viewsA: I want to do Play/Pause with images as if it were with Hover
In a very simple way you can do so by hiding/displaying by clicking: function playStream(){ stream.play(); document.getElementById('play').style.display == "none";…
-
0
votes1
answer17
viewsA: How to recover values using sortable! of a li’s date and the current position of the
You can read the sequence of the elements LI and for a input and read this on php. You can do this before doing Submit, or each time you sort, but idea and pass for example the sequence…
-
2
votes1
answer36
viewsA: I made a square that moves everywhere and I’d like to set some boundaries to where you can walk
As I said, in each function before changing the position value just validate with the limit values: var topo=50; var esq = 200; function cima(){ if (topo < 0) return; topo -= 5;…
-
0
votes2
answers37
viewsA: Entity Framework -> How to find the largest table elements
As I don’t have the classes here can not validate 100%, but by the name of the properties, would be something like this, grouping Productstatus, and sectioning with Max: var data = _context.Produto…
-
1
votes1
answer66
viewsA: Change DIV color when clicked on condition (JS)
It would be easier to put that style in a class, and use the toggle to add/remove the class: // use a classe "trocacor" para pegar todos os divs de uma vez e reaproveitar o código…
-
6
votes3
answers90
viewsA: Group array of emails by domain of each email in Javascript
If I were just to group I could use one reduce but since you need to generate an object with a new structure, I thought I’d go through the items and add to a new element, grouping by domain: var…
-
2
votes2
answers49
viewsA: Result of the same account is different in VB and C#
Clearly the codes are different, so the result is expected to be different too. Note that the Sts are done differently, but if you do the code in a similar way the results are the same: C#: double x…
-
1
votes1
answer26
viewsA: Ways to implement day "opening" to release data entry
First I will answer the question, then I address the comment, which is a little different from what is in the question. The modeling could be for example like this: CREATE TABLE dados_fechamento( id…
-
0
votes2
answers196
viewsA: onClick error in Nextjs / React js
Looking at your code, it has several unnecessary spaces, I do not know if it is like this or was pasting in the question, but, besides, to pass the event as parameter, you must declare so: (e).…
-
1
votes1
answer38
viewsA: Insert a checkbox within a Jquery Javascript button
In that case, you need to treat the event mousedown input and cancel the event using stopPropagation() $("li").mousedown(function() { // faz log de uma mensagem para demonstrar console.log(…
-
1
votes1
answer35
viewsA: Why does this simple php code not work ? - echo ("$var1 + $var2 = {$var2+$var1} <br>");
This interplation with {} does not work like this in the php, if you want to do the operation do out of it and out of quotes, like this: $var1 = 1; $var2 = 2; echo ("$var1 + $var2 = " .…
phpanswered Ricardo Pontual 21,129 -
2
votes3
answers85
viewsA: RGBA / RGB color syntax in CSS
There are several syntaxes for the RGB/RGBA as shown color value documentation: * Hexadecimal syntax */ #3a30 /* 0% opaque green */ #3A3F /* full opaque green */ #33aa3300 /* 0% opaque green */…
-
0
votes1
answer104
viewsA: Script for a particular SQL library
Now seeing the whole script I could see the problem, which is here: CREATE TABLE LIVRO( ID SERIAL PRIMARY KEY, NOME VARCHAR (50) NOT NULL, FOREIGN KEY (ID_CATEGORIA) REFERENCES CATEGORIA(ID), <-…
-
0
votes1
answer65
viewsA: Change the number of decimals in the table structure (SQL SERVER)
You can use the command ALTER TABLE ALTER TABLE NomeDaTabela ALTER COLUMN NomeDaColuna decimal(16,3); See what I used here (16,3), because it already had (15,2), that is, it had "15 digits, being 2…
sqlanswered Ricardo Pontual 21,129 -
0
votes1
answer99
viewsA: MYSQL - TRANSACTIONS
Let’s go in pieces: "I put to error in the second line purposely" , this will cause you to miss only that line, up to that point. "but still inserts it into the personal table2, because?" because…
-
4
votes1
answer162
viewsA: Javascript pass more than one parameter through the fetch
You can create an object with the values and pass in body, so for example: var dados = { id: 1234, nome: "Teste", tipo: "pagamento" }; fetch('dados.php', { method: 'POST', body:…
-
5
votes5
answers287
viewsA: How to go through an array of objects, add specific properties and unify those objects where it has a specific property equal to another?
One can use the method reduce() to iterate on each element of the array, remove duplicates and add. For example: listaProdutos = [ {nome:'Teclado',preco:28.00}, {nome:'Mouse',preco:36.00},…
javascriptanswered Ricardo Pontual 21,129 -
1
votes2
answers68
viewsA: How to use XML inside a String variable
I could search inside the string, but it is not the best way, if the string is a valid XML document, better convert to an XML Document and search the value inside the tag using getElementsByTagName.…
-
3
votes1
answer53
viewsA: Are there abstract classes in Python?
Yes you have, following the documentation here from ABC need to import ABC to create an abstract class: from abc import ABC class ClasseAbstrata(ABC): @abstractmethod def abstract_method(self) In…
-
0
votes1
answer25
viewsA: Use different Background Images in HTML+CSS
To do this you can use Media Queries, that allow you to apply a style according to some media selectors, in your case, the resolution size, which will differentiate you from desktop/mobile, for…
-
2
votes1
answer66
viewsA: Add one more ID when generating one more INPUT via javascript
No need to declare this variable i = 1 and then incrementing, you can get this value always updated in the click using for example this selector: var i = $("#idDiv > div").length; i.e., the Ivs…
-
1
votes1
answer50
viewsA: POO doubt object
If you create an instance of a class, then the variable is a reference to the object in memory. If you delete (here I will see, set `null* to a reference, that object can no longer be accessed in…
-
1
votes1
answer103
viewsA: How does it work and how is a payment system added to the site?
"It is some kind of API of a bank or a company that is added on the site?" Yes is what is usually done, some examples are "Pagseguro", "Mercadopago" and "Paypal". Or to be more precise I could…
online-paymentanswered Ricardo Pontual 21,129 -
2
votes2
answers36
viewsA: Relationship between Similar Tables
Tab_image with the fields (ID, Data, ETC..., fk_client, fk_company) Only that way, every line would have a primary key from the user that inserted, but only one of them will do this and not both...…
-
0
votes1
answer28
viewsA: Logica de incrementar posição com php para o html
Do not use position: absolute this makes the elements overlap, would need to manually define the position of each one, which in addition to bad is harder when you do not know how many items have,…