Object property undefined (javascript) i didn't understand why my canvas wasn't drawn. With a little of debugging i discovered that at row 35 the property x of the object "item" returns undefined [ canvasContext.fillRect(item.x, item.y, 5, 5) ]. Someone can explain me why?    var players = []; players.push(new Player(100, 200)); players.push(new Player(300, 200)); players.push(new Player(400, 400)); players.push(new Player(200, 200));  function Player(x, y) {   this.x = x;   this.y = y; }  function auto() {   setInterval(     function() {       movePlayers();       updateCanvas();     },     1000   ); }  function movePlayers() {   for (var item in players) {     item.x += 1;     item.y += 1;   } }  function updateCanvas() {   var canvas = document.getElementById("canvas");   var canvasContext = canvas.getContext("2d");   canvasContext.clearRect(0, 0, canvas.width, canvas.height);   for (var item in players) {     canvasContext.fillRect(item.x, item.y, 5, 5);   }  } auto() &lt;canvas id="canvas"&gt;&lt;/canvas&gt;
JavaScript for...in vs for Do you think there is a big difference in for...in and for loops? What kind of "for" do you prefer to use and why?  Let's say we have an array of associative arrays:  var myArray = [{'key': 'value'}, {'key': 'value1'}];   So we can iterate:  for (var i = 0; i &lt; myArray.length; i++)   And:  for (var i in myArray)   I don't see a big difference. Are there any performance issues?
I usually try to avoid lens flare, usually by avoiding shooting directly into bright lights (or using  to minimize it). However, sometimes I find a situation where lens flare actually adds to the image.  What can I do to effectively incorporate lens flare into my image? Also, are there any ways to do so while minimizing loss of contrast? I am aware    but I ask this regarding SE-2.0 sites, as the example I will take gaming:  Both answers on the question  make perfect sense to me, i.e. on the one hand this might overuse the tagging system but on the other hand it would help a lot for filtering.  Therefore I suggest a system which, in this case, would internally store the platforms to which a tag is relevant and   if a question is tagged with one of these platforms, nothing special will happen and the question is to be considered platform specific (e.g. a bug which only appears on the PS3 version) if the question is not tagged with a platform, the only result will be that the tag filter mechanism works a bit different compared to what would happen if the question was (invisibly) tagged with all platform tags:   If the invisible tagging is definite on interesting or ignore (i.e. there is not at least one ignored and one interesting tag) the usual mechanism works. if the tagging is ambiguous (i.e. contains both interesting and ignored tags), no filtering happens at all    The actually attributed tags must of course override this behaviour. That way questions about a game one likes but which is available for a platform one doesn't care about will still be highlighted unless specifically tagged with that platform, but no additional tags have to be used to filter a game which is only available on ignored platforms.  This can of course easily be extended to other sites, e.g. the  may be interesting both general and for c++ but totally uninteresting if the question is only about a JavaScript implementation.  I am only unsure whether search should include those hidden tags, too. It's been more than a month since I have started using . It has these users with user names in the format of "user-random number". I have observed them in some of the stack activities, most of the time asking questions.   Does the moderators create them for their own purpose. If yes what purpose do they serve?   I mean a user is free to have any user name. But it's just a hunch that such users are actually moderators. I may be wrong; just need some clarification. I want to prove that if we have a commutative integral domain $D$ with field of fractions $F\neq D$ then $F$ is not finitely generated as a $D$-module. (In this question it may be the case that $1\not\in D$.)    My original plan was to localize at a maximal ideal and then use Nakayama's lemma but as we don't have a $1$ our localization may not be local (in fact we need not have maximal ideals).  So I'm a bit lost as to where to go?  Thanks for any help. What Is Exponentiation? SharePoint Current User View using JavaScript $\left|x_{n+1} - x_n\right| < C\left|x_n - x_{n-1}\right|$ prove this is Cauchy How to install gail and atk-bridge? "Whether" Vs. "If" Could someone please help me with these sentences? I need to know  Which one doesn’t sound natural? Which one is formal and which one is not?   A - I don’t know whether this word fits in the sentence. B - I don’t know if this word fits in the sentence.   C - I don’t know whether or not this word fits in the sentence. D - I don’t know if or not this word fits in the sentence.   E - I don’t know whether this word fits in the sentence or not. F - I don’t know if this word fits in the sentence or not.  For me only D doesn't work and sounds not idiomatic. Meanwhile for me all of these sentences can be used in both written and spoken languages. Do you confirm me? I have a local user on my laptop. My company is migrating to a domain setup and I want to migrate the local user to a domain user, with all the settings (desktop, Start menu, programs) intact. How can I do that?  Also, is it possible to have a local user with the same settings as the domain, for when I'm working on my laptop while not connected to the domain? Question on groups of order $pq$ I would like to know if my brother can fly by United Airlines from USA to El Salvador, and my father, from El Salvador to USA using the same round trip ticket, both of them have the same name. What are routed events and how it's different from normal events How to open a terminal from within Atom? I'm currently working with Atom, and sometimes I want to open a terminal on the directory my working file is. To do this, I usually have to open the folder in nautilus (right clicking the file in atom) and then I open a terminal on that directory from nautilus (right click).  I wonder if there is a way to open the terminal in the file directory without having to open nautilus first. I just installed a fresh install of 32-bit 12.04 LTS Pangolin today. When I tried to install a few applications, it was really slow. But when I download a .deb or .tar.gz file from on my web browser, it is a lot faster.  Computer specs:  HP Pavilion Slimline s7700n PC  [Memory]         873.7 MiB  [Processor]      AMD Athlon(tm) 64 X2 Dual Core Provessor 3800+ x 2  [Graphics]       GeForce 6105 LE/integrated/SSE2/3DNOW!  [Disk Size] 638.5 GB  I normally get 200-400 kbps.  This is the comparison. Is there a difference between foo(void) and foo() in C++ or C? Consider these two function definitions:  void foo() { }  void foo(void) { }   Is there any difference between these two? If not, why is the void argument there? Aesthetic reasons? %AX = (%AH + %AL)  So why not %EAX = (%SOME_REGISTER + %AX) for some register %SOME_REGISTER? Double integral with transformation; possible error in limits I'm asked to show that the following integral is true with the transformation $u = x+y$ and $y=uv$:  $$\int_0^1 \int_0^{1-x} e^{y/(x+y)} dx dy = \frac{e-1}2 $$  I found the determinant of the jacobian of the transformation is $-u$, and the exponent is just $v$ so the integral becomes $$\iint_R |-u|e^v du dv = \frac {u^2}2 e^v|_R$$ $$=\frac{(x+y)^2}2e^{y/(x+y)}|_{x=0}^{1-x}\;|_{y=0}^1$$ And plugging it all in doesn't work (AFAICT). For one, the x's don't all cancel.  I've looked at it 100 times. It's definitely written dxdy not dydx even though there is definitely an x in the integral. Maybe this is a typo and why my calculation isn't working out? I tried reversing the order to dydx and it didn't work. I tried changing the limit of integration to $1-y$ and it didn't work out.  I'm not even sure how to figure out the domain of integration in the uv-plane. Flipping things around yields y=uv and x=u-uv. But if my domain is bounded by x=0 and y=0 and y=1 (ignoring the last limit for now), then I have uv=o=u and uv=1. !?!  Am I just making an algebra mistake plugging everything in? Is there a way to handle a variable in it's own integral that I'm unaware of? What was the Historical Precursor for .NET Attributes? What languages or platforms influenced the .NET 1.0 Team to build-in the concept of Attributes from the very start? Was this an Aspect-Oriented thing? Serialization? or something else? I was still in VB6-land at this time, and never used any of the pre-1.0 .NET versions. Can Superman see through his eyelids? Given that his x-ray vision allows him to see though skin, can he use this ability with his eyes closed? Or do they prevent it somehow?