How does the in operator in python behave when the list it is traversing changes
Loop "Forgets" to Remove Some Items
Why is Facebook PHP SDK getUser always returning 0? Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request) I am having trouble debugging an issue with a plugin that I'm writing. I want to do an Ajax request when a user changes the option on a select input. The thing is it was fully working as expected yesterday, then when I test the website today (no code changes were made at all since yesterday) I'm getting an:   domain.com/wp-admin/admin-ajax.php 400 (Bad Request)  message in my Chrome console. If I try in Internet Explorer/FireFox it doesn't give the error in console but the Ajax request is still not working.  The plugin I'm creating is on a DigitalOcean droplet which was made using their one click app for WordPress.  Here is the barebones code I'm using on the plugin for the ajax:  //This is in a class' constructor method add_action('wp_enqueue_scripts', array($this, 'plugin_prefix_scripts'));  //PLUGIN_URL is a constant created earlier in the plugin public function plugin_prefix_scripts() { wp_enqueue_script('plugin_prefix_scripts', PLUGIN_URL . 'scripts/frontend_script.js'); wp_localize_script('plugin_prefix_scripts', 'js_object',   array(     'ajax_url' =&gt; admin_url('admin-ajax.php')   ) );   }  frontend_script.js:  $('#plugin-prefix-option-one, #plugin-prefix-option-two').on('change', function() {     var data = {         'action': 'plugin_prefix_page_change',         'option_val': 'some_val',     }      $.post(js_object.ajax_url, data, function(response) {         console.log(response); });   Back in the class:  add_action('wp_ajax_plugin_prefix_page_change', array($this, 'plugin_prefix_page_change'));  public function plugin_prefix_page_change() {     $arr = array(1, 2, 3, 4, 5);      wp_send_json($arr);      //I've also tried wp_die() and no die call at all but same outcome     die(); }   I'm unsure how to debug this further. Any help is much appreciated.  Thanks pyPdf for IndirectObject extraction Following this example, I can list all elements into a pdf file  import pyPdf pdf = pyPdf.PdfFileReader(open("pdffile.pdf")) list(pdf.pages) # Process all the objects. print pdf.resolvedObjects   now, I need to extract a non-standard object from the pdf file.   My object is the one named MYOBJECT and it is a string.  The piece printed by the python script that concernes me is:  {'/MYOBJECT': IndirectObject(584, 0)}   The pdf file is this:  558 0 obj &lt;&lt;/Contents 583 0 R/CropBox[0 0 595.22 842]/MediaBox[0 0 595.22 842]/Parent 29 0 R/Resources   &lt;&lt;/ColorSpace &lt;&lt;/CS0 563 0 R&gt;&gt;     /ExtGState &lt;&lt;/GS0 568 0 R&gt;&gt;     /Font&lt;&lt;/TT0 559 0 R/TT1 560 0 R/TT2 561 0 R/TT3 562 0 R&gt;&gt;     /ProcSet[/PDF/Text/ImageC]     /Properties&lt;&lt;/MC0&lt;&lt;/MYOBJECT 584 0 R&gt;&gt;/MC1&lt;&lt;/SubKey 582 0 R&gt;&gt; &gt;&gt;     /XObject&lt;&lt;/Im0 578 0 R&gt;&gt;&gt;&gt;   /Rotate 0/StructParents 0/Type/Page&gt;&gt; endobj ... ... ... 584 0 obj &lt;&lt;/Length 8&gt;&gt;stream  1_22_4_1     ---&gt;&gt;&gt;&gt;  this is the string I need to extract from the object  endstream endobj   How can I follow the 584 value in order to refer to my string (under pyPdf of course)?? Uncertainty and wave-trains My textbook and the following extract from feynman's lectures present the same idea regarding wavetrains and uncertainty in their wavelengths. Why is it that a wavetrain confined to some space has an uncertainty in its wavelength or the wave number? Is not a confined wave-train equivalent to a burst of successive pulses which can have a definite wavelength according to their origin or nature of origin.   Next, i understand that the De Broglie relation relates the uncertainty in wavelength to the uncertainty in momentum but what links the finiteness of the wave-train to the uncertainty in position? Prove that if $(ab)^i = a^ib^i \forall a,b\in G$ for three consecutive integers $i$ then G is abelian I've been working on this problem listed in Herstein's Topics in Algebra (Chapter 2.3, problem 4):     If $G$ is a group such that $(ab)^i = a^ib^i$ for three consecutive integers $i$ for all $a, b\in G$, show that $G$ is abelian.   I managed to prove it, but I'm not very happy with my result (I think there's a neater way to prove this). Anyway, I'm just looking to see if there's a different approach to this.   My approach:  Let $j=i+1, k=i+2$ for some $i\in \mathbb{Z}$.  Then we have that $(ab)^i = a^ib^i$, $(ab)^j = a^jb^j$ and $(ab)^k = a^kb^k$.  If $(ab)^k = a^kb^k$, then $a^jb^jab =a^jab^jb$.   We cancel on the left and right and we have $b^ja = ab^j$, that is $b^iba = ab^j$.  Multiply both sides by $a^i$ on the left and we get $a^ib^iba = a^jb^j$, so $(ab)^iba = (ab)^j$. But that is $(ab)^iba = (ab)^iab$.   Cancelling on the left yields $ab=ba$, which holds for all $a,b \in G$, and therefore, $G$ is abelian.  Thanks! How do I copy a file in Python?  I couldn't find anything under . computing the orbits for a group action Number of ways to pair off $2n$ points such that no chords intersect For $n \geq 0$ evenly distribute $2n$ points on the circumference of a circle, and label these point cyclically with the numbers $1, 2 . . . , 2n$ Let $h_n$ be the number of ways in which these $2n$ points can be paired off as $n$ chords where no two chords intersect  I want to find a recursive formula for $h_n$.  First I find $h_1,h_2,h_3$ to see the recursive nature.    $h_1 = 1$ as their only one way to make one chord  $h_2 = 2$   Now $\require{enclose}      \enclose{horizontalstrike}{h_3=4}h_3=5$ ((1,4), (2,3), (5,6) case is missed in image)  I found a wikipedia link    and it is very close to my problem, But in this link you don't need to pair off $n$ chords.  But I can't get to come up with a recursive formula for my question.  If I would to guess I would say $h_n = 2 \times h_{n-1}$, And would this means that $h_4 = 8$ ?? How to convert Strings to and from UTF8 byte arrays in Java In Java, I have a String and I want to encode it as a byte array (in UTF8, or some other encoding). Alternately, I have a byte array (in some known encoding) and I want to convert it into a Java String. How do I do these conversions? The answer is, according to the book: $(m-1)!\cdot \binom{m+r-1}{r}$ I get why this is true. You arrange $m$ people in their seats in $(m-1)!$ ways and then you put $r$ empty spots inbetween them.I was thinking - choose $m$ seats out of $m+r$ to put the people on => $\binom{m+r}{m}$ Arrange them once you've chosen the seats $\to (m-1)!$ So in total: $\binom{m+r}{m} \cdot (m-1)!$ This is obviously not true. What's wrong with the way I'm thinking? Why constructors will always have same name as of class and how they are invoked implicitly? To show that $\sum a_nb_n$ is absolutely convergent Assume that $\sum a_n$ is convergent and $\sum b_n$ is absolutely convergent.To show that $\sum a_nb_n$ is  absolutely convergent  My try::Consider the sequence of partial sums of $\sum |a_nb_n|$  $S_n=|a_1b_1|+|a_2b_2|+......+|a_nb_n|$  Now $(a_1b_1+a_2b_2+......+a_nb_n)\leq ( (a_1^2+a_2^2+..+a_n^2))^\frac{1}{2}((b_1^2+b_2^2+..+b_n^2)^\frac{1}{2})$  How to proceed from here? If the universe is expanding, what is it expanding into? How to use THAT and WHO Can a hyphen be used without anything on the right side? When you attempt to modify a file without having write permissions on it, you get an error:  &gt; touch /tmp/foo &amp;&amp; sudo chown root /tmp/foo &gt; echo test &gt; /tmp/foo zsh: permission denied: /tmp/foo   Sudoing doesn't help, because it runs the command as root, but the shell handles redirecting stdout and opens the file as you anyway:  &gt; sudo echo test &gt; /tmp/foo zsh: permission denied: /tmp/foo   Is there an easy way to redirect stdout to a file you don't have permission to write to, besides opening a shell as root and manipulating the file that way?  &gt; sudo su # echo test &gt; /tmp/foo The SourceForge signon page says I can associate an OpenID with my existing SourceForge account:    I enter my currently-signed-in SourceForge account password I select the custom OpenID URL and enter https://openid.stackexchange.com I'm redirected to https://openid.stackexchange.com/account/login?&lt;session key bits&gt; I enter my openid.stackexchange.com login information there I get the error message:     Cannot Complete Login      Detected an attempt to send an assertion when the identifier () is not owned by the logged in user.    I don't understand what that means. Sending packets captured with Wireshark I currently have a Yongnuo YN560-TX trigger and a Yongnuo YN-560 Mark III. I would like to get a iTTL flash that also works with remote triggering.  How compatible are are different flash brands (Neewer, Yongnuo, etc.) when it comes to things like setting zoom, etc. ? How old is SpongeBob? I don't mean how old is the series, I mean what is SpongeBob's age if he were a real person. I ask because his age seems to be ambiguous in the show.   He has a full-time job He has his own house He is always referred to as a kid (especially in the movie) He acts childish and immature In one episode, he was pretending to be an adult/grown-up