Posts by Jordão • 1,127 points
11 posts
-
0
votes6
answers1877
viewsA: Code refactoring to convert GPS coordinates into DMS format into an array
There are a number of problems mainly caused by user-entered tabs In this case perhaps it would be better to change the user interface so that they do not have as much freedom to enter the values. I…
-
9
votes3
answers12452
viewsA: How to perform a function after two or more asynchronous events?
As you mentioned, you can use jQuery Deferreds (something like "postponed") and Promises (promises). You call all actions you wish to occur concurrently within a $.when(...): $.when(acao1, acao2)…
-
3
votes1
answer267
views -
3
votes4
answers2589
viewsA: Is it possible to create an 'abstract class' in Javascript?
One way to build an abstract "class" with the usual inheritance of Javascript prototypes is by using a constructor like the following: /** * Construtor da classe abstrata. * @abstract * @constructor…
-
7
votes4
answers3196
viewsA: What is good practice when casting an exception within if?
Your if is a "Guard clause": a clause that, if true, prevents the execution of the rest of the method code (or a loop). Guard clauses always contain "jump" code, such as return, throw, break or…
-
2
votes1
answer130
viewsA: getcontext reading error when inheriting the createjs. Sprite class
Pass your image to the Bot, and this error will no longer occur: function handleImageLoad() { oBot = new Bot(oBotImage); // << mude aqui! oStage.addChild(oBot); oStage.update(); } Note that,…
-
51
votes5
answers9611
viewsA: How do Closures work in Javascript?
"Closures" (something like "closing") are functions that "capture" variables coming from outside the function. In English it is said that a "closure" close-ups over (closes on) certain variables. A…
-
5
votes2
answers2183
viewsA: How to set the cursor position in an editable element?
You need to use the objects Range and Selection to obtain a selected range within the element: // marca lugar para posicionar o cursor em `editor` var marker = '{|}'; // cria intervalo var range =…
-
5
votes7
answers25439
viewsA: How to convert a JSON response to a C#object?
You can use the method Json.Decode (part of ASP.NET MVC) to obtain a dynamic object with JSON properties: dynamic pessoa = Json.Decode(json); Console.WriteLine(pessoa.name); And if you have a class…
-
6
votes4
answers1385
viewsA: How to replace {vars} in a string?
One idea is to use a IFormattable that understands its formats. For example, if you have such a class: class Modelo : IFormattable { public string Usuario { get; set; } public DateTime Horas { get {…
-
2
votes2
answers173
viewsA: How to force the version of a Maven plugin?
You can try using the section pluginManagement to fix the desired version of the plugin: <pluginManagement> <plugins> <plugin> <artifactId>C</artifactId>…