Which ordering of nested loops for iterating over a 2D array is more efficient
Why does the order of the loops affect performance when iterating over a 2D array?
Do the druid's uses of the Wild Shape feature recharge while still in Wild Shape?  Say a 10th-level Circle of the Moon Druid spends two uses of Wild Shape to transform into an Air Elemental, whose form she can stay in for the next 5 hours. After 2 hours, she takes a short rest, but does not drop the Wild Shape. She has another couple of hours to keep the Air Elemental form.  My main concern: Does she get her two uses of Wild Shape back with that short rest? Or, does she have to drop the Air Elemental form first before taking the short rest to recharge Wild Shape? Is it possible for some integer $n&gt;1$ that $2^n-1\mid 3^n-1$ ?   I have tried many things, but nothing worked. How can I generate PDF metadata from LaTeX? I am writing a document using LaTeX and generating PDF.  Can anybody tell me how I can generate the PDF metadata, e.g. author or title, from LaTeX?  On Windows XP, I am using MikTex's texify to generate the PDF.  On linux, I am using pdflatex to generate the PDF.  Any answers for either platform would be much appreciated! Is a bool read/write atomic in C# Is accessing a bool field atomic in C#? In particular, do I need to put a lock around:  class Foo {    private bool _bar;     //... in some function on any thread (or many threads)    _bar = true;     //... same for a read    if (_bar) { ... } } I'm looking for the method by which the partial derangement formula $D_{n,k}$ was derived. I can determine the values for small values of N empirically, but how the general case formula arose still alludes me.  Any links/books or an explanation will be appreciated.  The formula is:  $D_{n,k} = {n \choose k}!(n-k)$  Links: Why is the determinant of a symplectic matrix 1? Suppose $A \in M_{2n}(\mathbb{R})$. and$$J=\begin{pmatrix} 0 &amp; E_n\\   -E_n&amp;0  \end{pmatrix}$$ where $E_n$ represents identity matrix. if $A$ satisfies $$AJA^T=J.$$ How to figure out $$\det(A)=1~?$$ My approach: I have tried to separate $A$ into four submartix:$$A=\begin{pmatrix}A_1&amp;A_2 \\A_3&amp;A_4 \end{pmatrix}$$ and I must add a assumption that $A_1$ is invertible. by elementary transfromation:$$\begin{pmatrix}A_1&amp;A_2 \\ A_3&amp;A_4\end{pmatrix}\rightarrow \begin{pmatrix}A_1&amp;A_2 \\ 0&amp;A_4-A_3A_1^{-1}A_2\end{pmatrix}$$ we have: $$\det(A)=\det(A_1)\det(A_4-A_3A_1^{-1}A_2).$$ From$$\begin{pmatrix}A_1&amp;A_2 \\ A_3&amp;A_4\end{pmatrix}\begin{pmatrix}0&amp;E_n \\ -E_n&amp;0\end{pmatrix}\begin{pmatrix}A_1&amp;A_2 \\ A_3&amp;A_4\end{pmatrix}^T=\begin{pmatrix}0&amp;E_n \\ -E_n&amp;0\end{pmatrix}.$$ we get two equalities:$$A_1A_2^T=A_2A_1^T$$ and $$A_1A_4^T-A_2A_3^T=E_n.$$ then $$\det(A)=\det(A_1(A_4-A_3A_1^{-1}A_2)^T)=\det(A_1A_4^T-A_1A_2^T(A_1^T)^{-1}A_3^T)=\det(A_1A_4^T-A_2A_1^T(A_1^T)^{-1}A_3^T)=\det(E_n)=1,$$ but I have no idea to deal with this problem when $A_1$ is not invertible. Aristotle's Categories with academic commentary I am using LaTeX with the article document class. The Bibtex bibliography style that I am using is agsm, part of the Harvard family of bibliography styles.  I have two questions:  (1) If I cite an entry of type @book, then in the reference list I get publisher, address. I would like to re-arrange this order to address: publisher. Which part of agsm.bst should I modify?  (2) I would like to change single quotation marks ' ' to double quotation marks " " for setting off the title of entries of type @article. Which part of agsm.bst should I focus on? Dragging files into blender Design Review: 3.3V Logic to 12V Logic (Uni-directional and Bi-directional) I'm looking for feedback and improvements on my design below. Specific questions are at the end. I created this as an attempt to answer my own, . From my feedback there, it seems like I needed to be more clear in my requirements. These are screenshots from Eagle. If there's a better way to share, please let me know so I can correct it. Entire board  The overall purpose of this board is to translate between 12V logic, and 3.3V logic. The top portion of the board represents the 12V side. The LEDs are placeholders to indicate whether the 12V signal is HIGH or LOW. In practice, these would be replaced with more , requiring up to 3A. The switches are also placeholders, allowing one to manually turn the 12V signal on and off. They are only for test purposes, the &quot;real&quot; 12V signal would be coming as the output from other relays. The bottom half is the 3.3V side. This will be connected to a  (BBB). The board will connect to 2 output GPIO pins and 2 input GPIO pins of the BBB. Overall, I want to translate the 3.3V I/O from the BBB to the 12V signals on the other side (to control more relays and read their signals). I have designed 3 modules to control both directions individually, and together. 3V3_TO_12V Module  This module converts the 3.3V GPIO output from the BBB to a 12V signal on the other side. When the 3.3V signal is low, the 12V signal is low. When the 3.3V signal is high, the 12V signal is high. To do this, the 3.3V GPIO output is connect to a , which turns a  relay on and off. This switches the 12V power as output of the module to be used elsewhere. 12V_TO_3V3 Module  This module converts a 12V signal to 3.3V signal, to be read by a GPIO input from the BBB on the other side. When the 12V signal is low, the 3.3V signal is low. When the 12V signal is high, the 3.3V signal is high. To do this, the 12V signal simply turns a  relay on and off. This switches the 3.3V power to be read as input by the BBB. DUAL_12V↔3V3 Module  This module combines the previous two modules to create a bidirectional translation. If the 12V side is high, the 3.3V input to the BBB GPIO should be high. If the 3.3V output from the BBB GPIO is high, then the 12V side should be high too. It's similar to a logical OR, if either side is high, the corresponding signal on the other side should be high too. A single 12V signal has to be split into individual input and output signals on the 3.3V side for the BBB. Questions  Is the  and  relay combination overkill for having the BBB GPIO output control the 12V power line? I like the isolation and safety it provides, but it seems too much (in terms of cost and board space) Is there a better solution for the 12V to 3.3V conversion. I like the simplicity of the  relay switching a 3.3V signal, but it takes up lots of room. Does the DUAL_12V↔3V3 Module (which combines each translation direction) even make sense? This seems wasteful to use 2 relays and a high side driver, but I haven't found simpler solution that achieves the same result. Should I add pulldown resistors for the BBB GPIO inputs, or are the internal pulldown resistors good enough?  Any other feedback is welcome. I'm new to electronic design. Trigger to check for duplicate contacts on lead conversion I'd like to write a Lead trigger, to check for duplicate Contacts before inserting the lead, or converting it.   Contacts fields I'd like to check:   Firstname - should not be the same as the leads name Lastname - should not be the same as the leads name Email - should not be the same as the leads phone   After checking these fields &amp; failing to find a duplicate, only then should the lead be converted. Can I move Xcode and Android Studio to SD card I'm planning to buy a 64GB SD card to supplement the storage on my MacBook Air 128GB (early 2015)  I wanted to know if I can move my Xcode and android studio to it as both have them take a significant part of the memory.  If this can happen, I wanted to know how can I move these two to the SD card. I'm fairly new to macOS and have no idea how to do this. Compare Debian (left) and Ubuntu (right):  $ ifconfig                                 $ ifconfig bash: ifconfig: command not found          eth0     Link encap ... $ which ifconfig                           $ which ifconfig $                                          /sbin/ifconfig   Then as superuser:  # ifconfig                                 # ifconfig eth0      Link encap ...                   eth0     Link encap ... # which ifconfig                           # which ifconfig /sbin/ifconfig                             /sbin/ifconfig   Furthermore:  # ls -l /sbin/ifconfig                     # ls -l /sbin/ifconfig -rwxr-xr-x 1 root root 68360 ...           -rwxr-xr-x 1 root root 68040 ...   It seems to me the only reason I cannot run ifconfig without superpowers on Debian is that it's not in my path. When I use /sbin/ifconfig it does work.   Is there any reason I should not add /usr/local/sbin:/usr/sbin:/sbin to my path on Debian? This is a personal computer, I am the only human user.    Versions used (uname -a): Ubuntu:   Linux ubuntu 3.13.0-51-generic #84-Ubuntu SMP Wed Apr 15 12:08:34 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux   Debian:  Linux debian 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u3 (2015-08-04) x86_64 GNU/Linux Wrongly set chmod / 777. Problems? I was trying to run chmod -R 777 ./ but ended up typing chmod -R 777 / and set 777 on my entire machine. What can go wrong? How can I fix it? I put a video in my pdf with Acrobat and there I can watch my video. But if I open the pdf on my mobile, I can't watch the video, I only see an image. Is there a way to watch videos of a pdf in a mobile? I have a samsung J5. Why are p-values uniformly distributed under the null hypothesis? An infinite subset of a countable set is countable In my book, it proves that an infinite subset of a coutnable set is countable. But not all the details are filled in, and I've tried to fill in all the details below. Could someone tell me if what I wrote below is valid?  Let $S$ be an infinite subset of a countable set $T$. Since $T$ is countable, there exists a bijection $f: \mathbb{N} \rightarrow T$. And $S \subseteq T = \{ f(n) \ | \ n \in \mathbb{N} \}$. Let $n_{1}$ be the smallest positive integer such that $f(n_{1}) \in S$. And continue where $n_{k}$ is the smallest positive integer greater than $n_{k-1}$ such that $f(n_{k}) \in S$. And because $S$ is infinite, we continue forever. Now consider the function $\beta : \mathbb{N} \rightarrow S$ which sends $k \rightarrow f(n_{k})$.   So in order for $S$ to be countable, $\beta$ would have to be a bijection. $\beta$ is injective since if $f(n_{k}) = f(n_{j})$, then $n_{k} = n_{j}$ because $f$ is injective. We also can conclude $k = j$ because the various $n_{i}$ chosen were strictly increasing.   Edit: $\beta$ also needs to be surjective. So for every $r \in S$ there exists a $q \in \mathbb{N}$ such that $\beta(q) = f(n_{q}) = r$. We know that $f^{-1}(r) \in \{n_{1}, n_{2}, ..., n_{k} ... \}$, so we can let $f^{-1}(r) = n_{d}$. Thus $\beta(d) = f(n_{d}) = r$. Why do games run slow on CPU Maybe my question sounds naive because I'm not a game developer but I dont see objective reasons for this. An average cpu is in times more powerful than an average gpu like a few graphics cards in one. The most repeated reasons in internet:  the GPU isn't as busy as the CPU  If the gpu renders the screen how it can not be busy The modern cpus are powerful enough. They are not busy most of time. For example my cpu's usage is 3%.  many GPU's are designed to process graphics commands in parallel, CPU single threads them  What bothers the games to run a few parallel processes even on one cpu core? In my opinion its not correct to tell that the gpu is better if games never use 100% of the cpu's capacity. To be specific they dont use even 50%.  To clarify my question based on responses in the comments:  Did you mean to ask &quot;Why do games render more slowly on the CPU?&quot;  Yes I mean why the cpu cant do the whole work for games when it is underloaded and especially if it does the largest part of work in any case.  You can not compare GPUs and CPUs directly, because they do different things.  What bothers them to do the same things?  The CPU isn't as well suited to performing rendering calculations  I dont understand what &quot;suited&quot; means. And why the cpu is not suitable for primitive tasks aka paint roller.  adding additional parallel processes doesn't improve performance  Then why do you produce multicore graphics cards and multicore central processing units? Just give various parts of one task to a few processes if one process is slow and 100% of the capacity is not used. What bothers to emulate the gpu? Its also unclear for me why when you play without a separate graphics module the games see only one cpu core when you play with the gpu they see and use all the cpu cores. May be some magic. `sudo echo "bla" >> /etc/sysctl.conf` permission denied Disclaimer: I'm pretty novice at sysadmin stuff.  I'm trying to set up port forwarding in an AWS EC2 instance, this has to be done in the command-line because I don't want to go in and edit anything, it has to be automatic (it's part of a build process).   sudo echo "net.ipv4.ip_forward = 1" &gt;&gt; /etc/sysctl.conf      Permission denied   The weird thing is I've been (successfully) using sudo for pretty much every command that required su privileges. If I do sudo su before the command (trying it out by hand in an ssh session), then it works.  Reasons behind this? Possible solutions that don't involve sudo su or manual edits? Unparsed HTML shows on search result page