I'm part of a small study group at work that's trying to get a better grasp on what makes JavaScript tick. In our recent discussions about objects, we've learned that an object's public methods are recreated each time an object is instantiated, while methods assigned to the object's prototype are only created once and inherited by all instances. From what I understand, both public methods and those assigned to the prototype are publicly accessible.  The question I have, then, is why bother creating public methods at all if adding to the prototype is apparently more efficient? What benefit does the public method provide that the prototype doesn't?
What's the difference between  var A = function () {     this.x = function () {         //do something     }; };   and  var A = function () { }; A.prototype.x = function () {     //do something };
Given this (very) tricky determinant, how can we calculate it easily?  $$\begin{pmatrix} \alpha + \beta &amp; \alpha \beta &amp; 0 &amp; ... &amp; ... &amp; 0 \\ 1 &amp; \alpha + \beta &amp;  \alpha \beta &amp; 0 &amp; ... &amp; 0 \\ 0 &amp; 1 &amp; \alpha + \beta &amp; \alpha \beta &amp; ... &amp; ... \\ ... &amp; ... &amp; ... &amp; ... &amp; ... &amp; 0 \\ ... &amp; ... &amp; .... &amp; ... &amp; ... &amp; \alpha \beta \\ 0 &amp; 0 &amp; 0 &amp; ... &amp; 1 &amp; \alpha + \beta   \\ \end{pmatrix} \in M_{n\times n}$$  EDIT:     I have to prove it is equal to $\frac{{\alpha}^{n+1} - {\beta}^{n+1}}{\alpha - \beta}$   Any help is appreciated, I just could not find a trick to ease it up! When should end punctuation go inside quotes? I have been/am being taught that end punctuation should always go inside quotes. For example, you are supposed to write:     Marvin thought it was "awful."   The problem is I do not see how does this make sense. Intuitively, I always wrote:     Marvin thought it was "awful".   as that makes more logical sense — you want a quote to be an exact replication of what somebody else said, so why should you add punctuation inside?  I always thought it made more sense to not touch the quote and add anything after or before if it must be added.  So, why should I put end punctuation inside quotes? Is cancer caused by vitamin B17 deficiency? How to remove my passport from a blacklist in Indian Immigration? Let $(\Omega, \mathcal F,P)$ be a probability spaces and $H$ be a Hilbert space. By a random operator $A$ from $H$ to $H$ we mean a linear continuous mapping from $H$ into the Frechet space $L_0^H (\Omega, \mathcal F,P)$ of all $H$-valued random variables. My question is: How Can we define $|A|$ and the adjoint $A^*$? What split-screen options are available in Battlefront? How many players can play split-screen, and what game modes are (or aren't) available?   How many players can play local co-op? How many players can play local multiplayer? How many players can play online multiplayer from a single console? I use bash on both my Mac and as my cygwin shell. Overall, I'm quite pleased with it.  My one complaint however is that its TAB completion isn't as good as Windows Command Line TAB completion.   For example, if there are two files with the same prefix, then bash just beeps at me when I try to TAB complete. If I keep nailing TAB, then it will eventually show me a list of potential files.  I definately prefer how Windows will cycle through potential files right on the command line.   Is there a way to get bash to operate similar to Windows Command Line in this regard?  If there isn't (I do not want to switch shells), am I missing something about TAB completion in bash? Is there a more efficient way to use it? Almost all standard sources on the existence of Majorana spinors (e.g. Appendix B.1 to Polchinski's "String Theory", Vol. 2) do so in a way I consider inherently ugly:   A priori, we are dealing with an irreducible complex representation $(V,\rho)$ of the Clifford algebra of signature $(p,q)$, i.e. generalized Dirac spinors. That Majorana spinors exist means abstractly that there is a  on $V$, i.e. a conjugate-linear map $\phi : V\to V$ with $\phi^2 = \mathrm{id}_V$ that commutes at least with the $\mathfrak{so}(p,q)$ action.  Every single source I can find for Majorana spinors uses operations like the transpose, complex conjugation and Hermitian adjoint on the $\Gamma$-matrices to obtain matrices acting on the same space. This is abstractly wrong, the transpose acts on the dual, the complex conjugation on the conjugate, and the Hermitian adjoint needs an inner product we have no reason for choosing. Of course, since $V$ is finite-dimensional, one can pick a basis and define the uncanonical isomorphisms to its dual and its conjugate, but I find this inelegant, particularly since the standard derivations require us to make a particular such choice with respect to the signs the $\Gamma$-matrices have under e.g. ${}^\dagger$. Finally, the Majorana spinors are usually defined by some equation involving an unnatural and arbitrary-looking product of $\Gamma$-matrices, which varies from source to source according to different sign conventions and sign choices made in the course of the derivation.  It's inelegant because the rest of the theory of spinors can be developed without making such uncanonical choices. Both the uniqueness of the dimension of the irreducible Dirac representations (there are two of them in odd dimensions) and the existence of the Weyl spinors in even dimensions can be derived purely from the abstract properties of the Clifford algebra, no choices made, no transpose, adjoint or conjugate occuring. The (admittedly slightly subjective question) is: Is there a way to show in which dimensions Majorana spinors exist that neither requires an uncanonical choice of basis nor arbitrary choices of signs?  Some partial results:   In even dimensions, the Dirac representation is necessarily self-conjugate since it is the only irreducible representation of the Clifford algebra, so all that is left to show is that a conjugate-linear $\mathfrak{so}$-equivariant map on it squares to $\mathrm{id}_V$ and not to $-\mathrm{id}_V$. However, I can't seem to exhibit any particular equivariant map on it that one could simply check for its square. In odd dimensions, one first needs to figure out whether the two inequivalent Dirac representations are conjugate to each other or self-conjugate.     As further motivation that a clear proof using only canonical properties of the Clifford algebra itself is required, consider the confusing and contradictory claims in the literature:   Polchinski, "String Theory", Vol. 2, p.434: $\mathrm{SO}(d-1,1)$ has Majoranas for $d = 0,1,2,3,4 \mod 8$, corresponding to a special case of $p-q = d-1-1 = 6,7,0,1,2 \mod 8$. Fecko, "Differential Geometry and Lie Groups for Physicists", pp. 651: $\mathrm{Cliff}(p,q)$ has Majoranas for $p-q = 0,2\mod 8$.  This clearly conflicts with Polchinski's claims e.g. for $d=3$. Figueroa-O'Farrill, , pp. 18: We have Majoranas for $p-q = 0,6,7\mod 8$ and "symplectic Majoranas" for $p-q = 2,3,4\mod 8$.   Note that these results conflict simply by the number of possible $p-q$ regardless of whether I've correctly taken care of the differing conventions of whether $p$ or $q$ denotes timelike dimensions. What is the accepted/most commonly used way to manipulate dynamic (with all dimensions not known until runtime) multi-dimensional arrays in C and/or C++.  I'm trying to find the cleanest way to accomplish what this Java code does:  public static void main(String[] args){  Scanner sc=new Scanner(System.in);  int rows=sc.nextInt();  int cols=sc.nextInt();  int[][] data=new int[rows][cols];  manipulate(data); }  public static void manipulate(int[][] data){    for(int i=0;i&lt;data.length;i++)    for(int j=0;j&lt;data[0].length.j++){          System.out.print(data[i][j]);           }     }   (reads from std_in just to clarify that dimensions aren't known until runtime).  Edit:I noticed that this question is pretty popular even though it's pretty old.  I don't actually agree with the top voted answer.   I think the best choice for C is to use a single-dimensional array as Guge said below "You can alloc rowscolssizeof(int) and access it by table[row*cols+col].".  There is a number of choices with C++, if you really like boost or stl then the answers below might be preferable, but the simplest and probably fastest choice is to use a single dimensional array as in C.  Another viable choice in C and C++ if you want the [][] syntax is lillq's answer down at the bottom is manually building the array with lots of malloc's. Taskbar > File Explorer > Context Menu failing me So I have the latest version of Windows 10, and this is a new PC.  File Explorer is in the taskbar.  When I open the context menu (right-click) on it, I get the list of folders as seen in the picture.  When I right click on any of them, I get the blank black box you see in the picture.  If I click on any of the folders, such as Downloads or Update.  Nothing happens.  They don't open.  The only way to use it is to click on the actual File Explorer icon and then navigate from there.  I've tried uninstalling things (not that I have much installed since it's a fresh install) and I've tried scans, etc.  This only happens with File Explorer.  Everything else works fine.  I can't figure it out. Process Unicode files with BOM correctly with POSIX tools Trying to use grep today, I ran into the  of the  in a Unicode file (UTF-8, in this case). Specifically, I was trying to find a file beginning with XYZ with the pattern grep '^XYZ', but of course grep treated the BOM as three separate characters and did not match the first line of the file if the first line started with XYZ. I even tried to update the regular expression to ignore spaces ('^[[:space:]]*XYZ'), but to no avail.  Other questions have dealt with  or , but I want to know if POSIX tools have a general option to handle Unicode files correctly. If grep handled the Unicode file correctly, it would consider the file contents to start after the BOM and match XYZ on the first line just like any other line. How to write conditional equations with one-sided curly brackets I want to write a conditional expression such as the following.    What is the best way to express such conditional expressions in Latex? If you are talking on behalf of you and someone else what is the correct usage?  On behalf of my wife and me On behalf of my wife and I On behalf of me and my wife On behalf of myself and my wife On behalf of my wife and myself ...  My understanding is that after that phrase you would carry on talking in first person. Is there a case where including the same header twice is actually helpful? I have several identical elements with different attributes that I'm accessing with SimpleXML:  &lt;data&gt;     &lt;seg id="A1"/&gt;     &lt;seg id="A5"/&gt;     &lt;seg id="A12"/&gt;     &lt;seg id="A29"/&gt;     &lt;seg id="A30"/&gt; &lt;/data&gt;   I need to remove a specific seg element, with an id of "A12", how can I do this?  I've tried looping through the seg elements and unsetting the specific one, but this doesn't work, the elements remain.  foreach($doc-&gt;seg as $seg) {     if($seg['id'] == 'A12')     {         unset($seg);     } } I need this date format in a visualforce page: "December 14, 2013". I can't seem to find the format options for visualforce. I read that it's the same as the java messageformat class options, but I cannot find a list for that either.  A little help would be much appreciated I know that I can update a snap package using  sudo snap refresh &lt;package&gt;   But is there a way to update all snaps, like   sudo apt dist-upgrade How to make git ignore changes in case? I'm not too sure what is going on here, but sometimes a particular file in my repository will change the case of its name. e.g.,: before: File.h after: file.h I don't really care why this is happening, but this causes git to think it is a new file, and then I have to go and change the file name back. Can you just make git ignore case changes? [edit] I suspect it is Visual Studio doing something weird with that particular file, because it seems to happen most often when I open and save it after changes. I don't have any way to fix bugs in VS however, but git should be a bit more capable I hope. Set Xorg to use only part of the screen Just like if we have any quadratic equation which has complex roots, then we are not able to factorize it easily. So we apply quadratic formula and get the roots.  Similarly if we have a cubic equation which has two complex roots (which we know conjugate of each other) and one fractional root, then we are not able to find its first root by hit &amp; trial.  So my question is like quadratic formula, is there exist any thing like cubic formula which help in solving cubic equations?  For example, I have an equation $$2x^3+9x^2+9x-7=0\tag{1}$$ and I have to find its solution which I am not able to find because it has no integral solution. Its solutions are $\dfrac {1}{2}$, $\dfrac{-5\pm \sqrt{3}i}{2} $, I know these solutions because this equation is generated by myself.  So how can I solve equations like these?  Also while typing this question, I thought about the derivation of quadratic formula, which is derived by completing the square method.  So I tried to apply ‘completing the cube’ method on the general equation $ax^3+bx^2+cx+d=0$ but it didn't help.  So please help me in finding a cubic formula or to solve the equations like given in example by an alternative method.