Posts by Marco Souza • 12,304 points
506 posts
-
0
votes0
answers12
viewsQ: How do I convert angular ng-repeat to Flask?
How can I do the same Angular ng-repeat function in Flask? <tbody ng-repeat="x in oCtrl.ListaProdutosAno | filter:{codigoProduto: produto_estatistica.codigoProduto} track by x.codigoProduto +…
-
0
votes0
answers83
viewsQ: Warning Elasticsearchdeprecationwarning: this request Accesses system indices
I’m getting a Warning when trying to get all indexes in Elastic after the latest version update. Warning. C: Users... Appdata Local Programs Python Python38-32 lib site-Packages Elasticsearch…
-
2
votes3
answers415
viewsA: How do I timeout and replay a command line in Python?
You can use the Retry Pattern to perform its function again. Retry is a Pattern used in various languages to redo a function call if an error occurs, in your implementation you can specify the…
-
3
votes2
answers242
viewsQ: What is virtualenv for in Python?
What is virtualenv for in Python? Do you have any alternative to non-use or is it more advisable to use it?
-
0
votes2
answers210
viewsA: How to convert a value to float and int in python?
Your specific error you are trying to convert a dictionary to a float. In this case you need to access the value of your dictionary so you can then convert its values. For example: dicionario = {…
-
0
votes1
answer64
viewsA: How to create property in a Python object?
After some research and @Woss comment, I was able to solve with a class. class Produto(object): def __init__(self, termo: str, qtdRegistros: int, descricao:str, tipoConsulta:str): self.UrlTermo =…
-
0
votes1
answer47
viewsA: Problem when performing the calculation between arrays
You are getting the error "only size-1 arrays can be converted to Python scalars" because the function expects a single value instead, you passed an array. use the library of numpy in place of the…
python-3.xanswered Marco Souza 12,304 -
0
votes1
answer27
viewsA: Is it possible to return all ids from an Elasticsearch search keeping the specified `size`?
After some searches I managed to assemble the following query. GET meuindex/_search { "from":0, "size":40, "query":{ "bool":{ "should":[ { "multi_match":{ "query":"pincel branco bic", "fields":[…
-
1
votes1
answer43
viewsA: How to point the oldest person on a list?
You must first order your field Idade using Descending to then make your loop. class Pessoa(object): def __init__(self, nome: str, idade: int): self.Nome = nome self.Idade = idade dados = list()…
python-3.xanswered Marco Souza 12,304 -
0
votes1
answer27
viewsQ: Is it possible to return all ids from an Elasticsearch search keeping the specified `size`?
It is possible to return all ids of an Elasticsearch search? I have the following query that most of the time returns in the field ['hits']['total'] more hits than what I specify on size. As in the…
-
0
votes1
answer64
viewsQ: How to create property in a Python object?
How can I create an object with property and add to an object list using python? I have a funtion that expects a return from a list of products, this return is used by other futions and do not want…
-
1
votes1
answer63
viewsQ: How to include minimum_should_match in the query of Elasticsearch dsl?
I’m trying to use the minimum_should_match how are you in documentation q = Q('bool', must=[Q('match', title='python')], should=[Q(...), Q(...)], minimum_should_match=1 ) s = Search().query(q) But…
-
0
votes2
answers61
viewsA: How do you filter a list with multiple words in python?
With the idea of @Woss, I set up a recursive function that checks if there are words in the string and if you have found all words before. def filtra_busca_termo(termo, termoBusca, achouTermo):…
-
2
votes2
answers61
viewsQ: How do you filter a list with multiple words in python?
How can I filter a list in the same way I can in SQL? Ex: In SQL I can do several AND in a text field with CHARINDEX SELECT * FROM TB_Produto AS A (NOLOCK) WHERE CHARINDEX('papel', NM_PRODUTO) >…
-
0
votes1
answer58
viewsA: Elasticsearch server connection
I solved the problem by pointing to port 80 and changing use_ssl to False. es = Elasticsearch([{'host': 'elk-site....com.br', 'port': 80, 'use_ssl': False}])
-
1
votes1
answer63
viewsQ: How to sort with Elasticsearch while maintaining search relevance?
I’m trying to search for a word in Lasticsearch with python and sort by one of the columns, but this is changing the result the way I really wanted it. For Ex: When I search without order it returns…
-
1
votes2
answers83
viewsQ: How to consult with Elasticsearch-dsl?
I’m starting to make queries with elasticsearch_dsl and I’m getting lost to returns my object by product name. from elasticsearch import Elasticsearch from elasticsearch_dsl import Search,…
-
0
votes1
answer58
viewsQ: Elasticsearch server connection
Good afternoon! I’m trying to connect in Elasticsearch, but I’m not getting, I don’t know if I need to inform anything else in class es=Elasticsearch(..) # Import Elasticsearch package from…
-
0
votes1
answer107
viewsQ: Gitlab permission error in visual studio 2019
I have the error below when I try to pull/push via visual studio. Opening repositories: C:\Projetos\Ecommerce\Epson Permission denied, please try again. Permission denied, please try again.…
-
0
votes0
answers123
viewsQ: Is ROWCOUNT reliable for change checking?
I am mounting a query to be executed via DAPPER/C#, my idea is not to check if the data exists in the table returning the object to the application, but rather, to check directly in the data bank of…
-
1
votes1
answer41
viewsA: Entity framework Client For Sale
This depends a lot on how you want to manipulate your data. In general we create a list in the Customer with its sales and a Customer for sale to facilitate navigation if you are with the sale and…
-
1
votes1
answer223
viewsQ: How to run a MERGE object list by returning the Update or Insert Id?
I have the following scenario; I need to make a INSERT or UPDATE from a list of List<PRD_ARTIGO_VARIANTE_VALOR>, my doubt is whether there’s any way I can get past the list of a single time by…
-
0
votes0
answers29
viewsQ: How do I publish a process-dependent application together?
Is there any way to publish an Aplication console with dependency on other consoles ? Today I have a screen of Windowns Form that is my login screen, I select which console application should be…
-
0
votes2
answers389
viewsA: SQL - Doubt Query Exists and Not Exists
There are several ways to do this query, but the best I see is the use of INNER JOIN. See the example below. select ed.codEdi, ed.nomEdi from Editora ed JOIN Exemplar ex on ex.codEdi = ed.codEdi…
-
3
votes1
answer54
viewsA: How to lock a method so that others do not call while it is used?
Have a look at the documentation here. You already have an answer on the subject here. public class SuaClasse { private readonly object balanceLock = new object(); public static void Log(LogType…
-
0
votes1
answer1102
viewsA: Print window, save PDF Selenium Webdriver
For windows or windows form, you need to use another framework like Uiautomationclient, see examples below. var processoId = Process.GetProcessesByName(Nome do processo).First().Id;…
-
0
votes2
answers395
viewsA: C# With Selenium - Doubt about xPath
Surely your Xpath is not right and is returning null. One way you can do it is this. var inputs = browser.FindElementsByTagName("input"); foreach (var item in inputs) { var alt =…
-
1
votes1
answer149
viewsA: search object list in Entity [LINQ]
See if it helps var prop1Lista = listaPrimitivos.Select(x => x.Propriedade1).tolist(); var prop2Lista = listaPrimitivos.Select(x => x.Propriedade2).tolist(); var result = db.Tabela…
-
0
votes1
answer172
viewsA: How to insert data into an N:N Table
Your logic is not wrong seeing from the point that you can do the CRUD of each entity separately, to my see what you can do is create a screen where you can join these two entities and so do the…
-
1
votes3
answers272
viewsA: Deserialization of JSON
Simple, your object has a list of cities, so it looks like this. using System.Collections.Generic; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string json =…
-
1
votes1
answer322
viewsA: Save Image Path to the database and call in View Asp.Net MVC
Remove the Path.Combine(HttpContext.Server.MapPath( and use the "~/Imagens/Blog/" + arquivo.FileName; The use of Httpcontext.Server.Mappath makes it possible to recover the physical path of your…
asp.net-mvcanswered Marco Souza 12,304 -
0
votes1
answer452
viewsA: C#hash encryption
As you are encrypting the password before entering in the bank, you will need encryption in the same way to use in your select parameter otherwise you will not find your data in the bank. See how it…
-
0
votes1
answer451
viewsA: Aligning fields with bootstrap inline-Forms
If you want each input to have the same size and alignment below each other with 3 input per line you have to set for each form-group 3 div classy col-md-4, each row of your form by default has the…
-
1
votes3
answers299
viewsA: How to get the amount of "true"?
In a dynamic way using the Formula you could scan the properties of your class and check which ones are bool type and add the ones that have the value as true. See how I’d do. using…
-
1
votes1
answer110
viewsA: System.Data.Entity.Infrastructure.Dbupdateconcurrencyexception error while updating with Entity
Your problem is that you recover the object with the Entity Framework, but when you are returning it does not inform the primary key of the object. db.Entry(protocolo).State = EntityState.Modified;…
-
0
votes1
answer156
viewsA: Error while using Parallel.Foreach
Use the Tryparseexact to convert your date, see the example below. string[] formats = {"M/d/yyyy h:mm:ss tt", "M/d/yyyy h:mm tt", "MM/dd/yyyy hh:mm:ss", "M/d/yyyy h:mm:ss", "M/d/yyyy hh:mm tt",…
-
1
votes4
answers593
viewsA: Sql - Query of two maximum values
See the example below of how you can do. SELECT m.codigo, m.data, m.valor, m.seq FROM @minha_tabela m join ( SELECT m2.codigo, max(m2.data) as data, max(m2.seq) as seq FROM @minha_tabela m2 group by…
-
1
votes2
answers977
viewsA: Connection to the database in ASP.NET with Entityframework
In the Entity Framework you need to tell the context what the database connection is, this is done by moving to the base class : base("DataContext") your connection name as shown below. public class…
-
2
votes1
answer65
viewsA: How to get a value using interpolation?
I managed to solve using the Smart Format., I don’t know if it’s a good library, but right now I’m taking what I need. var pessoa = new Pessoa() { Documento = new Documento() { Numero = 12345, Tipo…
-
2
votes1
answer65
viewsQ: How to get a value using interpolation?
I am trying to recover a class value using interpolation. Using Console.WriteLine($"Meu Nome é, {pessoa.Nome}");, I get the value of the form I want, but in my case the string will come from a…
-
1
votes1
answer61
viewsQ: How to get the value of a property with Expression?
I’m trying to get the value of a property through Expression, but I’m getting the following error. The instance property '.Rota.Applicationname' is not defined for the guy…
c#asked Marco Souza 12,304 -
1
votes1
answer30
viewsA: Function does not recognize hidden elements
Create an object in javascript and pass it as parameters, instead of passing data: { DataInicio: dataInicio, , surely your controller has no optional parameters and when you don’t pass it the data…
-
0
votes1
answer34
viewsA: Email automatico no sql server 2012
You will need to manipulate your query to be able to assemble your table the way you need, the way I see to do this is with a Cursor, would be like this. declare @tabelaEx table ( PRODUTO…
sqlanswered Marco Souza 12,304 -
2
votes3
answers666
viewsA: ASP.NET - How to use multiple post methods in the same controller?
Your problem is that you don’t have Httpget action for your view to load. [HttpGet] public ActionResult UserInfo1() { return View(); } [HttpGet] public ActionResult UserInfo2() { return View(); }…
-
0
votes1
answer29
viewsQ: How to remove class from a dynamically created field?
I’m trying to remove a class from a label dynamically created by handlebars, But I can’t find the label with his id; On the console if you pass the idLabel it returns the right id.…
-
1
votes1
answer525
viewsQ: Button making Submit for action instead of opening only Modal
I am riding a Modal to add a category and a list of products in a modal. When I click the button to add a new product my category Create action is called when I should just open the modal. I do not…
-
1
votes1
answer51
viewsA: How to make database transaction in Webforms?
The example below is using Dapper. using (var transactionScope = new TransactionScope()) { using (var conexao = new SqlConnection(Configuracao.Configuracoes.StringDeConexaoSQLServer)) {…
-
1
votes1
answer125
viewsA: Asp.Net MVC Binding view model with a List
I decided to change the loop to the FOR. @if (Model.Validadores != null) { for (var i = 0; i < Model.Validadores.Count; i++) { <tr> <td> @Html.HiddenFor(x =>…
-
0
votes1
answer125
viewsQ: Asp.Net MVC Binding view model with a List
I’m trying to make a Binding of my view, only when the action is called my object filaViewModel comes with the filaViewModel.Validators equal to null. I’ve tried to pass with @Html.Hidden("Code",…
-
1
votes0
answers91
viewsQ: How to map a json string to another json string?
Is there any way to map a json string to another json string? The goal is to take the value of one json property and set it in another json property. Exe; I have the json. { "codigo":0,…