How can I run this python script on all html files under a directory? I have a python script  $ cat ~/script.py import sys from lxml import etree from lxml.html import parse doc = parse(sys.argv[1]) title = doc.find('//title') title.text = span2.text.strip() print etree.tostring(doc)   I can run the script on an individual file by issuing something like  $ python script.py foo.html &gt; new-foo.html   My problem is that I have a directory ~/webpage that contains hundreds of .html files scattered throughout sub-directories. I would like to run ~/script.py on all of these html files. How can I do this?  I'm aware that I can list all the .html files under ~/webpage/ by issuing   $ find ~/webpage/ -name "*.html"   but I'm not quite sure how to use this list to run my script on them.
Running command on multiple files within multiple directories I want to run the command   python quast.py -o quast contigs.fasta   but I want to do this for multiple contigs.fasta files in multiple directories.  I'm running OSX.
Why prefer composition over inheritance?  What trade-offs are there for each approach?  When should you choose inheritance over composition? How can I have 2 different mod folders with the new Minecraft launcher? Proving an infinite number of primes of the form 6n+1 I would like to protect the formatting of a cell (or a range of cells) in a Google Spreadsheet, but still allow changing the data in that (or those) cell(s).  For example, I want to add a validation rule on a cell that says the cell has to contain a number between 1 and 10, and I would like others to be able to change the value in that cell, but not the validation rule itself.  How do I do that?  So far I was only able to completely protect the cell (content + formatting) or not at all (the user can change the content as well as the formatting).  To me this seems to be an important functionality when adding access rights to spreadsheets. Is it possible that it is completely missing from Google Spreadsheets? I'm taking Calculus II next semester so I don't have all the tools from it to back me up but something came up in a discussion this evening that asked me to prove that the following sequence converges. As I'm new to formal math I'm hoping someone can verify my proof, especially step $6$. I must prove that $$\lim_{n\to\infty}P_n=b$$ where $$P_{n+1} = P_n + \frac{b-P_n}{2}$$ $$P_0 = a$$ and $a,b \in \mathbb{R}$ such that $a&gt;b$ My proof goes as follows:   We must prove that $$\lim_{n\to\infty}P_n=b$$  That is, $\forall\epsilon&gt;0$ there exists a $\delta$ such that there exists an $n$ satisfying $$n&gt;\delta \iff b-P_n&lt;\epsilon$$  First, let us prove that $P_n$ is bounded by $b$ by contradiction. Let us choose an $i$ such that $P_i &lt; b$ and $P_{i+1}&gt;b$. Then we have $P_{i+1} = P_i + \Delta P$ where $\Delta P &gt; b-P_i$. but this is impossible because by the definition of the recurrence $\Delta P = \frac{b-P_i}{2} &lt; b-P_i$. Therefore, $P_i$ is bounded from above by $b$.  Additionally, it is trivial to show that $P_{i+1} &gt; P_i$.  With this in mind, choose an arbitrary $\epsilon$. We need to show that there exists an $n$ such that $P_n &gt; b-\epsilon$. Assume the contrary, that $P_n$ is bounded by $\epsilon$.  Using a similar argument to what which was used before, assume $P_n$ is bounded by $\epsilon$ and then there exists a $P_i$ such that $P_{i+1}\not &gt; P_i$. But this results in a contradiction with (4)  Therefore, $P_n$ is not bounded by $\epsilon$ and we have proved what we want to prove. What's the difference between package managers? What are the differences between apt-get, aptitude, and synaptic, and which one is the recommended choice for normal day-to-day package management?  This is a basic question, but I think it'd be good information to have on the site, and besides I am relatively new to Ubuntu so I could use an expert explanation. Why does this test program result in a java.lang.IllegalMonitorStateException?  public class test {     static Integer foo = new Integer(1);     public static void main(String[] args) {         synchronized(foo) {             foo++;             foo.notifyAll();         }         System.err.println("Success");     } }   Result:  Exception in thread "main" java.lang.IllegalMonitorStateException         at java.lang.Object.notifyAll(Native Method)         at test.main(test.java:6) Error on \usepackage {geometry} text property What kind of questions can I expect to see on a qualifying exam? How to mesh codeigniter with ajax Buying a "blender" that can purée a potato My wife had a "smoothie" made by a co-worker that is based on green apples and raw red potatos.  Our smoothie maker can't do that and leaves unchopped bits and a gritty feel.  Her friend uses a Vitamix blender, and looking up the model number not only induced sticker shock, but reviews raised concerns with the item leaving bits of teflon in the food etc. And the price for just a replacement pitcher is so high that it appears overpriced.  What is it about a blender that allows it to make a good purée rather than just mixing things easily?  I think it might be the design of the blade and base, not just raw power: even a modest powered blender doesn't stall or run out of power; but it doesn't chop any finer no matter how long it is left running.  It might also involve speed vs torque usage of power.  Does anybody know what makes a machine capable of making a good purée as opposed to just blending, especially when both kinds are sold as “blenders”.  Should I be looking for ones with different options for blades like a food processor, to make it well suited to different purposes? E.g. I have seen blades just for milkshakes.  In general, how do you shop for one when the only information a seems to be total power and the number of presets? Kill some processes by .exe file name Can I rename the wp-admin folder? Is it possible to rename the wp-admin folder?  I know I could just rename it, but unless it's supported by the code lots of things would break.  If I use a custom folder name, it will make it slightly more secure, security by obscurity and all that. When I installed my SSD I just mounted with discard and didn't sweat it. However today I was reading about the pros and cons of using fstrim instead and decided to run the program to get an idea of how long it would actually take (still with my partitions mounted with discard). The command took several minutes on both my root and home partitions. For my home partition I used -v and got this:  $ sudo fstrim -v /home /home: 137494052864 bytes were trimmed   This is more than the amount of free space on the partition!  $ df -h /home Filesystem      Size  Used Avail Use% Mounted on /dev/sda2       206G   78G  118G  40% /home   Subsequent runs finish in less than a second, eg:  $ sudo fstrim -v /home /home: 0 bytes were trimmed   Surely if I have always had the partition mounted with discard, fstrim should not trim a large amount of data like that? The discard option is definitely enabled, here are the relevant fstab lines:  UUID=xxxxxxxx...    /          ext4   noatime,discard,errors=remount-ro  0      1 UUID=xxxxxxxx...    /home      ext4   noatime,discard,errors=remount-ro  0      2   And mount output lines:  /dev/disk/by-uuid/xxxxxxxx... on / type ext4 (rw,noatime,discard,errors=remount-ro,stripe=128,data=ordered) /dev/sda2 on /home type ext4 (rw,noatime,discard,errors=remount-ro,stripe=128,data=ordered)   The SSD is a TOSHIBA THNSNS256GMCP. Why does this happen? How do we define capillary number in 2D (two dimensions) In 3D the capillary number $Ca$ is defined as: $$Ca=\frac{\nu \rho U}{\gamma}$$ where $\nu$ is the kinematic viscosity ($m^2/s$), $U$ is the velocity ($m/s$)and $\gamma$ is the interfacial tension ($N/m$) and $\rho$ is the density in $kg/m^3$ . However in 2D I will have $\rho$ in units of $kg/m^2$ (2D simulation), so how to find capillary number? What's the nice 'trick' to showing that the following expression is irrational?  $2^{1/3} + 2^{2/3}$ If an edit was suggested to an answer to my question and I go to this edit, I see the checkmark Why aren't variables declared in "try" in scope in "catch" or "finally"? In C# and in Java (and possibly other languages as well), variables declared in a "try" block are not in scope in the corresponding "catch" or "finally" blocks.  For example, the following code does not compile:  try {   String s = "test";   // (more code...) } catch {   Console.Out.WriteLine(s);  //Java fans: think "System.out.println" here instead }   In this code, a compile-time error occurs on the reference to s in the catch block, because s is only in scope in the try block.  (In Java, the compile error is "s cannot be resolved"; in C#, it's "The name 's' does not exist in the current context".)  The general solution to this issue seems to be to instead declare variables just before the try block, instead of within the try block:  String s; try {   s = "test";   // (more code...) } catch {   Console.Out.WriteLine(s);  //Java fans: think "System.out.println" here instead }   However, at least to me, (1) this feels like a clunky solution, and (2) it results in the variables having a larger scope than the programmer intended (the entire remainder of the method, instead of only in the context of the try-catch-finally).  My question is, what were/are the rationale(s) behind this language design decision (in Java, in C#, and/or in any other applicable languages)? Can internal forces do work? My Mechanics textbook claims that the sum of the work by internal forces is not generally zero.  translated to English the paragraph reads:     Notice about the work by internal forces: the work by the internal forces is in general not equal to zero although the sum of the internal forces is always equal to zero. Since the work also depends on the relative displacement of the two pointmasses in the material system, the work provided by these 2 internal forces will generally not be equal to zero.   Other sources claim that the work done by internal forces is always zero.  (answer by Mark Eichenlaub)     Then I didn't do any work on the system at all since, by definition, only external forces can do work.        the net work done by internal forces is zero since they do not cause motion of the object.   To me it would seem that these sources contradict eachother. Do they? If so, which one is correct? If not, please explain why they don't contradict eachother. Matrices $B$ that commute with every matrix commuting with $A$