Assume you have a list A = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].  In a single line of code, cut A in half and assign B to be a copy of A’s last half followed by the first half (i.e. B would be equal to [6, 7, 8, 9, 10, 1, 2, 3, 4, 5]).
I need a good explanation (references are a plus) on Python's slice notation.   To me, this notation needs a bit of picking up.   It looks extremely powerful, but I haven't quite got my head around it.
Is it feasible to transform each variable differently while doing multiple regression Is there any way to favorite/bookmark an answer? Lots of questions are very generic, &quot;share an experience&quot; kinds of questions. In these cases, I am quite often interested in specific answers that may not have gotten that many upvotes. These questions also tend to elicit lots of responses, so going back to find the answers I'm interested in somewhere in the middle of a sea of responses is a pain. Is there a way to favorite or bookmark these answers? I know there is a way to view all my questions in reverse chronological order from the PC by going to my profile. But I would like to do the same from the mobile app for Android. On Android in the left upper hand corner I can only see the latest answers to my posts, but I would be able to view all my posts. This is what happens:  sudo apt-get install vlc Reading package lists... Done Building dependency tree        Reading state information... Done E: Unable to locate package vlc   Please help. I would also like to know when this error occurs, I've seen it before too. Extract URLs from text in PHP What does the , operator do in C? Can I set the start point of a bezier curve? I've asked this question towards a developer for Minecraft and I thought I'd ask here too since they might not see the question.  How do I select all but two types of entities in Minecraft?  For example, something like: /say @e[type=![Player,Item],r=50] (to clarify I also tried type=Item,Player, type=Item,type=Player etc)  Should select any entity that does not match players or items, so things like Creepers, Ghasts, XPOrbs, PrimedTNT and so on within a radius of 50 blocks and print them to the chat.  Instead it ignores one of the flags, and works with the other instead. How do I go about porting Ubuntu Touch to different devices? I would like to port Ubuntu Touch to a device that is currently not supported. What are the requirements for doing this and where do I begin? YouTube videos reload when I replay What bizarrities lurk within the decimal expansion of an irrational number? i.e. can we write  $\pi = 3.14159\dots X\dots$  where $X$ consists of (say) $10^{100}$ consecutive zeroes?  [Originally asked on reddit without response :-( ] Comprehensive book on group theory for physicists? An integer is a $n$'th power if that holds true for all moduli. I have not been able to solve this problem. Any insights would be appreciated!   Let $x, n > 1$ be integers. Suppose that for each $k > 1$ there exists an integer $a_{k}$ such that $x − a_k^n$ is divisible by $k$. Prove that $x = A^{n}$ for some integer $A$. Securing SSH server against bruteforcing I have a little SVN server, old dell optiplex running debian. I don't have that high demands on my server, because its just a little SVN server... but do want it to be secure.  I just renewed my server to a newer and better optiplex, and started looking a bit into the old server. I took it down after experiencing problems. When I check the logs, its full of brute-force attempts and somehow someone has succeeded to enter my machine. This person created some extra volume called "knarkgosse" with two dirs "root" and "swap1" or something.  Don't really know why and what they do, but sure do want to prevent this from happening again. I find this a bit strange though because I change my password ever few months or so, and the passwords are always random letters and numbers put together... not easy to brute-force.  I know I can prevent root from logging in, and use sudoers... and change the SSH port, but what more can I do?  So I have a few questions:   How can I prevent logging in for 5 minutes after X amount of incorrect tries. Or slow tries down after each incorrect try? Is there some kind of central blacklist which a server can connect to? A blacklist that keeps track of IP addresses that are "unsafe" and should never be granted access? What more can I do to apply safety to my server?   Like I said earlier, I am running Debian 5 with Apache (www-data user problem?), svn, mysql, php, phpmyadmin, hudson. It is on a home network with port forwarding on 80, 443, 8080, 8180, 23 and 22. Are Newton's "laws" of motion laws or definitions of force and mass? Mean or sum of gradients for weight updates in SGD I am using single observation to compute losses using neural network implementation in PyTorch. I am confused in a small detail of SGD. If I compute loss and do loss.backward(), I am accumulating gradients.  If I do this on 100 observations and then run optimizer.step(), should I average out the gradients?  This is what I am doing as of now:  def compute_loss(training_data):   for data in training_data:     loss = F.mse_loss(data[0], data[1])     loss.backward()  def optimize(sample):   optimizer.zero_grad()   compute_loss(sample)   optimizer.step()   Should it be rather:  def compute_loss(training_data):   for data in training_data:     loss = F.mse_loss(data[0], data[1])     loss.backward(torch.Tensor([1.0/len(training_data)])) How does entropy depend on location and scale? I don't think I ever understood the rationale behind this.  I get that the dot product $\mathbf{a} \cdot  \mathbf{b} =\lVert \mathbf{a}\rVert \cdot\lVert \mathbf{b}\rVert \cos\theta$ is derived from the cosine rule. (Do correct me if I'm wrong.)  However, I never really understood why $\mathbf{a} \times  \mathbf{b} =\lVert \mathbf{a}\rVert \cdot\lVert \mathbf{b} \rVert \sin\theta$. Is there a proof for this?  In addition, how does the vector cross product lead to orthogonal vectors?  I remember learning that they do and I know how to solve equations using the respective formulas, but I never got why is it so. Show that $e^{-\beta} = \frac{1}{\sqrt{\pi}} \int_{0}^{\infty} \frac{e^{-u}}{\sqrt{u}} e^{-\beta^2 / 4u} du$. Show that $e^{-\beta} = \frac{1}{\sqrt{\pi}} \int_{0}^{\infty} \frac{e^{-u}}{\sqrt{u}} e^{-\beta^2 / 4u} du$.  I'm not really sure of how I should proceed to show this, and it's pretty un-intuitive as well.  I've managed to manipulate the RHS into  $$\frac{e^{4\beta}}{\sqrt{\pi}} \int_0^\infty \frac{1}{\sqrt{u}} e^{-(\beta+2u)^2/4u} du$$ which now vaguely resembles a Gaussian. However, substituting $v = \beta + 2u$ in in order to to get something like $e^{-x^2}$ doesn't particularly help. I got $$ \frac{e^{4\beta}}{\sqrt{2\pi}} \int_0^\infty \frac{1}{\sqrt{v - \beta}} e^{-v^2/2(v-\beta)} dv. $$  I'm really unsure of how I should proceed; any help would be appreciated. Prove: $\displaystyle\sum_{k=1}^n k k!=(n+1)!-1$ (preferably combinatorially)   It's pretty easy to think of a story for the RHS: arrange $n+1$ people in a row and remove the the option of everyone arranged to height from shortest to highest, but it doesn't hold up for the LHS.   Alternatively, trying to visualize the LHS, I noticed that it's like a right angle tetrahedra:  1  2!+2!  3!+3!+3!  ...  But it doesn't help to see a connection to the RHS.  Note: no integrals or gamma function nor use of other identities without proving them nor generating functions.