I'm fairly new to JavaScript and TypeScript. As far as I'm concerned, TypeScript is compiled into regular JavaScript. Coming from C#, where objects are passed by reference (if they're not primitive types or structs). I've written some TypeScript code to test something: interface IRunner {      run(): string; }  class TestDI {     private readonly Runner: IRunner;      constructor(runner: IRunner) {         this.Runner = runner;     }      test(): void {         console.log('Result of runner: ' + this.Runner.run());     } }  class FooRunner implements IRunner {     run(): string {         return 'Foo';     } }  class BarRunner implements IRunner {     run(): string {         return 'Bar';     } }  let runner: IRunner; runner = new FooRunner();  const SUT: TestDI = new TestDI(runner);  // Expected output: Foo // Actual output: Foo console.log(runner.run());  // Expected output: Foo // Actual output: Foo SUT.test();  runner = new BarRunner();  // Expected output: Bar // Actual output: Bar console.log(runner.run());  // Expected output: Bar // Actual output: Foo SUT.test();  In the code above I've passed an instance of IRunner interface into a class c-tor, then, a field of my class is populated with whatever I passed in the c-tor. Later in the code I change the variable I passed into the c-tor, however, when I call the test function Runner field of my class seems to not reflect any changes done on the original variable I passed when creating an instance of my TestDI class. In C# the code I've written would behave as I expect it to. But here it's not. What's going on?
The primitive types (number, string, etc.) are passed by value, but objects are unknown, because they can be both passed-by-value (in case we consider that a variable holding an object is in fact a reference to the object) and passed-by-reference (when we consider that the variable to the object holds the object itself).  Although it doesn't really matter at the end, I want to know what is the correct way to present the arguments passing conventions. Is there an excerpt from JavaScript specification, which defines what should be the semantics regarding this?
How do I find the length of an array? I know Newton's third law of motion might be the answer for this but still I am wondering how the rockets could thrust in the empty space and move in the opposite direction. I guess an astronaut wouldn't be able to push in the empty space with his hands or legs to move himself, but with a rocket engine it's possible. How? What might be the explanation for this in General Relativity? I'm not sure if this is possible architecturally, but when judging whether to set a bounty and how much it should be, it would be nice to see the impact based on our previous questions. If you're not visiting the site throughout the day, there is no way to tell how effective that bounty might be--particularly for increasing traffic. There is a similar question with adding and removing tags that increase the visibility in the right places, and the effect on views that may have. Auto mount a disk drive in ubuntu 14.04 LTS (Bookmark directory not found) Debugging using Nvidia Nsight 2.2 in Visual Studio 2010 I have used the code shown below to draw a static CMOS inverter. I have tried to use the TikZ library calc to calculate the point at which drains of the PMOS and the NMOS devices meet; and the mid-point of the line which connects the gates of the two devices. Apparently calc gets the y coordinates of the points right. However, calc seems to get the x coordinates of the points wrong. What could I be doing wrong?  Here is the TikZ code:  \documentclass{standalone} \usepackage[americaninductors]{circuitikz} \usetikzlibrary{calc} \begin{document} \begin{circuitikz} \draw % Draw MOSFETs: (0,0) node [pigfete,yscale=-1,anchor=S] (M1) {} (M1.D) node[nigfete,anchor=D] (M2) {} (M1.G)--(M2.G) % The line connecting the gates of the MOSFETs. ; % Draw the power rails: \draw ($(M1.S)-(2.0,0)$) -- (M1.S) -- ($(M1.S)+(1.2,0)$); \draw ($(M2.S)-(2.0,0)$) -- (M2.S) -- ($(M2.S)+(1.2,0)$); % Input and output nodes: \node (I) at ($0.5*(M2.G)+0.5*(M1.G)$) {}; % The mid-point between the gates. \node (O) at (M1.D) {}; % The point at which the drains of the MOSFETs are conneted. % The Input and output lines. \draw ($(I)-(.8,0)$) -- (I); \draw (O) -- ($(O)+(0.8,0)$); \end{circuitikz} \end{document}   Here is the figure that I get: Note that that input and the output lines are not connected to the rest of the circuit. Can we attribute the problem of the lines not being connected, to the rest of the circuit, to the way I am using calc? Book series about aliens who put "caps" on people to control them I remember reading a series when I was around 7th or 8th grade about aliens who had taken over Earth by putting metal caps on people when they were "entering adulthood" to control them (not direct control, but it would keep them from rebelling). There was a faction of people who able to escape and had fake caps and would save teens who were about to be capped.  The main protagonist was a teen boy who was a boxer (or training to be a boxer or something). The aliens would hold tournaments for the humans and whoever won would be "worthy" to serve as personal slaves to the aliens.     The protagonist won and was able to get inside to try and learn more about the aliens from the inside. Aut $\mathbb Z_p\simeq \mathbb Z_{p-1}$ Flag apron shows superfluous closing anchor tag I awoke this morning to a spam flag on a site I moderate, and noticed this when I went to read the post.    Notice answered&lt;/a&gt;, which I imagine isn't meant to have the &lt;/a&gt; there.  I also confirmed that this displays asked&lt;/a&gt; for other types of flags (namely, closed without comment).   I looked around for a duplicate of this but can't seem to find it, so maybe it's a recent change? I am using Paint to draw some swords for a character I have. I am not very experienced and this is my first time trying to draw swords.  My question is how large (Preferably in pixels) do I need to make the picture to make the curves on the sword to look smooth. I am using current scale of 100 pixels = an inch. For the first sword I made this worked fine as there were few curves and they were small but the one I am working on now have a larger curve. (A good reference is .)   EDIT: I only have access to paint. I would use other programs if I could. Suppose $X$ is infinite and $A$ is a finite subset of $X$. Then $X$ and $X \setminus A$ are equinumerous Suppose that $X$ is infinite and that $A$ is a finite subset of $X$. Then $X$ and $X \setminus A$ are equinumerous.     My attempt:  Let $|A|=n$. We will prove by induction on n. It's clear that the the theorem is trivially true for $n=0$. Assume the theorem is true for all $n=k$. For $n=k+1$, then $|A \setminus \{a\}|=k$ for some $a \in A$. Thus $X \setminus (A \setminus \{a\}) \sim X$ by inductive hypothesis, or $(X \cap \{a\}) \cup (X \setminus A) \sim X$, or $\{a\} \cup (X \setminus A) \sim X$. We have $\{a\} \cup (X \setminus A) \sim X \setminus A$ since the theorem is true for $n=1$. Hence $X \setminus A \sim \{a\} \cup (X \setminus A) \sim X$. Thus $X \setminus A \sim X$. This completes the proof.       Does this proof look fine or contain gaps? Do you have suggestions? Many thanks for your dedicated help!     Update: Here I prove that the theorem is true for $n=1$.  Assume that $A = \{a\}$ and consequently $X \setminus A= X \setminus\{a\}$. It's clear that $|X \setminus A| \le |X|$. Next we prove that $|X| \le |X \setminus A|$. Since $X$ is infinite, there exists $B \subsetneq X$ such that $B \sim X$ (Here we assume Axiom of Countable Choice). Thus $|X|=|B|$. There are only two possible cases.   $a \in X \setminus B$   Then $B \subseteq X \setminus \{a\}=X \setminus A$ and consequently $|X|=|B| \le |X \setminus A|$. Thus $|X| \le |X \setminus A|$ and $|X \setminus A| \le |X|$. By Schröder–Bernstein theorem, we have $|X \setminus A| = |X|$. It follows that $X \setminus A \sim X$.   $a \in B$.   Let $b \in X \setminus B$. We define a bijection $f:X \setminus \{a\} \to X \setminus \{b\}$ by $f(x)= x$ for all $x \in X \setminus \{a,b\}$ and $f(b)=a$. Thus $X \setminus \{a\} \sim X \setminus \{b\}$. Since $b \in X \setminus B$, it follows from Case 1 that $X \setminus \{b\} \sim X$. Hence $X \setminus \{a\} \sim X \setminus \{b\} \sim X$. Thus $X \setminus \{a\} = X \setminus A \sim X$.  To sum up, $X \setminus A \sim X$ for all $|A|=1$. Short story from many years ago: the ancient, brilliant, cruel race was Earthlings Tsunami dampening mechanisms GetFeatureInfo from Image WMS Is the axiom of choice used in the proof that every open set is the union of basis elements (Mukres, Lemma 13.1) How to show $a,b$ coprime to $n\Rightarrow ab$ coprime to $n$? Let $a,b,n$ be integers such that  $\gcd(a,n)=\gcd(b,n)=1$. How to show that $\gcd(ab,n)=1$?   In other words, how to show that if two integers $a$ and $b$ each have no non-trivial common divisor with and integer $n$, then their product does no have a non-trivial common divisor with $n$ either.     This is a problem that is an exercise in my course.   Intuitively it seems plausible and it is easy to check in specific cases but how to  give an actual proof is not obvious. Why does this function return a different value every time? Computing the $n^{\textrm{th}}$ permutation of bits. I've seen  post about the $n^{\textrm{th}}$ permutation of a set but that is not what I need. If you have a bit string (ones and zeros only) there are  to quickly permute the NEXT lexicographically ordered bit permutation. For example take $$000111 \rightarrow 001011 \rightarrow 001101\rightarrow\cdots$$ etc. If the string is long then there are going to be approximately one Bajillion of these things. And I want to know how to compute the $n^{\textrm{th}}$ guy without doing the exhaust.  Backgound: This is for a parallel computing job where I need to farm out the search space of elements of a set.  Foreground: I own a copy of Knuth's 4th volume of "The Art of Computer Programming" and I think the answer is in there but I can't seem to find it. (It's like 900 pages).  I'm posting here in the hopes that someone has knowledge of this (obviously). Even if you can point me to a source, say the part in Knuth's book where he describes this problem I would be most grateful. I'm heading to India next week and have a connection in Munich, Germany. I made the mistake of booking a flight with only an hour and a half layover (freaking out!) and I'm wondering if I'll have to go through customs in Munich or if I can pass right on through. Gimp won't allow me to copy and paste a transparent image On the latest version of GIMP on my PC, whenever I try to copy a transparent image from the internet, GIMP will automatically fill in the transparent areas with the background color I have selected.  This is a non-issue on my Mac, but I need to do this work on my PC, so how can I make it recognize the alpha of the image and not fill it with the background color?  The image canvas that I'm working with does have an alpha channel, but that does not seem to make a difference.