Posts by Tobias Mesquita • 22,900 points
750 posts
-
1
votes2
answers419
viewsA: Performance types of Eventbus in Vuejs
As for the Eventbus mechanism, in both cases they are equal, what changes is the way in which you access the same. The second case, which is set a plugin that will injetar à $bus at the prototype of…
-
1
votes1
answer1038
viewsA: Owl Carousel + Vue.js with dynamic item
I went through this problem a little while ago, in my case I needed to encapsulate the Owl-Carousel inside a Component. Owl-Carousel.Vue <template> <ul> <slot></slot>…
-
0
votes1
answer164
viewsA: Web service with c#
First thing you need to do is get the schemas dos XML return sending, ie the files Registro.xsd, ConsultaLote.xsd and RegistroAdmitido.xsd. They must have a structure similar to the xsd example…
c#answered Tobias Mesquita 22,900 -
0
votes1
answer326
viewsA: How do I change the csv header, C#
First of all, I would like to remind you that mounting a CSV correctly is not as simple as it seems, so I advise you to use the CsvHelper as for Displayname, you can check if Property has this…
-
1
votes2
answers560
viewsA: Notification in Vue
you can create the notification immediately, but schedule it for a time in the future. var addNotification = document.getElementById("add_notification"); addNotification.addEventListener("click",…
-
1
votes1
answer32
viewsA: How would I show the person logged in at the top of the list
you can use a case.: SELECT * FROM usuarios ORDER BY CASE WHEN id == ? THEN 0 ELSE 1 END
-
1
votes1
answer79
viewsA: How to make an Annotation data validator based on another field?
you can do it this way.: public class RequiredEqualAttribute : RequiredAttribute { public RequiredEqualAttribute(Type type, string prop, object value) { this.Property = type.GetProperty(prop);…
-
3
votes1
answer916
viewsA: How to go through an object and filter this object?
You can use the Array.prototype.filter const lista = [ { idade: 20, nome: 'Fulano' }, { idade: 20, nome: 'Ciclano' }, { idade: 21, nome: 'Beltrano' } ]; let filtrado = lista.filter((item) =>…
-
0
votes1
answer61
viewsA: Electron - Error 400 when obtaining geolocation
The problem occurred when setting the variáveis de ambiente, to them processo principal (main.js), they were not being reflected into the rendering process. My first attempt was to move them to the…
-
0
votes1
answer61
viewsQ: Electron - Error 400 when obtaining geolocation
I’m trying to use the navigator.geolocation.getCurrentPosition and the navigator.geolocation.watchPosition in a PWA project made with Quasar. It is working very well in Browser and Cordova…
-
3
votes1
answer160
viewsA: Generic CRUD in Entity Framework with unspecified entity
First, CRUD generic the Entity Framework already possesses, the same is called DbSet<T>. Second point, I see that you want to abuse the AsNoTracking, this will bring you more problems than…
-
2
votes2
answers682
viewsA: API User and password in Header
look, the ideal is you do something in the style of OAuth. Leave a Url for authentication, this Url should expect a Body with Usuario and Senha, the return of this section should be a Token. This…
-
0
votes3
answers1435
viewsA: Call functions for ajax request inside callback
I believe that using a Promise be more appropriate in your. var ajax = function (method, url, data) { return new Promise(function (resolve, reject) { var request = new XMLHttpRequest();…
-
-1
votes4
answers2204
viewsA: How to get page load percentage?
As many pointed out, what search is not something simple, maybe it is valid if you want to make a screen to download/upload large files. The first thing you need to do is calculate the size of your…
-
1
votes2
answers293
viewsA: Set object key by a variable
Objects in Javascript behave like value-key dictionaries, so you can access them by name. console.log(obj[0]["Perfil" + numero]); if the idea is to change the profile number, you can do it as…
javascriptanswered Tobias Mesquita 22,900 -
1
votes1
answer282
viewsA: EF6 MVC5 C# - How to maintain filters with Querystring page
I believe your filter allows pargination and sorting, so one way out is to add both to your model. for example, a basic crud with filter by title and date range.: public class EntityModel { public…
-
0
votes1
answer34
viewsA: How to animate cursive font
friend, I’m just playing the content of the following site.: How to Make a "Write-On" Effect using HTML5 Canvas & JavaScript var ctx = document.querySelector("canvas").getContext("2d"); var…
-
1
votes2
answers53
viewsA: Validating Valor
follows another alternative, using a validation with HTML5. var soma = document.getElementById("soma"); soma.addEventListener("input", function (e) { var msg = ""; if (!e.target.value) msg = "por…
-
1
votes1
answer210
viewsA: Convert "date and time" to "date" in C#
the DateTime has a property called Date. t.DataDeContrato = Convert.ToDateTime(row.ItemArray[6]).Date;
-
1
votes2
answers5083
viewsA: Convert Datatable to List C#
you can create an extension for Datatables as the following.: using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Dynamic; using…
-
0
votes5
answers2427
viewsA: Get clicked element position
to get the Intel, you can use a indexOf on the children. var btsApagar = document.querySelectorAll(".apagar"); var onApagarClick = function (evt) { var linha = this.parentElement.parentElement; var…
-
1
votes2
answers476
viewsA: Request ajax with append before opening modal
first, async: false is always a bad idea. The $.ajax returns a promise, then, open your modal in the continuation of the same. function mostrarUploads(id) { return $.ajax({ url:…
-
3
votes2
answers138
viewsA: Tolist() returning read-only
as Maniero pointed out, you cannot manipulate an anonymous type, however you can assemble your query to meet your condition. In your specific case, I believe it is to accomplish something similar to…
-
1
votes2
answers681
viewsA: How to Create an array from text snippets of a string?
Follows a more reusable alternative. var _split= function (text, term) { var index = 0; var terms = []; text.replace(new RegExp(term, "gi"), function (term, i) { terms.push(text.substring(index,…
-
1
votes1
answer304
viewsA: Real-time database replication
40,000 requests in two hours is not much, even if it was in 15 minutes, it would be about 50 requests per second. So I think there’s plenty of room for improvement in your database, analyze your…
-
-1
votes1
answer116
viewsA: How to fit these elements?
Some time ago I made an implementation that solved a similar problem.: Jsfiddle: https://jsfiddle.net/TobyMosque/wamsc1ks/ var content = document.getElementById("container"); var content =…
cssanswered Tobias Mesquita 22,900 -
0
votes2
answers1357
viewsA: Multi threads c#
If its operations do not carry out IO, or if you cannot use the .net 4.5 or later, may make use of Parallel.For. var s = new Soma(); Parallel.For(0, 5, i => PrintNumbers()); now you’re using the…
-
3
votes1
answer738
viewsA: How to return a Datareader C#
Look, I don’t see how you could do this safely. If you use the using, the DataReader will be closed if you do not use the using, the connection will be open until someone closes it. An alternative,…
c#answered Tobias Mesquita 22,900 -
2
votes1
answer79
viewsA: Conflict between similar objects in the Entity Framework
Come on, in spite of your DAL is masking the problem, I believe the method GetConteudoByID(id) is doing something similar.: using (var context = new EFContext()) { return context.Conteudos.Find(id);…
-
1
votes2
answers3639
viewsA: Export of CSV data
First piece of advice I give you, try adapting your code so it gets a typed list instead of a Datatable. However the example below will lead to count that it will continue with Datatable. Another…
-
0
votes4
answers102
viewsA: How to create a button that randomly selects 3 out of 5 numbers
you can shuffle an array as follows.: var itens = [1,2,3,4,5,6].map(function (item) { return { random: Math.random(), item: item }; }).sort(function(objA, objB) { return objA.random - objB.random;…
-
1
votes2
answers617
viewsA: How to organize JSON content
I guess I shouldn’t be doing this, but there it is. var arquivo_json = document.getElementById("arquivo_json"); var ordenar = document.getElementById("ordenar"); var form =…
-
1
votes1
answer38
viewsA: mount HTML element with vanilla JS, cannot list all JSON elements
you forgot a +. people.innerHTML += markup; in any case, I suggest at least that you remove the .innerHTML = markup of your bond, this operation is very costly. let markup = ""; let people =…
-
1
votes3
answers191
viewsA: Operations with multiple input js
follows a suggestion without depending on jQuery.: // O objetivo do objeto Linha é criar um scope para os elementos da pagina. var Linha = function (linha) { this.linha = linha; // os seletores…
-
2
votes2
answers1048
viewsA: How to add delay to Display:block
Follows an alternative. div { clear: both; } .icon { position: absolute; top: 0px; left: 0px; height: 32px; width: 32px; background-repeat: no-repeat; background-size: calc(100% - 4px);…
-
5
votes2
answers63
viewsA: Why is the selected <select> option not being cleared using Choosen?
You are selecting the index of loop not the page entry, see if the code below works: $("#btnLimpar").click(function(){ $("#editPublication")[0].reset();…
-
7
votes3
answers643
viewsA: How do I remove a "listener" that I added via addeventlistener?
Unfortunately, Javascript does not provide a way to list all events, so you will need to keep a reference to events added. Below is an example of how to remove a specific event. let teste =…
javascriptanswered Tobias Mesquita 22,900 -
0
votes2
answers219
viewsA: Service to pick up a change in the bank
You can create a Windows Service with a SqlDependency protected override void OnStart(string[] args) { SqlDependency.Stop(this.ConnectionString); SqlDependency.Start(this.ConnectionString);…
-
1
votes1
answer133
viewsA: How to return a table from xml in sql server
you can do it this way.: DECLARE @xml as xml SET @xml = '<Operacao Id="1"> <Contatos> <Contato Id="2013"> <Emails> <Email Id="40"/> <Email Id="41"/>…
-
0
votes2
answers1032
viewsA: How to add div before another div with Javascript
use the method Node.insertBefore(newNode, referenceNode). var primeira = document.querySelector(".primeira"); var divAdicionada = document.createElement("div");…
javascriptanswered Tobias Mesquita 22,900 -
3
votes1
answer58
viewsA: Difference in whether or not to use the term Function
According to the documentation in Mozilla, enviar despite being the contracted form of enviar: function(), the contracted form is a named function, while the second is an anonymous function. Note :…
-
0
votes1
answer182
viewsA: Change Primarykey Entityframework
The solution below might work, as I have not tested it, I ask you to do so, If it doesn’t work, please comment below so I can remove this answer. First step, you should change all your Fks that…
-
0
votes1
answer603
viewsA: How to use two forms with the same ID?
A suggestion, modify your ids to be unique. Now let’s go to the contour solution... modify the following.: Original: <button type="submit" ... onclick="submit_form()" /> Proposed: <button…
-
0
votes3
answers495
viewsA: Send email asynchronously Asp.net mvc
you don’t need to create a new Task with the Task.Run or the Task.Factory.StartNew, after all the smtp.SendMailAsync already returns a Task. All you need to do (or rather not do), is not wait for…
-
1
votes1
answer115
viewsA: Codetemplate in . net core [scaffolding]
I performed the manual download of the package through the link.: Nuget Gallery - Microsoft.VisualStudio.Web.CodeGenerators.Mvc While extracting the contents of the package, I checked that the…
-
1
votes1
answer1913
viewsA: How to Request JSON Data
Hello, there are some approaches, I’ll quote to what I think is most appropriate, which is using the HttpClient. If you do not find it in your project, install the following package.:…
-
3
votes1
answer117
viewsA: Vue JS always removing the first item
follows a complete example. the only difference, is that I am declaring the Dice within the v-for. var app = new Vue({ el: '#itens', data: { itens: [ { clube: "Clube 01", socio: "Socio 01" }, {…
vue.jsanswered Tobias Mesquita 22,900 -
1
votes2
answers1516
viewsA: Deserialize json string array to string array
try changing your classes to the following.: [DataContract] public class DadoPermissao { [DataMember(Name = "name")] public string Name { get; set; } [DataMember(Name = "value")] public string Value…
-
1
votes1
answer61
viewsA: How to organize the Theme Directory
The location of your scripts/styles is something very personal, you can put these files in the folder Script/Content or in a folder reserved for frameworks and blibiotecas third-party. I would…
-
1
votes1
answer252
viewsA: finalize process
Jonathan, if you are saving the spreadsheet on disk just so you can read it using Excel.Application, then try saving it under a temporary name. string extensao = Path.GetExtension(upload.FileName);…