Posts by afsantos • 1,584 points
10 posts
-
4
votes1
answer963
viewsA: Permutation between two vectors
Preamble The answer comes late, but maybe it helps someone anyway. I followed his example, and used only arrays. Using classes and objects it is possible to clean this code a bit. Unlike your…
-
1
votes2
answers97
viewsA: Attr with Internet Explorer
I do not have Internet Explorer 8 to try to reproduce the problem, but I leave some tips that may be at the origin of the problem. Your HTML has some errors, although I think copy-paste errors for…
-
3
votes2
answers469
viewsA: jQuery onload x jQuery onDomready
This is the biggest difference between the two events. With DOMContentLoaded, scripts start running as soon as the DOM (page HTML) is ready to be accessed by Javascript. On the other hand, with…
-
14
votes4
answers47574
viewsA: Capture screen size at time of request
This issue on Soen may be of interest. In particular, I compile here some of the suggestions given. Get page and browser sizes with jQuery: $(window).height(); // altura do browser…
javascriptanswered afsantos 1,584 -
4
votes1
answer200
viewsQ: Basic competition in Erlang
Adapted of this issue no stack overflow international, whose answer is my own. The next code was given in a class. We tested the code, but I didn’t really understand how it works. How this code…
-
4
votes1
answer200
viewsA: Basic competition in Erlang
Let’s start by looking at the first two lines. -module(pingpong). -compile(export_all). The first is the statement of the module. Its argument is an atom (a word without quotation marks, in lower…
-
42
votes1
answer27667
viewsQ: Why and when to use Enum in Java?
Someone who is learning the language, novice or experienced, may never have crossed paths with Java enumerations. I have read several times that they are useful, for example, to implement the…
-
47
votes1
answer27667
viewsA: Why and when to use Enum in Java?
As enum represent a fixed set of values in a more or less self-documented. Make code more explicit, more readable, and less vulnerable to programming errors. A common alternative is to use String or…
-
21
votes4
answers44155
viewsQ: How to test null values in Javascript
I found the next code, and I got the impression that it didn’t make much sense. function (data) { if (data != null && data !== undefined) { // codigo } } From here, three different scenarios…
-
5
votes4
answers44155
viewsA: How to test null values in Javascript
One undeclared variable is different from having the value undefined. Example of an undeclared variable: var a; alert(b); // ReferenceError: b is not defined Example of a variable with the value…