what is the difference between a method within JS function and to it's prototype? As output of both the below JS class is same, then what is special here with prototype?  One of the feature of prototype is get rid of duplicate code, in what case this is possible with prototype?  1.     function Person(name) {         this.name = name;         this.sayName = function () {             console.log(this.name);         };     }     var person1 = new Person("Nicholas");     person1.sayName();   2.   function Person(name) {         this.name = name;     }     Person.prototype.sayName = function () {         console.log(this.name);     };     var person1 = new Person("Nicholas");     person1.sayName();
Use of 'prototype' vs. 'this' in JavaScript? What's the difference between  var A = function () {     this.x = function () {         //do something     }; };   and  var A = function () { }; A.prototype.x = function () {     //do something };
I would like to know how potential difference is created between two points?Is potential difference created by adding more electrons at one side?If that's the case how to add more electrons at one side?  I'm really looking to know what really constitutes potential difference? the output when I start firefox from Terminal How to circumvent using an out parameter in an anonymous method block? The following method does not compile. Visual Studio warns "An out parameter may not be used within an anonymous method". The WithReaderLock(Proc action) method takes a delegate void Proc().  public Boolean TryGetValue(TKey key, out TValue value) {     Boolean got = false;     WithReaderLock(delegate     {         got = dictionary.TryGetValue(key, out value);     });     return got; }   What's the best way to get this behavior? (Please refrain from providing advice on threadsafe dictionaries, this question is intended to solve the out parameter problem in general). https:// search results appearing on Google for purely http:// site Why do we say "eat healthy" instead of "eat healthily"? Why do we say "eat healthy" instead of "eat healthily", even though the latter is the only "correct" one, according to the comments in      What came first: ads saying "eat healthy", or the grammatical acceptability of such a phrase?    Merriam-Webster does not consider "healthy" to be an adverb, unlike "quick": , and therefore this question is not a duplicate of Can you construct a field with 4 elements? Can you construct a field with 4 elements? can you help me think of any examples? How can I set Excel to always import all columns of CSV files as Text? Though I try to avoid it, I occasionally have to open a CSV file in Excel. When I do, it formats columns containing numbers, which makes them useless for my purposes. As far as I can tell, the only way to prevent this from happening on import is to rename the file so the extension isn't .csv and use the import wizard to specify the format of each column individually. For files with 50-60 columns, this is impractical.  Since every answer for this oft-asked question on the internet suggests either some means of converting the formatted numbers back once the file is open (which won't work for me - I want to solve the general problem, not a few specific cases) or manually selecting the format type of each column (which I don't want to do), I'm looking for a way to set a global preference or style such that all columns of all CSV files opened are always formatted as text.  I know about "armoring" the numbers with quotes, too, but the files I get don't come like that and I was hoping to avoid having to pre-process the files so Excel doesn't screw them up.  Is there a way to do specifically this: Always format all columns in opened CSV files as text, without manually selecting each column every time during import?  I'm using Excel 2003, but I'll take answers for 2007 if that's what you know. LaTeX Error: Option clash for package xcolor I have an option clash between package xcolor and another package, but I don't know which. Here is my MWE  \documentclass[10pt]{beamer} \setbeamertemplate{navigation symbols}{} \usepackage{caption} \usepackage{subcaption} \usepackage{url} \usepackage{color} \usepackage[usenames]{xcolor}  \author{The author} \title{Package conflicts} \date{October 3rd, 2012}  \begin{document}  This is supposed to be \textcolor{olivegreen}{olivegreen} \end{document}   And the error message is :  This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian) entering extended mode (./error_xcolor.tex LaTeX2e &lt;2009/09/24&gt; &lt;blablabla&gt; ! LaTeX Error: Option clash for package xcolor.   I hope this is enough log for you guys. At this time of the day, I'm hoping for America to save my french ass ... again : ) Use SUM In Update Statement I am attempting to use SUM() in my SET statement for my UPDATE.  When I try this, I get an error of      Msg 157, Level 15, State 1, Line 234   An aggregate may not appear in the set list of an UPDATE statement.   What should I alter in my CTE so that I can run this update?    ;WITH CTE AS  (Select EC, CN, CID, EntryDate         FROM OPENQUERY(192.55.108.214,'select                                count(es.estimatenumber) As EC                               ,cm.an CN                               ,cm.am CID                               ,es.entrydate EntryDate                               from etalac es                                INNER JOIN bacalac cm                               ON es.CID = cm.am                               GROUP BY cm.an, cm.am, es.entrydate')) UPDATE d2016 SET TotalNumber = SUM(EC) FROM CTE cte INNER JOIN datafor16 d2016 ON cte.CID = ed2016.CID WHERE CAST(entrydate As Date) BETWEEN '01/01/2016' AND '01/22/2016'; Change style properties of several layers simultaneously? When to capitalize words such as "lake", and when can the whole word be omitted? Which of the following sentences are correct?     "He gave two examples of large lakes, Lake Michigan and Lake   Superior."      "He gave two examples of large lakes, Michigan and Superior."      "He gave two examples of large Lakes, Michigan and Superior."      "He gave two examples of large lakes, Lakes Michigan and Superior."   This question is primarily about what variants are formally correct, not which one sounds the best.  I think that the question should be valid for several words of the same kind, such as mountain (Mount), figure (Figure), table (Table) and so on. We have been asked to prove the above statement through the two sub-proofs:   Firstly we must prove that $e^x$ is increasing and then prove that $\log(x)$ is also an increasing function.   After we are asked to prove that using the delta-epsilion definition of a limit that $\lim_{x \to 0} e^x = 1$.   I have done all of this but still don't see where the instructor is going with this. I want to install Oracle's JRE and to update to the latest version with the Software Updater when they released. Is there a Ubuntu package that is provided by Canonical or Oracle?  Before release Java 7, I followed  to install Java 6.  But it doesn't work for Java 7. There is no package sun-java7-xxx. How can you install Java 7? Show intersection of two algebras are not a $\sigma$-algebra I have the following question:    $\textbf{Question}:$ Let $\mathcal{F}_1$ and $\mathcal{F}_2$ be two algebras. Is $\mathcal{F}_1 \cap \mathcal{F}_2$ a $\sigma$-algebra?  I believe the answer is no. I know the definition of an algebra and the definition of $\sigma$-algebra.    I'm assuming I need to show that the intersection of the finite unions of each algebra is finite, but then I get stuck trying to work out how to show it is not a $\sigma$-algebra.  All help is appreciated.  Many thanks, John Show that $\mathbb{Q}(\zeta_n)$ is Galois over $\mathbb{Q}$ and $Gal(\mathbb{Q}(\zeta_n)/\mathbb{Q}))\cong \mathbb{Z_n}^*$ Question 1: For $n \in \mathbb{N}$ explain why $\mathbb{Q}(\zeta_n)$ is Galois over $\mathbb{Q}$   We must show that it is normal and separable.   $\mathbb{Q}(\zeta_n)/\mathbb{Q}$ is normal since it is a splitting field for $X^n-1 \in\mathbb{Q}[X]$ (I think... Is this correct?).  It is separable because it is of characteristic $0$  Question 2: $Gal(\mathbb{Q}(\zeta_n)/\mathbb{Q}))\cong \mathbb{Z_n}^*$  Is this because the primitive nth root of unity $\zeta_n$ acts as a generator for a cyclic group? I am unable to fill out a decent proof on this.   Thanks for your help difference between "function foo() {}" and "foo() {}" I can define bash functions using or omitting the function keyword. Is there any difference?  #!/bin/bash  function foo() {   echo "foo" }  bar() {   echo "bar" }  foo  bar   Both calls to functions foo and bar succeed and I can't see any difference. So I am wondering if it is just to improve readability, or there is something that I am missing...  BTW in other shells like dash (/bin/sh is symlinked to dash in debian/ubuntu) it fails when using the function keyword. Real Numbers Raised to Imaginary Powers? What is a real number to the power of an imaginary or complex number? e.g. 3i. I have searched through sites about imaginary numbers, but none seem to say anything about imaginary indices. Examples and explanations would be appreciated. Confidence Interval Calculation I have temperature data of July 1991 to 2007, and wants to find the Confidence Interval at 95%, which distribution is best fit the data, Z or T. Please give me reason also.    minTemp = 14.4444, maxTemp = 38.3333, SizeofData = 527, (17 years) hist(July, 20), histfit(July, 20); Is there a consensus in the mathematical community, or some accepted authority, to determine whether zero should be classified as a natural number?  It seems as though formerly $0$ was considered in the set of natural numbers, but now it seems more common to see definitions saying that the natural numbers are precisely the positive integers. What is attached to this spigot and how to remove