I need to be able to determine the size of a block special file.  For example, given /dev/sda, I need a command that will provide the size of the device. (By size I mean capacity, since this is a storage device.)    Rationale:  I can store information in the device with:   echo "12345" >/dev/sda  # needs to be run as root   (Don't run that command by the way... unless you don't care about your data.)  However, I need to know how much data I can store on the device and I don't know how to do that.
How can I find out the size of a block device, such as /dev/sda? Running ls -l gives no useful information.
How do I switch to first person? Is speed of light and sound rational or irrational in nature? Just as circumference of circle will remain $\pi$ for unit diameter, no matter what standard unit we take, are the speeds of light and sound irrational or rational in nature ?   I'm talking about theoretical speeds and not empirical, which of course are rational numbers. If you have a glass of water, say, three quarters full and you pour it at an angle of say, $45^{\circ}$ with respect to the the table, the water comes out of the glass and goes directly down towards the floor.  However, when the glass is more full, or even three quarters full and the 'angle of pouring' is far less with respect the table, when the water comes out of the glass, rather than going straight down it kind of stays stuck to the glass and travels down the outside of it.  Why does this happen? (I'm sure many of you have observed it yourself by accident and ended up making a mess). Oscillation of air particles and speed of sound wave A sound wave is essentially air particles oscillating parallel to the direction of travel of the wave.  We learnt that $v = f\lambda$, where $v$ is the speed of the wave, $f$ is the frequency of the wave and $\lambda$ is the wavelength of the wave.  Suppose the air particles oscillate with a frequency of $f_{particle}$. Is there any relationship between $f_{particle}$ and $v, f, \lambda$ of the entire sound wave?   I thought about this because intuitively, if the air particles vibrated faster, then the wave should travel faster, but I am unable to come up with any formula that describe this relationship (if it is even true!). Proving that the set of limit points of a set is closed Getting a stack overflow exception when declaring a large array The following code is generating a stack overflow error for me  int main(int argc, char* argv[]) {     int sieve[2000000];     return 0; }   How do I get around this? I am using Turbo C++ but would like to keep my code in C  EDIT:  Thanks for the advice.  The code above was only for example, I actually declare the array in a function and not in sub main.  Also, I needed the array to be initialized to zeros, so when I googled malloc, I discovered that calloc was perfect for my purposes.  Malloc/calloc also has the advantage over allocating on the stack of allowing me to declare the size using a variable. Does walking fast prevent eggs hatching? How to add percent sign to NSString Merge two arrays as key value pairs in PHP I've got two arrays of the same size.  I'd like to merge the two so the values of one are the key indexes of the new array, and the values of the new array are the values of the other.  Right now I'm just looping through the arrays and creating the new array manually, but I have a feeling there is a much more elegant way to go about this.  I don't see any array functions for this purpose, but maybe I missed something?  Is there a simple way to this along these lines?  $mapped_array = mapkeys($array_with_keys, $array_with_values); Order and degree of a differential equation Here is a question in my book  Find the order and degree of the differential equation $$y=1+\frac{dy}{dx}+\frac{1}{2!}{\left(\frac{dy}{dx}\right)}^2+\frac{1}{3!}{\left(\frac{dy}{dx}\right)}^3+\cdots$$  At first sight we can conclude that the order is $1$ and the degree is undefined as  as the power of $\frac{dy}{dx}$ continues to increase and has no limit.However  my book gives the following solution  Rewrite the DE as $$y=\exp\left({\frac{dy}{dx}}\right)$$ $$\implies \frac{dy}{dx}=\ln y$$ whose order and degree is 1 .  Now ,I completely agree with this solution however I find it rather counterintuitive to my first line of thought .If the book is correct how can it be justified to prove my intuition was wrong? How can I filter items with a certain enchantement? How to recover/reset forgotten Gnome Keyring Password? In Visual Studio, How do I show all classes inherited from a base class?    For example, in ASP.NET MVC there are several '' types -- and they all inherit from / implement the base class ActionResult.    It looks like unless you just 'know' that View and Json are valid ActionResult types, there is no way you can easily find this information out.    Please prove me wrong.  Is there something in the object browser that makes this easy to find out?  I'm even up for suggestions of tools outside of Visual Studio to discover this information about various classes.  For example: is there something in Resharper that will help me out? Writing a character N times using the printf command I found the following command to repeat a character in Linux:  printf 'H%.0s' {1..5000} &gt; H.txt   I want, for example, H to repeat 5000 times. What does %.0s mean here? Here's an example question from the :     On the last day of a one-week sale, customers numbered 149 through 201 were waited on. How many customers were waited on that day?   Possible answers: 51, 52, 53, 152, 153.   The correct answer here is 53, which is the result of (201-149) + 1 = 53.  What's the reasoning in adding the +1? What editors/IDEs are available for easing the process of writing TeX/LaTeX documents? Please state some useful features like code completion, spell checking, building final DVI or PDF files, etc.  This question is undergoing a systematic refurbishment, see  on Meta. If you’d like to see another editor feature covered here or to take care of an editor that’s not covered yet, share your ideas in that meta question.  List of editors Links to answers. I'm currently a Combinatorics student trying to parse through this solution. I do not understand the proof currently. Any help understanding it is greatly appreciated.    Question Let the number of partitions be given by the function $p(n)$, i.e. the number of ways of writing the integer $n$ as a sum of positive integers. Prove that that if $g$ is any polynomial function in $n$, then there exists an integer $N$ such that $g(n)&lt;p(n)$ for all $n&gt;N$. Do not use the asymptotic Hardy-Ramanujan formula.    Provided Proof.    Enough to show $n^a&lt;p(n)$ for fixed positive integer $a$. (This is just saying that we want to show $p(n)$ grows faster than any degree polynomial of $n$, right?) We have that $(i_1,i_2,\ldots,i_{a+1},1^{n-i_1-\cdots -i_{a+1}})$ is a partition of $n$ as long as $i_{a+1}\leq i_a\leq \cdots i_1 \leq \lfloor\frac{n}{a+1}\rfloor$. (I really don't understand this step. What is this partition? Of the coefficients or terms of polynomial $p(n)$? And how do we know this is $\leq \lfloor\frac{n}{a+1}\rfloor$?) The number of partitions $n$ of this form is multiset binomial coefficient $$\left(\dbinom{\lfloor \frac{n}{a+1}\rfloor}{a+1}\right)=\frac{\lfloor\frac{n}{a+1}\rfloor(\lfloor\frac{n}{a+1}\rfloor+1)\cdots(\lfloor\frac{n}{a+1}\rfloor+a-1)}{(a+1)!}$$ (I'm assuming that if I can understand (2.) then I can understand this line) This means $p(n)&gt;\left(\binom{\lfloor \frac{n}{a+1}\rfloor}{a+1}\right)$ for all $n&gt;0$. Since $a$ is constant, the given fraction grows with order $n^{a+1}$, which means $p(n)&gt;n^a$ for $n$ sufficiently large. (Why does it grow with order $n^{a+1}$?)   Thanks all again in advance! Book series about preparation for a war at the Singularity I am looking for a book series (almost certainly a trilogy) that starts with some humans in a space station being abducted by a small funny-looking alien and taken to a prison planet. They find out that the way space travel works is by creating copies of the passengers, and the originals remained on the space station. This is actually good for the aliens since they believe every sentient being will resurrect at the Singularity and will be forced to fight a battle, so the more the merrier.  The one other detail I remember is that the world economy has a rampant inflation, so people take any cash they have at the end of the day and buy 20th-century memorabilia that doesn't devalue as much. A script on AIX which checks the number of parameters passed and complains if they are not correct:-  if [ "$#" -ge 1 ]; then   ... else   echo 'Usage: myscript &lt;a&gt; [b] [c]' fi   The script sets some environment variables so it is sourced. By that I mean I type the following on my command line. There is no second script, I am not sourcing a script from within another script.  . ./myscript.sh   If I pass it no parameters, I expect it to print out the usage statement but instead it runs using the parameters passed to the previous command that was sourced (not necessarily even this script!).  To double check this I added this line at the beginning of my script to prove that this was the case.  echo $# $@   If I pass it no parameters, it prints out the number and the list of parameters from a previously sourced script.  How do I get it to say $# is zero when I pass it zero parameters and source it?  The smallest possible recreate is a script thus:-  myscript.sh  echo $# $@   and then run it thus:-  . ./myscript.sh a b c   which prints out  3 a b c   then run it again without any parameters thus:-  . ./myscript.sh   which prints out the same  3 a b c   when you would expect it to print out  0   If you don't source the script and just run it thus:-  ./myscript.sh   then it works as expected and prints out  0   I hope that clarifies the issue at hand.  Since I seem to be getting lots of answers to explain why the above doesn't work and no answers to tell me what I should do instead, I thought I would have one more attempt at trying to explain what I am trying to do.  Requirement  I need to write a script that expects at least one parameter and complains if it is not invoked with a said parameter (see the first block of code in my question above), and this script needs to set some environment variables. Because of this second requirement I have assumed that I need to source the script so that the environment variables are still set when the script completes. How can you write a script that can tell when it has not been passed parameters that is also able to set an environment variable? Book Recommendation for mathematical finance Does anyone know a book which covers topics on:  Brownian Motion   Martingales   Stochastic Calculus  Stochastic Differential Equations   Options pricing. Black-Scholes model  Fundamental Theorems. Interest Rates   Random Walk   Applications in Insurance   Simulations. Convergence   Simulation methods   I would like something in-depth, but at an undergraduate level.