As you know, in Eclipse you can turn on "Unnecessary 'else' statement" check that will trigger on if-then-else with premature return. And, from my experience, there are two most possible situations when use such statement:  1) Pre-check:  if (!validate(arg1)) {     return false; } doLotOfStuff();   2) Post-check:  doLotOfStuff(); if (condition) {      return foo;  } else {     return bar;  }   In the second case, if the trigger is on, Eclipse will suggest you to change the code to:  doLotOfStuff(); if (condition) {      return foo;  }  return bar;    However, I think that the return with else statement is more readable as it is like direct mapping of business logic. So I am curios if this "Unnecessary 'else' statement" code convention is widespread or code with else statement is more preferable?
Are there good reasons why it's a better practice to have only one return statement in a function?   Or is it okay to return from a function as soon as it is logically correct to do so, meaning there may be many return statements in the function?
Is it possible to show our custom message in QGIS Status bar using python? Is there any way to show our custom message in Qgis Status bar using python? Just like in arcgis IApplication.statusbar.message(0) = "Please wait..."  like that is there any option to show progressbar in Qgis like IApplication.progressbar.show() How to deal with factors with rare levels in cross-validation? Suppose in a regression analysis in R, I have a factor type independent variable with 3 levels in my train dataset. But in the test data set that same factor variable has 5 levels. Therefore I can not predict the response values for test dataset. What should be done in this case? Solve for $x$ in $6x^2-25x+12+\frac{25}{x}+\frac{6}{x^2}=0$ Could new users be prompted to edit instead of commenting? It's very common to ask for additional information on a question.  This is perhaps most common with new users who are a little unfamiliar with the need to put all relevant information in their question to start with.  To be blunt, I'm a little tired of explaining to new users that an edit is better than a comment, particularly where we ask "please add the output of..." I note that some users have taken to explicitly asking OPs to edit their question and adding an edit link in their comment.  But still this is missed.  More recently, adding a comment to a new user's question displays a little note saying:     ... is a new contributor. Be nice, and check out our Code of Conduct.   Could there be a similarly formatted note to new contributors commenting on their own question or answer:     If you need to add more information please  your [question][answer] instead of adding a comment. Is there a systematic way of finding the conjugacy class and/or centralizer of an element? Is there a systematic way of finding the conjugacy class and centralizer of an element? Could the task be simplified if we are working with "special groups" such as $S_n$ or $A_n$? Are there any intuitive approaches? Thanks. Identify $E(X\mid X+Y)$ for $X$ and $Y$ independent and Poisson I am currently trying to understand how does an instance of the EM algorithm is derived when there are "hidden variables" in this old paper: .  I don't really understand how the expectation step is derived, and what bothers me the most, is that I cannot prove the following statement (right before 2.11):  $$ \mathbb{E}[X|X+Y] = \frac{(X+Y)\lambda_X}{\lambda_X+\lambda_Y} $$  where $X \sim Poisson\{\lambda_X\}$ and $Y \sim Poisson\{\lambda_Y\}$  To begin, I wrote the discrete expectation as follows: $$ \mathbb{E}[X|X+Y] = \sum_{k=1}^{X+Y} k P(X=k|X+Y)\\ = \sum_{k=0}^{X+Y} k \frac{P(X+Y|X=k)P(x)}{P(X+Y)} $$  Where I can replace $$ P(X+Y=k) = \frac{(\lambda_X+\lambda_Y)^ke^{-(\lambda_X+\lambda_Y)}}{k!}$$ $$ P(k=x) = \frac{\lambda_X^xe^{-\lambda_X}}{x!}$$ $$ P(X+Y=k|x) = P(Y=x-k) = \frac{\lambda_Y^{x-k}e^{-\lambda_Y}}{(x-k)!}$$  but I dont really know how to mix that together, because I don't really see what does the event $X+Y$ stands for, and how does it rely on the x in the integral ?  Thank you very much for you help What is $dx$ in integration? Why modules with no variables? Usually, when we see two letters put together it is to define the pronunciation or to differentiate synonyms or just its foreign origins. But some words don't seem to have any reason to double up.     Why does vacuum have two of the letter U?  Why does aardvark have two of the letter A?  Why does llama have two of the letter L? How to integrate OpenCV Manager in Android App While any of the other sections under &quot;Edit Profile &amp; Settings&quot; do work normally. I was working on a problem that resulted in the calculation: $20 \equiv 10x \pmod{11}$.  I got the answer $x \equiv 2 \pmod{11}$ with the thought process: Since $10$ is a factor of $20$ I can rewrite $20 \pmod{11}$ as $10x \pmod{11}$ with $x=2$. But isn't this basically the same as using division, which we aren't supposed to do in modular spaces?  If I solve by multiplying $20$ by the multiplicative inverse of $10 \pmod{11}$ which is $10$, I get $200 \pmod{11}$ which simplifies to $2 \pmod{11}$ anyway. Did these numbers just happen to be the same or is my original method valid? What happens if you increment an iterator that is equal to the end iterator of an STL container What is the smallest (installed size) ubuntu based distribution? For ridiculously small hard drives (8GB), what Ubuntu Based (although not necessarily official) distribution offers the smallest installed size?  Let me clarify: I still want a certain amount of personal file space, preferably a few gig. I also don't have a problem with performance, while it is mediocre, a 2.6GHz single-core and 1GB of ram suffice to run ubuntu fine, but i find that it  uses 6-7GB of space. I am aiming for closer to 4GB. Error: MIXED_DML_OPERATION on setup and non-setup objects I am studying different point estimate methods and read that when using MAP vs ML estimates, when we use a "uniform prior", the estimates are identical. Can somebody explain what a "uniform" prior is and give some (simple) examples of when the MAP and ML estimators would be the same? How to establish the following identities without the help of calculus:  For positive integer $n, $ $$\sum_{1\le r\le n}\frac{(-1)^{r-1}\binom nr}r=\sum_{1\le r\le n}\frac1r $$  and  $$\sum_{0\le r\le n}\frac{(-1)^r\binom nr}{4r+1}=\frac{4^n\cdot  n!}{1\cdot5\cdot9\cdots(4n+1)}$$ How to check if a macro value is empty or will not create text with plain TeX conditionals? I have a macro which holds some text value, e.g. \macro{some text}. If it is empty, I would like for nothing to appear in the document, but it has some content of any kind which would produce text displayed in the document, I would like a message to appear, "Text: some text".   \macro{} would be considered empty. \def\somedata{}, \macro{\somedata} would be considered empty. \macro{0} would be considered not empty.   I have tried making a TeX conditional which can check if the value is not empty, but nothing I tried works, e.g.:  \ifx #1 {} \else     Text: #1 \fi  \ifx#1{} \else     Text: #1 \fi  \ifx #1 \nil \else     Text: #1 \fi  \ifx#1!="" \else     Text: #1 \fi   What is the correct syntax for creating a conditional in plain TeX with checks if a value is not empty? Why is "No new release found" when upgrading from a LTS to the next? I'm following the , but on launching the upgrade tool I get this response:  Checking for a new ubuntu release No new release found   Am I doing something wrong? Is there a workaround? Why log-transforming the data before performing principal component analysis? Im following a tutorial here:  to gain a better understanding of PCA.  The tutorial uses the Iris dataset and applies a log transform prior to PCA:     Notice that in the following code we apply a log transformation to the continuous variables as suggested by [1] and set center and scale equal to TRUE in the call to prcomp to standardize the variables prior to the application of PCA.   Could somebody explain to me in plain English why you first use the log function on the the first four columns of the Iris dataset. I understand it has something to do with making data  relative but am confused what's exactly the function of log, center and scale.  The reference [1] above is to Venables and Ripley, Modern applied statistics with S-PLUS, Section 11.1 that briefly says:     The data are physical measurements, so a sound initial strategy is to work on log scale. This has been done throughout.