How to extend an existing JavaScript array with another array, without creating a new array There doesn't seem to be a way to extend an existing JavaScript array with another array, i.e. to emulate Python's extend method.  I want to achieve the following:  &gt;&gt;&gt; a = [1, 2] [1, 2] &gt;&gt;&gt; b = [3, 4, 5] [3, 4, 5] &gt;&gt;&gt; SOMETHING HERE &gt;&gt;&gt; a [1, 2, 3, 4, 5]   I know there's a a.concat(b) method, but it creates a new array instead of simply extending the first one. I'd like an algorithm that works efficiently when a is significantly larger than b (i.e. one that does not copy a).  Note: This is not a duplicate of  -- the goal here is to add the whole contents of one array to the other, and to do it "in place", i.e. without copying all elements of the extended array.
How to append something to an array? How do I append an object (such as a string or number) to an array in JavaScript?
Word for a temporary project name In software development, and I imagine in many other fields, we often make up temporary nicknames for new projects or features. These are not meant to be the real names for the end product and are often funny, playful, or sarcastic in nature. These are also not intended to be "codenames" that hide the nature of the project or feature. Is there a word for such nicknames? ArcPy Utility Network Trace Not Returning Any Result How To Reduce Noise In Cycles Render So this is my first try with cycles and I was wondering what can I do to make the image clearer? Terminating Python scripts in Processing framework I'm writing a Python script to use it in Processing framework. I need to cancel script execution if certain conditions are met (to save user's time). I tried to use sys.exit(arguments) command. The issue is that not only the script, but QGIS itself shuts down too. I also tried quit() but result is the same. How should I terminate script in Processing framework? The following code is for reproduction purpose only. I don't need ad hoc solution for this particular case because I already have it. I need to know how to deal with this issue in general. ##Raster processing=group ##raster_1=raster ##raster_2=raster   from osgeo import gdal import sys from numpy import * import ntpath import re import platform from PyQt4 import QtGui   raster_1 = gdal.Open(raster_1) raster_2 = gdal.Open(raster_2)  rasters_list = [raster_1, raster_2]  # create a message for the case when CRSs of rasters do not match class WrongCRS(QtGui.QMessageBox):    def __init__(self):     super(WrongCRS, self).__init__()      self.initUI()    def initUI(self):      self.warning(self, 'Oops!',             &quot;Rasters must have the same CRS!\n\nExecution cancelled!&quot;, QtGui.QMessageBox.Ok)  # check CRS proj = None for raster in rasters_list:   new_proj = raster.GetProjection()   if proj is None:     proj = new_proj   else:     if proj != new_proj:       WrongCRS()       sys.exit('CRSs do not match!')     else:       continue A cyclic group is a group that is generated by a single element.  That means that there exists an element $g$, say, such that every other element of the group can be written as a power of $g$.  This element $g$ is the generator of the group.  Is that a correct explanation for what a cyclic group and a generator are? How can we find the generator of a cyclic group and how can we say how many generators should there be? How to compact VirtualBox's VDI file size? I've a VirtualBox VM which configured a very large hard disk size (bigger than host). By my mistake, a program on the VM generated lots of log files and the VDI file size keeps growing until there is no space on the host.   Now I've deleted the log files but the VDI file size are not getting smaller after using VBoxManage.exe modifyhd "C:\Virts\mybox-i386.vdi" compact  Is there a way to really compact the VDI file size? Thanks! The nose of Tom Riddle (as a student) was fine, as I have seen in the movies. But, Voldemort's nose doesn't look like a normal human nose. What really happened? Compute $E(X\mid X+Y)$ for independent random variables $X$ and $Y$ with standard exponential distributions Being $X$ and $Y$ independent random variables distributed as $\mathrm{Exponential}(1)$ and let $T=X+Y$ Calculate $E(X|T)$.  This is my attempt at solving this:  Being $Z=\sum_{i=1}^{n}P_{i}$ where $P_{i}$~$\mathrm{Exp}(\lambda)$ then using it's MFG you have that $$M_{P_i}(t)=\frac{\lambda}{\lambda-t}$$ then $$M_{Z}(t)=M_{\sum{P_{i}}}(t)=(M_{P_{1}})...(M_{P_{n}})=(\frac{\lambda}{\lambda-t})^n$$ with this being the MFG of a $\mathrm{Gamma}$ distribution with parameters $(n,\lambda)$  With this result is easy to see that $T$~$\mathrm{Gamma}(2,1)$  Now $E[X|T]=\int xf_{X|T}(x|t)dx$  Then using Bayes' theorem we can make $$f_{X|T}(x|t)=\frac{f_{T|X}(t|x)f_{X}(x)}{f_{T}(t)}$$ then $$f_{T|X}(t|x)=Pr(T=t|X=x)$$ $$=Pr(X+Y=t|X=x)$$ $$=Pr(x+Y=t|X=x)$$ $$=Pr(Y=t-x)=f_{Y}(t-x)$$  Using this result we can now rearrenge $$f_{X|T}(x|t)=\frac{f_{Y}(t-x)f_{X}(x)}{f_{T}(t)}$$ $$=\frac{e^{-(t-x)}.e^{-x}}{\frac{te^{-t}}{\Gamma(2)}}$$ $$=\frac{1}{t}$$ then $$E[X|T]=\int (x)(\frac{1}{t})dx$$  And this where I got stuck because $1_{x\epsilon(0,\infty})$, I made this explanation step-by-step hoping that someone can se easily check where I went wrong. I would aprecciate a step-by-step answer, thanks. In the example below, an error is caused by \begin{align} and \end{align} but I do not see why:  \documentclass{book} \usepackage{amsmath} \newenvironment{subalign}{\begin{subequations}\begin{align}}{\end{align}\end{subequations}} \begin{document} \begin{subalign}      a&amp;=b\\     &amp;=b \end{subalign} \end{document} Is it possible to add new alphabets to unicode-math? In ordinary LaTeX, one can easily add new math alphabets by using \DeclareMathAlphabet. One is then able to use, say, cmsy, eus, and rsfs letters side-by-side. Unfortunately, there does not seem to be a similar mechanism in unicode-math, or at the very least \DeclareMathAlphabet doesn't do what it's supposed to do.  Question. How can I set up my own math alphabets in unicode-math?   Attempted workarounds  Since unicode-math has lots of math alphabets, one workaround might be to replace an unused alphabet with the desired one using \setmathfont[range=...-&gt;...]. This doesn't quite work right in my example:  \documentclass[12pt]{article} \usepackage{fontspec,xltxtra,xunicode} \defaultfontfeatures{Mapping=tex-text}  \usepackage{unicode-math}  \scrollmode  \setmathfont{xits-math.otf} \setmathfont[range={\mathscr,\mathbfscr},StylisticSet=0]{xits-math.otf} \setmathfont[range={\mathcal,\mathbfcal},StylisticSet=1]{xits-math.otf} \setmathfont[range={\mathtt-&gt;\mathcal}]{latinmodern-math.otf}  \begin{document} \[ \begin{array}{c} \mathcal{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z} \\ \mathscr{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z} \\ \mathtt{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z} \end{array} \]   I suspect the problem is that the codepoints of the calligraphic letters in Unicode are not contiguous.   Using \mathversion seems to work better:  \documentclass[12pt]{article} \usepackage{fontspec,xltxtra,xunicode} \defaultfontfeatures{Mapping=tex-text}  \usepackage{unicode-math}  \setmathfont{xits-math.otf}  \setmathfont[version=eucal]{latinmodern-math.otf} \newcommand{\eucal}[1]{\mathchoice %   {\mbox{\mathversion{eucal}$\displaystyle\mathscr{#1}$}} %   {\mbox{\mathversion{eucal}$\mathscr{#1}$}} %   {\mbox{\mathversion{eucal}$\scriptstyle\mathscr{#1}$}} %   {\mbox{\mathversion{eucal}$\scriptscriptstyle\mathscr{#1}$}}}  \setmathfont[range={\mathcal,\mathbfcal},StylisticSet=1]{xits-math.otf}  \begin{document} \[ \begin{array}{c} \mathcal{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z} \\ \mathscr{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z} \\ \eucal{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z} \end{array} \] \end{document}   But this feels very inefficient. How can I calculate how long it will take to transfer a file over LAN? I want to know about the method with which we can calculate data transfer speed.   If I am sending a 1 GB file through a 1 Gb/s LAN connection, from one computer to another, how much time will it take to transfer that file? Array index out of bound behavior Why isn't my website in Google search results? Multiple "order by" in LINQ I have two tables, movies and categories, and I get an ordered list by categoryID first and then by Name.  The movie table has three columns ID, Name and CategoryID. The category table has two columns ID and Name.  I tried something like the following, but it didn't work.  var movies = _db.Movies.OrderBy( m =&gt; { m.CategoryID, m.Name }) 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. Verbatim in beamer showing error: "File ended while scanning use of \@xverbatim." I am using Texmaker and MiKTeX on Windows 7. I have the following beamer code,  \documentclass{beamer} \theme{AnnArbor} \begin{document} \begin{frame} \begin{verbatim}     \begin{frame}[&lt;alignment&gt;]    \frametitle{Frame Title Goes Here}    Frame body text and/or LATEX code    \end{frame}  \end{verbatim} \end{frame} \end{document}   I was expecting the following output,         \begin{frame}[&lt;alignment&gt;]        \frametitle{Frame Title Goes Here}        Frame body text and/or LATEX code        \end{frame}   But instead I got the following Error Message,  File ended while scanning use of \@xverbatim.   Can any one please point out the error here. As far as I know verbatim can have anything inside it.  Also when I tried the following code,  \begin{verbatim}  \ begin{frame}[&lt;alignment&gt;]  \frametitle{Frame Title Goes Here}  Frame body text and/or LATEX code  \ end{frame} \end{verbatim}   I got the following output,      \ begin{frame}[&lt;alignment&gt;]      \frametitle{Frame Title Goes Here}      Frame body text and/or LATEX code     \ end{frame}   But I don't want space between \ and begin and \ and end. Can't execute terminal commands: "the command 'sudo' is available in '/usr/bin/sudo'" How to use a C++ string in a structure when malloc()-ing the same structure? I would like to understand how Physicists think of space-time in the context of String Theory. I understand that there are $3$ large space dimensions, a time dimension, and $6$ or $7$ (or $22$) extra dimensions, and all these dimensions need to fit together in a way such that the extra dimensions are compactified (with a Calabi-Yau or $G_2$ structure).   My question, however is not about the possible $10$, $11$ or $26$ dimensional manifolds that may be possible, but about whether string theorists consider space-time as somehow quantized (or discrete), or rather as a continuous manifold, or are both options possible? In other words, can strings move continuously through space, or are there a discrete set of locations where strings can be, and does string theory rule out one of the options?  How about the same question in loop quantum gravity (LQG)? Should I think of the spin networks in LQG as describing a discrete space-time?  Thanks for your insight, or any references you may be able to provide! For any prime $p > 3$, why is $p^2-1$ always divisible by 24? Let $p&gt;3$ be a prime. Prove that $24 \mid p^2-1$.   I know this is very basic and old hat to many, but I love this question and I am interested in seeing whether there are any proofs beyond the two I already know.