I know how to slice a list in python. But I have a confusion when I see the following codes:  from PIL import Image import numpy as np import matplotlib.pyplot as plt  img = Image.open('test.jpg') img = np.array(img) print(img.shape) # (204,204,3) plt.imshow(img) plt.imshow(img[:,:,::-1])   Both the last two lines can display the image correctly. But I wonder why img[:,:,::-1] as the img itself can display correctly. Is it just for fun or intentionally?   Thanks in advance!
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.
In Windows I used command-line clipboard copy-and-paste utilities...      pclip.exe and gclip.exe     These were UnixUtils ports for Windows (but they only handled plain text). There were a couple of other native Windows utilities which could write/extract any format.    I've looked for something similar in Synaptic Package Manager, but I can't find anything.    Is there something there, that I've missed? ... or maybe this is available in Bash scripting?    The type of utility I'd like will be able to read/write via std-in/std-out or file-in/file-out, and handle Unicode, Rich Text Format, picture, etc. clipboard formats...    NB: I'm not after a clipboard manager. The title is probably very confusing, but here's the situation:  I'm animating a flat grid curve by shrink-wrapping it onto a moving plane in order to get a uniform wave animation, it looks like this:    Before I render it, i want a bevel. What I did then was simply adding a bevel to the curve, making the curve look like this:    Now, when activating the shrinkwrap modifier, I expexted that only the curve would be shrinkwrapped, but alas, the bevel did the same:    As seen by the blue spots, the curve has been completely flattened along with the bevel.  How can I avoid this? I tried using a wave modifier instead of shrinkwrap, but this modifier doesn't seem to make perfectly round waves like this:    So, any thoughs on how to solve this?  Thanks for reading! Can Xcode 6 and Xcode 5 coexist on the same computer? How can I avoid "please insert CD/DVD" error when updating Ubuntu? I can't update 12.04 LTS. The Update Manager shows this:  CD/DVD 'Ubuntu 12.04 LTS _Precise Pangolin_ - Release i386 (20120423)' is required Please insert the above CD/DVD into the drive '/media/cdrom/' to install software packages from it.   The image I downloaded and burned to CD is from  the PC (Intel x86) desktop CD version. I burned many CDs but the result is the same. What's the difference between an Application, a Process, and a Service? Best book of topology for beginner? I am a graduate student of math right now but I was not able to get a topology subject in my undergrad... I just would like to know if you guys know the best one.. How can I control where smoke and fire are emitted from? How do I sudo a command in a script without being asked for a password? Regex to get string between curly braces Explode string into array with no empty elements? PHP's explode function returns an array of strings split on some provided substring. It will return empty strings when there are leading, trailing, or consecutive delimiters, like this: var_dump(explode('/', '1/2//3/')); array(5) {   [0]=&gt;   string(1) &quot;1&quot;   [1]=&gt;   string(1) &quot;2&quot;   [2]=&gt;   string(0) &quot;&quot;   [3]=&gt;   string(1) &quot;3&quot;   [4]=&gt;   string(0) &quot;&quot; }  Is there some different function or option or anything that would return everything except the empty strings? var_dump(different_explode('/', '1/2//3/')); array(3) {   [0]=&gt;   string(1) &quot;1&quot;   [1]=&gt;   string(1) &quot;2&quot;   [2]=&gt;   string(1) &quot;3&quot; } Dynamically Determine Calling Context? We have various ways of invoking apex. Triggers, Inbound Webservices, @InvocableMethod,@RemoteAction and what not. Often we call some or other utility methods from these execution contexts. I have some generic utility method,that should behave differently from the context it is called?  I know about Trigger.isExecuting but it only tells if its running in trigger context or not.  I have a utility method that creates lead from Webservices, VF button click and via Lightning . Whenever we create a lead I want some special operations to be done via the source it was originated.(Its not just updating a simple field leadSource, I have some methods that creates some childs and update other records of other type) . I can achieve this by passing an extra parameter to utility method to tell about source, but i have then to edit hundred of other class that uses this utility method. If i could dynamically find out via which context this piece of code is running,then i would have to change only one class to satisfy my requirement.    Is there something in APEX that tells in what context the apex method was called? Using "you" and "your" as a representation for yourself and everyone in general Example sentence:     I love when your dog just lets you sit there to pet them. You don’t necessarily know if they are enjoying it, but they love you enough to just sit there with you for a bit.   Is this correct? We assume the words "you" and "your" refer to the speaker of the sentence, and not to the listener, as second-person usually does. But it also refers to dog owners in general. I have always been curious about this. Construct a command by putting a string into a tty I managed to do this  echo -n "command" &gt; /dev/tty1  The letters appear, and the cursor moves, but they are "ghosts" – if you hit Enter, nothing happens (they are not in stdin).  Edit:  In the middle of the below screenshot, you see why I see the use of this. (The line with a red caption, right below the line with a yellow caption.) As it is now, you are not really "editing" the note text; you are just asked to write a new text, which will replace the text of the note you are (not really) editing. Thus, I thought it could be remedied by simply pasting the old text into the tty: if the user hits enter, no modification is made. (This program is in Perl/MySQL, but I thought it would be more interesting to ask for a general solution than "how do I do this in Perl".)    Edit 2:  Here is the Perl code, that uses the C code below (works exactly as intended), as well as a new screenshot – hopefully this will clarify things beyond doubt :) Again, look at the middle of the screenshot, where the edit is made to the note text - this time around, the old text is there, for example if you just wanted to fix a typo, you won't have to retype the entire note text.  my $edit_note_text = $edit_note_data[2]; print BOLD, RED, " new text: ", RESET; system("writevt /dev/tty \"$edit_note_text\""); my $new_text = &lt;$in&gt;; $new_text = fix_input($new_text); my $set_text = "UPDATE notes SET note = \"$new_text\" WHERE id = $edit_note_id"; $db-&gt;do($set_text); How to find all positive integers $n$ such that $(n-1)!+1$ can be written as $n^k$ for some positive integer $k$? Deploy a project using Git push Run Script on Wakeup? How do I pipe colored diff output to less? I just bought a house. Now I'm getting ads in the mail every day or two trying to get me to sign up to pay my mortgage bi-weekly (every two weeks) or weekly instead of monthly. In their words I could cut seven years and thousands of dollars off what I pay in long term. It seems like I would be paying the exact same amount of money, also.  I know "if something sounds too good to be true then probably it is". But I cannot figure out why in this case. What is the catch? Or is this something I should be signing up for ASAP? How do you access the Shrine of Winter? In Dark Souls 2 there is a 'Shrine of Winter' near Sinners Rise. When you approach the shrine it will not let you open the door and a message pops up that says      Seek Mightier Souls   What does this mean and how do you open this shrine? Is it acceptable to begin a declarative sentence with "Am"? I want to know firstly if it's grammatically correct to start a declarative sentence with "Am". For example:     Am excited about the game today.   Secondly, if it is grammatically incorrect, then I wanted to ask how much "head room" there is for the above usage. I can't think of an example now, nor find one here at english.stackexchange. However I imagine there are usages of the english language that grammatically are illegal, yet have somehow become accepted as colloquial or idiomatic perhaps.