Passing a Type to a generic method at runtime
How do I use reflection to call a generic method?
The question is $$\text{If }\, p, \ q\in \mathbb{N}, \;1-\frac12+\frac13-\frac14-\dotsb-\frac{1}{1318}+\frac{1}{1319}=\frac{p}{q}.\qquad \text{Prove that } 1979\mid p.$$ So my solution went like this:  $$S=1-\frac12+\frac13-\frac14-\dotsb-\frac{1}{1318}+\frac{1}{1319}\Rightarrow S=\sum_{k=1}^{1319}\frac{1}{k}-2\sum_{k=1}^{659}\frac{1}{2k}=\sum_{k=660}^{1319}\frac{1}{k}$$ Now this is equivalent to finding the sum of the roots of the equation $$\left(x-\frac{1}{660}\right)\left(x-\frac{1}{661}\right)\dots \left(x-\frac{1}{1319}\right)=0$$. Rewriting this equation, we get $(660x-1)(661x-1)\dotsc(1319x-1)=0$ (we can discard the $\displaystyle \frac{1319!}{659!}$ since $1979$ is a prime). Calculating the sum of the roots, we get the required value to be equal to $(1320+659)\times 330$ which is obviously divisible by $1979$ (again discarding the coeffecient of $x^{660}$).  Now my question is: Using the same method of converting the problem into finding the sum of roots of a polynomial, we get from the original equation something like this: $$(x-1)\left(x+\frac{1}{2}\right)\dots \left(x-\frac{1}{1319}\right)=0 \Rightarrow (x-1)(2x+1)\dotsc(1319x-1)=0$$ So, the sum of roots would be $-1+2-3+4-\dotsc+1318-1319=-660$ But this is not divisible by $1979$. Why does the former solution work while the latter doesn't? Is there a flaw in my reasoning? Note: I know that the question can be solved by some other methods. Please only explain my given doubts and don't instead give another solution  I realised my mistake after some hours of pondering over it. (In the 1st equation) To get the required sum I would need to take calculate $\displaystyle -\frac{\text{coeffecient of }x^{659}\,}{\text{coeffecient of }x^{660}}$. However what I've done is calculate this:  $\displaystyle -\frac{\text{ coeffecient of }x}{\text{coeffecient of }x^{660}}$ which is actually equal to $\text{sum of roots taken }659 \text{ at a time} $. It was just a coincidence that the value I calculated was divisible by $1979$. The correct way, indeed, would be through the link supplied Where can I find computer modern fonts for use in other programs, e.g. Adobe Illustrator? For some complicated diagrams, I need to use something like Adobe Illustrator or Inkscape, and would like to include nicely typeset labels. (I'm aware of post-processing solutions, such as pinlabel.) One way to do this is to use a closely-matching font, and then convert fonts to outlines. Better, however, would be to use Computer Modern directly in Illustrator.  Where can I find a Computer Modern font compatible with Adobe Illustrator? Prove that the functions $f(z)$ and $\overline{f(\overline{z})}$ are simultaneously holomorphic.   I take this to mean that $f(z)$ is holomorphic if and only if $\overline{f(\overline{z})}$ is holomorphic.  Let $g(z)=\overline{f(\overline{z})}$. Note that $\overline{g(\overline{z})}=f(z)$. So it suffices to prove that if $f(z)$ is holomorphic, then $g(z)$ is holomorphic.  Write $f(z)=u(z)+iv(z)$. Since $f(z)$ is holomorphic, the real and imaginary parts satisfy the Cauchy-Riemann equations:  $$\frac{\partial{u(z)}}{\partial{x}} = \frac{\partial{v(z)}}{\partial{y}}, \frac{\partial{u(z)}}{\partial{y}} = -\frac{\partial{v(z)}}{\partial{x}}.$$  We have $g(z) = u(\overline{z})+i(-v(\overline{z}))$. To prove that $g(z)$ is holomorphic, we must prove that its real and imaginary parts satisfy the Cauchy-Riemann equations:  $$\frac{\partial{u(\overline{z})}}{\partial{x}} = \frac{\partial{(-v(\overline{z}))}}{\partial{y}}, \frac{\partial{u(\overline{z})}}{\partial{y}} = -\frac{\partial{(-v(\overline{z}))}}{\partial{x}}.$$  How can we obtain this from the above relations? Let's assume a very simplified situation. There is only one seller asking for 10$ and there is only one buyer bidding 20$. At what price would the transaction go?   Some answers say it won't, because the ask price has to match the bid price. () Other answers say, that the time ordering is important. () Which answer is correct? What is the final price in the presented situation? What does the '!' really do when it's added to an ex command (:wq! | :w! | :q! )? I understand that it means force to do something.  When doing $ vim -R file I enter in read-only mode, but this works as preventive mode only   -R  Readonly mode.  The 'readonly' option will be set for all the     files being edited.  You can still edit the buffer, but will     be prevented from accidentally overwriting a file.  If you     forgot that you are in View mode and did make some changes,     you can overwrite a file by adding an exclamation mark to     the Ex command, as in ":w!".  The 'readonly' option can be     reset with ":set noro" (see the options chapter, |options|).     Subsequent edits will not be done in readonly mode.  Calling     the executable "view" has the same effect as the -R argument.     The 'updatecount' option will be set to 10000, meaning that     the swap file will not be updated automatically very often.   But what I can't get yet is why it makes the instruction to skip permissions even if the file's owner is root user, besides it also change owner &amp; group. What is considered a "real question"? Note:   This close reason is old and only applies to old questions that were closed prior to the closing overhaul. This has been replaced by the reasons "unclear what you're asking" for unclear questions and "too broad" for overly broad questions. Older questions that have been closed as "not a real question" will remain closed under this reason, so this question is left here for reference.   Questions used to be closed as "not a real question."     What makes a question a "real" question? What are new users expected to know about asking "real" questions? Why does SE treat questions differently from other online forums? How to make wget faster or multithreading? I've just upgraded my computer hardware(cpu + motherboard + graphic card + memory + hard disk), so that install a new OS is needed. I tried to download debian-6.0.6-amd64-netinst.iso with wget command but the speed is so slow that I could not bear. 4Kb/s ~ 17 Kb/s, slow like a running turtle, or even more slower if I use Chrome.  I've read the help information of wget, it seems like there are no options could make it more faster.  Is there anyway to make wget faster? Or is it possible to make it multi-threading download?  PS: my bandwidth is 4M. I use this command:  wget -c url  http://hammurabi.acc.umu.se/debian-cd/6.0.6/amd64/iso-cd/debian-6.0.6-amd64-netinst.iso Checking if a worksheet-based checkbox is checked Repeat each line multiple times Would like to have each line in a file repeated a fixed number of times.  e.g. have each line repeated four times:  a b c   becomes:  a a a a b b b b c c c c   I've done some searching, and there are a lot of questions and answers along the lines of doing the reverse, e.g. merging duplicate lines into single lines, and maybe a few about doubling lines by printing them again.  It would be easy to do this in C, but I wish I knew more about the native commands so I wouldn't have to resort to these kinds of one-off throw-aways all the time. Environment variables in Mac OS X Update: The link below does not have a complete answer. Having to set the path or variable in two places (one for GUI and one for shell) is lame.  Not Duplicate of:     Coming from a Windows background where it's very easy to set and modify environment variables (just go to System Properties > Advanced > Environment Variables), it does not seem to be that straight forward on Mac OS 10.5. Most references say I should update /etc/profile or ~/.profile. Are those the equivalent of System Variables and User Variables? For example, where should I set my JAVA_HOME variable?    EDIT:  I want to be able to access the variable from the terminal as well as an app like Eclipse. Also, I hope I don't have to restart/logout to make this take effect. Resizing Controls in MFC I am writing a program which has two panes (via CSplitter), however I am having problems figuring out out to resize the controls in each frame. For simplicity, can someone tell me how I would do it for a basic frame with a single CEdit control?   I'm fairly sure it is to do with the CEdit::OnSize() function... But I'm not really getting anywhere...  Thanks! :) Formatting OGR VRT file to convert CSV to KML? Opening a context menu (with the Menu key) Missing links to responses to comments on nomination posts In the responses tab in my profile, responses to comments on nomination posts include a working link in the page source, but because there's no title the links are empty and useless.    When listed in the inbox such posts do have a title, though in this case the link is to the post and not directly to the comment. (Actually, the links in responses end up being redirected and also go to the post and not to the comment, but they try to go to the comment.)  In Supercollider:    In Global Profile: Recursive matching with regular expressions in Javascript Direction of friction when a car turns When a ball moves to the right, friction acts to oppose the motion, in other words, to the left. However, when a car travels around a bend, the friction acts in the perpendicular direction to the car's velocity and provides the centripetal force. I just cannot understand why friction would act in that direction. How to cite a source that has vanished due to link rot? My colleague is writing a manuscript about a subject that is rarely reported in the mainstream literature (predation events). A few years ago on a fishing forum she found a photograph that demonstrated this phenomenon pretty well and saved it to her computer, but unfortunately between then and now the original source has vanished: Google Reverse Image Search can't locate it, the website is no longer running and is also unavailable in the Internet Archive. The original URL to the photo was also not retained.  What's the proper way to cite this source? It's not critical to include but it would definitely improve the final manuscript. If I roll 2d8 and 1d6 for damage, how many "damage rolls" is that? 1, 2, or 3? When to use "I" and "me" in an answer My rear rim brakes are squeaking loudly. I don't know what the problem is, but I am sure it has nothing to do with rain because it happens all the time even if it is dry.  Anybody have an idea what could be problem and how to solve it? It makes the rear brakes kind of useless, because if I use them I will scare the people or drivers around me.