Why do I have so many filesystems?
Understanding hard drive space
How do I efficiently get "the most recent corresponding row"? I have a query pattern that must be very common, but I don't know how to write an efficient query for it.  I want to look up the rows of a table that correspond to "the most recent date not after" the rows of another table.  I have a table, inventory say, which represents the inventory I hold on a certain day.  date       | good | quantity ------------------------------ 2013-08-09 | egg  | 5 2013-08-09 | pear | 7 2013-08-02 | egg  | 1 2013-08-02 | pear | 2   and a table, "price" say, which holds the price of a good on a given day  date       | good | price -------------------------- 2013-08-07 | egg  | 120 2013-08-06 | pear | 200 2013-08-01 | egg  | 110 2013-07-30 | pear | 220   How can I efficiently get the "most recent" price for each row of the inventory table, i.e.  date       | pricing date | good | quantity | price ---------------------------------------------------- 2013-08-09 | 2013-08-07   | egg  | 5        | 120 2013-08-09 | 2013-08-06   | pear | 7        | 200 2013-08-02 | 2013-08-01   | egg  | 1        | 110 2013-08-02 | 2013-07-30   | pear | 2        | 220   I know one way of doing this:  select inventory.date, max(price.date) as pricing_date, good from inventory, price where inventory.date &gt;= price.date and inventory.good = price.good group by inventory.date, good   and then join this query again to inventory. For large tables even doing the first query (without joining again to inventory) is very slow.  However, the same problem is quickly solved if I simply use my programming language to issue one max(price.date) ... where price.date &lt;= date_of_interest ... order by price.date desc limit 1 query for each date_of_interest from the inventory table, so I know there is no computational impediment.  I would, however, prefer to solve the whole problem with a single SQL query, because it would allow me to do further SQL processing on the result of the query.  Is there a standard way to do this efficiently? It feels like it must come up often and that there should be a way to write a fast query for it.  I'm using Postgres, but an SQL-generic answer would be appreciated. I've never really got how chmod worked up until today. I followed a tutorial that explained a big deal to me.   For example, I've read that you've got three different permission groups:   owner (u) group (g) everyone (o)   Based on these three groups, I now know that:   If the file is owned by the user, the user permissions determine the access. If the group of the file is the same as the user's group, the group permission determine the access. If the user is not the file owner, and is not in the group, then the other permission is used.   I've also learned that you've got the following permissions:   read (r) write (w) execute (x)   I created a directory to test my newly acquired knowledge:  mkdir test   Then I did some tests:  chmod u+rwx test/ # drwx------ chmod g+rx test/ # drwxr-x--- chmod u-x test/ # drw-r-x---   After fooling around for some time I think I finally got the hang of chmod and the way you set permission using this command.    But...  I still have a few questions:   What does the d at the start stand for? What's the name and use of the containing slot and what other values can it hold? How can I set and unset it? What is the value for this d? (As you only have 7=4+2+1 7=4+2+1 7=4+2+1) Why do people sometimes use 0777 instead of 777 to set their permissions?   But as I shouldn't be asking multiple questions, I'll try to ask it in one question.  In UNIX based system such as all Linux distributions, concerning the permissions, what does the first part (d) stand for and what's the use for this part of the permissions? I want to make sure all of the data in my plugins/themes is handled securely  before entering the database and before being output to the browser. My problem is that there are situations where the API handles the sanitization for you -- like when saving post meta fields -- and others where the plugin/theme author is wholly responsible for doing it -- like when saving custom settings.  For the scope of this question, I'm not concerned about validating data at the domain level -- e.g., checking that an Age field on a form is between 0 and 120, or that an e-mail address is valid. I'm only concerned about security -- e.g., escaping SQL queries to avoid SQL injection when saving to the database, or sanitizing data that's output to HTML templates to avoid XSS.  For output sanitization, I know that you always need to use functions like esc_html() and esc_attr() when echo'ing variables into HTML templates. But, what about when using ? Do they all sanitize the output already? If so, for which context (general HTML, tag attributes, etc)? Some functions have variants for different contexts (like the_title_attribute(), but most don't.  For input sanitization, I know that I need to use $wpdb-&gt;prepare() when making manual queries, but what about when using the Settings API to create a plugin settings page, or saving post meta fields for a custom post type?  Right now I've just been digging through Core and reading tutorials every time I use a function to find out if it sanitizes or not, but that's error-prone and time consuming. I'm hoping to find some kind of comprehensive list of all the possible situations and whether or not the API handles it. e.g.,  API validates/sanitizes   Saving post meta with update_postmeta() Saving user meta with update_user_meta() Outputting a post title - use the contextually appropriate variant of the_title() etc   You have to manually validate/sanitize   Saving plugin options with the Settings API. Pass a callback as the 3rd parameter of register_setting(). Direct database queries: Wrap the query in $wpdb-&gt;prepare(). Outputting variables in HTML. Use esc_attr(), esc_html(), etc etc   I'd also be interested to understand why the API provides it in certain situations, but not others. I'm assuming it has something to do with the unknown nature of the data, but would love to hear a thorough explanation. What are the positives and negatives of periodic DFT codes that don't use plane-wave basis sets? Most periodic density functional theory (DFT) codes use plane-wave basis sets in conjunction with three-dimensional periodic boundary conditions. In contrast, for molecular systems of finite size, Gaussian basis sets are often used. The former are quite efficient for periodic systems, but more expensive methods such as hybrid functionals become intractable for large system sizes. The latter is well-suited for finite clusters but rarely is appropriate for periodic systems.   uses a mixed Gaussian and plane-wave approach (GAPW) for periodic systems.  models periodic systems using atom-centered Gaussian functions.  expresses wavefunctions in real space, avoiding explicit basis sets.  What are some positives and negatives of these alternate approaches, when compared to more conventional periodic DFT packages? $n \mid (a^{n}-b^{n}) \ \Longrightarrow$ $n \mid \frac{a^{n}-b^{n}}{a-b}$ How does one prove that if $n \mid (a^{n}-b^{n}) \ \Longrightarrow$ $ \displaystyle n \mid \frac{a^{n}-b^{n}}{a-b}$ where $a,b, n \in \mathbb{N}$.  What i thought of is to consider $$(a-b)^{n} \equiv a^{n} + (-1)^{n}b^{n} \ (\text{mod} \ n)$$ and if we suppose that $n$ is odd then we have, $$(a-b)^{n} \equiv a^{n} -b^{n} \ (\text{mod} \ n)$$ and since $n \mid (a^{n} - b^{n})$ we have $$(a-b)^{n} \equiv 0 \ (\text{mod} \ n) $$  I think i am far away from the conclusion of the problem, but this is what i could work on regarding the problem. I listened to this on audiobook and it was great.  The premise was a human ends up travelling to an alien planet. The aliens have a perimeter to their 'base' that is under constant attack from the planet's animals. It is revealed towards the end that there is some sort of signal being transmitted that is making all the animals and plant life attack a certain point on the planet (where the aliens are).   Other major plot points I remember: The human traveller falls in love with an alien. The aliens have a sort of virtual training environment that simulates life outside the perimeter, where plants attack you etc. There is a secondary alien group that the human ends up with, and although they are rivals to other group, they have a trade set up.   Any help much appreciated! Thanks. Justifying the Normal Approx to the Binomial Distribution through MGFs Would absolutely love if someone could help me with this question, in a step by step way to help those who are uninitiated to Statistics and Mathematics.   So, I am trying to "prove/justify" through MGFs how as n(the sample size) increases and goes to infinity, a standardized binomial distribution converges to the Standard Normal Distribution. So in the beginning we have $X_n $~$ Bin(n,p)$ then we standardize this $R.V.$ by subtracting the mean $E(X_n)=np$ and dividing by the $SD$ which is $np(1-p)$. After doing this, we get a new $R.V.$ with $mean=1$ and $variance=SD=1$. It is the distribution of this standardized quantity that converges to a fixed distribution, correct? Namely the Standard Normal Distribution. Let's call the standardized version of $X_n$, $Z_n$.   I think what we need to do is to find the MGF of $Z_n$ and show that this MGF becomes the Standard Normal Distribution's MGF as the sample size $(n)$ heads toward infinity. Now $Z_n$ is a function of $X_n$ which we know the MGF of which is $(1-p+pe^t)^n$.   Now I know that $Z_n$ is a linear transform and that we should be able to use this to simply the MGF but I don't understand how the course notes do it, mostly because they skip a lot of steps and it is difficult to follow. There is also a Taylor Series Expansion for the exponential that I am confused about although I do understand the concept of the series expansion.  Help would be greatly appreciated! I would love assistant in exactly how we can prove this via MGF.   Thanks so much in advance :) How can I prove that $\gcd(a, b) = \gcd (a, b + ma)$?  I have tried this:  let $g = \gcd(a, b)$, then $g \mid a$ and $g \mid b$. This means that $g \mid ax+by$.  I don't know what to do next.  Thanks. How to turn the white colour portion to transparent I got this map icon in work in illustrator, and would like to turn those white dash line and the white outline of the location mark to transparent. Can you please advise me how to do it? Thank you in advance. Is the $ L^{p}$$[0,1]$ norm continuous in p? I ran into the following problem when I was doing my homework, and I have no thoughts on where I should start with:  (1) If $f\in L^{2}$, show that $\displaystyle \lim_{p \rightarrow 1^{+}}\int_{[0,1]}|f|^{p}=\int_{[0,1]}|f|$  (2) If $0&lt;p$, show that $\displaystyle \lim_{q\rightarrow p^{-}}||f||_{q}=||f||_{p}$  My first thought was Generalized LDCT, but it didn't seem to work. I also made some other attempts but none of them were successful... Can anybody give me some hints on how I should look at this question?  Also, I know if $p\rightarrow\infty$ then $||f||_{p}\rightarrow||f||_{\infty}$ on $[0,1]$, but does similar continuity in p holds for other $L^{p}[0,1]$ norms in general?  Thank you!  Edit:   Sorry if I did not make it clear enough in the question. All $L^{p}$ refers to $L^p[0,1]$.  The first question is found  (thanks to t.b.), but the second question remains, mainly because $f$ is not guaranteed to be in any $L^{p}$. Is "gift" accepted as a verb? I have always argued adamantly, as long as the issue has been around, that gift should never be used as a verb. However, someone whose English knowledge I quite respect disagrees.  I’ve done some searching and I haven’t found a consensus; should gifting be shunned? MySQL 5.5.16 allows anonymous connections Apparently, I can connect to MySQL (at least from my localhost) without having to provide any username or password. I can even put anything as username, as long as the password is empty. I have access to the information_schema and test databases. I can create tables. If I run SELECT USER() it returns the proper value randomstring@localhost, where the random string is whatever I used for username when I connected.  The mysql.user table contains root@localhost, root@127.0.0.1, @localhost and pma@localhost. I manually set encrypted passwords to all the records (UPDATE user SET password=...) and only root has any privileges, the other two records have "N" for all privileges. That record with the empty username looks suspicious, but I don't think it has anything to do with this and I think it was there from the beginning.  To make matters worse, if I add a user with a password, I can only connect using empty string as password (just like if I put anything as username). If I try to connect using the username I created and password I supplied when creating it (CREATE USER .. IDENTIFIED BY ..) it doesn't work.  Does anyone know what is wrong and how I can fix this?  Note: I am using MySQL 5.5.16 for Windows, provided by the XAMPP package. I know mathematically the answer to this question is yes, and it's very obvious to see that the dimensions of a ratio cancel out, leaving behind a mathematically dimensionless quantity. However, I've been writing a  (the specifics of which are out of scope), which has me thinking about the problem because I decided to handle angle units as dimensioned quantities, which seemed natural to enable the unit conversion with degrees. The overall purpose of the library is to disallow operations that don't make sense because they violate the rules of dimensional analysis, e.g. adding a length quantity to an area quantity, and thus provide some built-in sanity checking to the computation. Treating radians as units made sense because of some of the properties that dimensioned quantities seemed to me to have:  The sum and difference of two quantities with the same dimension have the same physical meaning as both quantities separately. Quantities with the same dimension are meaningfully comparable to each other, and not meaningfully comparable (directly) to quantities with different dimensions. Dimensions may have different units that are scalar multiple (sometimes with a datum shift).  If the angle is treated as a dimension, my 3 made up properties are satisfied, and everything &quot;makes sense&quot; to me. I can't help thinking that the fact that radians are a ratio of lengths (SI defines them as m/m) is actually critically important, even though the length is cancelled out. For example, though radians and steradians are both dimensionless, it would be a logical error to take their sum. I also can't see how a ratio of something like (kg/kg) could be described as an &quot;angle&quot;. This seems to imply to me that not all dimensionless units are compatible, which seems analogous to how units with different dimensions are not compatible. And if not all dimensionless units are compatible, then the dimensionless &quot;dimension&quot; would violate made-up property #1 and cause me a lot of confusion. However, treating radians as having dimension also has a lot of issues, because now your trig functions have to be written in terms of $\cos(\text{angleUnit}) = \text{dimensionless unit}$ even though they are analytic functions (although I'm not convinced that's bad). Small-angle assumptions in this scheme would be defined as performing implicit unit conversions, which is logical given our trig function definitions but incompatible with how many functions are defined, especially since many authors neglect to mention they are making those assumptions. So I guess my question is: are all dimensionless quantities, but specifically angle quantities, really compatible with all other dimensionless quantities? And if not, don't they actually have dimension or at least the properties of dimension? What is the probability that a shuffled standard deck of 52 cards has no two cards of the same rank together ?  I am unable to get a handle on this problem, and wonder whether there is an analytical solution ? I did the following proof and I was wondering if its valid. It feels wrong because I didn't actually test the case when purportedly $n$ is not prime, but please feel free to correct me.  Assume there exists $n$ such that $\phi(n) = 14$. Assume $n$ is prime. Then $\phi(n) = n-1$. Then here, n-1 = 14, so n = 15.  We know since Euler's totient function is multiplicative that $\phi(xy)$ = $\phi(x)\phi(y)$, so $\phi(15) = \phi(3)\phi(5)$, but alas $\phi(3)\phi(5) = 2\cdot4 = 8 \ne 14$. If $n$ is not prime a similar argument follows since we know then that $n$ must be composed of prime numbers by the prime factorization theorem. How can you prove that the square root of two is irrational? I have a large dictionary file with 300,000+ words in it and I'm trying to find all words with the vowels aeiou in that order and have only exactly 5 vowels. My current attempt does not seem to be working and for the life of me I don't understand why.  less mywords | grep -iE [^aeiou]*a[^aeiou]*e[^aeiou]*i[^aeiou]*o[^aeiou]*u[^aeiou]*   I think it get's all the words I'm looking for but there are a few words that pop up which I can not get rid of.  abstemiousnesses ultraserious   There are a few other but they are in the same vein. Curiously, even if I add something like [^u]* to the front ultraserious keeping popping back up! Any solution would be fine however I would like it restricted to grep as we've been told it can be done using only grep. The existence of the empty set is an axiom of ZFC or not? I found in the Wolfram MathWorld page of the  that this is one of the Zermelo-Fraenkel Axioms, however on the page about these  I read that it is an axiom that can be deduced from the Axiom of Subsets and the Axiom of Foundation (or Axiom of Regularity), so, the existence of the Empty Set is an axiom of ZFC or not? How do I handle collision detection so fast objects are not allowed to pass through walls? I'm creating a 2d sidescrolling shooter, and I'm having a little trouble with collision detection for the bullets. Everything including the bullets are objects with their own polygons / update methods.  The trouble is that bullets go fast, and at 60 frames per second (what the game runs at) a bullet will often skip right through a wall -- since it moves more than the width of the wall during in the update interval -- and continue happily on its way since the polygons will never actually overlap.  What can I do about this? The only thing I've been able to come up with is to draw a line from the old position to the new position and do collision detection on that, but line drawing for collision detection is recommended against by the slick2d documentation. How can I solve this? "There Is"/"There are" depends on plurality of the first list element or not?