I have a object  Class Employee(id, name, city){ };  List&lt;Employee&gt; list1 = new ArrayList(); list1.add(new Employee(2, "Abc", "eJ")); list1.add(new Employee(3, "Zec", "eJ"); list1.add(new Employee(4, "Cec", "eJ")); list1.add(new Employee(5, "Abc", "Ab")); list1.add(new Employee(6, "Abc", "Ze"));   i need to sort Employee object based on name even along with city  "Abc","Ab"  "Abc","eJ" "Abc","Ze" "Cec","eJ" "Zec", "eJ"   but i am getting sorting like - city not getting ordered along with name.  "Abc","eJ" - city not ordered here "Abc","Ab" "Abc","Ze" "Cec","eJ" "Zec", "eJ"   Anyone knows, plz help me wat is the issue  with comparator?
Assume you have some objects which have several fields they can be compared by:  public class Person {      private String firstName;     private String lastName;     private String age;      /* Constructors */      /* Methods */  }   So in this example, when you ask if:  a.compareTo(b) &gt; 0   you might be asking if a's last name comes before b's, or if a is older than b, etc...  What is the cleanest way to enable multiple comparison between these kinds of objects without adding unnecessary clutter or overhead?   java.lang.Comparable interface allows comparison by one field only Adding numerous compare methods (i.e. compareByFirstName(), compareByAge(), etc...) is cluttered in my opinion.   So what is the best way to go about this?
What does the decay constant mean? In my curriculum, the  is "the probability of decay per unit time"  To me, this seems non-sensical, as the decay constant can be greater than one, which would imply that a particle has a probability of decaying in a time span that is greater than 1.  Can someone explain this? How can I gzip standard in to a file and also print standard in to standard out? I want to execute a command, have the output of that command get gzip'd on the fly, and also echo/tee out the output of that command. i.e., something like: echo &quot;hey hey, we're the monkees&quot; | gzip --stdout &gt; my_log.gz  Except when the line executes, I want to see this on standard out: hey hey, we're the monkees I am having trouble to set up my Epson printer on Ubuntu 16.04. How can I install the drivers? Our DM keeps interrupting our long rests In the latest campaign, we're still around the third level, but every single night we've spend in the wild so far, we were interrupted by hard combat encounters (as in DMG-worded "hard"), forcing us to use our resources (like HP, spell slots, Ki, once-per-day stuff) and not restoring any of those lost the previous days. I feel like the , as it lasts four to six rounds, so we usually say that we'd like to resume our rest but the answer is always "you've been interrupted, your rest is over, you can't restart any until dusk". So the only real long rests we could have always were in town.  We've always used watch-turns, and being interrupted in the first night of the campaign, we now always spend one hour to find a safe place to rest and we make that intent very clear to the DM. But yet, kobolds, goblins, ghouls and gnolls always find us in the middle of the night, but never when we travel for ten hours during the day (which is comparable to "fast travel" in his own word). Once on the second day in the wild, we were faced to a deadly encounter (as in DMG-worded "deadly") which we survived only by fleeing. And we're kind of forced to get back to the deadly encounter, which is more than one day away from the nearest town.  We're five players and I'm the only one with PnP RPG experience... from ten years ago. I don't remember being this resourceless. We asked if it was a survival campaign and the answer was that it was only a normal introduction campaign found on the Internet that he spiced up a bit. We've also asked if we did anything wrong and the answer was that we followed the normal story.  The DM is mastering his second campaign (the first one is still ongoing, but with veteran players). The DM also plays a lot of survival campaigns as a player.  Is this situation normal? If yes, why? If not, what should I say to the DM?  Note that I'm fully aware of the "long rest" rule as written on page 186 of the PHB. This is why I encouraged my team to say that we resume our rest. (thanks Bloodcinder) As we all know, air consists of many gases including oxygen and carbon dioxide. I found that carbon dioxide is heavier than O2. Does the volume difference neglect the mass difference? Is it same for all other gases in air or is there another force that keeps all of these gases together?  If I take a breath of a fresh air, will the exhaled air be heavier because of its higher CO2 content? Will it fall on the floor? Stop Mathematica from giving imaginary solutions I have installed bootable ubuntu on hard disks but now I can not format them with Disk Utility program. When I try to format it says "One or more partitions are busy on /dev/sdb" for both hard disks. Is there any way to format these drives?  EDIT: With "Disk Utility" program when I select one of the hard drives It shows 3 volumes;  99 MB FAT 111 GB EXT4 9 GB UNKNOWN   I can not format this unknown volume.  With Gparted program, It doesn't shows Unknown volume only shows 111GB EXT4. Should I upgrade my body or lens first? I just installed Dufour on my Windows 7 Lenovo ThinkCentre desktop. When I open 2.0.1 I get this error window:    And when I try to add the 'Add Delimited Text Layer' plugin I get this message:    When I click 'OK' the program closes.   Any help is greatly appreciated - thanks. Is there a drupal.org API for retrieving the list of available modules, a description of them and available versions? I´m posting this because I have some active questions in SO and I´m leaving for the weekend and wont have internet until monday or tuesday.  SO is a very active site and I hate no to answer/thank/comment people who are kind enough to answer my questions.  I think an "away" indicator like an out of office reply would be a really nice feature to add for "politeness" sake. Transforming positively skewed data with positive and negative values My data (see image below) is positively skewed and contains both positive and negative values. I'd like to transform it to achieve normality so I can apply a repeated measures ANOVA, but can't find a technique that works.  I've considered the following options:   Square-rooting: doesn't keep the sign Square-rooting then making the original negative values negative: makes my data bimodal Natural log transform: can't do this with negative values Add a constant then log transform: this arbitrarily leaves my lowest value as an outlier '' transform (Cox, 2005; also Whittaker et al. 2005): makes my data bimodal Outlier removal (2.5 SD): doesn't fix normality, but an ANOVA on this data has similar results to an ANOVA on the raw data (for better or worse). Perform the non-parametric equivalent (Friedman test) and compare the results: will do this today   My supervisor suggests I should stick with the outlier removal though the data is still visibly skewed, and 'see what the reviewers suggest' but I just wanted to check here in case there was anything I was missing.  Original data:    With outliers (2.5 SD) replaced with the value at that criterion. I later decided to just exclude the outliers, so imagine the highlight data points in each condition removed. Make two vector points move together (Sketch or Illustrator) I am looking to sell and buy a house. But with the current market being as crazy as it is (houses are selling fast for sometimes 150,000 over asking), I'm afraid if we sell first, we could be stuck without a new house. Or stuck settling on or over-paying for something and wishing we never sold at all. I'm wondering if it's possible to buy first. What is the best way to secure my next house before selling my current house without getting locked into a B-lender mortgage or risking too much?  I know there would be some risk putting an offer on a new house without knowing how much the current house will sell for, or the risk we don't sell the current house before the new house closes. I'm also afraid conditional offers will not be considered. Are there any other options?  (We do have a mortgage on the current house, but because the market has gone up so much there is also a good chunk of equity.) Initializing K-means centers by the means of random subsamples of the dataset? If I have a certain dataset, how smart would it be to initialize cluster centers using means of random samples of that dataset?  For example, suppose I want 5 clusters. I take 5 random samples of say, size=20% of the original dataset. Could I then take the mean of each of these 5 random samples and use those means as my 5 initial cluster centers? I don't know where I read this but I wanted to know what you guys think about the idea.    UPDATE: Please see this thread  for the general discussion about the various initialization methods. This thing came up in a combinatorics course I am taking.  Choose a fixed set of primes $p_1,p_2,\dots,p_k$ and let $A_n$ be number of integers in $\{1,2,\dots,n\}$ which are not divisible by any of the $p_i$'s. $A_n$ is given by $ n - \sum_{1\leq i_1 \leq k} \lfloor \frac{n}{p_{i_1}} \rfloor + \sum_{1\leq i_1 &lt; i_2 &lt; k} \lfloor \frac{n}{p_{i_1}p_{i_2}}\rfloor - \dots $. Now, if $n$ is divisible by each of the $p_i$'s then we have the simpler expression : $A_n = n \prod_{i=1}^{k}(1-\frac{1}{p_i})$(added later : note I am not assuming $n = \prod_{i=1}^{k}p_i$ here, this holds true whenever $n = c \prod_{i=1}^{k} p_i $ for some integer c, since each $\lfloor \frac{n}{p_{i_1} \dots p_{i_j}} \rfloor = \frac{n}{p_{i_1} \dots p_{i_j}}\ )$.  Another student pointed out that even if $n$ does not have $\prod_{i=1}^{k} p_i$ as a factor, the approximation $B_n = n \prod_{i=1}^{k}(1-\frac{1}{p_i})$ to $A_n$ is quite close in some specific cases. It is easy to see that $\lim_{n\to\infty}\frac{A_n - B_n}{n}=0$ as $\lim_{n\to\infty}\frac{1}{n}\lfloor \frac{n}{p_{i_1}p_{i_2}\dots p_{i_j}} \rfloor \to \frac{1}{p_{i_1}p_{i_2} \dots p_{i_j}},$ however that is not strong enough to imply that $A_n - B_n$ will be always close. Is there any way to analyze how well this approximation will perform in general? I am interested in the worst case for small to moderately sized $n$.  Just to give a feel of how close $A_n$ and $B_n$ can get, assuming the set of primes is $\{2,3,7\}$ we have (assuming my program is correct):  n     A(n)     B(n) 17    5    4.86   27    8    7.71   37    11      10.57   107   31      30.57   1111  318     317.43   3001  858     857.43   4007  1145    1144.86   5000  1429    1428.57 . Unity Tweak tool fails to start with the error "com.canonical.unity.webapps schema is missing" com.canonical.unity.webapps   In order to work properly, Unity Tweak Tool recommends you install the necessary packages Are there any examples of subspaces  of $\ell^{2}$ and $\ell^{\infty}$ which are not closed? Find My iPhone Email Notification Is the email notification from Apple that your device has been tracked using Find My iPhone a new feature? Comparing currency values as floats does not work