Posts by Jean Gustavo Prates • 3,067 points
71 posts
-
4
votes2
answers154
viewsA: Why . all in an empty list returns true?
Explanation According to the documentation if the sequence is empty, value will be returned true. Value Returned Type: System.Boolean true if all elements of the source sequence pass the test in the…
-
3
votes2
answers397
viewsA: Jquery.get() asynchronous or synchronous?
Explanation Yes, the method $.get is asynchronous, it is an abbreviated form of the code below. $.ajax({ url: url, data: data, success: success, dataType: dataType }); According to the method…
-
5
votes2
answers101
viewsA: How to create events in C#?
Explanation There is a type of Collection in C# that notifies changes made to the list through events, the Observablecollection. With it, you can assign a method to the event CollectionChanged to…
-
1
votes1
answer777
viewsA: Post method is not running on Postman
Explanation You’ve assigned a route to Controller but did not assign to the Action, in this case, the Conventional Routing. In this type of routing, by default, the name of the Action for the…
-
2
votes2
answers250
viewsA: How to sort and list only 5 items from a list?
Explanation The problem of your code that does not sort as expected is in the section below: dashboard.NotasFiscais.Take(5).OrderByDescending(x => x.ValorTotalNota); We can see that before…
-
1
votes1
answer569
viewsA: Error: Must declare the scalar variable
Explanation The value of the property Hospital of the anonymous object used in the command parameter does not match the one specified in SQL. Change the declaration line from the list variable to…
-
0
votes1
answer31
viewsA: Unknownnode when loading XML in class
Your XML mapping is incorrect. In order for the code to work as expected, you need to use a wrapper that encapsulates the list. Classes [XmlRoot(ElementName="header")] public class Header {…
-
1
votes1
answer51
viewsA: SQL query without repeated element
The behavior of your query is correct. It is likely that Id of your table does not repeat, so returns the data without grouping even with Distinct. To return the results in a grouped form, use the…
sqlanswered Jean Gustavo Prates 3,067 -
5
votes2
answers675
viewsA: How to organize an Array in Date order?
You can use Linq to convert the list of strings to a list of dates and sort them. Example var orderedDates = datas.OrderBy(x => DateTime.ParseExact(x,"dd/MM/yyyy", CultureInfo.InvariantCulture));…
-
9
votes2
answers995
viewsA: Lazy Loading EF Core, upload daughter entities and daughters?
To include several related data levels, use the method ThenInclude(). Examples Entity Framework - Dados Relacionados var example = context.Parent .Include(x => x.Child) .ThenInclude(g =>…
-
1
votes1
answer327
viewsA: How to clear a @Html.Textboxfor using Javascript?
To use the method Ajax.BeginForm() it is necessary that the plugin Microsof jQuery Unobtrusive Ajax be referenced in your project/file (available on Nuget). With the plugin referenced and the route…
-
4
votes2
answers459
viewsA: Ternary Operator C#
Yes, it is possible. var ternaryResult = (false ? "First Result" : false ? "Second Result" : "Last Result"); See working on Dotnetfiddle. For more information on the operation of the operator ?:,…
c#answered Jean Gustavo Prates 3,067 -
1
votes2
answers287
viewsA: Filter a list of spans with jquery
Use the implementation below to get the expected result. $("#inputGroupSelect01").on("change", function(){ filtrarLista(this); }); function filtrarLista(element){ var $element = $(element); var…
-
-1
votes2
answers162
viewsA: Previous dates
To select customers registered in the previous month your code will be next to the examples below: Entity Framework db.Usuarios.Where(x => x.DataCriacao.Month ==…
-
1
votes1
answer48
viewsA: Page count
You can use the attribute Date HTML5 to store the contents of your page array. Here is an example of the implementation. var arrMenuInterno = [ { titulo: "Introdução", telas: [ {arquivo:…
-
5
votes2
answers489
viewsA: ASP.NET Core Isdevelopment
To work with different environments in . NET Core you need to name the environment in the variable ASPNETCORE_ENVIRONMENT Command Prompt set ASPNETCORE_ENVIRONMENT=Development Powershell…
-
0
votes1
answer95
viewsA: How to block scrollbar when browsing a desktop device?
You can use media-queries to remove the scrollbar. In the example below, we filter the media type screen and the width min-width to characterize a Desktop. This allows us to remove the scroll…
cssanswered Jean Gustavo Prates 3,067 -
1
votes1
answer141
viewsA: Error when selecting part of a string in the select of an entity using Entity Framework and Linq
You can use Padright to fill in spaces. var lista = _projetoAppServ.ObterTodos("Descricao") .Select( a => new { ProjetoId= a.ProjetoId, Descricao = a.Descricao.PadRight(50, ' ').Substring(0,50)…
-
0
votes2
answers47
viewsA: I can’t email my Webapi
To avoid this scenario, include a bar at the end of the route. This implementation will delimit the parameter email between the two bars and will not consider it as part of the.…
asp.net-web-apianswered Jean Gustavo Prates 3,067 -
1
votes1
answer26
viewsA: Selecting all page elements?
To select all elements of an HTML page, use querySelectorAll, through CSS or getelementsbytagname selectors, through the symbol * to select all nodes. See the implementations below:…
-
6
votes2
answers554
viewsA: How to create a Function and call your methods without using new, similar to jQuery’s $ ?
You can store a function in a variable and use it to perform internal functions through an object, this algorithm implements Javascript Module Pattern. var $fn = function() { return { alertar:…
-
2
votes1
answer962
viewsA: How to create an array of data from an html table?
You can create a function to check and assign the table data to an object and then include it in a list. In the code below, I created a function tableToJSON which receives as a parameter the seletor…
-
1
votes2
answers77
viewsA: distinct use in a dropdownlist
Use the following code to get the expected result: ViewBag.Compra = Lista() .Select(x => new {Id = x.NomeId, NomeProduto = x.NomeProduto}) .Distinct();…
-
1
votes2
answers57
viewsA: How to draw dots between an image and another with HTML5 and CSS3?
Another way to implement is to use the element hr vertically across a class. .container { text-align: center; } .vertical-dotted-hr { margin-top: 20px; margin-bottom: 20px; width: 100px; transform:…
-
4
votes4
answers554
viewsA: Correct CSS Div > li > span
The symbol > in a CSS selector ensures that the next element will be a immediate son, and, in your case, the immediate child is the ul. To get the expected result, use the following selector:…
cssanswered Jean Gustavo Prates 3,067 -
2
votes3
answers52
viewsA: Multiple foreign keys in a single query
Muril, Use the query below to get the expected result. SELECT C.NOME_CARTA, E.NOME_EDICAO, E.SERIAL, T.TIPO, C.EFEITO_DESC, C.ATK, C.DEF, C.LINK_IMG, A.ATRIBUTO, C.ID_LRL, C.QUANTIDADE FROM CARTAS C…
-
2
votes1
answer100
viewsA: SQL query is not grouping
Renan, From what I understand, you want to group from the LEFT. Use the query below. select left(P.ProjDesc,6), COUNT(P.ProjID) from Projetos P where P.ProjStatus <> 9 group by…
-
2
votes1
answer1112
viewsA: How to get date without Datetime time?
Matheus, Use the code below to get the date without the time. @Model.Data.ToString("dd/MM/yyyy") Hug,
-
0
votes2
answers71
viewsA: Problems in an SQL query
Elliott, The error occurs because you are trying to access data from an external query within a sub-select. To fix the error, you must remove the fto.id_taxon of Sum() in the Sub Select. I see that…
-
2
votes2
answers503
viewsA: Search in text file and compare with others
You can use the method Except. In the code below, the variable resultado store records that are not present in the list _fixo. If you want the result to be the records that exist in common in the…
c#answered Jean Gustavo Prates 3,067 -
2
votes1
answer54
viewsQ: POST on Azure Webapi generating Timeout
I have a Webapi hosted on Azure, but when there are many POST requests, Azure returns timeout (the first two only works on average). Someone’s been through this trouble before?…
-
1
votes2
answers229
viewsA: Mysql Query - Count separate table fields
Explanation You can develop your query by making a subquery a field. Use the example below as the basis. Example CREATE VIEW `dashboards` AS ( SELECT ( select count(`clientes`.`id`) from `clientes`)…
-
7
votes5
answers1552
viewsA: Restriction of words in comments
You can use the function strpos, which returns the position of a given string within another. In your case, you can create an array with swear words and scroll through this array to see if it exists…
phpanswered Jean Gustavo Prates 3,067 -
8
votes1
answer173
viewsQ: Addorupdate - use array as parameter
I’m doing tests with Entity Framework and I had a problem when placing a array as a parameter. Why when I assign the conversion of array in a function variable and directly in the method parameter…
-
2
votes1
answer60
viewsQ: If there is update a table and insert into another, if not, insert into the two
How to make an expression using EPH so that when a certain list of objects is sent and already exists in the database, it is updated and the change is inserted in another historical entity,…
-
3
votes1
answer101
viewsA: Procedure sql server, return the total value of an id
Explanation You can use the aggregation function SUM() to sum the values and group the results by the name of the products with the clause GROUP BY. Query SELECT nome_produto [Nome do Produto],…
sql-serveranswered Jean Gustavo Prates 3,067 -
1
votes1
answer356
viewsA: Subselect within a field
Explanation I believe that the easiest way (I believe more performative too) to perform this consultation would be to use the JOIN with the table Transferor. Query SELECT c.razaosocial,…
sqlanswered Jean Gustavo Prates 3,067 -
2
votes1
answer137
viewsA: Sql - Merge select - Create Row if nonexistent record
Explanation You can use your select as the basis of a derived table, making it possible to use a filter to keep the other fields with 0 or now(). We use the function ROW_NUMBER() to account for how…
-
3
votes1
answer2012
viewsA: How to exchange point for comma in java and Bigdecimal type?
You can change the comma per point through the code, so on the front end it will be transparant. Example valor = new BigDecimal(cmpValor.getText().replace(",",".");…
javaanswered Jean Gustavo Prates 3,067 -
49
votes1
answer2641
viewsQ: What does the symbol "$" mean before a string?
Viewing a code here in Sopt, I noticed the use of the symbol "$" and I was left with doubt about its use. What is the symbol "$" before a string? What good is he? Why use it? Example using static…
-
4
votes3
answers565
viewsA: Repeat LEFT JOIN with other parameters in the same query
You can use the clause CASE to account for only one condition. See the example below: SELECT PAI.NOME, COUNT(DISTINCT(CASE WHEN FILHO.SEXO = 'F' THEN FILHO.ID ELSE NULL END)) AS 'FEMININO',…
-
2
votes2
answers88
viewsA: Doubt LEFT JOIN SQL
Try using the following query, will return all people who participate in the group of the person entered in the condition. SELECT DISTINCT PESSOAS.* FROM TBL_PESSOAS PESSOAS LEFT JOIN…
sqlanswered Jean Gustavo Prates 3,067 -
3
votes3
answers1053
viewsA: How to update with SQL Server count?
You can use the function ROW_NUMBER() to do this count. Follow query example below. WITH ALGUMNOME AS ( SELECT NOME AS 'NOME', ROW_NUMBER() OVER (ORDER BY NOME DESC) RN FROM TABELA ORDER BY NOME )…
-
1
votes1
answer46
viewsQ: What are the most common ways to enter data remotely?
I have several applications where I perform constant data insertions in the local database, however, the number of simultaneous applications has become very large and the data is delayed. Now, I…
.netasked Jean Gustavo Prates 3,067 -
3
votes1
answer1546
viewsA: SQL query grouping by age group
You should list the registration table with the age range table and group the results through the age range column. Use the example below: SELECT COUNT(case when sexo= 'Masculino' then 1 end) AS…
-
0
votes1
answer141
viewsA: SP_HELPTEXT without formatting
Try using the Precedent below. CREATE PROCEDURE [dbo].[sp_helptext2] (@ProcName NVARCHAR(256)) AS BEGIN DECLARE @PROC_TABLE TABLE (X1 NVARCHAR(MAX)) DECLARE @Proc NVARCHAR(MAX) DECLARE @Procedure…
-
0
votes3
answers80
viewsA: Move the mouse, and know that I’m on top of an object
Add the event onmouseover available in SVG components SVG <svg> <image onmouseover="alert('Isso é um alert');"/> </svg> CSS #svg-image:hover { cursor: pointer }…
javascriptanswered Jean Gustavo Prates 3,067 -
1
votes1
answer207
viewsA: Get the parent by passing the child code using Hierarchical Data (SQL Server)
You can use the method Getancestor, it returns the hierarchyid for the inserted position. In your case, it will return the first position. See the example below: SELECT EmployeeID FROM Employee…
-
0
votes1
answer293
viewsQ: JSON Class Construction and Consumption
I’m trying to consume a JSON, but in the structure I developed the code does not return data. Please, could you help me and explain the concept of consumption and how the JSON structure works? Code…
-
12
votes1
answer6642
viewsQ: What is a memory dump?
What is a dump from memory? How it can help in the possible identification of an inconsistency in the code? How the analysis is performed?