Increasing QGIS 3.2 (Bonna) Render Size on my Macbook Air
Map display not filling window in QGIS on Mac?
Python idiom to return first item or None I'm sure there's a simpler way of doing this that's just not occurring to me.  I'm calling a bunch of methods that return a list.  The list may be empty.  If the list is non-empty, I want to return the first item; otherwise, I want to return None.  This code works:  my_list = get_list() if len(my_list) &gt; 0: return my_list[0] return None   It seems to me that there should be a simple one-line idiom for doing this, but for the life of me I can't think of it.  Is there?  Edit:  The reason that I'm looking for a one-line expression here is not that I like incredibly terse code, but because I'm having to write a lot of code like this:  x = get_first_list() if x:     # do something with x[0]     # inevitably forget the [0] part, and have a bug to fix y = get_second_list() if y:     # do something with y[0]     # inevitably forget the [0] part AGAIN, and have another bug to fix   What I'd like to be doing can certainly be accomplished with a function (and probably will be):  def first_item(list_or_none):     if list_or_none: return list_or_none[0]  x = first_item(get_first_list()) if x:     # do something with x y = first_item(get_second_list()) if y:     # do something with y   I posted the question because I'm frequently surprised by what simple expressions in Python can do, and I thought that writing a function was a silly thing to do if there was a simple expression could do the trick.  But seeing these answers, it seems like a function is the simple solution. I have these two CREATE TABLE statements:   CREATE TABLE GUEST (   id int(15) not null auto_increment PRIMARY KEY,   GuestName char(25) not null );  CREATE TABLE PAYMENT (   id int(15) not null auto_increment   Foreign Key(id) references GUEST(id),   BillNr int(15) not null );   What is the problem in the second statement? It did not create a new table. Uniform random variable as sum of two random variables Taken from :  Show that it cannot be the case that $U=X+Y$ where $U$ is uniformly distributed on [0,1] and $X$ and $Y$ are independent and identically distributed. You should not assume that X and Y are continuous variables.  A simple proof by contradiction suffices for the case where $X$, $Y$ are assumed discrete by arguing that it always possible to find a $u$ and $u'$ such that $P(U\leq u+u') \geq P(U\leq u)$ while $P(X+Y \leq u) = P(X+Y \leq u+u')$.  However this proof does not extend to $X,Y$ being absolutely continuous or singular continuous. Hints/Comments/Critique? Correct position of "only" Which is grammatically correct?  I can only do so much in this time.  or  I can do only so much in this time. I am studying statistics and I am wondering when it comes to standard error or a sampling if the calculation changes when there are weights added.   I have a weighted mean:  $$\mu_{w} = \dfrac{\sum_{i=1}^Nw_ix_i}{\sum_{i=1}^Nw_i}$$ and a weighted variance calculated by:  $$s^2_{w}=\dfrac{\sum_{i=1}^Nw_i}{(\sum_{i=1}^Nw_i)^2-\sum_{i=1}^Nw_i^2}\cdot \sum_{i=1}^N(x_i-\mu)^2$$  is the sampling error still calculated as  $$\text{SE}=\sqrt{\dfrac{s^2_{w}}{n}}$$ How to show this equality of $\rho(X,Y)$ Let I have $(S,\Sigma,\mu)$ be a probability space, then $X,Y \in \Sigma$. Define $\rho (X,Y)$ by $\rho (X,Y)$ = correlation between random variable $I_X$ and $I_Y$, where $I_X$ and $I_Y$ are the indicator function of $X$ and $Y$. Express $\rho (X,Y)$ in term of $\mu (X)$, $\mu (Y)$, $\mu(XY)$. Conclude that $\rho(X,Y)=0$, if and only if $X$ and $Y$ are independent.      How to show that: $$\rho(X,Y)= \frac{\mu(XY)\,\mu(X^cY^c)-\mu(XY^c)\,\mu(X^cY)}{(\mu(X) \,\mu(X^c)-\mu(Y) \,\mu(Y^c))^{1/2}};0&lt;\mu(X)&lt;1;\,0&lt;\mu(Y)&lt;1$$ I have to solve: $\lim\limits_{x\to \infty} \frac{\ln(x+1)}{\ln(x)}$. Can you give me any hints to go? Thanks a lot! How do I turn on SharePoint App store in SharePoint 2013 Explain what is a transistor in plain English! notify-send not working under ssh Maybe this is answered somewhere else, but I didn't see it.  I am running Ubuntu 14.04. When I SSH into my machine, for example:  ssh &lt;user&gt;@&lt;machineip&gt; notify-send "Hello"   I don't see anything on the monitor where I am logged into the machine. If I prefix notify-send with DISPLAY=:0.0 or DISPLAY=:0 nothing different happens. I just never see any notification on the current session.  Is there some trick/switch to getting this working?  In case this isn't clear, allow me to reiterate: From Computer A, I SSH into Computer B. Within the SSH session, I wish to execute notify-send to run on Computer B. I expect a growl-type notification to appear on the monitor of Computer B. A non-diagonal $4\times4$ matrix such that $A^3=A^2=0$ and its rank is $2$ Let $A$ be a $4\times 4$ matrix over $\mathbb C$ such that $\operatorname{rank} A=2$ and $A^3=A^2\neq 0$  Suppose $A$ is not diagonalizable.  Then which one is true   $A^2=A\neq 0$ $\exists$ a vector $v$ such that $Av\neq 0$ but $A^2v= 0$ the characteristic polynomial of $A$ is $x^4-x^3$   My try:  If $A^2=A$ then minimal polynomial of $A$ has two distinct roots and hence $A$ is diagonalisable hence false. Since $A^3=A^2\neq 0$ so the characteristic roots of $A$ are $0,0,1$ Since rank of $A$ is $2$ $1$ must appear twice so the characteristic polynomial of $A=x^4-(0+0+1+1)x^3+(0.0.1+0.1.1+1.1.0+1.0.1)x^2+(0.0+0.1+1.1+...)x+(0.0.1.1)$ hence 3 is false  2 I am not sure Please find the error in my solution and don't refer it to some previous solution Process to convert simple Python script into Windows executable How do I reference photographs with a separate numbering system to figures in latex? I am writing a book, and would like to be able to have the photographs labelled with an independent numbering system to my figures.  In the text I would refer to, for example, figure X and separately to photograph X, so I want them to have different numbering systems, just as equations and figures do.  Is it possible to have a different \begin{figure} environment so that the numbering can be separated? Should I be concerned that the sill plate is not lined up with the foundation? I am in the process of building a one level home in PA. After the formed concrete walls were poured and the framing began, I noticed that on one side of the house that the sill plate was flush with the edge of the foundation wall in the rear, but, by the time the sill plate got to the front it was 2 1/2" away from the edge of the foundation wall. In summary, the sill plate walks from flush with the foundation wall at the rear to 2 1/2" at the front. This happens over about a 50' run.  Any thoughts or concerns would be appreciated. Any recommendations on what sorts of questions to ask when I meet the site supervisor on Monday? I accidentally installed some USB drivers to my Windows 7 system, they were the wrong ones and now my keyboard and mouse won't work. A system restore would get rid of them, but obviously I can't control my computer to make that happen.  Keyboard and mouse still work before windows has loaded, in the BIOS and boot system, so can I do anything from there? I've already tried booting into another OS, accessing my windows filesystem and deleting the Program Files entry, but it didnt work so they must go deeper than that. Or could i launch it from a remote machine? I've got some VNC server insalled so if i could get that running that could work. The code for reference is this  @article{matcontcl,  title= {MATCONT and CL MATCONT},  author = {A. Dhooge, W. Govaerts, Yu.A. Kuznetsov, W. Mestrom, A.M. Riet and  B.Sautois},  year = {2006},  journal = {Continuation toolboxes in matlab}, }   This is the error that follows  This is BibTeX, Version 0.99d (TeX Live 2015/W32TeX) The top-level auxiliary file: PropuestaInvestigacion.aux The style file: abbrv.bst Database file #1: biblio.bib Too many commas in name 1 of "A. Dhooge, W. Govaerts, Yu.A. Kuznetsov, W. Mestrom, A.M. Riet and B.Sautois" for entry matcontcl while executing---line 1049 of file abbrv.bst Too many commas in name 1 of "A. Dhooge, W. Govaerts, Yu.A. Kuznetsov, W. Mestrom, A.M. Riet and B.Sautois" for entry matcontcl while executing---line 1049 of file abbrv.bst Too many commas in name 1 of "A. Dhooge, W. Govaerts, Yu.A. Kuznetsov, W. Mestrom, A.M. Riet and B.Sautois" for entry matcontcl while executing---line 1090 of file abbrv.bst Too many commas in name 1 of "A. Dhooge, W. Govaerts, Yu.A. Kuznetsov, W. Mestrom, A.M. Riet and B.Sautois" for entry matcontcl while executing---line 1090 of file abbrv.bst (There were 4 error messages)   How could I fix it? We login to applications almost every day. The password is stored in our fingers, as an automated process (if they have used it long enough). When users realize they have entered a wrong character (before hitting login-button) they erase the whole password, and retype the entire password – instead of just the last wrong character. Question is why?         &ndash; Wireframes created with If $\sum a_n$ converges and $b_n=\sum\limits_{k=n}^{\infty}a_k $, prove that $\sum \frac{a_n}{b_n}$ diverges Let $\displaystyle \sum a_n$ be  convergent series of positive terms and set  $\displaystyle b_n=\sum_{k=n}^{\infty}a_k$ , then prove that $\displaystyle\sum \frac{a_n}{b_n}$ diverges.   I could see that $\{b_n\}$ is monotonically decreasing sequence converging to $0$ and I can write $\displaystyle\sum \frac{a_n}{b_n}=\sum\frac{b_n-b_{n+1}}{b_n}$, how shall I proceed further? Views indicator inaccurate, shows one views on question with two close votes Two close votes and only one person has viewed the question?    How did this happen? What is a “protected” or "highly active" question? Questions can be protected (i.e. marked "highly active").   What does it mean for a question to be protected? Why are some questions protected? Who can protect and unprotect questions? Who can answer a protected question? How are protected questions displayed? When should I protect or unprotect a question? When does the Community user protect a question?