Autoformat and autoindent source code
Automatic code reindent button
I was answering a question on Stack Overflow and required to use a trailing space in one of my code snippets.  I formatted it like so:  `&lt;a `   And it renders without the trailing space: &lt;a  Using the &lt;code&gt; tag does account for trailing spaces, though in my case it busts because of the &lt;. Here's my formatting with the &lt;code&gt; tag:  &lt;code&gt;&lt;a &lt;/code&gt;   Here's how it renders:  (Yes, you should see nothing there).  This is a pretty annoying bug. Can we get it fixed? Can my friend and I play minecraft together with different mods? The Monty Hall problem How do I find out which paths my (La)TeX installation checks looking for packages (on a Linux system)? I know that I can check from where one particular package would be called, using  kpsewhich &lt;packagename&gt;.sty   and that if I want a custom package, I usually have to put it in the same folder as my document.   I assume that similar to a $PATH, LaTeX checks a list of paths in an attempt to find my package.   Which paths are those? In what order are they checked? If this is system-specific, how can I find out the configuration for my system?   Related questions:    , the answers to which contain some paths that  LaTeX apparently checks.  mentions    &gt;    /usr/local/texlive/2009/texmf &gt;    /usr/local/texlive/2009/texmf-dist &gt;    /usr/local/texlive/texmf-local &gt; &gt; as well as other directories.   (Neither of those lists is complete). I want to make it so I always have 50 entities in an area. So when 1 dies/despawns/leaves the area I want it to detect that and summon in a new entity, and yes I do want them to die/despawn/leave the area so preventing those things is not an option. Plain integer partitions of $n$ using $r$ parts Division of number $n$ on parts $a_1,...,a_r$ where $a_1 \le ... \le a_r$ we call a plain if $a_1 = 1$ and $a_i - a_{i-1} \le 1$ for $2 \le i \le r$. Find enumerator (generating function) for plain divisions.  my try  The hint was to use bijection between plain divisions and some commonly know enumerator. I tried to use enumerator of divisions on different parts: $$ (1+x)(1+x^2)...(1+x^r)$$ where number of plain divisions is  $$[x^n](1+x)(1+x^2)...(1+x^r) $$ let function  $$f(n,r) = [x^n](1+x)(1+x^2)...(1+x^r) $$  For some first divisions it works. For example: $$f(4,3) = 1 $$ $$f(6,3) = 1 $$ $$f(11,5) = 2$$ But when I tried to find bijection, I failed. I found that this function isn't correct because $f(15,6) = 4$ but should be equal to $3$ because: $$15 = 1,1, 2, 3, 4, 4 \\ 15 = 1, 2, 2, 3, 3, 4\\ 15 = 1, 2, 3, 3, 3, 3 $$. There I stucked. Two arrays in foreach loop I installed Windows 7, which ate Ubuntu's boot file. When starting up the computer, it now goes straight to Windows, without giving me the option of booting Ubuntu.   How can I get Ubuntu back? Show a Form without stealing focus? I'm using a Form to show notifications (it appears at the bottom right of the screen), but when I show this form it steals the focus from the main Form. Is there a way to show this "notification" form without stealing focus? gnome-terminal fails to start (timed out) I just upgraded from Ubuntu 16.04 to 18.04. My workflow is to connect from Windows using VcXsrv to Ubuntu (ssh with X tunneling), starting a xterm on Ubuntu. Inside the xterm I am typing gnome-terminal to get a gnome-terminal. Since the upgrade this is not working anymore. I am getting $ gnome-terminal   # Couldn't register with accessibility bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.   # Error constructing proxy for org.gnome.Terminal:/org/gnome/Terminal/Factory0: Fehler beim Aufruf von StartServiceByName für org.gnome.Terminal: Zeitüberschreitung wurde erreicht    or when starting with English locale $ LANG=en_US.utf8 gnome-terminal   # Couldn't register with accessibility bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.   # Error constructing proxy for org.gnome.Terminal:/org/gnome/Terminal/Factory0: Error calling StartServiceByName for org.gnome.Terminal: Timeout was reached  I am not always getting the first line, but I am always gettint the timeout error. Digging more into the issue I found out  sudo gnome-terminal works gnome-terminal works when run in a xterm when locally logged in on the PC when I am also logged in locally on the PC then gnome-terminal in the remote session's xterm opens a gnome-terminal on the local session on the PC (still getting the first error line about registering with accessibility bus) when I am also logged in over rdp (Windows network connection) then a gnome-terminal in the ssh session opens a gnome-terminal in the xrdp session when I login over rdp (Windows network connection), logoff there, then gnome-terminal can open a gnome-terminal  What can I do to get gnome-terminal in a remote session's xterm to work? Error Code: 1215. Cannot add foreign key constraint (foreign keys) If I read the sentence     Find ten apples and oranges.   Do I need to find ten or twenty pieces of fruit? Lowest voltage drop diode possible I am harvesting energy from an NFC device using a tuned antenna on my PCB. Though this method I am able to generate about 3.05V. I would like to charge a super capacitor using the power harvested from the NFC device. To do this I have  used the simple diode circuit provided  (and shown in Figure 1 below).  The problem I am facing is my circuit requires a minimum of 3V to operate within operating conditions, however with the added drop by typical diodes I believe there with be various situations where the generated voltage will drop below the required 3V. Are there any Diodes available which have ultra low voltage drops of less then 0.01V? and is that even possible?  Please note:   my system load will be &lt; 5mA  The 3.05V generated was without a diode in the circuit Given the following code, what does the if __name__ == "__main__": do?  # Threading example import time, thread  def myfunction(string, sleeptime, lock, *args):     while True:         lock.acquire()         time.sleep(sleeptime)         lock.release()         time.sleep(sleeptime)  if __name__ == "__main__":     lock = thread.allocate_lock()     thread.start_new_thread(myfunction, ("Thread #: 1", 2, lock))     thread.start_new_thread(myfunction, ("Thread #: 2", 2, lock)) Is a Squib a Muggle? ‘And what on earth’s a Squib?’ said Harry.   To his surprise, Ron stifled a snigger.   ‘Well – it’s not funny really – but as it’s Filch ...’ he said. ‘A Squib is someone who was born into a wizarding family but hasn’t got any magic powers. Kind of the opposite of Muggle-born wizards, but Squibs are quite unusual. If Filch’s trying to learn magic from a Kwikspell course, I reckon he must be a Squib. It would explain a lot. Like why he hates students so much.’ Ron gave a satisfied smile. ‘He’s bitter.’   Chamber of Secrets - pages 110-111 - British Hardcover   If a Squib is 'kind of the opposite of a Muggle-born wizards' wouldn't that make a Squib more Muggle than wizard? Does a Muggle strictly have to be born to Muggle parents to be considered a Muggle, or can the lack of magic render a person, even of wizarding parentage, a Muggle?  Hermione can say in all truthfulness that she is a 'Muggle-born witch.' The nickname (albeit derogatory) for a Muggle-born is 'Mudblood.' Filch can say in all truthfulness that he is a 'wizarding-born non-magic person,' which, according to Hagrid is a Muggle.  'Squib' may be derogatory in the same way as 'Mudblood' is. Neville laments his family thought he was a Squib when he showed no magical tendencies as a child; the Longbottoms were so rattled at the thought of Neville being a Squib that they, among other things, threw him out a second-story window to see if he would bounce. So could 'Squib' actually be a derogatory term meaning the opposite of 'Mudblood'? After all, the Ministry doesn't allow Squibs to register as magical beings, and many Squibs are schooled and trained in Muggle professions. Squibs don't get a Hogwarts letter.    Wizards can be born to Muggles. Can Muggles be born to wizards?  ETA 11.22.14: In regard to this question, I was glancing through Philosopher's Stone, and I came across this, that Neville said:     ‘Well, my gran brought me up and she’s a witch,’ said Neville, ‘but the family thought I was all Muggle for ages. My great-uncle Algie kept trying to catch me off my guard and force some magic out of me – he pushed me off the end of Blackpool pier once, I nearly drowned – but nothing happened until I was eight.’   Philosopher's Stone - page 93 - Bloomsbury - chapter seven, The Sorting Hat   Could what Neville says contribute to the theory and/or conclusion that Squibs are, or are not, Muggles? How do we apply what Neville said? PHP - Get rid of notation Excel function that evaluates a string as if it were a formula? Suppose I have a text string like "11+5" or even "=11+5" stored in a cell. Is there a function in Excel that will allow me to actually evaluate that string as if it were a formula?  This would be helpful for another project where I would like to be able to write 'dynamic' formulas in Excel. Torsion elements of a group aren't necessarily a subgroup In a question from an exam in an undergraduate group theory course, we were asked to prove or disprove that the set of all Torsion elements of a group is necessarily a subgroup.  I knew that the set of Torsion elements is closed under the inverse operation, but was later told that it is not closed under multiplication, therefore disproving the claim. However, I couldn't find any examples of a group $G$ and two elements $a,b$ such that both $a$ and $b$ have a finite order, but $ab$ doesn't. I know that for this to happen $G$ must be an infinite and non-Abelian group, but still couldn't find a valid example.   What are some examples of groups/elements fulfilling the aforementioned property? I'm developing a PHP application and I'm wondering about the best way to include multi-language support for users in other countries.  I'm proficient with PHP but have never developed anything with support for other languages.  I was thinking of putting the language into a PHP file with constants, example:  en.php could contain:  define('HZ_DB_CONN_ERR', 'There was an error connecting to the database.');   and fr.php could contain:  define('HZ_DB_CONN_ERR', 'whatever the french is for the above...');   I could then call a function and automatically have the correct language passed in.  hz_die('HZ_DB_CONN_ERR', $this);   Is this a good way of going about it?  -- morristhebear. Definition respective derivation of angular momentum formula I am reading An Introduction to Mechanics by Kleppner and Kolenkow (2014). On page 241 is the definition of the :      Here is the formal definition of the angular momentum $\vec{L}$ of a particle that has momentum $\vec{p}$ and is at position $\vec{r}$ with respect to a given coordinate system: $$\vec{L}=\vec{r} \times \vec{p}$$   In the book there is no explanation why this formula should be true. From this equation the formulas for torque and moment of inertia are derived.   My question is: Why is the formula above correct? Why isn't the formula for angular momentum something completely different, like $\vec{L}=\sqrt{(\vec{r} \times \vec{p})2\pi M}$? Is the formula for angular momentum just a mere definition and if not, how to derive it? How did people come across that particular formula?