I'm creating a program to find the standard deviation of an ArrayList of double values given by the user. I am to provide a string on the command line to indicate whether I want the mean (mean), or the standard deviation (std). However, I am having difficulty giving those strings to the command line.      This is the error I'm getting:  &gt; Exception in thread "main" java.lang.NumberFormatException: For input string: "std"         at java.base/java.lang.NumberFormatException.forInputString(Unknown Source)         at java.base/java.lang.Integer.parseInt(Unknown Source)         at java.base/java.lang.Integer.parseInt(Unknown Source)         at StatDriver.main(StatDriver.java:28)          public static void main(String[] args) {            Scanner input;           ArrayList&lt;Double&gt; data;           int dataSize;           String userInput = "";            // Determine the appropriate array size.           if (args.length &gt; 0) {              dataSize = Integer.parseInt(args[0]);           } else {              dataSize = 15;           }            // Create the array.           data = new ArrayList&lt;Double&gt;(dataSize);            // Read values from the terminal.           input = new Scanner(System.in);           while (input.hasNextDouble()) {              data.add(input.nextDouble());           }            // Calculate and display the results.           if(args[0] == "mean") {               System.out.printf("Mean: %.2f\n", Stats.mean(data));           }           else if (args[0] == "std") {               System.out.printf("StdDev: %.2f\n", Stats.stdDev(data));           }           else {               System.out.printf("Mean: %.2f\n", Stats.mean(data));                }        }     }
I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug.  Is == bad? When should it and should it not be used? What's the difference?
I have 1:50 wound current transformer and I don't have the datasheet. Could anybody help me to calculate the burden resistor?    Maximum current to be measured: 2A  Max output voltage to ADC: 5V How do I use superposition to solve a circuit? Yes, this is a pedagogical question. While answering another recent question, I wanted to refer the OP to concise instructions for using superposition to solve circuits. I found that all the easily found resources online were somewhat deficient. Typically they were unclear about what kinds of circuits superposition applies to, or about the actual method to apply the superposition theorem to a circuit problem. So,   What kinds of circuits can be solved by superposition?  How are different kinds of sources treated when solving by superposition?  What are the steps to solve a circuit using the superposition theorem? Grub not loading after Windows 8 Install My system was configured to dual boot Ubuntu 12.04.1 LTS and Windows 7. Today I got my hands on the MSDN release of Windows 8 and I installed it over my Windows 7. Now the computer just boots to Windows 8 directly without loading the GRUB screen.  So I followed the steps as suggested in: . Running this command:      ls -l /dev/disk/by-label/   gives the following output:      total 0     lrwxrwxrwx 1 root root 10 Sep 11 07:51 Entertainment -&gt; ../../sda2     lrwxrwxrwx 1 root root 10 Sep 11 02:45 PENDRIVE -&gt; ../../sdb1   Also fdisk -l command gives this as the output:      Disk /dev/sda: 320.1 GB, 320072933376 bytes     255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x1246aa23         Device Boot      Start         End      Blocks   Id  System     /dev/sda1   *        2048   319582199   159790076    7  HPFS/NTFS/exFAT     /dev/sda2       319582208   602906623   141662208    7  HPFS/NTFS/exFAT     /dev/sda3       602908672   625135615    11113472   83  Linux      Disk /dev/sdb: 1939 MB, 1939865600 bytes     64 heads, 63 sectors/track, 939 cylinders, total 3788800 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0xc3072e18         Device Boot      Start         End      Blocks   Id  System     /dev/sdb1   *        2248     3788799     1893276    c  W95 FAT32 (LBA)   So I assume that I have to run this: sudo grub-install /dev/sda3 to get GRUB up and running. But I am getting this error:      /usr/sbin/grub-probe: error: cannot find a device for /boot/grub (is /dev mounted?).   Can anyone please guide me in the right direction? The current Ubuntu installation is far too customized to my needs to lose it to a boot manager issue! Any help is much appreciated! What happens to the second Marty at the end of Back to the Future? In  (the original movie), Marty comes back from 1955 10 mins early to prevent Doc from being shot (which he fails at). He then rolls up to the Lone Pine Mall and sees himself hit 88 mph and shoot back to 1955 (again). Marty then carries on with this life as usual. What happens to the Marty that goes back to 1955 at the end of the film?  This obviously is a recursive problem where it would create another timeline and Marty would keep coming back 10 mins early to view another Marty zip back to 1955? Clarify or visualize the parameters involved for receiving the Curious badge Let's say I have two planets that are one hundred thousand lightyears away from each other. I and my immortal friend on the other planet want to communicate, with a strong laser and a tachyon communication device.  I record a message on the tachyon communication device and release the message at exactly the same time as I activate the laser, both of which are directed to the other planet which is one hundred thousand lightyears away. Say it is the year 0 for both of us at the time I did this.  If tachyons existed, then the message would arrive to my friend before the photons in the laser. It would arrive, say, a thousand years earlier. From my vantage point, that message will arrive to her at year 99,999; the same would be true for my friend's vantage point. However, she will only see the laser at year 100,000.  So since she got the message at year 99,999, she immediately sends me a reply back going through the same procedure as I did. She records a message and releases it at the same time as the laser. The tachyons will arrive 1,000 years earlier than the laser, so for me, I will receive the message at year 199,998. I will receive the laser, however, at year 199,999.  It seems to me that communication this way does not violate causality. I will still have received the message after I had sent it.   If tachyons truly violated causality, though, I realize it should arrive at year -1 for her, and so she can reply to me at year -2, which would mess me up by year 0 as I will ask her how she knew I was planning on sending her a message before I sent it. I could send her a different message, which she would end up receiving at year -1, and will end up confusing her as she would have received one message asking her out, and the other asking her how did she know I was asking her out. She then decides I am crazy and sends me a message at year -2 that she does not want to date me, and so she will have both turned me down and entertained me before I have even asked her out.  On the other hand, let's go back to year 0 and add a third device to our list: an Alcubierre drive. After I send out the message and the laser, I get impatient and do not feel like waiting 99,999 years, so I get on my Alcubierre drive spaceship and arrive on her planet at the same year 0. My friend is not in her office, so I leave a note to her also immortal secretary saying I dropped by and that she should expect a message for her in year 99,999.  I then get back on my Alcubierre drive and land back on my planet, still on year 0. Meanwhile, the tachyons and photons I sent out are still racing to arrive to her. By year 99,999, she receives the message just as I Alcubierre drive back to her, and I pick her up for dinner.  But the point of my question is, it seems to me that just going faster than light, if that alone was what you had, would not violate causality. It must be something else. I understand time dilation and that things with mass cannot travel at the speed of light, but using the Alcubierre drive, hypothetically speaking, I was still able to outpace the photons while also having mass. It still did not produce causality problems. Alcubierre drives are also valid solutions to GR.  It seems circular to me to say that what makes traveling faster than light violate causality is because it violates causality (if faster than light communication was divorced from causality problems, then the causality problem would cause itself -- thereby violating causality and, hence, we would scrap it and conclude that there is no causality problem after all).  What is it that I am missing? If someone could help me out, that would be excellent. I've been itching to ask my friend out for a few millenia now. :) EntityFieldQuery display pager How do I display pager using EntityFieldQuery for fetch results? I can't find complete example.  I am doing simmilar to:   But I miss part to output simple pagination links (1,2,3... for every next page). Use fixed keyboard for a given app Solving linear congruences by hand: modular fractions and inverses I'm no expert in darkroom photography, but it seems a little odd that there is a type of light that doesn't affect film or developing paper etc. The only way that I could think to explain it is:   The low frequency red photons don't have enough energy to raise electron states in the film/paper, or Magic   either way, I'm curious to know how this handy tool is, as per title, safe. How to restrict some websites in Ubuntu 14.04 I would like to restrict some websites to be surfed. I mean I want to prevent access to some websites. Please guide me on how to do the same in Ubuntu 14.04 LTS. $_POST vs. $_SERVER['REQUEST_METHOD'] == 'POST' Some guy called one of my Snipplr submissions "crap" because I used if ($_SERVER['REQUEST_METHOD'] == 'POST') instead of if ($_POST)  Checking the request method seems more correct to me because that's what I really want to do. Is there some operational difference between the two or is this just a code clarity issue? For an ecology project, my lab group added vinegar to 4 tanks containing equal volumes of pond water, 1 control with no elodea (an aquatic plant) and 3 treatments with the same amount of elodea in each. The purpose of adding the vinegar was to reduce the pH. The hypothesis was that the tanks with elodea would go back to their normal pH quicker. This was indeed the case. We measured the pH of each tank daily for about two weeks. All the tanks eventually returned to their natural pH, but the length of time that this took was much shorter for the tanks with elodea.  When we told our professor about our experimental design, he said that there exists no statistical test that can be performed on the data to compare the control to the treatment. That because there was no replicate for the control (we only used one control tank) we cannot calculate variance and so we can't compare the sample means of the control and the treatment. So my question is, is this true? I definitely understand what he means. For example, if you took the height of one man and one woman, you can't draw conclusions about their respective populations. But we did 3 treatments, and the variance was small. It seems reasonable to assume that the variance would be similar in the control?  Update:  Thank you for the excellent answer. We got more water and elodea from the wetland and decided we would run the experiment again with smaller tanks but this time with 5 controls and 5 treatments. We were going to combine this with our original data but the starting pH of the tanks was different enough that it doesn't seem valid to consider the new experiment to be sampled from the same population as the original experiment.  We considered adding different amounts of elodea and trying to correlate speed of pH remediation (measured as time elapsed until pH returned to its original value) with amount of elodea, but we decided that wasn't necessary. Our objective is only to show that the elodea makes a positive difference, not to construct some kind of predictive model for exactly how the pH responds to differing amounts of elodea. It would be interesting to determine the optimal amount of elodea, but that's probably just the maximum amount that can survive. Trying to fit a regression curve to the data wouldn't be especially illuminating because of the various complicated changes that occur to the community when adding a large amount. The elodea dies, decomposes, new organisms start to dominate, and so on. Since Ubuntu 11.10 use a new kernel, it's very difficult to have a decent support for virtualization.   VirtualBox doesn't support guest additions for ubuntu 11.10, so I can't copy to and from my ubuntu desktop and windows, which I absolutely require, plus FreeBSD seems not to be able to use DHCP without guest additions.  Virt-manager instead gives an error on launch:  Unable to open a connection to the libvirt management daemon.  Libvirt URI is: qemu:///system  Verify that:  - The 'libvirt-bin' package is installed  - The 'libvirtd' daemon has been started  - You are member of the 'libvirtd' group   unable to connect to '/var/run/libvirt/libvirt-sock', libvirtd may need to be started: Permission denied  Traceback (most recent call last):   File "/usr/share/virt-manager/virtManager/connection.py", line 1146, in _open_thread     self.vmm = self._try_open()   File "/usr/share/virt-manager/virtManager/connection.py", line 1130, in _try_open     flags)   File "/usr/lib/python2.7/dist-packages/libvirt.py", line 102, in openAuth     if ret is None:raise libvirtError('virConnectOpenAuth() failed') libvirtError: unable to connect to '/var/run/libvirt/libvirt-sock', libvirtd may need to be started: Permission denied   The problem is solved by running virt-manager as root, but I don't like that. How do I change permissions to run Virt-Manager as user?  Is there a way to install guest additions on Ubuntu 11.10? Can quarks be considered real and elementary? BIGINT UNSIGNED value is out of range Where do I get the key for the first house? I've 'completed' the game, but didn't find the key for the first house. (I got the one for the arcade machine house). Where can I find it? Mouse sensitivity in 14.04 dissapeared If I go to "Settings -> Mouse &amp; Touchpad" in Ubuntu 14.04 all the options are gone! How can I bring them back? I've got a project where I'm looking to tweak the standard lead conversion process.   Triggers and lead conversion has always been funky in past projects so I was hoping to start the design off by reviewing the order of execution, but after a long google search I'm coming up empty handed.   Anyone out there know the specific trigger order for lead conversion?    Edit: I'm not asking about trigger execution order for any object, but all the objects created in the lead conversion process.  I'd think it would be something like this:        Lead Before Update Triggers (isConverted = false, convertedAccountId = null, convertContactId = null, convertedOpportunityId = null)         Account Before Insert Triggers (not fired if merged with existing account)   Account After Insert Triggers (not fired if merged with existing account)   Contact Before Insert Triggers (not fired if merged with existing contact)   Contact After Insert Triggers (not fired if merged with existing contact)   Opportunity Before Insert Triggers (not fired if no opportunity) (OpportunityContactRoles null)   Opportunity After Insert Triggers (not fired if no opportunity) (OpportunityContactRoles = convertedContactId)   Lead After Update Triggers (isConverted = true, convertedAccountId = XXX, convertedContactId = XXX, convertedOpportunityId = XXX) How do I determine if an array is initialized in VB6? Passing an undimensioned array to the VB6's Ubound function will cause an error, so I want to check if it has been dimensioned yet before attempting to check its upper bound.  How do I do this?