I´m using the Matlab-prettifier package to include Matlab-code in my Latex-file, and it generally works, i.e, when I´m using the custom environment from the package:  \begin{lstlisting}[style=Matlab-editor] format long f=@(x) x^5 + x-1; fzero(f, 1), hm(f, 0, 1, 0.5*10^-8) ans =    0.754877666246693  ans =    0.754877667874098 \end{lstlisting}   So this works, but since this is an environment I use a lot, I would like to rename it to something shorter, and I´ve tried this:  \newenvironment{matlab} {\begin{lstlisting}[style=Matlab-editor]} {\end{lstlisting}}   That way I could just write  \begin{matlab} Matlab-code here \end{matlab}   to typeset the Matlab-code, but this doesn´t work, and I get a long and -- at least for me - incomprehensible error message, with a lot about undefined control sequences. Can anybody help me out with this? Thanks in advance!  Best answer (for me):
I've just started using matlab-prettifier.    Since the line \begin{lstlisting}[style=Matlab-editor] is a lot to type, I created my own environment:  \newenvironment{myMP}      {\begin{samepage}\begin{lstlisting}[style=Matlab-editor]}      {\end{lstlisting}\end{samepage}}   I've used this syntax many times before, but in this case it doesn't work.  Is there any reason why I can't enclose the lstlisting inside my own one?  Here's sample code, illustrating the problem.  \documentclass{minimal} \usepackage[framed]{matlab-prettifier}%For matlab code \newenvironment{myMP}      {\begin{samepage} \begin{lstlisting}[style=Matlab-editor]}      {\end{lstlisting} \end{samepage}} \begin{document} \begin{myMP} matlab word \end{myMP} \end{document}   When I run this with pdflatex it returns a *, indicating that the environment wasn't closed properly.  Thanks!
Given $a,b,c,d \in \mathbb{Z}$, there is $x,y$ such that  $$(a^2 + b^2)(c^2 + d^2) = x^2 + y^2$$  One can show this by considering the complex number $a + bi$ and $c+ di$, using complex properties to deduce that $x = ac - bd, y = ad + bc$ is a solution.   However, given that either $a^2, b^2$ are distinct or $c^2,d^2$ are distinct, then how can one can find nonzero solutions $x,y$?  Sorry, I am assuming $a,b,c,d$ are nonzero. Do multiple instances of the Extra Attack feature stack? The WotC article  creates the &quot;Favored Soul&quot; sorcerous origin, which grants the the sorcerer the Extra Attack feature at level 6. Say I made Favored Soul sorcerer go up to level 6, and then multiclassed into Ranger to get its Extra Attack at level 5. Would the two Extra Attack features stack so that I could get 3 or 4 attacks in a turn? Finding an isomorphic subring of matrices I'm struggling a fair amount with this exercise:     Find a subring of $M(2,\mathbb{Q})$ which is isomorphic to a) $\mathbb{Q}$ x $ \mathbb{Q}$ b) $\mathbb{Q}$ c) $\mathbb{Q}[x]$/$x^2$   Now I know a subring must be a subgroup, must contain the elements $0,1$ and must be closed under multiplication. As we are looking for isomorphisms then they must also be ring homomorphisms and must be bijective.  I tried to come up with a random subring and attempt to prove it is an isomorphism. E.g $\left\{\left.\begin{matrix}  a &amp; b \\ c &amp; 0  \end{matrix}\right|a,b,c \in \mathbb{Q}\right\}$ is a subgroup of $M(2,\mathbb{Q})$ and then try and show it's an isomorphism. However I'm stuck here as I don't actually know how to go about finding these specific isomorphisms and I completely lose what I'm doing. Any help would be great. When we want to open an application or file from the terminal, we type, say,  okular file.dvi   This opens the application, but also shows the status of the application. We cannot close the terminal, because it kills the process. Unfortunately, if you're trying to, for example, create a LaTeX file, you will need one tab for the text editor, one for the dvi file, and so on. And if you're trying to open all windows from the terminal, you can forget it. I'm trying use the terminal as much as possible, and while I have Yakuake, it is still a bother having so many tabs and seeing which of those have an application I've killed and so on.  So, is there a way to open an application/file from the terminal so that the status doesn't show and immediately gives the prompt so that we can use it to open more applications? How do I uninstall the command line tools for Xcode? We have a bunch of Mac at work that no longer require Xcode or command line tools so we'd like to remove them so the compilers aren't hanging around and we don't have to keep updating them when updates arrive. , but now that Xcode is an app store app you are left with the tools if you ever install them. Can we clean this other than wiping the OS for macs running 10.10 and newer? iOS 9 Screen Recording in El Capitan I used to record iOS devices through QuickTime, however now it's only recording audio (not sure is this linked to OS X 10.11 or iOS 9).  How can I fix this (without third party sofrware)? Is the set of all finite sequences of letters of Latin alphabet countable/uncountable? How to prove either? I'd wish to visit Dubai with my girlfriend, but after reading  and  I started to get a little worried about it. How should I book an hotel? Must I book two singles? Could it be a problem if we walk together in the city and go together to restaurants and malls without being married? Skate shoes vs mtb shoes? It's an old argue on forums, still cant get it. What is the (real, that worth the money and time for ordering from abroad, in my case) difference, let's say between  shoes and some kind of old school skate shoes (the fat ones, like )?  P.S as far as I know most dirt BMXers are quite happy with regular skate shoes. How is using a transformer for isolation safer than directly connecting to the power grid? How is using a 1:1 transformer safer than using the mains straight off? Is it because you can limit the current coming from the transformer whereas straight from the mains its not current limited? I fail to see how its "safer" when playing with electricity is dangerous. Could someone please explain why it is considered safer to be isolated by a transformer. I'm trying to work with  in Java.   I want to implement arithmetic functions.  For this, I will first require a way to normalize the functions.  I know I can't add 1/6 and 1/2 until I have a common denominator. I will have to add 1/6 and 3/6.  A naive approach would have me add 2/12 and 6/12 and then reduce.  How can I achieve a common denominator with the least performance penalty?  What algorithm is best for this?    Version 8 (thanks to ):     Improvements include:         the equals() method is now consistent with the compareTo() method      final class Fraction extends Number {     private int numerator;     private int denominator;      public Fraction(int numerator, int denominator) {         if(denominator == 0) {             throw new IllegalArgumentException("denominator is zero");         }         if(denominator &lt; 0) {             numerator *= -1;             denominator *= -1;         }         this.numerator = numerator;         this.denominator = denominator;     }      public Fraction(int numerator) {         this.numerator = numerator;         this.denominator = 1;     }      public int getNumerator() {         return this.numerator;     }      public int getDenominator() {         return this.denominator;     }      public byte byteValue() {         return (byte) this.doubleValue();     }      public double doubleValue() {         return ((double) numerator)/((double) denominator);     }      public float floatValue() {         return (float) this.doubleValue();     }      public int intValue() {         return (int) this.doubleValue();     }      public long longValue() {         return (long) this.doubleValue();     }      public short shortValue() {         return (short) this.doubleValue();     }      public boolean equals(Fraction frac) {         return this.compareTo(frac) == 0;     }      public int compareTo(Fraction frac) {         long t = this.getNumerator() * frac.getDenominator();         long f = frac.getNumerator() * this.getDenominator();         int result = 0;         if(t&gt;f) {             result = 1;         }         else if(f&gt;t) {             result = -1;         }         return result;     } }     I have removed all previous versions.  My thanks to: Atlas generation for different extents Can Ability Score increases caused by magic items qualify me for feats? As far as I know, only a player character's non-temporary ability scores are considered for taking feats, taking prestige classes, etc. Meanwhile, any ability bonus that comes from spells, or magic items that are in effect only while worn, is not counted (except tomes which increase abilities permanently).  So a Fighter with low Int who wants to qualify for Combat Expertise can't use spells or items that gives an Int bonus to raise it high enough to qualify. Is that right?  For example:  Say our fighter has Str 12, so he can not take the Power Attack feat. Suppose he asks for a spell from the wizard to make his Str 16, or to borrow a ring which provides +4 Str from another character. (Or any other method that will provide him a non-permanent bonus). His Str is now 16. Can he take Power Attack with that non-permanent bonus now? Because after the spell duration ends or he takes off the ring, his Str score will be to low again to qualify for Power Attack. In high Reynolds numbers we have turbulent flow. This is because the inertial forces are much greater than the viscous forces. I understand inertial forces to be actually the fictional forces due to the momentum of the moving fluid. And viscous to be the forces that drag each layers together. But why when inertial forces are too high than the viscous forces, there is turbulence? Why don't the molecules just continue to move laminarly due to their momentum? I can assume the viscous forces are not very strong in high speeds (in high inertial forces) to keep them together to form a laminar flow? But again, why they result in irrational movement after the effect of viscous forces is not anymore considerable? As a mechanical analogue, if I have balls attached together and make them travel linearly, and remove their between them attachment, they can continue to travel linearly. But what happens in fluid molecules that turbulence is created? Minecraft extra folders? Once I click to run minecraft a small window appears saying "Downloading runtime", then three other folders appear onto my desktop: Game, Native Log, and Runtime. This really annoys me, as I have to keep deleting them after I am done with a session of minecraft. Why is this? It never use to happen before. How to interpret the margin of error in a poll? Recently the media reported on a political poll that stated that "46% of Republican voters in Mississippi think that interracial marriage should be illegal".  One example story (of many around the 'net) is this one from the NY Daily News: .  From that article:     A survey conducted last month shows 46% of GOP voters in the state   believe interracial marriage should be illegal - a plurality of the   people questioned   Given that I know many people in interracial marriages (including in my own family) I was motivated to track down the full story rather than fall to the obvious hysteria.  I located the press release on the poll from Public Policy Polling  (PDF)  which has:     46% of these hardcore Republican voters believe interracial marriage   should be illegal, while 40% think it should be legal. With Barbour   included, Huckabee gets more support (22%) from the former than the   latter (15%), as does Palin (13-6). The support for Bachmann (10-2),   Gingrich (13-8), and Pawlenty (4-1) works the opposite way.   And at the end of the first page they state:     PPP surveyed 400 usual Mississippi Republican primary voters from   March 24th to 27th. The survey’s margin of error is +/-4.9%.   Now what I don't understand is how to interpret the results especially the margin of error value.    From the raw numbers, 46% (~50%) of 400 voters is 200 voters who responded who think that interracial marriages should be illegal.  But from stats of Mississippi in the 2008 Federal election, McCain polled about 725,000 Republican votes (to Obamas 556,000). My gut feeling is that you can't extrapolate that 46% number to the other 724,600 Republican voters and still retain a 5% margin of error.  So is the media misrepresenting the numbers (really? the media would do that?!?!?!) Or are there statistics at work that I don't understand?  Thanks for your help! I've seen examples like this:   public class MaxSeconds {    public static final int MAX_SECONDS = 25; }   and supposed that I could have a Constants class to wrap constants in, declaring them static final. I know practically no Java at all and am wondering if this is the best way to create constants. How do I move Steam games to a new computer without re-downloading them? Jack probs with heaphones/earbuds So I already asked this question, but I couldn't respond to the answers. I can't hear out of the left ear of any headphones/earbuds because I have to push the jack towards the Earth to hear out of it. It seems you guys think the jack is the problem when I'm pretty sure it's the computer (my Acer laptop). I also forgot to mention the headphones (PX22 Turtle Beaches) work with both ears, but I have to plug in the usb extension cord in order for that to work (it's also the same cord that enables the mic on my headphones), plus I lost the cord. Thanks 4 hewps. Optimal way to ignore duplicate inserts? Background  This problem relates to ignoring duplicate inserts using PostgreSQL 9.2 or greater. The reason I ask is because of this code:    -- Ignores duplicates.   INSERT INTO     db_table (tbl_column_1, tbl_column_2)   VALUES (     SELECT       unnseted_column,       param_association     FROM       unnest( param_array_ids ) AS unnested_column   );   The code is unencumbered by checks for existing values. (In this particular situation, the user does not care about errors from inserting duplicates -- the insertion should "just work".) Adding code in this situation to explicitly test for duplicates imparts complications.  Problem  In PostgreSQL, I have found a few ways to ignore duplicate inserts.  Ignore Duplicates #1  Create a transaction that catches unique constraint violations, taking no action:    BEGIN     INSERT INTO db_table (tbl_column) VALUES (v_tbl_column);   EXCEPTION WHEN unique_violation THEN     -- Ignore duplicate inserts.   END;   Ignore Duplicates #2  Create a rule to ignore duplicates on a given table:  CREATE OR REPLACE RULE db_table_ignore_duplicate_inserts AS     ON INSERT TO db_table    WHERE (EXISTS ( SELECT 1            FROM db_table           WHERE db_table.tbl_column = NEW.tbl_column)) DO INSTEAD NOTHING;   Questions  My questions are mostly academic:   What method is most efficient? What method is most maintainable, and why? What is the standard way to ignore insert duplication errors with PostgreSQL? Is there a technically more efficient way to ignore duplicate inserts; if so, what is it?   Thank you!