What is wrong with parsing the ls command ?
Why *not* parse `ls` (and what to do instead)?
Haar Measure on Semidirect Product of Unimodular Groups Let $M, N$ be closed subgroups of a given locally compact topological group such that the product $P = MN$ is semidirect, with $M$ normalizing $N$.  Assume second countable, sigma compact, whatever so that Radon products coincide with product measures.  To make life easy, assume $M, N$ are unimodular.  How do we construct a Haar measure on $P$? Review of a proof for De Moivre's theorem using mathematical induction The following is a rigorous proof of De Moivre's theorem by means of mathematical induction. The theorem put simply is that:  Any complex number, $z = a+bi$, on a cartesian plane can be expressed in polar form, where $a=r\cos\theta$ and $b=r\sin\theta$ and $r$ is the absolute distance from the origin to the point $z$. In light of this, the expression for the complex number $z$ in polar form is $z=r(\cos\theta+i\sin\theta)$ In order to find the $n^{th}$ power of $z$, the following rule applies: $$\displaystyle z^n=(r(\cos\theta+i\sin\theta))^n=r^n(\cos n\theta+i\sin n\theta)$$ where $n\in\mathbb N$ (I have confined $n$ to the natural numbers given that I intend on using mathematical induction to prove the theorem.  Base step: We must prove that what is stated is true for $n=1$, hence $$z^1=r^1(\cos 1\cdot\theta+i\sin1\cdot \theta)$$ $$=r(\cos\theta+i\sin\theta)$$ which is true. Next we assume it is true for $n=k$, and therefore proceed to the inductive step. Inductive step: When calculating $z^{n+1}$, it's the same as calculating $z^nz$, hence $$z^{n+1}=(r^n(\cos n\theta + i\sin n\theta))(r(\cos \theta+i\sin \theta))$$ $$=r^nr(\cos n\theta+i\sin n\theta)(\cos\theta +i\sin \theta)$$ $$=r^{n+1}(\cos n\theta\cdot\cos\theta+\cos n\theta \cdot i\sin\theta+i\sin n\theta\cdot\cos\theta+i^2\sin n\theta\cdot\sin\theta)$$ from here, $i^2=-1$, and therefore $+i^2\sin n\theta\cdot\sin\theta$ becomes $-\sin n\theta\cdot\sin\theta$. In addition to this, the following trigonometric identities will be used: $$\sin(n\theta + \theta) = \sin n\theta\cdot\cos\theta+\cos n\theta\cdot\sin\theta$$ $$or$$ $$k\sin(n \theta+\theta)=k\sin n \theta\cdot\cos \theta + \cos n\theta\cdot k\sin\theta$$ $$and$$ $$\cos(n \theta + \theta)=\cos n\theta\cdot\cos\theta-\sin n\theta\cdot\sin\theta$$ by using these, the original equation has now become $$=r^{n+1}(\cos(n \theta + \theta) + i\sin(n \theta + \theta))$$ then, after factoring out $\theta$, the theorem becomes $$=r^{n+1}(\cos((n+1)\theta)+i\sin((n+1)\theta))$$ which completes the proof. Question: is this proof correct all the way through? Or have I missed any conditions? If all is well in the case of this proof, could somebody aid me in proving it for $\{n|n\in\mathbb R,n\geq1\}$ The Matching Problem/Derangements - n letters to n people There are n letters addressed to n eople at different addresses. The n addresses are typed on n envelopes.  A disgruntled secretary shuffles the letters and puts them in the envelopes in random order, one letter per envelope.  Find the probability that at least one letter is put in a correctly addressed envelope. [Hint: use the inclusion-exclusion formula.] What is the probability approximately, for large n ?    My attempt at a solution:  P(all correct) = $\frac{1}{n!}$  P(n-1 correct) = ${n \choose n-1} \frac{1}{n!} = \frac{1}{1!(n-1)!}$  ${n \choose n-1}$ ways of selecting n-1 correct letters.  P(n-2 correct) = ${n \choose n-2} \frac{1}{n!} = \frac{1}{2!(n-2)!}$  ...  P(n-n correct) = ${n \choose n-n} \frac{1}{n!} = \frac{1}{n!(n-n)!} = \frac{1}{n!}$  This all looks ok to me, but I tested this for a case of 4 people, (I think the theoretical value should be $\frac{9}{24}$ but obviously that is not what I got. Can someone correct my logic please? Also, with regards to the hint about inclusion/exclusion - where would that come in?  I read about derangements on Wikipedia but it did not make total sense to me (the derivation).  I would appreciate any advice whatsoever including references to other material. So I am in an introductory linear algebra(with proofs) class, and I came across the following theorem:  If $S$ is a subspace of a vector space $V(F)$ and is generated by $\{a_1,...,a_n\}$ then any subset $\{b_1,...,b_m\}$ of $S$ with $m&gt;n$ is linearly dependent.   The proof in the textbook is done through induction (as most proofs regarding finite sets are) but I really do not follow it and I feel there is a simpler way of doing it. A hint would be appreciated. Show if a user is online, idle, or offline on their account page? I want to display the status of the user on the account page. I added the following code in the theme I am using. It works, but users are never displayed offline. Why? What is wrong in the code? user.html.twig &lt;div class=&quot;bs-field-status&quot;&gt;   {% if status == 'Online' %}     &lt;i class=&quot;user-online fa fa-circle fa-lg&quot;&gt;&lt;/i&gt; Online   {% elseif status == 'Absent' %}     &lt;i class=&quot;user-absent fa fa-circle fa-lg&quot;&gt;&lt;/i&gt; Absent   {% else %}     &lt;i class=&quot;user-offline fa fa-circle fa-lg&quot;&gt;&lt;/i&gt; Offline   {% endif %} &lt;/div&gt;  bootstrap_subtheme_front_office.theme &lt;?php /**  * @file  * Bootstrap sub-theme.  *  * Place your custom PHP code in this file.  */  use Drupal\Core\Database\Database;  /**  * Implements hook_entity_presave().  */ function bootstrap_subtheme_front_office_preprocess_user(&amp;$variables) {   // get user object   $user = $variables['elements']['#user'];   //- The user has logged in at least once   if ($user-&gt;getLastLoginTime()) {     if (account_is_logged_in_less_then_thirty_minutes($user-&gt;id())) {       $status = 'Online';     }     else {       $status = 'Absent';     }   }   else {     $status = 'Offline';   }   $variables['status'] = $status; }  /**  * @param $uid  *  * @return bool  */ function account_is_logged_in_less_then_thirty_minutes($uid) {   $connection = Database::getConnection();   $query = $connection-&gt;select('sessions', 'sessions')     -&gt;fields('sessions', ['sid', 'uid', 'timestamp'])     -&gt;condition('sessions.uid', $uid, '=')     //- chef if the user was online in 30 minutes (60 * 30)     -&gt;condition('sessions.timestamp', \Drupal::time()         -&gt;getRequestTime() - (60 * 30), '&gt;')     -&gt;execute();   //- Get result.   $results = $query-&gt;fetchAll(\PDO::FETCH_OBJ);   return (count($results) &gt; 0) ? TRUE : FALSE; } Why do fonts look messed up in Adobe Acrobat? Creating additional Virtual Host Ubuntu Server Can't mount ISO file as loop device: Error: “failed to setup loop device” sudo mkdir -p /media/cdrom cd ~ sudo mount -o loop ubuntu-* / mount: ubuntu-*: failed to setup loop device: No such file or directory Is there a difference between foo(void) and foo() in C++ or C? Consider these two function definitions:  void foo() { }  void foo(void) { }   Is there any difference between these two? If not, why is the void argument there? Aesthetic reasons? This question is updated to request additional answers and details in light of information now available in the Dungeon Master's Guide. In the released DM basic rules, Lost Mine of Phandelver, Hoard of the Dragon Queen, and the DMG teaser there are wands, staves, and rings that you can use to cast spells.  Do abilities that trigger from casting a spell activate when casting a spell from an item?  Can the character modify the spell using class abilities when casting a spell from an item?   Examples include:  An abjurer Wizard's arcane ward recovering hit points from a Dispel Magic cast from a Ring of Spell Storing  A sorcerer using Twinned Spell on a ray of enfeeblement from a Staff of Power  An evocation wizard using Sculpt Spell on a fireball from a Wand of Fireballs.   Now that the DMG is out we have some clearer rules on casting spells from items (DMG p. 141):  Some magic items allow you to cast a spell from the item.  The spell is cast at the lowest possible spell level, doesn't expend any spell slots, and requires no components, unless the item's description says otherwise  The spell uses its normal casting time, range and duration, and the user of the item must concentrate if the spell requires concentration. A magic item, such as certain staffs, may require you to use your own spellcasting ability when you cast a spell from the item.  Does whether or not you can apply class abilities to the casting of the spell depend whether the item uses the user's own spellcasting ability (such as the Staff of Fire) versus an item that comes with a fixed spellcasting ability built-in (such as the Wand of Fireballs)? Does it matter if it's something that triggers more or less automatically like Arcane Ward, versus something you have to control, like Careful Spell? What kind of matter are black holes made of? Imagine a black hole originally formed from, for example, Rubidium atoms. On the other hand, one made from, for example, Helium atoms. Will it be there any difference between the two? Or perhaps once formed it all turns into the same type of matter?  Can the "composition" of the matter-energy in the black hole be inferred somehow?  Could one say that "black hole substance" is a distinct form or state of matter different from other forms or states of matter? I have a Java String that contains XML, with no line feeds or indentations. I would like to turn it into a String with nicely formatted XML. How do I do this?  String unformattedXml = "&lt;tag&gt;&lt;nested&gt;hello&lt;/nested&gt;&lt;/tag&gt;"; String formattedXml = new [UnknownClass]().format(unformattedXml);   Note: My input is a String. My output is a String.   (Basic) mock result:    &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;root&gt;   &lt;tag&gt;     &lt;nested&gt;hello&lt;/nested&gt;   &lt;/tag&gt; &lt;/root&gt; How do I run .sh scripts? Whenever I open a .sh file, it opens it in gedit instead of the terminal. I can't find any option similar to Right Click → Open With → Other Application... → Terminal.  How do I open this file in the terminal? How do I fix a boolean/bisected surface edge? I am trying to slice up my models using the Boolean modifier.  After applying the modifier on my smooth mesh, I get the expected result, a flat dissection to separate my mesh into two.  The problem lies in how I can resolve the visual "jaggered" edge that separates my (smooth) mesh exterior from the flat dissection face.    Is it possible to achieve a smooth-to-flat variation without this artifact?   I tried to alter a mixture of the two but end up with artifacts, or unwanted blocky flat mesh faces around the dissection edge of my mesh. Why not introduce a donate button in Stack Exchange sites? Adding values to a C# array Where are the proprietary NVIDIA drivers in 16.04? The proprietary NVIDIA drivers "disappeared" with my latest update:    The option of "Proprietary drivers for devices" is correctly set under the "Ubuntu Software" tab. I have the graphics-driver PPA (ppa:graphics-drivers/ppa) correctly added to my sources.  Any ideas on how to bring the proprietary drivers back?  PS1: I need them because some of the games I play under wine don't work without them, for whatever reason.  PS2: Also, this feels like it should have a straightforward answer, but I've been looking online for a while without luck. Easy way to remap non-modifier keys on Mac? I want to remap § to ` and ± to ~ on my Mac keyboard because they are located in a place I am not used to. Is there an easy way to do this? In Dark Souls 2 there is a 'Shrine of Winter' near Sinners Rise. When you approach the shrine it will not let you open the door and a message pops up that says      Seek Mightier Souls   What does this mean and how do you open this shrine? Given that$(3x-1)^7=a_7x^7+a_6x^6+a_5x^5+...+a_1x+a_0$, find $a_7+a_6+a_5+a_4+...+a_1+a_0$ Given that$$(3x-1)^7=a_7x^7+a_6x^6+a_5x^5+...+a_1x+a_0$$find $$a_7+a_6+a_5+a_4+...+a_1+a_0$$  Is there anyway to do the question without using binomial theorem and expanding the expression on the LHS??