I have some java application on windows 7 x64 and pass a parameters to it:  -Xms256m -Xmx256m   Then I run  and see columns (values) on java process: Private bytes (414 620K), Working Set (328 876K) and Virtual Size (1 890 352K). It is easy to see that after I specify max and min heap size java.exe process allocates more memory in virtual size. And this influence on Page file size on windows to grow.  So how to restrict java virtual memory usage?  P.S. If you want to reproduce this situaltion you can download , edit bin\cassandra.bat with -Xms256m -Xmx256m and after start you can see a difference between heap memory size and virtual. However cassandra is just a java program, so the question about how to run java program, not how to run cassandra.
Is there any way to set a system wide memory limit a process can use in Windows XP? I have a couple of unstable apps which do work ok for most of the time but can hit a bug which results in eating whole memory in a matter of seconds (or at least I suppose that's it). This results in a hard reset as Windows becomes totally unresponsive and I lose my work.  I would like to be able to do something like the /etc/limits on Linux - setting M90, for instance (to set 90% max memory for a single user to allocate). So the system gets the remaining 10% no matter what.
Near Earth vs Newtonian gravitational potential Newton's Law of Universal Gravitation tells us that the potential energy of object in a gravitational field is $$U ~=~ -\frac{GMm}{r}.\tag{1}$$  The experimentally verified near-Earth gravitational potential is  $$U ~=~ mgh.\tag{2}$$  The near-Earth potential should be an approximation for the general potential energy when $r\approx r_{\text{Earth}}$, but the problem I'm having is that they scale differently with distance.  $(1)$ scales as $\frac 1r$.  So the greater the distance from the Earth, the less potential energy an object should have.  But $(2)$ scales proportionally to distance.  So the greater the distance from the Earth, the more potential energy an object should have.  How is this reconcilable? Earlier i was not specifying a custom log format, and the captured request headers were getting printed fine. I wanted to log the unique-id-header, but could not find any way of doing so. So i copy pasted the log-format mentioned on , and unique id started getting logged.  Unfortunately, now the captured request headers are not getting logged. The %hrl and %hsl are coming out as empty strings.  Very weird. Here is my config, plzz help :(  listen server   bind *:80   mode http    option  httplog   option  http-server-close   no option logasap   # disable early logging of HTTP requests so that total transfer time is logged   option  forwardfor   capture request  header    X-Forwarded-For      len 500    capture request  header    Host                 len 500    capture request  header    X-Request-UID        len 500    rspadd  X-Haproxy-Backend:\ server    # Generate the X-Haproxy-Unique-ID and log it to make it easy to track requests   log-format %Ci:%Cp\ [id=%ID]\ [%t]\ %f\ %b/%s\ %Tq/%Tw/%Tc/%Tr/%Tt\ %st\ %B\ %cc\ %cs\ %tsc\ %ac/%fc/%bc/%sc/%rc\ %sq/%bq\ {%hrl}\ {%hsl}\ %{+Q}r   unique-id-format %{+X}o\ %Ci:%Cp_%Fi:%Fp_%Ts_%rt:%pid   unique-id-header X-Haproxy-Unique-ID   Here is the log i see:  Sep 13 17:28:57 localhost haproxy[11979]: 10.161.27.218:41592  [id=0AA11BDA:A278_0AA15B71:0050_505217C5_0014:2ECB] [13/Sep/2012:17:28:37.567]  server www-example-com-healthz/- 19998/0/2/1/+20001 200 +326  - - ---- 10/10/1/1/0 0/0 {} {}  "GET /testing/healthz?merchant=www.example.com&amp;source=elb HTTP/1.1"   Note that %hrl and %hsl are empty strings :( How do i capture the request headers ?? Correlation between dichotomous and continuous variable I am trying to find the correlation between a dichotomous and a continuous variable.  From my ground work on this I found that I have to use independent t-test and the precondition for it is that the distribution of the variable has to be normal.  I performed Kolmogorov-Smirnov test for testing the normality and found that the continuous variable is non-normal and is skewed (for about 4,000 data points).   I did the Kolmogorov-Smirnov test for the entire range of variables. Should I split them into groups and do the test? I.e., say if I have risk level (0 = Not risky, 1 = Risky) and cholesterol levels, then should I:    Divide them into two groups, like  Risk level =0 (Cholestrol level) -&gt; Apply KS Risk level =1 (Cholestrol level) -&gt; Apply KS  Take them together and apply the test? (I performed it on the whole dataset only.)   After that, what test should I do if it is still non-normal?    EDIT: The above scenario was just a description I tried to provide for my problem. I have a dataset which contains more than 1000 variables and about 4000 samples. They are either continuous or categorical in nature. My task is to predict a dichotomous variable based on these variables (maybe come up with a logistic regression model). So I thought the initial investigation would involve finding the correlation between dichotomous and a continuous variable.  I was trying to see how the distribution of the variables are and hence tried to go to t-test. Here I found the normality as an issue. The  Kolmogorov-Smirnov test gave a significance value of 0.00 in most of these variables.  Should I assume normality here? The skewness and kurtosis of these variables also show that the data is skewed (>0) in almost all cases.  As per the note given below I will investigate the point-biserial correlation further. But about the distribution of variables I am still unsure. Working with a huge file. Illustrator is super slow. What can I do to ease the load? How was this answer posted after this question was closed? Question:   Answer:   The question was closed at 11:57:57 (according to the hover-over-"x-mins-ago" bar) and the answer was posted at 12:16:35. It's a fairly lengthy answer, so it's possible that it was started to be written before it was closed but I swear I've started to answer a question then I got a banner along the top saying "this question has been closed" and the answer was no longer post-able. Explicitly calling a default method in Java How are unmarketable market orders (other side of the order book is empty) matched with incoming orders? The $n$ complex $n$th roots of a complex number $z$ Suppose $z$ is a nonzero complex number, so $z=re^{i\theta}$. Show that there are only $n$ distinct complex $n$-th roots, given by $r^{1/n}e^{i(2\pi k+\theta)/n}$ for $0\leq k\leq n-1$.   My proof: Let $z=re^{i\theta}\in\mathbb{C}$ and $a\in\mathbb{C}$ s.t. $a^{n}=z$. Let $a=\rho e^{i\varphi}$. Then, $a^{n}=(\rho e^{i\varphi})^{n}$. Setting $\rho^{n}e^{i\varphi n}=re^{i\theta}$ and rewriting in polar form, we get $$\rho^{n}(\cos(n\varphi)+i\sin(n\varphi))=r(\cos(θ)+i\sin(\theta)).$$ Thus $\rho^{n}=r$ $\rightarrow$ $\rho=r^{1/n}$ and $n\varphi=\theta\rightarrow\varphi=\theta/n$. Thus the roots of $a\in\mathbb{C}$ have the form $$r^{1/n}(\cos(\tfrac{\theta}{n})+i\sin(\tfrac{\theta}{n}))=r^{1/n}(\cos(\tfrac{\theta}{n}+2\pi j)+i\sin(\tfrac{\theta}{n}+2\pi j))$$ for some $j\in\mathbb{Z}$ due to the periodicity of trig functions. Then, $$r^{1/n}(\cos(\tfrac{\theta}{n}+2\pi j)+i\sin(\tfrac{\theta}{n}+2\pi j))=r^{1/n}e^{i\left(2\pi j+\tfrac{\theta}{n}\right)}=r^{1/n}e^{i(\theta+2\pi k)/n}$$ for $0\leq k\leq n-1 ,j=nk\in\mathbb{Z} $.  I feel like there could be a more concise way to put this. How to find out if an item is present in a std::vector? What are the functions that are their own inverse?  (thus functions where $ f(f(x)) = x $ for a large domain)  I always thought there were only 4:  $f(x) = x , f(x) = -x , f(x) = \frac {1}{x} $ and $ f(x) = \frac {-1}{x} $   Later I heard about a fifth one     $$f(x) = \ln\left(\frac {e^x+1}{e^x-1}\right) $$ (for $x &gt; 0$)  This made me wonder are there more? What are conditions that apply to all these functions to get more, etc. Can HTML checkboxes be set to readonly? I thought they could be, but as I'm not putting my money where my mouth was (so to speak) setting the readonly attribute doesn't actually seem to do anything.  I'd rather not use Disabled, since I want the checked check boxes to be submitted with the rest of the form, I just don't want the client to be able to change them under certain circumstances. Is it possible to use "negative sound waves" to "cancel out" a sound to create silence? Let $x$ and $y$ be positive integers such that $xy \mid  x^2+y^2+1$. Show that $$ \frac{x^2+y^2+1}{xy}= 3 \;.$$ I have been solving this for a week and I do not know how to prove the statement. I saw this in a book and I am greatly challenged. Can anyone give me a hint on how to attack the problem? thanks Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on I have a scenario. (Windows Forms, C#, .NET)   There is a main form which hosts some user control. The user control does some heavy data operation, such that if I directly call the UserControl_Load method the UI become nonresponsive for the duration for load method execution. To overcome this I load data on different thread (trying to change existing code as little as I can)   I used a background worker thread which will be loading the data and when done will notify the application that it has done its work.   Now came a real problem. All the UI (main form and its child usercontrols) was created on the primary main thread. In the LOAD method of the usercontrol I'm fetching data based on the values of some control (like textbox) on userControl.    The pseudocode would look like this:  CODE 1  UserContrl1_LoadDataMethod() {     if (textbox1.text == "MyName") // This gives exception     {         //Load data corresponding to "MyName".         //Populate a globale variable List&lt;string&gt; which will be binded to grid at some later stage.     } }   The Exception it gave was     Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on.   To know more about this I did some googling and a suggestion came up like using the following code  CODE 2  UserContrl1_LoadDataMethod() {     if (InvokeRequired) // Line #1     {         this.Invoke(new MethodInvoker(UserContrl1_LoadDataMethod));         return;     }      if (textbox1.text == "MyName") // Now it wont give an exception     {     //Load data correspondin to "MyName"         //Populate a globale variable List&lt;string&gt; which will be binded to grid at some later stage     } }   BUT BUT BUT... it seems I'm back to square one. The Application again  become nonresponsive. It seems to be due to the execution of line #1 if condition. The loading task is again done by the parent thread and not the third that I spawned.  I don't know whether I perceived this right or wrong. I'm new to threading.  How do I resolve this and also what is the effect of execution of Line#1 if block?  The situation is this: I want to load data into a global variable based on the value of a control. I don't want to change the value of a control from the child thread. I'm not going to do it ever from a child thread.   So only accessing the value so that the corresponding data can be fetched from the database. I have a large external with many subfolders that I want to move all videos, pictures, and music to another hard-drive, what would be the best way to do this? How many arrangement of the letters in MISSISSIPPI have at least 2 adjacent S's?  I was thinking that I can glue two of the S's together, so there will be 9 letters plus the special letter SS, and the number of arrangements will be $10!/(2!2!4!)$, this is not the correct answer, but what is wrong with my reasoning.  (the correct answer is $11!/(4!4!2!)-7!/(4!2!)\binom{8}{4}$, I understand the solution) After a very long time will we see more stars (due to the fact that more light is get to us) or less stars (as the universe expends and light have to pass larger distance)? In general, can stellar objects go outside of the scope of the observable universe or is it only growing with time? Calculations are always better than just discussion. Does it have any connection to dark matter? prove that : $\cos x \cdot \cos(x-60^{\circ}) \cdot \cos(x+60^{\circ})= \frac14 \cos3x$ I should prove this trigonometric identity. I think I should get to this point : $\cos(3x) = 4\cos^3 x - 3\cos x $ But I don't have any idea how to do it (I tried solving $\cos(x+60^{\circ})\cos(x-60^{\circ})$ but I got nothing) Multi-OS Portable TeX system I'm looking to treat myself to a totally portable TeX system and was wondering: is it possible to devise an installation scheme that would run on Windows, Linux and MacOS at the "same" time?  I think TeXLive is the best choice here, but I'd much rather avoid having to maintain three separate TeXLive installations. I'd like the three installations to share the package databases for instance.  I'll be using a 32Gb USB stick, in case it matters.  PS: I think I'm onto something here... will post back when I have a working prototype.  Edit: after reading  I managed to format a USB stick with UDF and have it read and written in Linux and Windows (need to perform some tests on Mac yet). This is the first step towards interoperability.  Edit 2: well, as it turns out, the previous note was useless (the partition table breaks under Windows), I've found  and it works like a charm. The only remaining step is writing a couple of scripts to set the environmental variables and we're done ;) So I currently have this issue where my Epson WF-3620DWF can't find the blue and yellow cartridges. (They are official epson ones) and I have a full black cartridge in there. How do I force my printer to ONLY print in black and ignore the cartridge(s) not recognised error?