I wanted to know if we can overload a function on prototype object in JavaScript?          function Person(name, family) {   this.name = name;   this.family = family; }  Person.prototype.getFull = function() {   return this.name + " " + this.family; };  Person.prototype.getFull = function(someParam) {   return this.name + " " + this.family; };   var p =  new Person(); p.getFull(); p.getFull(someparam);
What is the best way(s) to fake function overloading in Javascript?   I know it is not possible to overload functions in Javascript as in other languages.  If I needed a function with two uses foo(x) and foo(x,y,z) which is the best / preferred way:   Using different names in the first place Using optional arguments like y = y || 'default' Using number of arguments Checking types of arguments Or how?
How many Valyrian steel swords are there at the beginning of GoT, and who owns them? If $A$ and $B$ are compact subsets of $\mathbb R$, then so is $\frac{A}B$. Given compact $A,B \subseteq \mathbb{R}$ with $\alpha := \inf(B) &gt; 0$, define $$\frac{A}B := \left\{\frac{x}y : x \in A  \text{ and } y \in B\right\}.$$ Show that $\frac{A}{B}$ is compact.  I am thinking of using the following result given in a previous exercice but I don't know how to proceed.     $K \subset \mathbb R^n$ is compact if and only if for all $\{x_{n}\}$ such that $\{x_{n} : n\in \{1,2,\dotsc\}\}\subset K$, there exists a convergent subsequence $\{{x_{\phi(n)}}\}$ that converges to a limit $l \in K$.   When does the infimum come into place? To make Latin-letter variables bold I can use e.g. \mathbf{a}, but while putting Greek letters or symbols such as \nabla inside \mathbf doesn't cause any errors or warnings, it also doesn't do anything else.  What is the best way to make bold math symbols, in particular Greek letters and \nabla? Sensor for detecting airsoft bullet I'm trying to make airsoft chronograph/chronometer (a device that measures airsoft bullet speed). The idea is to measure time in which bullet is traveling from point A to point B, and then I can calculate bullet speed. Bullet is shot into plastic pipe with diameter of 32mm. I've tried to put on one side IR LED and on the other side phototransistor (BPW 40), both at the start and end of the tube. Something like this:  Blue circles are phototransistors, red circles are IR LEDs and white circles are airsoft bullets. When bullet passes through area where bullet 2  is drawn (just in between IR LED and phototransistor), everyting works perfectly. But when the bullet passes where bullets 1 and 3 are drawn, it isn't detected. That is expected, but unwanted behavior. So my question is: how can I detect bullets regardlessly of it's position ? I've thought about putting IR LEDs and phototransistors around the pipe (not only in one place), like this:  but this solution isn't cheapest: 5 IR LEDs + 5 BPW 40 = cca $12 times 2 (because I need it on both sides of the pipe) = $24. Is there any cheaper solution ? Is BPW 40 good choice for phototransistor ? I don't know which IR LEDs I'm using (and salesman in the store also doesn't know - he told me these are generic ones for remote controllers, like TV or DVD controller). Diameter of the pipe is 32mm and it will be long about 14cm (sensors will be 10cm apart). Diameter of airsoft bullet is 6mm. EDIT: I'll go for my second idea. I just have one more question: is it better to arrange IR emitters and photo transistors this way:  or this way:  Thanks !! How is $\ln(-1) = i\pi$? ... and why ?  Assuming $X_1$,$X_2$ are independent random-variables with mean $\mu_1,\mu_2$ and variance $\sigma^2_1,\sigma^2_2$ respectively. My basic statistics book tells me that the distribution of the $X_1-X_2$ has the following properties:    $E(X_1-X_2)=\mu_1-\mu_2$ $Var(X_1-X_2)=\sigma^2_1 +\sigma^2_2$   Now let's say $X_1$, $X_2$  are t-distributions with $n_1-1$, $n_2-2$ degrees of freedom. What is the distribution of $X_1-X_2$ ?   This question has been edited: The original question was "What are the degrees of freedom of the difference of two t-distributions ?". mpiktas has already pointed out that this makes no sense since $X_1-X_2$ is not t-distributed, no matter how approximately normal $X_1,X_2$ (i.e. high df) may be. Do I need a UK or Ireland transit visa when flying from the US to a Schengen country? What are the main differences between performing principal component analysis (PCA) on the correlation matrix and on the covariance matrix? Do they give the same results? Proving that $G$ is a group if $a*x=b$ and $y*a=b$ have solutions. (Reference : Fraleigh, A first course in abstract algebra)     Prove that a nonempty set $G$, together with an associative binary operation * on $G$ such that $a*x=b$ and $y*a=b$ have solutions in G, $\forall a,b\in G$, is a group.   Because * is an associatie operation, we have to prove that: there exists $e\in G$ such that $e*a=a=a*e$ for any $a\in G$, and that for any $a\in G$ there exists $\alpha \in G$ such that $a*\alpha=e=\alpha *a$.  This is very confusing, first I tried to prove the identity exists. If we consider a=b, then $a*x=a=y*a$, and because of the hypothesis $x,y\in G$ always exists, now we have to show that $x=y$, but I just can't do this with out inverses, so I tried to prove that the inverses exists, however I have no idea how the identity looks like, I'm stuck.  And I tried to get unstuck, so I thought particular cases, first if $G$ had only one element, then what would happend if it had just two elements... but I remembered that we don't know if G is finite or not, and I think this makes things a little bit more complicated.  What can I do? Mean of a Cauchy Distribution Applescript run from menu bar? Stopping all automatic updates Windows 10 We've upgraded some machines to Windows 10 and realized there were some updates which updated as required. However, I realized there was no option available to stop the download similar to that on Windows 7 and 8.1. The only way I could stop the download was to stop the Windows Update service.  My question is does anyone know of a way to stop auto updates or is stopping the service is the only solution? Why LastModifiedbyid in Trigger.new gives old value I have noticed the strange behaviour of salesforce due to which even my code broke down in production.  I was trying to stop the user from updating some field..I used before udpate trigger and code like Trigger.new[i].LastModifiedbyId..  Ideally it should give the current user in Trigger.new[i].LastModifiedbyId in  but it gives oldrecordLastModifiedbyId..  Although userinfo.getuserid resolves the problem later.  Any idea about this behaviour of salesforce. What are exchanges like "How are you," "I'm fine," and "See you later" called? Every finite subset of $\mathbb R$ contains its supremum (and its infimum)   Proof Let $A=\{a_1,...,a_n\}$ be a finite subset of $\mathbb{R}$. Since it is non-empty and it is bounded ($\max A$ is an upper bound), it has supremum, that is $\exists \sup A$ and by definition $\forall a \in A \;\, a \leq \sup A$. Let's suppose that $\sup A  \not\in A$ then, since $\max A \in A$ we have that $\max A &lt; \sup A$. But considering that $\mathbb Q$ is dense in $\mathbb R$ we can conclude that $\exists r \in \mathbb Q$ s.t. $\max A &lt; r &lt; \sup A$, but this is absurd since $r$ is an upper bound of $A$ and it is lower than the supremum. Necessarily, $\sup A\in A$.  Is there anything wrong? Is there any way to prove this without using density of $\mathbb Q$ or another property? Thanks in advance. Overview of basic facts about Cauchy functional equation Java rounding to nearest 0.05 Is there a correct gender-neutral singular pronoun ("his" vs. "her" vs. "their")? Is there a pronoun I can use as a gender-neutral pronoun when referring back to a singular noun phrase?  Each student should save his questions until the end. Each student should save her questions until the end. How do I restore iPhone 6s stuck on connect to iTunes screen/Apple logo I'm not really sure how, but after I woke up today, my phone was just displaying the loading spinner and doesn't start up anymore. It's weird because my phone turned off last night and suspecting that it was probably out of charge, I thought charging it overnight would fix the problem.   So, my iPhone is currently stuck on the iTunes/Apple Logo loop. When I put it into DFU/Recovery Mode and connect it to iTunes, it isn't able to restore it. It keeps throwing "Network Connection Problems" -- it downloads iOS 10 for a bit and suddenly stops downloading, throwing the error. I've also tried downloading a custom .ipsw from  but it seems that the file is corrupted whenever iTunes tries to unpack it.   Any thoughts on how I could go about fixing this?   Note - I don't have a jailbroken iPhone. Google page title not matching html  tag