Posts by Barbetta • 5,587 points
191 posts
-
1
votes1
answer721
viewsA: Connect to database using . Net Core 2
To recover the connection string from appsettings.json you can do it this way using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration using…
-
1
votes2
answers88
viewsA: Foreign key in Webapi with dotnet core
Is there any way for Entity to map better to those keys that are coming NULL do not appear in JSON? To ignore null objects it is necessary to configure this in Startup.cs, you can do it this way…
-
0
votes2
answers326
viewsA: I need to make a Python entry by storing it as a list, all in one line
It is possible to pass a list inside a list. dados = [] for i in range(2): codigo, KM, consumo = raw_input().split() dado = [codigo, KM, consumo] dados.append(dado) for item in dados: print("Código:…
-
1
votes1
answer47
viewsA: API problem after deploying
What happened: You created a app within your site (probably Default Web Site). With this is created a alias(In your case api) and to access your application you need to have the alias in the…
-
0
votes2
answers359
viewsA: Generic Method of a Generic Class C# for similar classes
You need to pass the generic entity in the parameter, it would look like this public void Gravar<T>(T obj) { context.Set<T>().Add(obj); } To call this you need only pass the object as…
-
7
votes1
answer151
viewsQ: What are index hints?
I saw a comment from @Ricardopunctual that mentioned Density-based index hints your question seems very confusing. it starts with a very basic thing such as "how do I process in sql server", which…
-
1
votes1
answer217
viewsA: Get or return a variable to the angular
You can return one json with the information you want your code can be like this: A class was created to treat return of the method, in it was added a field for status and another for message the…
-
0
votes1
answer195
viewsA: Import XML File Data to Array
Probably your code would work if the XML had no statement(<?xml version="1.0" encoding="utf-8"?>) In such cases it is necessary to "skip" the statement to catch the nodes. A class of Regra and…
-
1
votes1
answer799
viewsA: Send view to controller values by jquery
You can do it this way View: <form id="myForm"> <input type="text" name="Barconteudo" id="Barconteudo" /> <input type="text" name="Teste" id="Teste" /> <input type="button"…
-
1
votes2
answers668
viewsA: I can’t parse json with brackets in c#
When the json is among [ ] means that it is a array, see here for that pasta do Deserialize from a list Class with the properties of json: public class Dados { public string chave { get; set; }…
-
0
votes1
answer83
viewsA: Load a window only once after reloading the site in Asp.net C#
You can use the sessionstorage, it will have value until the user closes the browser, after that it will be destroyed $(function() { var deveExibirModal = sessionStorage.getItem('deveExibirModal');…
-
0
votes4
answers208
viewsA: Identify missing value in numerical sequence
Follow an option, I haven’t done many tests, but at first it’s working I request the size of the deck on the entry and add it to a list, then "lose" a card and finally check the sequence if it is ok…
-
1
votes3
answers380
viewsA: Print a string with only numeric values
Follow another alternative using Linq string dados = "a132sb26c33"; string resultado = new String(dados.Where(Char.IsDigit).ToArray()); Console.WriteLine(resultado); I put in the .Net Fiddle for…
-
2
votes1
answer156
viewsQ: Why use readonly to instantiate?
I read and reread that question/answer a few times and I understood the difference between const and readonly. I also read the documentation, but I still can not understand what gain I have using…
-
0
votes1
answer517
viewsA: Route.config of website in c# Asp.net
Let yours RouteConfig.cs thus: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Routing; namespace SiteTESTE { public class…
-
1
votes2
answers101
viewsA: Do you doubt about " insertion" of variables in the input command in C#?
The method ReadLine() contained within the Console always returns a string(View documentation), therefore, if your variable is not of the type string conversion will be required; Already the method…
-
1
votes3
answers255
viewsA: SQL bring result with repeated column numbers all only the largest
I believe you have a mistake in yours scrip for, apparently, you compare the order code with the client code on join, see inner join pedido b On a.cod= b.cod You can add a AND in his join that will…
-
2
votes1
answer966
viewsA: How to capture radio input value of an object with ajax?
Just change the: var estrela = $(this)("input[name='fb']:checked").val(); To: var estrela = $("input[name='fb']:checked").val() I was wrong the way I was calling. Follow an example working: function…
-
2
votes2
answers997
viewsA: How to insert new object in json file
From what I understand you’re getting one json, playing in a list, adding a new item, converting again to json and saving. For this just do the SerializeObject of the list, string json =…
-
0
votes2
answers621
viewsA: Do not let browser save password
Seeing this reply of OS Missed to set the type="password" in the input hidden'. It is also necessary that this input come before the input that will really be used. <form> <div…
-
1
votes1
answer342
viewsA: How to identify if the access is internal or external?
Since your company’s IP is fixed, you can check this way, do the IP check, if it’s corporate make a call, if it’s not, make another call. The below follows two ways to check the external IP First by…
-
1
votes1
answer1236
viewsA: Error {"The object reference was not defined as an instance of an object." } System.Nullreferenceexception MVC ASP.NET
This error happens because the list Movies is coming null, see the Excption generated. One way to fix this is, if it is null, it instance a zeroed list, so the table will be displayed, but without…
-
1
votes1
answer77
viewsA: Oauth with Dependency Injection
He’s waiting for an instance of IUsuariosServices, you set it here IUsuariosServices _usuariosServices; public OAuthProvider(IUsuariosServices usuariosServices)//Aqui diz que que o construtor base…
-
1
votes1
answer30
viewsA: Undefined object reference for an instance - Null foreign key
Try the following check on your View, I did a two-step check, first confirms if the object is null and then Username <table class="table table-bordered data-table" style="font-size: 12px">…
asp.net-mvcanswered Barbetta 5,587 -
1
votes1
answer216
viewsA: DDD + Entityframework + Migrations + SQL Server
The connection string may be simpler than this, of course, depending on what you want, it is still worth passing some definitions through it. But there must be a reason. Assuming you’ve created an…
-
1
votes2
answers73
viewsA: MVC Encrypt/ hide information according to User function
As it is just visualization there is no need to do something complex, you can in your view make a if and whether or not to display the data: <div class="form-group"> <label class="col-md-4…
asp.net-mvcanswered Barbetta 5,587 -
2
votes1
answer29
viewsA: Subselect without condition WHERE
Making a join between the tables is possible, will pick up the vehicle and "join" with the service order information Select * from ordem_servico inner join veiculo on veiculo.id_carro =…
-
3
votes1
answer68
views -
3
votes4
answers26369
viewsA: Find certain text in a string
You can use the if for this, it would look more or less like this nome=str(input('Qual o seu nome completo?')) if("Enzo" in nome): print("A string tem o nome Enzo") else: print("A string não tem o…
-
7
votes2
answers675
viewsA: Search for files by extension
You can take all files from the directory and see if the extensions contain what you want: DirectoryInfo directoryInfo = new DirectoryInfo(@"C:\teste\"); bool retorno; string nomeArquivo = "MyFile";…
-
3
votes1
answer96
viewsA: How to use time_format() in Mysql?
The time_format() receives first the field and then the formatting parameters, to display time and second would look like this: select TIME_FORMAT(hora, '%H:%s') from tabela By way of doubt, also…
-
2
votes1
answer315
viewsA: How do I sort a date field in mysql?
Because the date is on string it will order appeals for the data before the "-", it is necessary to convert the field to date select * from tabela order by str_to_date(data, '%d-%m-%Y') desc I put…
-
2
votes2
answers228
viewsA: Asp.Net MVC - Selecting item from a Dropdownlist reflects the same selection in another Dropdownlist that contains the same selection items
You can use the event change, your code would look something like this <script type="text/javascript"> $("#CamaraA").change(function(){ $("#CamaraB").val(this.value) }) </script> The…
-
0
votes1
answer114
viewsA: Message appears when selecting value in a dropdownlist
If you want to display a message on the screen to the user stating which item he has chosen, there is no need to again perform interaction with the database. the following example will be with…
-
3
votes3
answers47
viewsA: How to view a given value in a table
You can use the following query SELECT pessoas.nome, pessoas.regiao FROM pessoas WHERE regiao = 'RS' To make filters in sql use the clause WHERE, as shown above. Note also that in query I returned…
-
10
votes2
answers1951
viewsA: App - Xamarin or Ionic?
What is the main difference between Xamarin and Ionic? The idea of Xamarin is the development cross-plataform native, ie when generating the applications, native applications are generated for each…
-
3
votes5
answers680
viewsA: What to do when a UI element cannot be used by a user?
The first point I see in this whole question is that, as much as we add references, the answers still have a tone of opinion (including, this is an opinion[using irony]). Usability is a more human…
-
7
votes1
answer6927
viewsA: How to change Default Encoding in Sublime Text 3
To change the encoding of sublime, go in Preferences>Settings, search for default_encoding, after this put the parameter in the user configuration area and indicate the encoding desired. Another…
-
6
votes1
answer14523
viewsA: Error The multi-part Identifier "..." could not be bound
The error is because you are trying to access a field not yet mapped in join In his first join you try to access ImportaContratosAux.ContratoId that is only being carried in the second join to query…
-
0
votes2
answers783
viewsA: Check return $.getJSON
You can use the if(result){} He will return true if the return **: ** null Undefined Nan Empty string ("") 0 false Source…
-
2
votes2
answers1143
viewsA: Extract and print specific xml values using Python
The blocks of code Python "work" according to your indentation, your code is only returning 1 name as it goes through all for and only "escreve" the last item in the name variable, your code should…
-
2
votes1
answer225
viewsA: What is so-called functional and non-functional (quality) requirement?
Regarding that explanation of the non-functional requirement and the to the example used, it is correct to state both are in fact correct? No, actually non-functional requirement does not have to do…
-
4
votes1
answer284
viewsA: Difference between Addmvc vs Addmvccore
I’ve been starting to mess with asp.net-coreand I was curious about the question. Looking at the doc and the source code, we have the two calls with the following code: TL;DR: The AddMvc implements…
-
0
votes1
answer2232
viewsA: How to calculate average and show the highest and lowest values?
Edit With the table passed by @Luzinetemaciel Obs: as commented by José Diz was added check if values are null to avoid return with NULL SELECT dessecod AS dessecod, MatCod AS MATERIA,…
sql-serveranswered Barbetta 5,587 -
1
votes2
answers3405
viewsA: Python, value percentage (result)
I made some changes to the code, there was no need to use lists. It is possible to simplify even more, but since it is not objective, let’s go to the code. I made the sum of all counters, and in the…
-
1
votes1
answer165
viewsA: How to use Include for objects that are inside a list
That would be the way: var relatorio = contexto.Set<Venda>() .Include(v => v.Itens.Select(p=> p.Produto)); Will return the sales list, with the items and products loaded.…
-
1
votes1
answer168
viewsA: High box input in Asp.net
One option would be to do for the domain Example: public class PessoaFisica { private string _nomeCompleto; private string _apelido; public string NomeCompleto { get => _nomeCompleto; set =>…
-
3
votes2
answers312
viewsA: Metodo Post Angular
Error occurs because source requests are not enabled http://localhost:4200. Origin 'http://localhost:4200' is therefore not allowed access. To allow requests, both from specific sources, and from…
-
3
votes1
answer97
viewsA: print text without translineation rule
To remove the - or remove it from the entrance Programar em python é mui to simples é só praticar. or it is possible to use the replace for linha in linhas: linha = linha.replace("-", "")…
-
1
votes1
answer1648
viewsA: Is there any way to pass a class instance as a parameter of a Python method?
Yes, the difference is that in python typing is dynamic, it comes from Duck Typing Follow an example by passing a class as parameter class Pessoa: def __init__(self): pass def setNome(self, nome):…