Up until recently I was under the impression that Unix-y programs were unaware of where their output went, be it to standard out, redirected to a file, or into a pipe. However, an unrelated U&amp;L question on this site brought to my attention the following example:  % echo "hello world" &gt; file  % grep --color=auto lo file hello world  % grep --color=auto lo file | cat hello world   Obviously you can't see it here, but the first command shows 'lo' highlighted, as expected. However, the second call, which goes through a pipe, shows no colour. This suggests that grep was aware of its output being directed to a pipe and avoided outputting colour. How is this done?
How does commands like ls know what its stdout is?  It seems ls is operating different depending on what the target stdout is. For example if I do:  ls /home/matt/tmp    the result is:  a.txt b.txt c.txt   However if I do  ls /home/matt/tmp | cat   the result is (i.e. new line per result):  a.txt b.txt c.txt   The process is passed a file descriptor 1 for stdout right? How does it determine how to format the result? Does the file descriptor reveal information?
After a very long time will we see more stars (due to the fact that more light is get to us) or less stars (as the universe expends and light have to pass larger distance)? In general, can stellar objects go outside of the scope of the observable universe or is it only growing with time? Calculations are always better than just discussion. Does it have any connection to dark matter? How to merge records for query set We have a question related to a DB query :   CREATE TABLE `Action` (   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,   `emp_Id` int(10) unsigned NOT NULL,   `name` varchar(60) NOT NULL,   `updated_action_at` datetime(3) DEFAULT NULL,   `created_At` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,   `notes` varchar(400) DEFAULT NULL,   PRIMARY KEY (`id`),    KEY `action_empId_fk` (`emp_Id`),    CONSTRAINT `action_empId_fk` FOREIGN KEY (`emp_Id`) REFERENCES `Employee` (`id`) ON DELETE CASCADE,  ) ENGINE=InnoDB AUTO_INCREMENT=502004 DEFAULT CHARSET=latin1   CREATE TABLE `ActionAssignedTo` (   `action_Id` int(10) unsigned DEFAULT NULL,   `emp_Id` int(10) unsigned DEFAULT NULL,   KEY `actionassignedto_emp_id_foreign` (`emp_Id`),   KEY `actionassignedto_action_id_foreign` (`action_Id`),   CONSTRAINT `ActionAssignedTo_ibfk_1` FOREIGN KEY (`emp_Id`) REFERENCES `Employee` (`id`) ON DELETE CASCADE,   CONSTRAINT `ActionAssignedTo_ibfk_2` FOREIGN KEY (`action_Id`) REFERENCES `Action` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1  CREATE TABLE `Employee` (   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,   `vendor_Id` int(10) unsigned DEFAULT NULL,   `name` varchar(40) NOT NULL,   `mobile_Number` varchar(15) NOT NULL,   `active` tinyint(1) DEFAULT '1',   `updated_At` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,   `created_At` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,   PRIMARY KEY (`id`),   KEY `employee_vendor_id_foreign` (`vendor_Id`),   CONSTRAINT `employee_vendor_id_foreign` FOREIGN KEY (`vendor_Id`) REFERENCES `Vendor` (`vendor_Id`) ) ENGINE=InnoDB AUTO_INCREMENT=511 DEFAULT CHARSET=latin1   We want to find the action created by employee with Action.empId = 4 along with the list of Assignee (an action can be assigned to multiple people)  We have the following query :   Select     notes,             Action.id,             AssigneeName.name,             ActionAssignedTo.emp_Id  from       Employee inner join Action  on         (Action.emp_Id = Employee.id  and        Action.emp_Id in (select Employee.id                               from Employee                               where Employee.vendor_Id = 1)) inner      join ActionAssignedTo  on         Action.id =  ActionAssignedTo.action_Id inner join Employee as AssigneeName  on         ActionAssignedTo.emp_Id =  AssigneeName.id where      Action.emp_Id = 4   Now, lets say if Action with id = 10 was assigned to 2 people : John (empId : 2) And Jack (empId : 5) --> the above query returns following results :  (columns from the query)  notes                       | Action.id | AssigneeName.name | ActionAssignedTo.emp_Id 1. Finish Designing Queries | 10        | John              | 2 2. Finish Designing Queries | 10        | Jack              | 5   If we observe the above results the first 2 columns get repeated for the Assignees for SAME ACTION ID  --> is there a way we can merge them something like   1. Finish Designing Queries |10         | { John : 2  , Jack  : 5}   Basically records being merged into one. Best practice: card expiry date on checkout Cutting features to do opposite of clipping in ArcGIS Desktop? What´s the easiest/smartest way of getting the opposite output of the clipping tool?   I just need the area of feature A1 which is not covered by feature A2 in a new Layer/File.  Now, I get the result by union´ing both features and deleting the "wrong" parts by hand.  I'm using ArcGIS Desktop 10. How do I quickly switch between weapons and spells? When  I see him quickly change his weapons and spells during combat. When he later goes inside his items, you can see a second smaller arrow next to the weapon that you can quickly change to in combat. How can I set such an alternative so that I can quickly switch weapon?  The screen doesn't seem to intuitively explain what key I need to use to do that... $ d_1,d_2\mid n\iff {\rm lcm}(d_1,d_2)\mid n\ $ [LCM Universal Property] Gauss's law in a uniform charge distribution extending infinitely in all directions Let us assume the universe filled with positive charge. About a particular point, all the positive charged particles will be symmetrical. Now consider a sphere of radius $r &lt; \infty$ and apply Gauss law. According to Gauss law the electric flux through the sphere will be some finite value as it contains some positive charge. But by symmetry the electric field through the sphere and hence electric flux will be zero. This is a contradiction. Suppose that f is continuous on $(a,b)$ and $\lim_{x\to a^+}  f(x) = \lim_{x\to b^-} f(x) = \infty$. Prove that $f$ has a minimum on all of $(a,b)$.  I was thinking of applying the extreme value theorem, but I realized that it applies only to closed intervals. So I was thinking of defining a closed interval that is in $(a,b)$, and using the definition of one sided limits to go about the problem, but I don't know how to proceed. Help please? Manually hacking tables in LaTeX is one of the less funny things when preparing a document. Naturally, there are quite a few tools that promise to simplify this. In fact, I have somewhat lost track of all the tools available, and I'd like to gather your valuable experience into one big post. Some of the tools are mentioned in , but I feel there's much more around.  I'd suggest that somebody starts an overview with an alphabetic list (so that I can accept this answer and it stays on top), and that everyone replies with a "community wiki" entry, one reply per tool, and inserts the tool into the list.  Personally, I use Excel2LaTeX, but I'm unhappy with having to fire up Windows in order to generate the LaTeX code. I'm thinking of a rewrite as a standalone Python tool using the xlrd library, but I'm not too inclined to reinvent the wheel. How to use mysql JOIN without ON condition? The following time-frequency correspondence illustration is in .    Also a gif animation version (if the animation doesn't show, please open the following image in a new window):    This picture has so much explanatory power, and I would like to replicate it in TikZ for future use.  Here is what I came up with:  \documentclass{minimal} \usepackage{tikz}  \begin{document} \begin{tikzpicture} [x={(1cm,0.5cm)},z={(0cm,0.5cm)},y={(1cm,-0.2cm)}] \draw[-&gt;,thick,blue!90] (0,6.5,0) -- (6.2,6.5,0) node[right] {Frequency}; \draw[-&gt;,thick,red!90] (0,0,0) -- (0,6.5,0) node[below] {Time}; \draw[-&gt;,thick] (0,0,0) -- (0,0,2) node[above] {Magnitude}; \foreach \x in {0.5,1.5,2.5,3.5,4.5,5.5}{   \draw[blue!50] (\x,0,0)   \foreach \y in {0,0.02,...,6.28}{     -- ({\x},{\y},{sin(\x*\y*(157))/sqrt(2*\x)})   };   \draw[blue!90, thick] (\x,6.5,0) -- (\x,6.5,1/\x); }  \end{tikzpicture} \end{document}   This is the output so far.    I have two questions:   How to produce that red superposed sine wave of all the blue sine waves? I don't know if there is a sum function or I have to use loop yet again? How to make the camera projection in TikZ more similar to the perspective in that wikipedia illustration?   Any suggestion and tweaking of the parameters I used in the sample drawing are welcome as well.  Thanks in advance!    Update 1:  Here is a new version using tikz, more readable than the first one. Yet the superposition of the sine waves are done manually...I still don't know how to use foreach to produce a sum.  \begin{tikzpicture}[x={(1cm,0.5cm)},z={(0cm,0.5cm)},y={(1cm,-0.2cm)}] \draw[-&gt;,thick,black!70] (0,6.5,0) -- (6.2,6.5,0) node[right] {Frequency}; \draw[-&gt;,thick,black!70] (0,0,0) -- (0,6.5,0) node[below right] {Time}; \draw[-&gt;,thick] (0,0,0) -- (0,0,2) node[above] {Magnitude}; \foreach \y in {0.5,1.5,...,5.5}{ \draw [cyan!50, domain=0:2*pi,samples=200,smooth]   plot (\y,\x, {sin(4*\y*\x r)/\y }); \draw[blue, ultra thick] (\y,6.5,0) -- (\y,6.5,1/\y); } \draw [red, thick, domain=0:2*pi,samples=200,smooth]  plot (0,\x, {sin(4*0.5*\x r)/0.5 + sin(4*1.5*\x r)/1.5 + sin(4*2.5*\x r)/2.5 + sin(4*3.5*\x r)/3.5 + sin(4*4.5*\x r)/4.5 + sin(4*5.5*\x r)/5.5} ); \end{tikzpicture}   The result is as follows: After converting to nodes in order to render using Cycles I've no idea where to enable the z-transparency. I guess the image textures alpha channel needs to be pluged somewhere but I've no idea which node would be suitable.   The question is how could I correctly setup the nodes to have the same effect as when using z-transparency in BI?      The materials original settings for BI are:    Which renders like:    I had no luck with DarenWs suggestion: Adding space around section title for in-register in KOMA-script context Ubuntu 13.10 to 14.04 Lts does not upgrade, keeps showing error The update from Ubuntu 13.10 to 14.04 LTS does not work it keeps showing me an error as could not calculate the upgrade, even when I want it to get updated from the terminal it says the same error. I did not use the beta its the final Ubuntu 14.04 LTS.I have restarted my laptop for like 5-10 times no change. Disabling the software sources also does not help. Difference between Unity and GNOME I often come across the terms Unity and GNOME while reading about Ubuntu. I understand that Unity is the default desktop environment for Ubuntu. What is GNOME and how is it related to/different from Unity? Stop all active ajax requests in jQuery How does the wording "for each" work? Some cards in magic has something happen for each {something}. For instance:  makes you gain 2 life for each creature you control. Tapping  adds one green mana to your mana pool, and you gain 1 life for each non-land card revealed.  How is this life gained: all at once or "one bit" at a time? Say I tap Selvala and 1 land, and 2 non-lands are revealed: do I gain 2 life, or do I gain 1 life two times? Would  have one or two +1/+1 counters placed on it if I had it in play at that point? How can one prove that $\pi^4 + \pi^5 < e^6$? Consider the diagram below:  (Author: Joshua Hykes )  From this diagram we can see that the absorption coefficient for the photoelectric effect generically decreases with the increase in energy of the photon. What is the physical reason for this decrease. (i.e. why does the probability of photoelectric absorption decreases with increasing photon energy).  Note: I am aware that the large spin is due to more inner electrons been able to be lifted.  Edit For Clarity  I will here rephrase the question: in the above diagram there is a general decrease in the absorption coefficient due to the photoelectric effect (i.e. the absorption of a photon by an electron and subsequent emission of that electron) with energy (ignoring the occasional absorption edge). This is of course linked to a decrease in the probability of the photoelectric effect occurring (and a corresponding decrease in the cross section). My question is: what is causing this decrease with increasing energy. (For the purpose of this question I am ignoring the contribution due to the Compton effect and pair production and simply focusing on the cross section due to the photoelectric effect.) How can I return pivot table output in MySQL?