I am trying to read and understand on what device would be a better switching element - BJT or MOSFET. From what I have read and my understanding is that: If the application requires faster switching, we need to go for the BJT because, the capacitance between the base and emitter is very less when compared to the capacitance between the gate and the source of the MOSFET. Since, charging the capacitance takes some time, and this capacitance in a MOSFET is higher, it is slower to switch than a transistor. Am I correct? And my other conclusion is that, the MOSFET has Rds(on) parameter. So, when in full conduction, there is an inherent power loss due to this internal resistance. Whereas in a transistor, there is no resistor. So, there is no big power loss. I am not sure about the cost part of the device. Which would cost us more? Is my understanding correct? Please let me know if my understanding is correct and if there are other critical parameters I have missed?
In my experimentation, I've used only BJTs as switches (for turning on and off things like LEDs and such) for my MCU outputs. I've been repeatedly told, however, that N-channel enhancement-mode MOSFETs are a better choice for switches (see  and , for examples), but I'm not sure I understand why. I do know that a MOSFET wastes no current on the gate, where a BJT's base does, but this is not an issue for me, as I'm not running on batteries. A MOSFET also requires no resistor in series with the gate, but generally DOES require a pull-down resistor so the gate doesn't float when the MCU is rebooted (right?). No reduction in parts count, then. There doesn't seem to be a great surplus of logic-level MOSFETs that can switch the current that cheap BJTs can (~600-800mA for a 2N2222, for example), and the ones that do exist (TN0702, for example) are hard to find and significantly more expensive. When is a MOSFET more appropriate than a BJT? Why am I continually being told that I should be using MOSFETs?
Prove if $\operatorname{ord}(a)=m$, $\operatorname{ord}(b)=n$, and $\operatorname{gcd}(m,n)=1$, then $\operatorname{ord}(ab)=mn$.   I was reading this and was thinking how this proof would look like. I tried to do it and am not sure if this is correct. Here is what I did:  If $a$ and $b$ commute then $(ab)^{mn} = a^{mn} * b^{mn} = (a^m)^n * (b^n)^m = 1 * 1 = 1.$ So $ord(ab) | mn$.  Now, take $k = \operatorname{ord}(ab) = m^\prime * n^\prime$ where m' is relatively prime with $n$ and $n'$ is relatively prime with $m$. By the result above $m' | m$ and $n' | n$. Now we have $((ab)^k)^{m/m'} = 1$ since $(ab)^k=1$. But on the other hand, by the commutativity:  $$((ab)^k)^(m/m') =$$  $$((ab)^(m' * n'))^(m/m') =$$  $$ a^{n'm} * b^{n'm} = $$  $$(a^m)^{n'} * b^{n'm'}=$$  $$b^{n'm'} = 1$$  This implies that $n' * m'$ is divisible by $n$. But $m'$ is relatively prime with $n$, so we must have $n' = n.$ By symmetry, $m' = m$. So $ord(ab) = mn$.  Just to say this again, I want to prove if $a$ and $b$ commute and $m$ and $n$ are relatively prime then   $$ord(ab)=mn.$$   The comments are vague. I guess this must be the answer then and there probably is not another way to do this. Do trees really get a large share of their mass from the carbon in the air? I remember hearing that trees and other plants actually obtain a large amount of their mass from the carbon floating in the air, not the ground beneath them. Does the makeup of air actually contain enough carbon to support this theory, and is a tree's surface area actually large enough to obtain the amount of carbon it needs directly from the air? Beamer keeping line position constant on itemize I want to have a slide in beamer with itemize exposing new line on each click while at the bottom part of the slide there are some equations. This is my attempt  \begin{frame}   \begin{overprint}{\textwidth}     \leavevmode     \begin{itemize}[&lt;+-&gt;]     \item &lt;1-&gt; Poisson Boltzman equation (PB)     \item &lt;2-&gt; Debye-H\"uckle equation  (DH)     \item &lt;3-&gt; The naive approach - applying (DH) equation to PE     \end{itemize}   \end{overprint}   \begin{tikzpicture}     \node at (0,0) {};         \node&lt;1,2&gt; [text width = 20cm]at (10.5,-1) {$ \nabla^2 \phi =\sum_i \frac{n_i q_i\text{e}^{-q_i \phi/kT}}{4 \pi \epsilon}$};         \node &lt;2&gt; [text width = 20cm]at (10.5,-2) {$q_i \phi/kT \ll 1 \Rightarrow \nabla^2 \phi \simeq \kappa^2 \phi$};         \node &lt;2&gt; [text width = 20cm, font=\footnotesize]at (10.5,-2.5) {$\kappa^2 = \lambda^{-1/2} =  \sum_i \frac{n_i q_i}{4 \pi \epsilon}$};         \node &lt;3&gt; [text width = 20cm] at(10.5,-1) {$\frac{F_{el}}{VkT} = - \left ( \frac{ 4 \pi e^2}{\epsilon kT}     \sum_{i=1} n_i z_i^2 \right )^{3/2} \left ( 12 \pi \right )^{-1}$};   \end{tikzpicture} \end{frame}   However, the itemized line jump up and down between slides. I've tried to use itemize without any environment surrounding it. I've also tried to use overlayarea instead of overprint. How can I keep the line position constant?  I've uploaded a gif animation to display this. On my machine it run really fast and I can't fix this. Hope the problem is understood.   When I run this, I get Energy conservation and interference I have a problem with energy conservation in case of interfering waves.  Imagine two harmonic waves with amplitudes $A$. They both carry energy that is proportional to $A^2$, so the total energy is proportional to $2A^2$. When they interfere, the amplitude raises to $2A$, so energy is now proportional to $4A^2$ and bigger than before.  The equivalent question is what happens to the energy with the superposition of two waves that interfere destructively.  Also, if someone could comment on the statement about this problem in my physics book (Bykow, Butikow, Kondratiew):      The sources of the waves work with increased power during the interference because they feel the wave from the other source. Intuitive explanation for formula of maximum length of a pipe moving around a corner? For one of my homework problems, we had to try and find the maximum possible length $L$ of a pipe (indicated in red) such that it can be moved around a corner with corridor lengths $A$ and $B$ (assuming everything is 2d, not 3d):    My professor walked us through how to derive a formula for the maximum possible length of the pipe, ultimately arriving at the equation $L = (A^{2/3} + B^{2/3})^{3/2}$.  The issue I have is understanding intuitively why this formula works, and exactly what it's doing. I understand the steps taken to get to this point, but there's an odd symmetry to the end result -- for example, is the fact that $\frac{2}{3}$ and its inverse are the only constants used just a coincidence, or indicative of some deeper relationship?  I also don't quite understand how the formula relates, geometrically, to the diagram. If I hadn't traced the steps myself, I would have never guessed that the formula was in any way related to the original problem.  If possible, can somebody give an intuitive explanation as to why this formula works, and how to interpret it geometrically?    Here's how he found the formula, if it's useful:  The formula is found by finding the maximum possible length of the pipe by expressing the length in terms of the angle $\theta$ formed between the pipe and the wall, and by taking the derivative to find when $\frac{dL}{d\theta} = 0$, which is the minimum of $\frac{dL}{d\theta}$ and is therefore when $L$ is the smallest:  $$ L = \min_{0 \leq \theta \leq \frac{\pi}{2}} \frac{A}{\cos{\theta}} + \frac{B}{\sin{\theta}} \\ 0 = \frac{dL}{d\theta} = \frac{A\sin{\theta}}{\cos^2{\theta}} - \frac{B\cos{\theta}}{\sin^2{\theta}} \\ 0 = \frac{A\sin^3{\theta} - B\cos^3{\theta}}{\sin^2{\theta}\cos^2{\theta}} \\ 0 = A\sin^3{\theta} - B\cos^3{\theta} \\ \frac{B}{A} = \tan^3{\theta} \\ \theta = \arctan{\left( \frac{B}{A} \right)^{\frac{1}{3}}} \\ $$  At this point, we can substitute $\theta$ back into the original equation for $L$ by interpreting $A^{1/3}$ and $B^{1/3}$ as sides of a triangle with angle $\theta$ and hypotenuse $\sqrt{A^{2/3} + B^{2/3} }$:  $$ \cos{\theta} = \frac{A^{1/3}}{ \sqrt{A^{2/3} + B^{2/3} }} \\ \sin{\theta} = \frac{B^{1/3}}{ \sqrt{A^{2/3} + B^{2/3} }} \\ \therefore L = A^{2/3} \sqrt{A^{2/3} + B^{2/3} } + B^{2/3} \sqrt{A^{2/3} + B^{2/3} } \\ L = (A^{2/3} + B^{2/3}) \sqrt{A^{2/3} + B^{2/3} } \\ L = (A^{2/3} + B^{2/3})^{3/2} \\ $$  The equation for the formula for the maximum length of the pipe is therefore $L = (A^{2/3} + B^{2/3})^{3/2}$. I have a module with a page callback handler for the path "products". So if the user navigates to products/apples then the module presents a page about our apples, and if they go to products/oranges then etc. These pages include detail about the various products.  I would like XML Sitemap to be populated from my module. After all, it's my module that knows what products exist, their descriptions etc.  Any hook or anything I can use for that? Getting text from last marker to EOF in POSIX.2 I have a text with marker lines like:  aaa --- bbb --- ccc   I need to get a text from the last marker (not inclusive) to EOF. In this case it will be  ccc   Is there an elegant way within POSIX.2? Right now I use two runs: first with nl and grep for the last occurrence with respective line number. Then I extract the line number and use sed to extract the chunk in question.  The text segments may be quite large, so I'm afraid to use some text-adding method like we add the text to a buffer, if we encounter the marker we empty the buffer, so that at EOF we have our last chunk in the buffer. Parallelize Bash script with maximum number of processes Lets say I have a loop in Bash:  for foo in `some-command` do    do-something $foo done   do-something is cpu bound and I have a nice shiny 4 core processor. I'd like to be able to run up to 4 do-something's at once.  The naive approach seems to be:  for foo in `some-command` do    do-something $foo &amp; done   This will run all do-somethings at once, but there are a couple downsides, mainly that do-something may also have some significant I/O which performing all at once might slow down a bit. The other problem is that this code block returns immediately, so no way to do other work when all the do-somethings are finished.  How would you write this loop so there are always X do-somethings running at once? What is the relationship between a chi squared test and test of equal proportions? Suppose that I have three populations with four, mutually exclusive characteristics.  I take random samples from each population and construct a crosstab or frequency table for the characteristics that I am measuring.  Am I correct in saying that:   If I wanted to test whether there is any relationship between the populations and the characteristics (e.g. whether one population has a higher frequency of one of the characteristics), I should run a chi-squared test and see whether the result is significant. If the chi-squared test is significant, it only shows me that there is some relationship between the populations and characteristics, but not how they are related. Furthermore, not all of the characteristics need to be related to the population.  For example, if the different populations have significantly different distributions of characteristics A and B, but not of C and D, then the chi-squared test may still come back as significant. If I wanted to measure whether or not a specific characteristic is affected by the population, then I can run a test for equal proportions (I have seen this called a z-test, or as prop.test() in R) on just that characteristic.   In other words, is it appropriate to use the prop.test() to more accurately determine the nature of a relationship between two sets of categories when the chi-squared test says that there is a significant relationship? Prevent windows from going into sleep when my program is running? What would be an English equivalent for the Mexican Spanish word tocayo? In Mexican Spanish (not sure if other Spanish speaking countries use the word too) we call "tocayo" to those people that share the same name as us (but not necessarily the same last name i.e., Juan Gonzalez and Juan Carlos Castillo are tocayos).  I was wondering if an equivalent for this word exists at all in English or maybe even an expression? What is the command to open the shutdown dialog? I would like to use a gesture to shutdown/restart my computer and I need to know the command that launches the shutdown dialog: Symbolizing layer with graduated colors by date/time field? I've got a layer of polygons where each has a date associated with it.  I want to color the polygons with graduated colors, but I want the colors to start with the newest polygons and fade to the oldest polygons.  So far I haven't been able to find a way to do this in ArcMap (&lt;= 9.3.1) other than to create a new field and calculate some integer or float value based on the date.  Is it possible to use a date or time field directly?   The data is natively a date-time value There are far too many records to use any unique-value renderer Converting the date to a numerical field is an answer for a different question. Stop Mathematica from giving imaginary solutions I know this is a total noob question but then again, when it comes to PostgreSQL I am a total noob...    I have installed the OpenGeo suite on my computer, running Windows 7, 64-bit.  I have downloaded the tutorial data and have been working through it.  I would like to access the database that I have made with ArcGIS so I can start learning about how that works.  However, when I try to connect to the database using the "Add Database Connection..." I can't seem to figure out what to put in for 'Instance' - everything I've tried (localhost, localhost,54321, my IP address with and without the port, my computer name) doesn't seem to work.  I installed and created the nyc test database according to all the instructions in the OpenGeo tutorial pages but am at a total loss here.  I know this must be an easy thing to deal with, I just can't get my head around it.  Can someone with more experience throw me a bone on this one?    Frustratingly enough, QGIS connects to the database with almost no effort and everything works fine - but my organization is heavily ESRI focused and switching to QGIS is a long shot...  EDIT Thanks everyone for pitching in on this.  I really appreciate the advice, it's what makes this site great.  I have installed    OpenGeo Suite 3.0.1 with no extensions ArcGIS Desktop 10.1, no license for server   I just went to the Opengeo website and downloaded the Windows installer and installed the default configuration. I have tried every permutation for the instance name that I can think of - using colons and commas, my machine name, localhost, postgresql, server, my IP address, random curse words, anything I can think of.  I have been using port 54321 instead of 5432 because that is what the OpenGeo workshop told me to set up my 'nyc' practice database to use.    It seems that localhost should work, here is a shot of the server properties from pgAdmin: I have a dataset for which I have multiple sets of binary labels. For each set of labels, I train a classifier, evaluating it by cross-validation. I want to reduce dimensionality using principal component analysis (PCA). My question is:  Is it possible to do the PCA once for the whole dataset and then use the new dataset of lower dimensionality for cross-validation as described above? Or do I need to do a separate PCA for every training set (which would mean doing a separate PCA for every classifier and for every cross-validation fold)?  On one hand, the PCA does not make any use of the labels. On the other hand, it does use the test data to do the transformation, so I am afraid it could bias the results.  I should mention that in addition to saving me some work, doing the PCA once on the whole dataset would allow me to visualize the dataset for all label sets at once. If I have a different PCA for each label set, I would need to visualize each label set separately. Why aren't Java Collections remove methods generic? Why isn't  generic?    Seems like Collection&lt;E&gt; could have boolean remove(E o);   Then, when you accidentally try to remove (for example) Set&lt;String&gt; instead of each individual String from a Collection&lt;String&gt;, it would be a compile time error instead of a debugging problem later. If $R$ is an infinite ring, then $R$ has either infinitely many zero divisors, or no zero divisors Please help me to prove that if $R$ is an infinite ring, then $R$ has either an infinite number of zero divisors, or it has no zero divisors. Two independent Poisson process question What's the bad magic number error? What's the "Bad magic number" ImportError in python, and how do I fix it?  The only thing I can find online suggests this is caused by compiling a .py -> .pyc file and then trying to use it with the wrong version of python. In my case, however, the file seems to import fine some times but not others, and I'm not sure why.  The information python's providing in the traceback isn't particularly helpful (which is why I was asking here...), but here it is in case it helps:  Traceback (most recent call last):   File "run.py", line 7, in &lt;module&gt;     from Normalization import Normalizer