Is there a good clean conventional way to do this?  For example, if there are any ".gz" files in a certain directory, I want to unzip them.  But if there aren't, I don't want to see any error.  If I use gzip -d /mydir/*.gz, I get the error:  gzip: /mydir/*.gz: No such file or directory   If I first shopt -s nullglob and then gzip -d /mydir/*.gz, I get the following:  gzip: compressed data not read from a terminal. Use -f to force decompression. For help, type: gzip -h   I have one method I know will work, which I'm posting as an answer.  I'm wondering if there's a better/cleaner way.  POSIX compatibility is a bonus, but not required.
I am trying to write an if statement to test whether there are any files matching a certain pattern. If there is a text file in a directory it should run a given script.  My code currently:  if [ -f /*.txt ]; then ./script fi   Please give some ideas; I only want to run the script if there is a .txt in the directory.
Run Metro application on startup? I want to know where the Metro applications (Mail, People, Messages, ...) executable file path is.  Also, how can I run Mail application when my PC starts? Leg bisectors in a trapezoid and angle equality Let $PQRS$ be a trapezoid. The bisectors of legs $PS$ and $QR$ intersect the opposite legs at $M$ and $N$ so that triangles $PMS$ and $QNR$ are formed.  Prove that $\measuredangle PMS= \measuredangle QNR$.  The question may seem easy but I fail to move on, playing with angles didn't help. I'd appreciate some hint from somebody with an eye for geometry and triangles. How do I run an executable using Lua? Making 3 points stick on a plane / flag with wind I have a flag I want to waft in the wind. I imported the shape as an SVG from Adobe Illustrator.  I converted the mesh to a curve.  It wouldn't let me make some subdivisons but it still seems to work with the cloth property.    When I press play, you can see the structure of the flag stops.  How can I make those last 3 points intact? Also the fill colour seems to have disappeared, do you know why and how I can bring it back?    Thanks  Steve  File here: How to make a cross-module variable? How can I parse dates and convert time zones in Perl? Charge controller for Li-ion or Li-Polymer battery I am trying to work out the good charger for Mobile phones, which can serve as good performer for various smart phones out there in market these days &amp; mostly using Li-ion battery. Charging has 4 stages -- "the initial trickle-charging, then constant current charging, then constant voltage charging &amp; finaly Top-up charge" -- all this is controlled &amp; monitored by a control circuit/IC of charger. So, my concern is if such circuit/module/IC is already there in Mobile phones &amp; taking care of all protections to battery/phone including overheating during charge OR The charger designer have to incorporate these circuits in Charger itself? If former case, that means we just need to make a charging source giving ample current &amp; 4.75V-5.25V voltage, like a high-powered USB output port would gives. My feeling is such stages-wise charging &amp; control/monitor circuitry is already within the phone set, i just want to reconfirm. I have an application that reads a CSV file with piles of data rows.  I give the user a summary of the number of rows based on types of data, but I want to make sure that I don't read in too many rows of data and cause OutOfMemoryErrors.  Each row translates into an object.  Is there an easy way to find out the size of that object programmatically?  Is there a reference that defines how large primitive types and object references are for a VM?  Right now, I have code that says read up to 32,000 rows, but I'd also like to have code that says read as many rows as possible until I've used 32MB of memory.  Maybe that is a different question, but I'd still like to know. Prove that if $X$ and it's closure $\overline X$ are connected and if $X\subset Y \subset \overline X$, show that Y is also connected. Can anyone give me a proof of the statement that if $X$ and its closure $\overline X$ are connected and if $X\subset Y \subset \overline X$, show that Y is also connected?  Thank you. Variance of sample mean. Let $X_1, X_2, \ldots X_n$ be random variables with mean $\mu$ and variance $\sigma^2$. We define the sample mean $\bar{X} = \sum_{i = 1}^n X_i$.  I am having trouble understanding why the variance of $\bar{X}$ is $\sigma^2 / n$.  Here is what I worked out thus far:  $$\begin{gather} \sigma_\bar{X}^2 = E((\bar{X} - \mu)^2) = E(\bar{X}^2 - 2\bar{X}\mu + \mu^2) = E(\bar{X}^2) - 2\mu E(\bar{X}) + E(\mu^2) = E(\bar{X}^2) - \mu. \end{gather}$$  However, I'm not sure what to do with the $E(\bar{X}^2)$. Why there's no article with 'Mexican' and 'an' with American in sentence: "She’s Mexican. But she’s married to an American."   (Pimsleur English course) Precedence of user and group owner in file permissions I just ran into something unexpected (for me) regarding file permissions on Linux (Arch Linux). Basically I have:   userX in groupX fileX userX:groupX ---rwx----   What puzzles me: I cannot perform any action (rwx) on fileX. Is this right? Can someone please confirm this is indeed the expected behaviour?  The only actions I can perform are mv and rm because I have write permissions on the parent directory.  The thing is, I always thought these permissions collapse on each other, starting with the most general one (other -> group -> user). In other words, if o=rwx who cares what the persmissions for group and user are? Apparently this is not the case but it doesn't make much sense to me; it seems counterintuitive. The only thing this approach seems to be useful at, is to easily exclude a very specific person / group, which doesn't seem like a smart way to go at it (imho). Besides, the owner (and group?) should be able to chmod anyway right? Any thoughts on this matter? How to receive sms from our android app? Wasn't the density of the universe at the moment after the Big Bang so great as to create a black hole? If the answer is that the universe/space-time can expand anyway what does it imply about what our universe looks like from the outside? Another indicator of a review audit: Question has no tags Indefinite articles used with plural nouns: It was AN amazing TWO DAYS The indefinite article a(n), derives from the old English word an meaning "one". Generally this word only occurs in determiner function before noun phrases which are singular. However, there seem to be some cases where this determiner occurs before plural noun phrases. I say that, but actually these noun phrase seem so bizarre to me, in terms of their structure, that I'm not sure they're definitely noun phrases at all. Here are some examples:   a full three months before we left an amazing two days an awkward ten minutes   Ignoring the article here for a moment, these noun phrases are odd because the adjective is occurring before the numeral. We would normally expect to see:   three full months two amazing days ten awkward minutes   Even given the oddness of the word order in the original phrases, I can see no reason why the normally singular indefinite article is licensed here.   Can anybody give an account of the syntactic structure of these phrases, and/or explain why the semantically singular article is able to be used with such phrases - even if they compulsorily trigger plural verb agreement?  Here is an example of one of these instances which seems to demand a plural verb:   An amazing two million people attend every year. *An amazing two million people attends every year. (ungrammatical) Suppose there are $2$ permutations given by $p$ and $q$. I need to check whether $p$ belongs to the group generated by $q$, and if so, it's representation in a power of $q$. In other words, I've been given $p$ and $q$, I need to check whether $\exists i \in \{ 0,...,|q|-1 \} \text{ such that } p = q^i$ I know that if $m = \gcd(i, |q|)$, then $|q^i| = \frac{|q|}{m}$. Now, say that such an $i$ exists. Then, $$ |p| = \frac{|q|}{\gcd(i, |q|)} \Rightarrow \gcd(i, |q|) = \frac{|q|}{|p|} $$ Thus, a necessary condition for such an $i$ to exist is: $|p|$ divides $|q|$ Say that this holds, and $\frac{|q|}{|p|} = r$, where r is an integer. Then we just have to solve $\gcd(i, |q|) = r$ for $ i \in \{ 0,...,|q|-1 \}$. Can this be done? If not manually, then by some efficient algorithm? (Note: Just looping over all values of $i$ is not efficient as $i$ may be very large) Edit: Another way I can think of solving this is by writing both $p$ and $q$ as product of disjoint cycles: $$ p = c_1c_2\ldots c_k \text{ and } q = d_1d_2\ldots d_l $$ And thus, as disjoint cycles commute: $$ p^i = c_1^ic_2^i\ldots c_k^i $$ How to proceed after this? We have no mention of Voldemort in Harry's sixth year. So, I was wondering- what could Voldemort have been doing? Syntax error while creating DB2 Trigger What is wrong in the below trigger syntax, I am getting this error An unexpected token "INT" was found following " DECLARE NULL_ROW_ID".  Expected tokens may include:  "END-OF-STATEMENT".. SQLCODE=-104, SQLSTATE=42601, DRIVER=3.68.61  CREATE TABLE A (     A_ID INT NOT NUll,     A_CODE VARCHAR(100) NOT NULL,     PRIMARY KEY(A_ID) );  CREATE TABLE B (     B_ID INT NOT NUll,     B_CODE VARCHAR(100) NOT NULL,     A_ID INT,     PRIMARY KEY (B_ID),     FOREIGN KEY (A_ID) REFERENCES A (A_ID)  );  CREATE OR REPLACE TRIGGER B_TRIGGER AFTER UPDATE OF A_ID ON B REFERENCING NEW AS N OLD AS O FOR EACH ROW     WHEN (N.A_ID IS NULL)     BEGIN ATOMIC         DECLARE NULL_ROW_ID INT;         SET NULL_ROW_ID = (SELECT A_ID FROM A WHERE A_CODE = 'Custom Null String');         IF NULL_ROW_ID IS NULL THEN             SIGNAL SQLSTATE '70000' SET MESSAGE_TEXT = 'Custom Null String row not found.';         END IF;     SET N.A_ID = NULL_ROW_ID;     END @   It's on DB2 Express-C 10.5 Prove $f(S \cup T) = f(S) \cup f(T)$