Python 3.8: Iterate over 1st and 2nd element, then 2nd and 3rd and so on I want to compare certain numbers I have in a list with values from another list by creating a range. Like this: r = np.arange(0, 20, 2)  Now, r is an array that looks like this: array([ 0,  2,  4,  6,  8, 10, 12, 14, 16, 18])  Now, I would like to use a for loop starting with the first two elements of r, and create a range, such that for the first iteration the 1st and 2nd elements are considered, then for the second iteration, the 2nd and 3rd elements are considered. So it looks like this for each iteration: range(0,2) range(2,4) range(4,6) range(6,8)  and so on. Is there a function to loop through in this way? I don't want to iterate over non-overlapping chunks, i.e. range(0,2) range(4,6) # This is not what I want range(6,8)  and so on.
What is the most "pythonic" way to iterate over a list in chunks? I have a Python script which takes as input a list of integers, which I need to work with four integers at a time.  Unfortunately, I don't have control of the input, or I'd have it passed in as a list of four-element tuples.  Currently, I'm iterating over it this way: for i in range(0, len(ints), 4):     # dummy op for example code     foo += ints[i] * ints[i + 1] + ints[i + 2] * ints[i + 3]  It looks a lot like &quot;C-think&quot;, though, which makes me suspect there's a more pythonic way of dealing with this situation.  The list is discarded after iterating, so it needn't be preserved.  Perhaps something like this would be better? while ints:     foo += ints[0] * ints[1] + ints[2] * ints[3]     ints[0:4] = []  Still doesn't quite &quot;feel&quot; right, though.  :-/ Related question:
I am trying to find a way with QGIS to get the intersection area of more than 2 layers.  All the tools in QGIS take just the 2 input layers.  For example in the image below, I have 4 layers and I want to retrieve just the black area.   Furthermore, I need to retrieve the count attribute and add it to the intersected area attribute table (in this case 4)    I know there is a tool that does the trick in ArcGIS, but is there a QGIS solution? Beamer: Blackboard theme and overlays I am currently preparing my beamer presentation for my PhD defense.  I took the example at the url  to get a black board style presentation.  This template includes a short script which uses a random-generator to randomly scatter dust-trails on the black background to mimic chalk traces (see MWE below).  The thing is that parallel to that, I am also using overlays to uncover my slide layout by layout. The script is executed each time I am using a layout command which slows down the compilation quite substantially. I am not so familiar with control statements in latex, so here is my question:  How can-I modify this script for the background to be refreshed only when the slide is over, and not after each layout command?  Remarks:  1) I am using the Augie font, but I didn't included it in the MWE so that it can be compiled more easily  2) In case, it should make a difference I am also using the \begin{textblock*} \end{textblock*} environment from the textpos package to position text on the slide.  Here is my MWE:   \documentclass[10pt,mathserif]{beamer}  \usepackage[francais,english]{babel} \usepackage[utf8] {inputenc} %for ISOlatin1 (8859-1) sources \usepackage[T1] {fontenc}      %for polices DC 8bits   %%%Fancy fonts %\usepackage{emerald} %\usepackage{eulervm} %%%  %%Extra packages \usepackage{amsmath} \usepackage{amsfonts} \usepackage{tikz} \usetikzlibrary{arrows,shapes} \usepackage[absolute,overlay]{textpos}    %set text colors for different objects \setbeamercolor{frametitle}{fg=white} \setbeamercolor{structure}{fg=white} \setbeamercolor{normal text}{fg=white} \setbeamercolor{alerted text}{fg=white} \setbeamercolor{example text}{fg=white}   %%Black background \setbeamercolor{background canvas}{bg=black}    %%%%%%%%%%%%%%%%%%%%%% %%%%%Script: Random Dust Trails%%%%%%%%%%%%%%% \pgfmathsetseed{\number\pdfrandomseed} % seed for random generator \setbeamertemplate{background}{     \begin{tikzpicture}         \useasboundingbox (0,0) rectangle (\the\paperwidth, \the\paperheight);        \foreach \i in {1,...,30} {             \pgfmathsetmacro{\x}{random(0,10000)/5000-1}%             \pgfmathsetmacro{\y}{random(0,10000)/10000-0.1}%             \pgfmathsetmacro{\r}{random(0,10000)/1000-5}%             \rotatebox{\r}{                 \pgftext[at=\pgfpoint{\x\paperwidth}{\y\paperheight}, left, base]{\includegraphics[width=\textwidth]{paintstroke.png}}             }         };      \end{tikzpicture} } %%%%%%%%%%%%%%%%%%%%%%  %%No navigation bar \setbeamertemplate{navigation symbols}{}  \begin{document}      \begin{frame}          \begin{itemize}             \item&lt;1-&gt; bla slide 1             \item&lt;2-&gt; blu slide 1             \item&lt;3-&gt; blub slide 1         \end{itemize}      \end{frame}  %%I want the background to be refreshed with the Dust Trails script only at the end of the frame          \begin{frame}          \begin{itemize}             \item&lt;1-&gt; bla slide 2             \item&lt;2-&gt; blu slide 2             \item&lt;3-&gt; blub slide 2         \end{itemize}      \end{frame}  \end{document}   This is my first post, so please be kind if I did something illegal on the formatting of the message ;-).  Thanks in advance,  Yannick The replier's From email address is modified when Marketing Cloud RMM forwards an email to the routing address We've set up RMM to forward replies to routing address and SFMC adds our subdomain to the replier's From email address (i.e. replier@gmail.com becomes replier.gmail.com@oursubdomain.com). However, their reply-to address remains the same.  It seems like DMARC Forward Reply Rewrite is enabled, but we were advised not to touch it as that may affect email deliverability.  Is there any workaround to this? And what will happen if we disable this feature? BJT Astable Multivibrator How to make wget faster or multithreading? I've just upgraded my computer hardware(cpu + motherboard + graphic card + memory + hard disk), so that install a new OS is needed. I tried to download debian-6.0.6-amd64-netinst.iso with wget command but the speed is so slow that I could not bear. 4Kb/s ~ 17 Kb/s, slow like a running turtle, or even more slower if I use Chrome.  I've read the help information of wget, it seems like there are no options could make it more faster.  Is there anyway to make wget faster? Or is it possible to make it multi-threading download?  PS: my bandwidth is 4M. I use this command:  wget -c url  http://hammurabi.acc.umu.se/debian-cd/6.0.6/amd64/iso-cd/debian-6.0.6-amd64-netinst.iso How to model non-negative zero-inflated continuous data? I'm currently trying to apply a linear model (family = gaussian) to an indicator of biodiversity that cannot take values lower than zero, is zero-inflated and is continuous. Values range from 0 to a little over 0.25. As a consequence, there is quite an obvious pattern in the residuals of the model that I haven't managed to get rid of:   Does anyone have any ideas on how to solve this? update-alternatives --install says it needs link name path priority? I typed:  sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/ jdk1.8.0/bin/java" 1   It's says alternatives --install needs link name path priority How can I install applications like Google Chrome on Ubuntu?  Are there any commands to install an application?    Index of answers: Windows 7 "Waiting for background program to close" I am using Windows 7 Home Premium. When I shut down my computer why does the screen show this:    Before shutting down I'm close all programs. Finding the Eclipse Version Number It is well known that confidence intervals and testing statistical hypothesis are strongly related. My questions is focused on comparison of means for two groups based on a numerical variable. Let's assume that such hypothesis is tested using t-test. On the other side, one can compute confidence intervals for means of both groups. Is there any relation between overlapping of confidence intervals and the rejection of the null hypothesis that means are equal (in favor of the alternative that means differ - two-sided test)? For example, a test could reject the null hypothesis iff the confidence intervals do not overlap. 'pagesize' attribute ignored in hot network list Steps to reproduce:   Open  in Guest/Incognito mode or with cookies disabled. This will have 30 questions per page by default. Click the  link and as expected, you'll see questions 1-50 with page size of 50. Go the the  and see the bug: you're in the second page of 30 items per page, i.e. you'll see questions 31-60 instead 51-100 as expected.     It is very annoying. Please fix it.  My user-agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:70.0) Gecko/20100101 Firefox/70.0  There are no plugins installed affecting the site. It happens both when logged in or not.  The mechanism used to work before, but some weeks/months ago it stopped, enough to bother me to post here :)  Here are all modified "privacy" settings from about:support page:  privacy.clearOnShutdown.offlineApps true privacy.clearOnShutdown.openWindows true privacy.clearOnShutdown.siteSettings    true privacy.cpd.offlineApps true privacy.cpd.openWindows true privacy.cpd.passwords   true privacy.cpd.siteSettings    true privacy.donottrackheader.enabled    true privacy.history.custom  true privacy.item.cookies    true privacy.sanitize.migrateClearSavedPwdsOnExit    true privacy.sanitize.migrateFx3Prefs    true privacy.sanitize.pending    [{"id":"shutdown","itemsToClear":["cache","cookies","offlineApps","history","formdata","downloads","sessions","siteSetti privacy.sanitize.sanitizeInProgress ["cache","cookies","offlineApps","history","formdata","downloads","sessions","siteSettings","openWindows"] privacy.sanitize.sanitizeOnShutdown true privacy.sanitize.timeSpan   0 privacy.trackingprotection.enabled  true privacy.trackingprotection.introCount   20 I don't know why but now, when i go in material preview or rendered (in solid mode it works fine), my object is entirely gray, or invisible idk, because it has the same color of the background. I've been working for days on this project without having this issue, it suddenly showed up. I tried opening other old projects and suddenly they all do the same so i guess it is some blender program setting that applies for all the projects, but idk how it happened cuz i didn't change anything :/, anyone got any tips? Restart my graphics card without rebooting? Installing python module within code I am making a test where I am asked to add the missing words.     [...] chair is [...] useful piece of furniture.    I would have said that a is the missing word in both the cases, but the test says the words I should have added are the and a respectively.     [...] last time I saw [...] bear, I was travelling in [...] Europe.   I would have added: nothing, a, nothing. The correct answer is: the, a, nothing.  Why is the the correct article to use in both the sentences? What is a good focal length for street photography? With a long lens you don´t disturb people but you are left "out of the scene", while with a short focal lens you are "inside the scene" but you may disturb people. What is a better alternative for street photography? Why is $\mathbb{E}[X] = 1 + \sum^\infty_{k=1}\mathbb{P}(X > k)$ true? I'm working through a problem regarding expected values in Markov chains, and at some point it says:     Recall from probability that if $X$ is a positive integer valued random variable, then $\mathbb{E}[X] = 1 + \sum^\infty_{k=1}\mathbb{P}(X &gt; k)$.   I know that by definition $\mathbb{E}[X] = \sum_a a\mathbb{P}(X = a)$, but I can't see how the above equality follows from this, nor am I sure if this is how to approach the problem. How do I change the icon for a particular file type? I'm trying to change the icon for application/x-hwp files. I've added the icons to the proper places, and checked it with assoGiate (after reading ). It shows that my desired icon is associated with the file type. Nevertheless, Nautilus is still showing the old icon. How can I make Nautilus show the correct icon? Why hash the message before signing it with RSA?