Can any one please explain me why this prints none for the first statement where it says &quot;university&quot;? The second command prints index(-5) and index(3) which is cd but the first one gives me back nothing. x = &quot;university&quot; print(x[-5:4]) x = &quot;abcdefg&quot; print(x[-5:4])
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 sudo required for installing VMware Tools? I'm trying to install VMware Tools in Ubuntu 16.04. Should I do this by using sudo? Why? su command + authentication failure I am having problems with the su command. I know my password and I am typing it correctly but su indicates authentication failure.  So I checked on the internet and then went into recovery mode and changed my username's password to what I was entering before.  Even now entering the same password on su gives me authentication failure.  Please suggest what am I doing wrong?? If $A$ is a square matrix and $A^2 = 0$ then $A=0$. Is this true? If not, provide a counter-example. This is a proof question and I am not sure how to prove it. It is obviously true if you start with $A = 0$ and square it.   I was thinking:  If $ A^2 = 0 $  then $ A A = 0 $  $ A A A^{-1} = 0 A^{-1}$  $I\,A = 0 $   but the zero matrix is not invertible and that it was not among the given conditions.  Where's a good place to start? Cosine of the sum of two solutions of trigonometric equation $a\cos \theta + b\sin \theta = c$ Question: If $\alpha$ and $\beta$ are the solutions of $a\cos \theta + b\sin \theta = c$, then show that: $$\cos (\alpha + \beta) = \frac{a^2 - b^2}{a^2 + b^2}$$  No idea how to even approach the problem. I tried taking two equations, by substituting $\alpha$ and $\beta$ in place of $\theta$ in the equation and manipulating them, but that didn't get me anywhere. Please help! Taylor expansion for $\arcsin^2{x}$ I stumbled upon this particular expansion that was included in  post.    $$ \displaystyle \arcsin^{2}(x) = \frac{1}{2} \sum_{n=1}^{\infty} \frac{1}{n^{2} \binom{2n}{n}} (2x)^{2n}$$    This caught my eye because I remember trying to derive a Taylor series for $\arcsin^{2}(x)$ a while ago without much success.  Can anyone prove this or point me to a material that would show a proof of this identity?  EDIT :  Feel free to use any mathematical apparatus at hand. I'm not interested in a proof fit for a certain level, nor am I looking for utmost elegance (though that would be lovely). How do the EV stats work? How to connect and disconnect to a network manually in terminal? Since the network manager is troubling me so much I want to replace it (possibly wicd orNM from ppa:volanin).  I do not know how to connect and disconnect to the network through the terminal without using network manager.  I would like a command-line way of managing the network. Since a few months, on one of the desktop Ubuntu 14.04 systems I use, CPU has regularly been going up to 80-100% for no apparent reason. htop would usually attribute responsability to file system processes, such as nemo or ntfs. To get CPU back down I would kill these process, which in some cases would lead to loss of access to the file system and a consequent restart.  Days ago I noticed that whenever this situation happened another process was always present also using high CPU: mediascanner-service-2.0. Some research lead me to  that simply advised its removal. So I did.  The end result has been unexpectedly positive: not only are the high CPU load episodes gone, the system is altogether much faster. The speed up of the Lens is dramatic: finding an application like Calc now takes 2 seconds at most when previously it took some 20 seconds. Finding a file takes now some 5 seconds, whereas before it took in the order of 30 seconds. Heavy programmes like Eclipse are starting up faster and workspaces are more fluid. There seems to be also an overall reduction in the frequency of disk access.  What is exactly this mediascanner2.0 package? Is it part of Unity 7 or a dependency that gets installed a posteriori? Is it possible to prevent its installation?  Update: following  it is possible to track this package down to indicator-session:  $ sudo aptitude why mediascanner2.0 i   indicator-session         Recommends indicator-applet (&gt;= 0.2) | indicator-renderer i A unity8                    Provides   indicator-renderer                             i A unity8                    Recommends unity-scope-mediascanner2                      pi  unity-scope-mediascanner2 Depends    mediascanner2.0                                  Apparently, mediascanner2.0 (and the Unity 8 shell) are part of the base 14.04 system. Left to answer is the exact function of this rogue package. I am trying to make folder that everyone can view and can't copy,modify.    For all answers.I thinking about specially ms office files. I tried following methods  Software  - copy protect    - anti copy    This method can't protect save as and upload  MS office macro    Users can enable,disable macros.  MS office restriction    This is best choice but can't protect from file uploading.   Almost I found the solution. Way is combination of MS office restriction and restrict access from browsers using firewall or antivirus. But I don't exact how to do this. I got a positive definite matrix $B,$ that is, $V(x) = x^TBx &gt; 0$ for any vector $ x \neq 0.$  I want to show that $ \lambda_\min \|x\|_2^2 \leq V(x) \leq \lambda_\max \|x\|_2^2$ for any $x \neq 0,$ where $\lambda_\min$ and $ \lambda_\max$ are defined by $$ \lambda_\min = \min \lbrace | \lambda|: \lambda \text{ is an eigenvalue of } B \rbrace$$ and  $$ \lambda_\max = \max \lbrace | \lambda|: \lambda \text{ is an eigenvalue of } B  \rbrace$$  Any hint please? Trouble downloading packages list due to a "Hash sum mismatch" error When I check for updates, I get a "Failed To Download Repository Information" error.   This is what comes up under details:   W: Failed to fetch gzip:/var/lib/apt/lists/partial/us.archive.ubuntu.com_ubuntu_dists_natty_main_source_Sources  Hash Sum mismatch,  E: Some index files failed to download. They have been ignored, or old ones used instead. Efficiently reverse the order of the words (not characters) in an array of characters How to adapt the color of a label using pgfplots I created this style that shifts the labels and put them on the bottom of the ybars.  However, I have a problem with the bars that have too short length (for example, see the 8.7 and 5.1 in the example below). I want to check if the values are less than some threshold, or the length of the bar is shorter than the label (number) then change its color.  How can I overlay another label on top of the one in white when the bar is shorter? or maybe change the color of the label to a gradient color? or just overlay the part that is outside of the bar?    \documentclass{standalone}  \usepackage{tikz} \usepackage{pgfplots} \usepackage{pgfplotstable} \usetikzlibrary{calc}  \begin{document} \makeatletter \begin{tikzpicture} \begin{axis}[ ybar, every node near coord/.style={   check for zero/.code={ % If meta=0, make the node a coordinate (which doesn't have text)     \pgfmathfloatifflags{\pgfplotspointmeta}{0}{         \pgfkeys{/tikz/coordinate}     }{}   },   check for zero, color=white, text opacity=1, font=\footnotesize, inner ysep=0.5pt, },% % Bottom nodes  calculate full offset/.code={     \pgfkeys{/pgf/fpu=true,/pgf/fpu/output format=fixed}     \pgfmathsetmacro\testmacro{((\pgfplotspointmeta-\pgfkeysvalueof{/pgfplots/ymin})*10^\pgfplots@data@scale@trafo@EXPONENT@y)*\pgfplots@y@veclength}     \pgfkeys{/pgf/fpu=false} },% nodes near coords bottom/.style={     every node near coord/.append style={         /pgfplots/calculate full offset,         yshift=-\testmacro,         rotate=90, anchor=west,%I need the rotate text here and not in the          %general style, as the ybar redefines the style     } },% ymin=0, nodes near coords={\pgfmathprintnumber[fixed zerofill,precision=1]{\pgfplotspointmeta}}, nodes near coords bottom, ] \pgfplotstableread{ % set real imag mag 1 8.7 2 5.1 3 91.8367  }\mydata \addplot table[x index=0,y index=1,header=false] {\mydata}; \end{axis} \end{tikzpicture} \makeatother \end{document}   * EDIT *  I need to create some special gradient on each label that is below the bar height. For example, I need to adapt something like  to each label that is not showing. However, I cannot find a way to put the macro in the style section of the codes. Or is there any equivalent solution? Is there a general formula for image size vs. print size? What size images do I need for common print sizes, such as wallet size, 8x10, and 16x20?  Is there a general formula?  How could that size change if, for example, a 16x20 was printed on canvas rather than photopaper? When you cast invisibility on your turn, and walk away from 2 enemies, do they get an attack of opportunity? When a PC is in melee with a creature, casts the basic invisibility spell, and leaves melee, does an NPC get an attack of opportunity? Reverse Triangle Inequality in vector space I have already proved Triangle Inequality $\lVert v+w\rVert \le \lVert v \rVert+\lVert w \rVert$ in vector space $\mathbb{R}^n$. However, I'm having difficulties proving the Reverse Triangle Inequality in the vector space.  I have started with   $$\lVert v \rVert^2=v \cdot v-w\cdot w+w\cdot w \le \lVert v-w \rVert+\lVert w \rVert^2$$ $$\lVert w \rVert^2=w \cdot w-v\cdot v+v\cdot v \le \lVert w-v \rVert+\lVert v \rVert^2$$  based on the Triangle Inequality but I don't know if it is correct. If this is right, I think I can go on with proving it the same way I would the normal Reverse Triangle Inequality. Finding the remainder of $\overbrace{11\ldots1}^{123 \text{ times}}$ divided by $271$ iPhone stuck on Connect to iTunes My iPhone is stuck on Connect to iTunes Screen (support.apple.com/iphone/restore iTunes logo and up arrow with lightning cable) I have Tried :-   Connecting it to iTunes and Updating, It updates Successfully.But on the same screen again   Restoring, It restores successfully.But on the same screen again  Tried Recovery Mode Screen Method and DFU method Tried Closing and Restarting iTunes Tried Deleting 'iPhone Software Update' folder in iTunes and Re-Downloding Updates    Nothing Works... Any Help will be appreciated I've been making a map for 1.10 and it's going great, but 1.11 shows great mobs to use for it. However, most things have channged in command syntax. For example, /kill @e[type=ArmorStand,r=6] is now /kill @e[type=Armor_Stand,r=6]  What about /testfor? I can't find a way to testfor a player to stand on a block and give them an effect.   What's is going on in this image is that a redstone clock is running into this command /testfor @a[1117,20,507,r=1] (if I was to stand on them cords the comparator would turn on and power that command block), but it only works in 1.10... from 1.11 snapshots, I've seen some errors of it, like it now needs to have {} at the beginning and end of it. (e.g. /testfor @a{[1117,20,507,r=1]})   It's still not working, though, so does anyone know how to get it to work? I have a website with url like that :  www.xxxxxx.com/card/wow/20-euros   In term of SEO is it better to use slash or hyphen?  www.xxxxxx.com/card-wow-20-euros   Even though it will be trickier with hyphen to route correctly with only hyphen ...  Or it doesn't matter?