Posts by Ricardo Pontual • 21,129 points
751 posts
-
3
votes1
answer41
viewsA: I wanted to understand the exit of this code
The size of the array needs to be set at compile time (when compiling), cannot be done in Runtime (i.e., when running), so it works in the first example, where it is already previously set to 2. It…
canswered Ricardo Pontual 21,129 -
2
votes1
answer34
viewsA: List table values randomly with RAND() or ARRAY for a Captcha
Basically you need two darlings: one with the desired word; other without the desired plavra limits to 3 (or more) Then just sort the result randomly: (SELECT id, palavra FROM captcha WHERE id IN…
-
0
votes2
answers33
viewsA: How to search multiple columns together with max() SQL (Mysql)
Another opium, if you’re using mysql version 8+, is to use ROW_NUMBER() OVER, to generate an "order" number for each history, based on the id_protocol: WITH UltimoHistorico AS ( SELECT h.*,…
-
5
votes3
answers102
viewsA: My variables are not being counted in the code
This is because of else if. The else is only assessed when a "contrary" condition occurs to the if. Imagine you typed 1, the first if is: if (numeros != 0) { - this condition is true, soon will…
-
1
votes1
answer63
viewsA: Select the last months, also showing the months without records
As suggested in the comment by @Sorack, you need to generate a sequence of dates and do LEFT JOIN (or RIGHT JOIN depending on which side are the generated dates) with sales chart. I use an example…
-
3
votes2
answers100
viewsA: What does "ad-hoc" mean in the context of computing?
Taking advantage of the link that @Bacco commented: https://dicionario.priberam.org/ad%20hoc (latin speech which means "for this") which is intended to an end specific. I’ve heard that term often…
terminologyanswered Ricardo Pontual 21,129 -
5
votes2
answers217
viewsA: What is the Mint language?
As quoted in the question and the official link to Mint: The Programming language for writing single page Applications In free translation: The programming language for writing SPA applications…
-
-1
votes1
answer39
viewsA: (Language C) I’m not really able to compare if between two chars
To compare char array, use the Function strcmp, available on string.h. You can even make a more "secure" token using a small word for example: char token[] = "senha"; char valor[10]; ....…
-
2
votes2
answers77
viewsA: Group a conversion list within SELECT
Taking advantage of @Sorak’s reply here: how-to-concatenate-lines You need to concatenate the multiple rows of the table Tb_productoconversao and add that to your SELECT. This can be done with JOIN,…
-
0
votes1
answer24
viewsA: How to insert an object just after the iteration element in the javascript’s for of
You can use the findIndex to find the desired index, then clone and add at the following position using splice: let data = [{id: 1}, {id: 2}, {id: 3}]; let idProcurado = 2; // encontra o índice…
javascriptanswered Ricardo Pontual 21,129 -
0
votes2
answers106
viewsA: Maskmoney does not work on duplicate input via javascript
When creating a new element, it is necessary to associate the events, and the maskMoney also, so after cloning and adding the DOM, just use to do this. In the example below, I put the association of…
-
0
votes1
answer35
viewsA: fadeOut CSS does not add up
To set how to start or end the effect of fade, can use the attribute Animation-Fill-mode How do you want the effect to be permanent, IE, when finishing keep as it was the last frame of animation,…
cssanswered Ricardo Pontual 21,129 -
2
votes2
answers68
viewsA: Add values inside XML tags with C#
A simpler way is to use the class XDocument, which allows you to use Linq in the xml, which makes operations much simpler. Documentation: system.xml.Linq.xdocument You can do this for example: var…
-
0
votes2
answers38
viewsA: How to align 4 Divs with image
To help with training, we can include all Divs in another div (let’s call it "container") with the display: flex. To understand more the display: flex, I suggest reading that other question: Grid…
-
2
votes2
answers74
viewsA: How to reduce the amount of If’s in a simultaneous redirect?
As what changes in the URL are only the parameters of querystring, in your "quiz" example, you can extract the parameters and take the value of "quiz" and add 1, which is basically what it does in…
javascriptanswered Ricardo Pontual 21,129 -
1
votes1
answer27
viewsA: How to apply a style to the html of a text selected from a textarea field?
The element textarea is used for text, not content html. The HTML element represents a multi-line Plain-text Editing control, Useful when you want to allow users to enter a sizeable amount of…
-
1
votes1
answer23
viewsA: Chart.js does not appear in html
There are two errors in the code: must use new Chart and not new chart, see the documentation: https://www.chartjs.org/docs/latest/getting-started/ the parameters are badly formatted, a comma is…
-
0
votes3
answers27
viewsA: INNER JOIN between two SELECT
Yes it is possible to do JOIN with a SELECT, in that case each SELECT will be a subquery. For this, include the SELECT in parentheses and give him a alias (name), something like that: SELECT A.*…
-
0
votes1
answer30
viewsA: Ajax running before fileReader sequence is grounded
The problem with your code is in this construction: converte() $.ajax({ .... When calling the method converte in turn, there’s this code: reader.onload = () => {…
-
0
votes1
answer100
viewsA: How to take the last sale of each customer
To do this you can break it into two queries. The first will return the n_note of the latest date grouped by client: SELECT MAX(n_nota) n_nota FROM nota_fiscal nf1 GROUP BY codigocliente Then just…
-
1
votes2
answers44
viewsA: C# - Adding indices from an array and filtering for common results
The hardest part is to separate each digit, for example 56 to add up 5 + 6. One way to do this is to convert to string, ai it is possible to treat each digit separately, to avoid doing mathematical…
-
0
votes1
answer39
viewsA: Group Data from a SELECT using the DATE parameter
Could group in the PHP or in the javascript. In the javascript could group using Reduce. "Date : 2021-03-17 Coordinates : -23.550829,-46.2008791/-23.5507955,-46.2008757/-23.5582206,-46.1995978" this…
-
1
votes1
answer24
viewsA: How to get the Keys values of a Keyvaluepair c#object?
It is possible to navigate the Keys, and one option is to use a Dictionary. Taking advantage of this, if the structure is always the same in the values (text, Response), you can create a class with…
-
0
votes2
answers49
viewsA: C# How to get combobox value?
That result System.Data.DataRowView means that, the property SelectedItem returned to you the selected object, which was set in the DataSource as you mentioned. To catch a value on this object you…
-
0
votes1
answer30
viewsA: Return field different from the one inserted in the GROUP BY clause
The query was "almost ready", missed using the WHERE to return only records with device='active' and in the HAVING count more than 2 occurrences, but this would not return the 2, 12 and 14, would…
-
0
votes1
answer45
viewsA: SQL Server select in a table returned by INFORMATION_ESCHEMA
Your script has an error when assigning the value to the variable @TABELA, lack the SELECT, and if you want the first record, you could use TOP: SELECT @TABELA = (SELECT TOP 1 TABLE_NAME FROM…
-
0
votes1
answer24
viewsA: Select case with subselect and Join
It is possible to subquery the case when. In your case as only one case could simply make a Join: SELECT m.arquivoordemmov, m.contadoragentemov, m.datamov, m.seqordemmov, m.seqproduto,…
-
1
votes1
answer44
viewsA: How to display "load" message while Webview is loading?
I think a good solution here would be to use the compontente Activityindicator It is a native component that can be customized, will be displayed in place of the component while it is loader, and…
-
2
votes1
answer35
viewsA: Group by records by date and user id
Your query has a problem: When doing the group per month/year only, will have the variation by id_user, so will not group that 3 as 1. IE, for the same month/year, will bring more than one. Grouping…
-
8
votes1
answer93
viewsQ: C# init equals private set?
I was reading about the new implementations on C# 9 and came across the init, init-only-setters: Starting with C# 9.0, you can create init accessors Instead of set accessors for properties and…
c#asked Ricardo Pontual 21,129 -
0
votes1
answer21
viewsA: Condition access to the next form through inputbox
You can put this code inside a loop While and only allow you to exit by typing the correct value, and using the UCase case ignores uppercase/lowercase: Dim input As String ' Loop infinito While True…
vb.netanswered Ricardo Pontual 21,129 -
0
votes1
answer47
viewsA: How to register a foreign key that is on another screen in php?
The ID generated by the last query, if it is AUTO_INCREMENT, is returned by mysqli_insert_id, thus: mysqli_query($conexao, $inserir) $id = mysqli_insert_id($conexao); Another way, if using the…
-
1
votes2
answers40
viewsA: Select in two tables with Count
Your query is almost right, the problem in it is, both tables have a column called "name", and this will give ambiguous reference, you need to prefix which table is using the column: SELECT…
-
1
votes1
answer49
viewsA: Download with Httpwebclient only works outside of Parallel.Foreach
The objective of Parallel.ForEach is to parallelize Tasks but not with async/await, where you hope to return a Task and hope that it is completed. The Parallel.ForEach shall work well with another…
c#answered Ricardo Pontual 21,129 -
4
votes2
answers156
viewsA: What are the principles of the dependency injection mechanism?
What would be an addiction and an injection? I think that’s the first question to support the theme. Dependency is any code (class, library, method, etc.) that another code needs to do use task, or…
-
1
votes1
answer61
viewsA: How do I make a char vector recognize a line break?
The line break is a character of "escape", are characters of type "ENTER" or "TAB". In the case of line break is the " n", and can be compared like this == "\n", but some characters are not possible…
c++answered Ricardo Pontual 21,129 -
3
votes1
answer38
viewsA: Return maximum table value in JOIN - MYSQL
Your query was almost ok. Note that to make the query work you need two criteria in Join: servicos.id_servico = situacao.id_servico: first Join, who connects the tables situacao.id_situacao =…
-
3
votes2
answers450
viewsA: What is Aggregate in Mongodb?
The concepts of aggregation (among other modeling concepts) have in the link @Maniero already commented: What is the difference between Association, Aggregation and Composition in OOP? The…
-
1
votes1
answer37
viewsA: Run time difference - Postgresql
Use the Function DATE_PART, to pick up the part of the date you want (days, hours, etc) and the Function AGE which returns the interval between dates. Taking your example: SELECT EXTRACT(DAYS FROM…
postgresqlanswered Ricardo Pontual 21,129 -
0
votes1
answer64
viewsA: if - Else if condition being ignored by browser
The if / else if certainly will not enter at all, because the conditions are different, and the variable name is not changed in the process, but your code can be improved to become simpler, of…
-
0
votes1
answer59
viewsA: How to set hostname in publication Asp net core 3.1 selfHosted
You can even do the Binding of a dns host name for its application, for example: var host = new WebHostBuilder() .UseKestrel() .UseUrls("http://dev.nossosite.com.br:80", "http://localhost:80")…
-
1
votes2
answers44
viewsA: Download Async Task C#
The method DownloadDataTaskAsync belongs to the class System.Net.WebClient: https://docs.microsoft.com/en-us/dotnet/api/system.net.webclient.downloaddatataskasync?view=net-5.0 You need to use this…
c#answered Ricardo Pontual 21,129 -
0
votes1
answer23
viewsA: INSERT using SEQUENCE . NEXTVAL with another SELECT
You can use Quence on select include the "ID" in the insert: INSERT INTO CONF_CODE (ID, OPTION_NAME, ISCHECKED) SELECT SOMEDASEQUENCE.NEXTVAL, DISPLAY_NAME, 0 FROM CONF_LABEL_LOCAL WHERE "TYPE" = 2…
-
1
votes1
answer21
viewsA: Capture key pressed using name instead of numbers
Using codes is the best option, because, how would the description be? I would need to do this for each language, etc. But to help, there is one emum associated with Keyvalues, that helped to make…
c#answered Ricardo Pontual 21,129 -
1
votes1
answer54
viewsA: Why isn’t my web site being created/rendered?
The problem is very simple: you are not applying the style :) Note that in css, you used the "button" selector, but the element is created/rendered using the "my-button" tag, so the selector must…
-
1
votes1
answer30
viewsA: My Sql, query with two different parameters for the same column to bring two different results
Yes it is possible to do this. Note that each count must have a criterion, which is "ROOM < 50", etc. To do this, you can user inside the COUNT one CASE WHEN to validate the footage for each…
-
-1
votes1
answer32
viewsA: What is the best way to store user registration date in the mysql database ? should I use now()? unix_timestamp()?
It is necessary to better understand the types and their characteristics to be able to answer this: DATA TYPE: now() returns a type DATETIME; unix_timestamp() a guy INT; SIZE: DATETIME by default…
mysqlanswered Ricardo Pontual 21,129 -
0
votes3
answers42
viewsA: How to count records in more than one table?
Just looking at her SELECT and what he tried to do in WHERE, which was supposed to be the JOIN between the tables, I can suggest this SELECT: SELECT COUNT(client.idClient) AS clientQuantity,…
-
1
votes1
answer43
viewsA: Doubt about CONCAT SQL
Can make a CASE ... WHEN to compare when the fields are equal does the CONCAT, otherwise returns only the field: SELECT CASE WHEN Equipe <> Motor THEN Concat(Equipe,' - ', Motor) ELSE Equipe…
-
2
votes1
answer43
viewsA: Javascript function to mark checkbox depending on condition
In your example you are using jQuery with an ID selector ($('#checkbox')), then you don’t need to use a each, because it will return an element only. Also, use prop('checked', true); to set checked…