i work on a little flask app, which consists in searching docs with keywords (ElasticSSearch) and upload docs in cluster.  Searching docs works fine but upload is hard, i can do it with curl but i have some problems  My curl command is like:   curl -F "file=@pdf-test.pdf" "http://127.0.0.1:pdf-8080/fscrawler/_upload"   My html is:   &lt;form id="uploadbanner" enctype="multipart/form-data" method="post" action="/"&gt;    &lt;input id="fileupload" name="myfile" type="file" /&gt;    &lt;input type="submit" value="submit" id="submit" /&gt; &lt;/form&gt;   in order to create upload button for the client.  I saw many topic about requests library, but my py code does not work, i really do not understand what i do wrong, and i am pretty lost.   I give you what i tried:   def upload(): url="http://127.0.0.1:8080/fscrawler/_upload"     if request.method == 'POST':         payload = open("test.pdf")          r = requests.post(url, data=payload)   Thanks for help, and have a good day :)
Is there a way to send a file using POST from a Python script?
Prove homotopic attaching maps give homotopy equivalent spaces by attaching a cell Prove: If $f,g:S^{n-1} \to X$ are homotopic maps, then $X\sqcup_fD^n$ and $X\sqcup_gD^n$ are homotopy equivalent.   I think it can be proved by showing they are both deformation retracts of $X\sqcup_H(D^n\times I)$ where $H$ is the homotopy between $f$ and $g$.  However, I have difficult in proving that the deformation retracts are continuous map. In fact, I have difficulty in representing a map in quotient spaces like $X\sqcup_fD^n$. I think a map from $X\sqcup_fD^n$ to $W$ can be represented by two maps: $m_1: X\to W$, $m_2: D^n\to W$, where for $x\in S^{n-1}$, $m_1\circ f(x)=m_2\circ i(x)$.  Then I construct the deformation retract this way: $m_1: X\to X$. For $x\in H(S^{n-1},t)$, $m_1(x)=H(S^{n-1},0)$, otherwise $m_1(x)=x$.  $m_2: D^n\times I\to D^n\times {0}$: $m_2((D^n,t))=(D^n,0)$.  It is easy to verify that $m_1$ and $m_2$ define a map from $X\sqcup_H(D^n\times I)$ to $X\sqcup_fD^n$. As long as this is a continous map, obvioulsy then we find a deformation retract. But it seems such a map is not continous? Is there a contraction for "I was"?    There are contractions for "I am" (I'm), "I will" (I'll), "I have" (I've), "I would" (I'd), and yet the simple past tense seems conspicuously missing. Why is that? Does that reasoning apply to "I did" and "I had" as well? Why are home appliances and other devices made to operate on dc? Differences between MATCH FULL, MATCH SIMPLE, and MATCH PARTIAL? I've noticed a MATCH SIMPLE and MATCH FULL, but I don't understand what they do. I see default is MATCH SIMPLE; but, how do the other MATCH clauses to the FOREIGN KEY constraint function? Some of code I read in trigger is like this    for(account a: [select id  from account where id in: mapAccount.keySet()]) {     //code      }    some are like   List&lt;Account&gt; listAccount = [select id  from account where id in: mapAccount.keySet()];   for(Account a: listAccount ){   //coode   }   Are those same from performance view?which one is better? My organization is looking at developing mobile applications, we have a wealth of web development resources. There are many factors to consider in making the decision of how to develop this application such as Cost(s), platform support, performance, and maintainability.   But, I have not found any research that actually backs up the assumptions that users prefer the experience of a native app over a hybrid mobile web app (A hybrid app is a HTML5 app distributed in an embedded web view using PhoneGap, etc.).   Some  that native apps are more performant and have a better user experience, but why? Have there been any user surveys or analytics that indicate this user preference towards native? find pair of numbers whose difference is an input value 'k' in an unsorted array How can I remove gpg key that I added using apt-key add -? I don't need the key in my server's keyring anymore. Is it possible to remove it? I added the key using this command:   curl http://repo.varnish-cache.org/debian/GPG-key.txt | apt-key add -   Thanks for helping I just started in Griffith's Introduction to electrodynamics and I stumbled upon the divergence of $\frac{ \hat r}{r^2} \equiv \frac{{\bf r}}{r^3}$, now from the book, Griffiths says:  Now what is the paradox, exactly? Ignoring any physical intuition behind this (point charge at the origin) how are we supposed to believe that the source of $\vec v$ is concentrated at the origin mathematically? Or are we forced to believe that because there was a contradiction with the divergence theorem? Also how would the situation differ if $\vec v$ was the same vector function but not for a point charge? Or is it impossible? When reading a stack trace like:  [FormatException: Input string was not in a correct format.]    System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer&amp; number, NumberFormatInfo info, Boolean parseDecimal) +2755599    System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +112    System.Convert.ToInt32(String value) +68   What do the +68, +112, etc. numbers mean. I'm guessing that they're offsets to something. If so, what? Is it possible to tell a Valyrian steel sword from a very well crafted steel sword, by sight alone I am able to evaluate the limit $$\lim_{x \to 1} \frac{x + x^2 + \dots + x^n - n}{x - 1} = \frac{n(n + 1)}{2}$$ for a given $n$ using l'Hôspital's (Bernoulli's) rule.  The problem is I don't quite like the solution, as it depends on such a heavy weaponry. A limit this simple, should easily be evaluable using some clever idea. Here is a list of what I tried:   Substitute $y = x - 1$. This leads nowhere, I think. Find the Taylor polynomial. Makes no sense, it is a polynomial. Divide by major term. Dividing by $x$ got me nowhere. Find the value $f(x)$ at $x = 1$ directly. I cannot as the function is not defined at $x = 1$. Simplify the expression. I do not see how I could. Using l'Hôspital's (Bernoulli's) rule. Works, but I do not quite like it.   If somebody sees a simple way, please do let me know.    Added later: The approach proposed by Sami Ben Romdhane is universal as asmeurer pointed out. Examples of another limits that can be easily solved this way:   $\lim_{x \to 0} \frac{\sqrt[m]{1 + ax} - \sqrt[n]{1 + bx}}{x}$ where $m, n \in \mathbb{N}$ and $a, b \in \mathbb{R}$ are given, or $\lim_{x \to 0} \frac{\arctan(1 + x) - \arctan(1 - x)}{x}$.   It sems that all limits in the form $\lim_{x \to a} \frac{f(x)}{x - a}$ where $a \in \mathbb{R}$, $f(a) = 0$ and for which $\exists f'(a)$, can be evaluated this way, which is as fast as finding $f'$ and calculating $f'(a)$.  This adds a very useful tool into my calculus toolbox: Some limits can be evaluated easily using derivatives if one looks for $f(a) = 0$, without the l'Hôspital's rule. I have not seen this in widespread use; I propose we call this Sami's rule :). Drush installed and running; No Drupal site found even with uri specified After much trial and tribulation, I thought I had drush all ready to roar. Much excitement. But then, no joy...  Drush is working. The sites operate fine via MAMP. Regardless, a "drush cc all" command returns:   No Drupal site found, only 'drush' cache was cleared.                                          [warning] 'all' cache was cleared.                                                                       [success]   This question has stumped drupalcon attendees and very experienced developers. Any ideas?  I am on Mac OS 10.9.3 using MAMP (free) Version 3.0.5  Here is my drush status:   Drupal version         :  7.29-dev                                 Site URI               :  http://default                           Database driver        :  mysql                                    Database hostname      :  localhost                                Database username      :  db_user                             Database name          :  db_name                        PHP executable         :  /usr/bin/php                             PHP configuration      :                                           PHP OS                 :  Darwin                                   Drush version          :  7.0-dev                                  Drush temp directory   :  /tmp                                     Drush configuration    :                                           Drush alias files      :                                           Drupal root            :  /Applications/MAMP/htdocs/mysite.dev   Site path              :  sites/default       Have tried executing drush from /Applications/MAMP/htdocs/mysite.dev; from /Applications/MAMP/htdocs/mysite.dev/sites/default; and using drush cc all --uri=http://localhost/mysite.dev  Tried running drush from sites/default. Same result. How to correctly install libpng12-0 on the Ubuntu 19.10? What is the difference between 'can', 'could', 'may' and 'might'? How to get exact camera view? Intuitive explanation of why $\dim\operatorname{Im} T + \dim\operatorname{Ker} T = \dim V$ I'm having a hard time truly understanding the meaning of $\dim\operatorname{Im} T + \dim\operatorname{Ker} T = \dim V$ where $V$ is the domain of a linear transformation $T:V\to W$. I've used this equation several times in many problems, and I've gone over the proof and I believe that I fully understand it, but I don't understand the intuitive reasoning behind it. I'd appreciate an intuitive explanation of it.  Just to be clear, I do understand the equation itself, I am able to use it, and I know how to prove it; my question is what is the meaning of this equation from a linear algebra perspective. Does anyone know what song plays at about ? Metric $d(x,y)=\frac{|x-y|}{\sqrt{1+x^2}\sqrt{1+y^2}}$ on $\mathbb{R}$ I know in TNG that all computer interfaces are now touch-screen, and that got me thinking: when was the first reference to touch-screen computer interfaces in Sci-Fi made?