I understand that when slicing strings, the first index number refers to the start (inclusive), second number refers to end (exclusive) and the third refers to step size. So, wouldn't the first example throw an index error since length 6 is outside of the string? In the second example I would've expected "nohty" and "ohty" for the third example but this is clearly not the case.  temp = 'Python' stringLen = len(temp) slicedStr = temp[stringLen::-1] print(slicedStr) &gt;&gt;&gt; nohtyP  stringLen = len(temp) - 1 slicedStr = temp[stringLen::-1] print(slicedStr) &gt;&gt;&gt; nohtyP  stringLen = len(temp) - 2 slicedStr = temp[stringLen::-1] print(slicedStr) &gt;&gt;&gt; ohtyP
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.
I have the following code:  \documentclass[a4paper,12pt]{article} \usepackage[margin=2cm]{geometry} %showframe \begin{document} \tableofcontents \newpage \section*{Abstract} \section{Introduction} \newpage \bibliographystyle{apacite} \bibliography{references} \end{document}   And when I create the table of contents it adds the "References" in the TOC, how can I remove this to not be included in TOC? So far I have tried something like   \bibliography*{references} Adding HTML entities using CSS content How do you use the CSS content property to add HTML entities?  Using something like this just prints &amp;nbsp; to the screen instead of the non-breaking space:  .breadcrumbs a:before {     content: '&amp;nbsp;'; } KKT points and nonlinear optimality (theory) I have some questions about Karush Kuhn Tucker conditions. I am not clear about the theory. There are plenty of theorems and I am confused with it. Let us say we have the following problem: We have a general problem, not a convex problem. $$\min f(x)\\g_{j}(x)\le 0,\forall j\in J\\h_{k}(x)=0,\forall k \in K. $$ I will solve it.....Lagrange function, verifying primal feasibility, dual feasibility and complementary slackness and I will get some KKT points. Now what is the conclusion?  If I get no KKT point, can I say that the problem has no solution or what is the conclusion? If I get only one KKT point, is it a local minimum or even a global minimum? If I get more KKT points, what is the conclusion? In which case I will verify SOSC condition? If I get more KKT points or even for one point is it necessary? And the conclusion is what? The KKT points which satisfies the SOSC condition are strick local minimum and the poins which does not satisfy it are not the solution of the problem?  I am so sorry for so many questions, but any help would be very appreciated. Thank you very much in advance. Why is it impossible to override a getter-only property and add a setter? Why is the following C# code not allowed:  public abstract class BaseClass {     public abstract int Bar { get;} }  public class ConcreteClass : BaseClass {     public override int Bar     {         get { return 0; }         set {}     } }      CS0546 'ConcreteClass.Bar.set': cannot override because 'BaseClass.Bar' does not have an overridable set accessor How To Store Files In An EXE Alright, so I'm working on programming my own installer in C#, and what I'd like to do is something along the lines of put the files in the .exe, so I can do  File.Copy(file, filedir);  Or, if this isn't possible, is there another way of doing what I am attempting to do? Let A,B be in $M_{mxn}(\mathbb{R})$  Prove that if rank(A + B) = rank(A) + rank(B), then col(A) ∩ col(B) = {0}  I started with a proof by contradiction, since we know that rank(A + B) ≤ rank(A) + rank(B). I assume that if rank(A + B) &lt; rank(A) + rank(B), then col(A) ∩ col(B) = {0}. I realize that we don't have to do the > case. However I am a little confused on how to show col from rank. How to get autofocus to work with D5100 and AF-P DX Nikkor I just bought Nikon 18 - 55 mm f/3.5 - 5.6G VR AF-P DX Nikkor from .  When I connected it to my Nikon D5100, the autofocus didn't work. There was nothing about this from the original seller's website.  Is there anything I can do short of returning? Area of intersection between two circles Suppose you have 2 circles that intersect each other in such a way that each circle passes through the other's center. What is the area between the circle(or common area) i.e. area between the centres of the circles? I'm trying to install texlive.  I proceeded in the recommended way, as per   After hours since initiating the download with install-tl as per instructions in . Hours after intiating the install-tl command, the installation aborted with the following error message:  Installing [2507/3271, time/total: 03:01:18/03:46:09]: rec-thy [221k] TLUtils::check_file: removing /tmp/bgLBEx3xxA/o1ankpQviV/rec-thy.tar.xz, sizes differ: TLUtils::check_file:   TL=0, arg=7428 TLPDB::_install_package: downloading did not succeed Installation failed. Rerunning the installer will try to restart the installation. Or you can restart by running the installer with:   install-tl --profile installation.profile [EXTRA-ARGS] install-tl: Writing log in current directory: /usr/local/src/install-tl-20160728/install-tl.log   I have no idea how to implement the crypic instruction  install-tl --profile installation.profile [EXTRA-ARGS]   because I can't find any information as what the EXTRA-ARGS should be, and google provided no help.    So I started again with   install-tl   hoping it would be smart enough not to start from scratch, but it wasn't, and did start from scratch, meaning another 3 hours.     This time it crashed after a few minutes, with   Installing [0051/3271, time/total: 04:08/04:30:47]: ae [84k] TLUtils::check_file: removing /tmp/ZLEUeUk8LV/ps7iOTjRWq/ae.tar.xz, sizes differ: TLUtils::check_file:   TL=43160, arg=57364 TLPDB::_install_package: downloading did not succeed Installation failed. Rerunning the installer will try to restart the installation. Or you can restart by running the installer with:   install-tl --profile installation.profile [EXTRA-ARGS] install-tl: Writing log in current directory: /usr/local/src/install-tl-20160728/install-tl.log   Why would the installation crash at different places?  Could somebody please interpret these crashes and how to prevent them?   If the installation crashes again, is there a way of picking up where I left off?   (presumably using the mysterious EXTRA-ARGS?).  If all else fails, is there another way of getting a less complete latex installation that will actually work?    Thanks very much for any advice? Understanding Group Permissions I'd appreciate help with a couple questions regarding standard file permissions. Assume that I'm not using access control lists.     If a file is associated with multiple groups, must all groups have the same permissions?   If the group permission includes write access, can any member of any group the file is associated with change the file permissions? Can such a person change the file owner?   Say now the file permission is rwxr----- (owner can do everything, but group members can only read). I am in the group associated with the file. I am also the file owner. Which permission am I granted? Read-only, or rwx? In Ubuntu 13.04 I used to use the ppa:upubuntu-com/tor64  PPA to install the 64-bit Tor Browser Bundle. However, in Ubuntu 13.10 it doesn't work anymore. How do I install the Tor Browser Bundle in Ubuntu? How to find $\sum_{r\ge 0} \binom{n}{r}\binom{n-r}{r} 2^{n-2r}$? Problem was to find $$\sum_{r\ge 0} \binom{n}{r}\binom{n-r}{r} 2^{n-2r}.$$ My partial progress i tried to motivate such that upper term in binomial terms gets constant rather than variable , so i thought of changing it to form $\binom{n}{n-r}\binom{n-r}{n-2r}$. Now it's of the form $\binom{n}{m}\binom{m}{k}$. We know it is equivalent to $\binom{n}{k}\binom{n-k}{m-k}$. Doing this we get $\binom{n}{2r}\binom{2r}{r}2^{n-2r}$. Now what I need to do as next step as such still nothing the upper or lower terms r any constant values(sum to ) , all are variables still. Now by one answer by Robpratt i got by snake oil , is there any other way to solve this problem ? Dealing with a whole bunch of two-line config files, I'd like a way to exclude any files that have a different number of lines.  So, something like:  mv * destdir only if file contains exactly two lines   Or:  wc -l * | grep '^ *2' | xargs mv {} destdir   Except that neither of those is actual working code.  While writing this I realized I do have a way to do this, which is ugly as heck, and I've included it below as an answer.  Is there an easy/clean way to do this? Add increase/decrease tab indent buttons to the editor toolbar These should work by adding spaces or removing spaces from the beginning of the current line or every line between the start and end of a text selection (inclusive).  (edited this question to supplement ) Adding unknown (at design time) properties to an ExpandoObject Finding $\int_0^{\infty}xe^{-\lambda x} \, dx$ How to integrate:  $$\int_0^\infty x \, \lambda e^{-\lambda x} \, dx$$    I tried using integration by parts:  Let $u = x$ and $dv = \lambda e^{-\lambda x} \, dx$  Then $du = dx$  And $v = - \lambda e ^{-\lambda x}$  Correct so far?   Then   $$\begin{aligned} uv - \int v \, du &amp;= -\lambda x e^{-\lambda x} - \int (- \lambda e^{- \lambda x}) dx \\ &amp;= -\lambda x e^{-\lambda x} - \lambda e^{-\lambda x} \end{aligned}$$    The correct answer from lecture notes      UPDATE 2  Let $u=\lambda x$ and $dv = e^{-\lambda x} dx$  Then $du = \lambda \, dx$  $$dv = e^{-\lambda x} \, dx$$  Let $y = -\lambda x$  Then $dy = -\lambda \, dx$  So $dx = -\frac{1}{\lambda} dy$  $$\begin{aligned} v &amp;= \int e^u \cdot - \frac{1}{\lambda} du \\ &amp;= - \frac{1}{\lambda} e^{-\lambda x} \end{aligned}$$  But here I seem to have an extra $- \frac{1}{\lambda}$ in $v$?  If I continue using integration by parts, I get:   $$-x e^{-\lambda x} + \color{red}{\frac{1}{\lambda}} \int e^{-\lambda x} \, dx$$ Counting number of subsets which contain a specific element There is a set $x = \{A,B,C,D,E,F,G\}$ and the question ask for counting the number of subsets which contain $D$. And the answer is $2^6$. why would it be $2^6$? I know the total number of subsets is $2^{|x|}$ is it realated? The rank of Jacobian matrix at a point of affine variety is independent of choice of generators Fixing geometry validity errors in QGIS 2? How to simplify the summation kk! without using induction?