Posts by Artur Trapp • 5,175 points
152 posts
-
3
votes1
answer28
viewsA: Promise does not execute . then()
I believe the problem lies in this line: request.onsucess = e => resolve(e.target.result); It is missing a 'c'. Thus the callback will never be called, and the Promise will never be resolved. The…
-
3
votes2
answers108
viewsA: Scope of variables in Javascript
This is because arrTimes does not exist in the context of its forEach, but rather in Campeonato. To fix this, just use keyword this to refer to the scope of Campeonato.…
javascriptanswered Artur Trapp 5,175 -
2
votes2
answers88
viewsA: ngFor does not give the expected result
The error is here: this.fil = [ { FI: element.FILIAL, porc: element.TOTAL } ] You are rebooting this.fil in each iteration of forEach, which means that it will always have only the current element…
-
0
votes2
answers154
viewsQ: Why . all in an empty list returns true?
I was having an error in a business rule, and when investigating, I arrived at the following code snippet, the intention of which is to verify that all the processes on a list are active: return…
-
1
votes1
answer108
viewsQ: How to move element in a straight line towards the coordinate?
I can move an element in the direction of the coordinate successfully. However, for what is needed, it must move in a straight line (which is the shortest possible distance between two points). In…
-
1
votes1
answer288
viewsA: Data update with IONIC and Firebase
Just use the method update, that you find in documentation: var objeto = { a : 'a', b : 'b' }; firebase.database().ref('caminho/para/o/meu/objeto').update(objeto) .then(function (retorno){ //se cair…
-
4
votes5
answers2296
viewsA: What good is a C#?
sealed, when used in a class declaration, prevents other classes from inheriting from it. public class TesteA { //... } public sealed class TesteB : TesteA { //... } In this case above, TesteB…
-
2
votes1
answer66
viewsQ: Microsoft Edge passing strange characters in AJAX call
I have an Ajax call on a web system, where you specify a date of dismissal, and fire an employee on that date: data is the parameter that comes with the Ajax call. When I test in Chrome or any other…
-
0
votes4
answers235
viewsA: Find out which div with the same class is larger
You just have to go through them all: var lista_imagens = $('.img'); lista_imagens.each(function (){ // aqui, seu this é a imagem da iteração corrente });
-
3
votes3
answers94
viewsQ: Because with Arrow functions the context is different from a common function?
In the snippet I prepared below, I have a table with some simple data. Below the table, there are two Abels that account for the total age of the data in the table. The first label is calculated…
javascriptasked Artur Trapp 5,175 -
1
votes1
answer963
viewsQ: Sort Array in Javascript
I have an Array with even numbers decreasing: var a = [20, 18, 10, 8, 6, 4, 2, 0] when I call a.sort(), he returns me the following: [0, 10, 18, 2, 20, 4, 6, 8] This ordination is not correct. How…
javascriptasked Artur Trapp 5,175 -
1
votes1
answer138
viewsA: ajax for notification
There are several techniques to keep information up to date with the server. This is one of them, and it is perfectly acceptable. There are other more up-to-date ways, but they have certain…
ajaxanswered Artur Trapp 5,175 -
4
votes1
answer125
viewsA: What does the Depth parameter of the json_encode() method mean?
It simply limits the maximum depth that will be processed. This one, is a depth array 1: array( 'foo', 'bar', 'baz' ) This, is a depth array 2: array( array( 'foo' ), array( 'bar' ), array( 'baz' )…
phpanswered Artur Trapp 5,175 -
2
votes1
answer155
viewsA: Function with if Javascript
The problem is here: document.getElementById('txtTipodePlano').value; When you create a control with runat="server", his id will change, unless ClientIDMode="Static". Therefore, he did not find the…
-
0
votes1
answer137
viewsA: Uncaught Typeerror: $(...). fullcallendar is not a Function
There is a typo, you typed: $('..').fullcallendar The correct one is with a capital C and only one l in Calendar: $('...').fullCalendar
fullcalendaranswered Artur Trapp 5,175 -
2
votes1
answer188
viewsQ: Canvas increasing the animation speed with each change of animation
I’m animating some sprites from LPC on a canvas, using Javascript. However, every time I change animation, the animation starts to get faster. The test can be done in the code below. Just press any…
-
5
votes2
answers1311
viewsA: What is the "Pointer-Events" property for?
pointer-events controls how that element will respond to user mouse events. Few options: none - cancel the entire mouse event auto - restores mouse events to normal. It can be useful for child…
css3answered Artur Trapp 5,175 -
1
votes2
answers476
viewsA: Request ajax with append before opening modal
The problem with your code is that your table is called tabelaUploads, and you’re looking for a tbody in the body of this table here: $('#bodyTabelaUploads tbody'), which will return nothing. Change…
-
1
votes0
answers33
viewsQ: How to detect slow internet?
Is there any minimally reliable way to detect that the user is on a slow connection? Basically, in my application, I would like to detect such a condition and omit to upload some complementary…
-
2
votes3
answers40
viewsA: System.Nullreferenceexception in an attribute of type Stringbuilder
listNewsletter is null, so listNewsletter.AppendLine will fire a NullReferenceException You can fix this by initiating listNewsletter in the builder of his class: public class modelExemplo { public…
-
0
votes2
answers142
viewsQ: How to prevent a modal from appearing?
Is it possible to prevent a modal from appearing if a certain condition is reached? Example of what I want, more or less: <button id="abreModal" class="btn btn-info btn-lg" data-toggle="modal"…
-
5
votes1
answer1089
viewsQ: How does the for(;;)work?
It’s probably duplicated, but I didn’t find it here on Sopt, and I don’t know how to Google. How the loop works for in that syntax? for(;;) { //... }…
-
7
votes2
answers2509
viewsA: What is the function of Function in jQuery and what is the right way or time to use?
$(function() { ... }); is just a shorter way of writing $(document).ready(function() { ... }); both will be executed when your DOM is ready for use. Look at this snippet of code: $( document…
-
5
votes2
answers8130
viewsA: Is it possible to read a. txt file in Javascript?
I believe with a simple XMLHttpRequest this is possible. Remember that server requests are asynchronous, so they are not executed in the order you read the code. That’s why we always provide…
-
4
votes3
answers230
viewsA: Why are methods that operate pointers insecure in . NET?
What does this modifier do? Code blocks formed with unsafe allow the use of pointers within it, example: using System; class MyClass { public unsafe static void Main() { int numero = 10; int*…
-
3
votes1
answer43
viewsA: Overload Error C#
This happens because your lsvRecebeGrupoLayout_ItemCheck is a method whose signature is not valid to be an event Handler ItemCheck. According to the specification, the method signature shall contain…
c#answered Artur Trapp 5,175 -
2
votes3
answers70
viewsQ: Prevent a value from being selected in the dropdown
Is there any way to prevent a value from being selected in a dropdown? For example: document.getElementById('teste').onchange = function (event){ var valor = this.value; if(valor == 4){ alert('esse…
-
1
votes2
answers100
viewsA: Jscript - Finding the id of the previous div
Just take the attribute id of parentNode of DIV2: //função executada no clique function onClick(){ //pega a div2 var div2 = document.getElementById('DIV2'); //pega o pai da div2 var div1 =…
-
4
votes4
answers2886
viewsA: Convert HTML to PNG
I think it is not possible to save a screenshot with Javascript. But an interesting alternative is to draw the html you want in an element canvas, and then use the method toDataURL() to take the…
-
2
votes2
answers78
viewsQ: What is the correct way to send a form to a controller via AJAX?
I have a simple form, which is basically my Viewmodel. I am doing a post via AJAX passing this form, however, on the server side, everything is always null. My AJAX is as follows: var formData =…
-
14
votes3
answers353
viewsQ: Is it possible to prevent one of the attributes of an object from being serialized in Javascript?
Is there any way to prevent one of the attributes of an object from being serialized? Take as an example the object below. If I do not want propriedade2 be serialized, how could I implement this?…
-
0
votes2
answers2684
viewsA: Read . js file and write to page using javascript
You can save your data to a file .js in JSON format, read it and display as you wish in the event window.onload. Follow a short example: var dados = { objeto1:{ nome: 'teste', valor: 'batata' },…
-
-1
votes2
answers1585
viewsQ: What are the advantages and disadvantages of developing or not with Android Studio?
Using technologies like Xamarin, it is possible, with some changes, to develop the same application for several platforms having a great reuse of code. Already, with Android Studio, it is possible…
-
3
votes1
answer67
viewsA: Functions perform out of order
This is because these functions are asynchronous. This means that the response of each of the requests will return when the server can respond, and this does not follow the order of the request. To…
javascriptanswered Artur Trapp 5,175 -
1
votes1
answer7626
viewsA: How to exchange images in javascript and Html5?
Try changing the name of the int variable, since it is a reserved Javascript word. There is also no need to pass a parameter to the function, since the variable int was globally declared var num =…
-
0
votes2
answers1855
viewsA: Create an id for an element from a condition with Javascript
If you just add or change the attribute id, just do: $(this).attr('id', 'SeuValor'); In the case, $(this) refers to who triggered the input event. But you can switch to another selector freely.…
-
3
votes1
answer93
viewsQ: What are the advantages of using "currying" in a function?
I understand that, roughly speaking, to use currying is to break a function that takes several arguments into smaller functions that receive only parts of the arguments of the original function.…
-
6
votes1
answer80
viewsQ: Doubt about $.post and $.ajax behavior
I’ve always been used to using $.ajax() for all my requests of the type, and this works perfectly. An example that is even occurring now is the following: $.ajax({ type: "POST", url:…
-
5
votes2
answers116
viewsQ: Function() X Function.call()
When analyzing Javascript/jQuery plugin code, I often see functions being invoked with .call(). I understand that by calling the functions in this way, the first parameter passed is the this (in…
-
5
votes3
answers370
viewsA: Private set of property in an interface
According to that one answer, you define only the getter of property: interface IFoo { string Name { get; } } And you can extend it in class to have a setter private: class Foo : IFoo { public…
-
2
votes0
answers162
viewsQ: Monetary value in full in Javascript
I wonder if there is any alternative (maybe some library) to write monetary values in full in Javascript, for example: Input -> 22,70 Output -> Twenty-two reals and seventy cents…
javascriptasked Artur Trapp 5,175 -
6
votes1
answer69
viewsA: How to debug a code in Jsfiddle?
You can use the command debugger; on some line of your code, so the debugger will stop there and you can debug. document.getElementById('teste').onclick = function (){ debugger; alert('teste'); }…
-
3
votes0
answers112
viewsQ: Difference between Get and Post AJAX
In AJAX, I have the functions $.post and $.get. I’ve always used the $.post, and never had a problem. But what’s the difference between them? In what situations I should use each? I searched here in…
-
9
votes2
answers993
viewsQ: Is there the equivalent of Andalso and Orelse in C#?
In VB.NET there are two interesting operators: the AndAlso and the OrElse. When used, the logical expression is not evaluated in full immediately. See the following example: If (Not Usuario Is…
-
2
votes4
answers10576
viewsA: To create a folder named after the current date in Windows cmd.exe
Since the requirement is only to show the whole date, try: mkdir %date:/=%
-
2
votes2
answers243
viewsA: Mark checkbox if value equals 1
To mark checkbox with jQuery, you can use the .prop('checked'), and set its value as true or false $(document).delegate('#txtChecar','keyup',function (e) { //Verifica se o valor digitado foi igual a…
-
3
votes1
answer37
viewsQ: Why can I invoke functions without parentheses in VB.NET?
In C#, this code does not compile: public static string Teste(){ string val = ""; return val.Trim; } Because the function Teste requires a return of the type string, and Trim is a MethodGroup. That…
-
1
votes1
answer95
viewsQ: How can I intercept click on link within Webview?
In my Android app, I have a webview that opens several different websites. Everything works in the compliant, but when there is a link on the page, and the user clicks on this link, the browser…
-
7
votes1
answer1399
viewsA: What is the difference between Alt, poweroff and reboot?
What in fact is Halt? Halt is a command that for all CPU’s present in the system. What are his stages? The boot stages are 6, as you said, which are as follows:: BIOS - performs some integrity…
linuxanswered Artur Trapp 5,175 -
4
votes1
answer55
viewsA: Function changing the string
Just add charCode to the desired amount, and then check which character that number equals: function trocar(){ var s = document.getElementById('seutexto').value; var q =…
javascriptanswered Artur Trapp 5,175