What I'm trying to do is take the user given input (operand) and round my current number to the amount of decimals that the operand is. For example if my current number in the calculator program this is running on is 15.44876, and the user input is 2, I would like the returned value to be 15.45, or just 15.44 at least.  public double round(double operand){     this.answer = Math.round(this.answer, operand);     return this.answer;   I know the code above is incorrect, but it's just a place holder since I'm pretty confused on this.
What I would like is a method to convert a double to a string which rounds using the half-up method - i.e. if the decimal to be rounded is 5, it always rounds up to the next number. This is the standard method of rounding most people expect in most situations.  I also would like only significant digits to be displayed - i.e. there should not be any trailing zeroes.  I know one method of doing this is to use the String.format method:  String.format("%.5g%n", 0.912385);   returns:  0.91239   which is great, however it always displays numbers with 5 decimal places even if they are not significant:   String.format("%.5g%n", 0.912300);   returns:  0.91230   Another method is to use the DecimalFormatter:  DecimalFormat df = new DecimalFormat("#.#####"); df.format(0.912385);   returns:  0.91238   However as you can see this uses half-even rounding. That is it will round down if the previous digit is even. What I'd like is this:  0.912385 -&gt; 0.91239 0.912300 -&gt; 0.9123   What is the best way to achieve this in Java?
Let $A=\begin{pmatrix}0&amp;5\\ 7&amp;4\end{pmatrix}$.      1) Write $A$ as a product of $4$ elementary matrices.      2) Write $A^{-1}$ as a product of $4$ elementary matrices.   My work. I have managed to find $A^{-1}$, which came out to be this:  \begin{pmatrix}-\frac{4}{35}&amp;\frac{1}{7}\\ \frac{1}{5}&amp;0\end{pmatrix}  However, I am struggling to figure out how I would split each of these matrices into $4$ elementary matrices. Any help? What is the regular expression to match strings (in this case, file names) that start with 'Run' and have a filename extension of '.py'?  The regular expression should match any of the following:  RunFoo.py RunBar.py Run42.py   It should not match:  myRunFoo.py RunBar.py1 Run42.txt   The SQL equivalent of what I am looking for is ... LIKE 'Run%.py' .... no Wi-Fi on Ubuntu 14.04 LTS Asus notebook with MEDIATEK MT7630e I'm new to Ubuntu. I installed it today, but the first thing I encounter is that I can only connect to the Internet through wifi.  Can someone help me?   iwconfig result :  eth0      no wireless extensions.  lo        no wireless extensions.   lspci:  00:00.0 Host bridge: Intel Corporation 3rd Gen Core processor DRAM     Controller (rev 09) 00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port (rev 09) 00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09) 00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04) 00:16.0 Communication controller: Intel Corporation 7 Series/C210 Series Chipset Family MEI Controller #1 (rev 04) 00:1a.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2 (rev 04) 00:1b.0 Audio device: Intel Corporation 7 Series/C210 Series Chipset Family High Definition Audio Controller (rev 04) 00:1c.0 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 1 (rev c4) 00:1c.1 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 2 (rev c4) 00:1c.3 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 4 (rev c4) 00:1d.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1 (rev 04) 00:1f.0 ISA bridge: Intel Corporation HM76 Express Chipset LPC Controller (rev 04) 00:1f.2 SATA controller: Intel Corporation 7 Series Chipset Family 6-port SATA Controller [AHCI mode] (rev 04) 00:1f.3 SMBus: Intel Corporation 7 Series/C210 Series Chipset Family SMBus Controller (rev 04) 01:00.0 3D controller: NVIDIA Corporation GF117M [GeForce 610M/710M/820M / GT 620M/625M/630M/720M] (rev a1) 03:00.0 Network controller: MEDIATEK Corp. MT7630e 802.11bgn Wireless Network Adapter 04:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. Device 5289 (rev 01) 04:00.2 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0a)   lspci -nnk | grep 0280 -A2:  03:00.0 Network controller [0280]: MEDIATEK Corp. MT7630e 802.11bgn Wireless Network Adapter [14c3:7630]     Subsystem: Foxconn International, Inc. Device [105b:e074] 04:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. Device [10ec:5289] (rev 01) Parent Field in Lightning Datatable Are Parent Fields supported in lightning Datatable?  I'm trying to display Account Name with Contact information, but it seems parent fields are not supported in lightning datatable.  Component:  &lt;aura:component controller="PagingSortingController"&gt;     &lt;aura:attribute name="mydata" type="Object"/&gt;     &lt;aura:attribute name="mycolumns" type="List"/&gt;     &lt;aura:handler name="init" value="{! this }" action="{! c.init }"/&gt;     &lt;lightning:datatable data="{! v.mydata }"          columns="{! v.mycolumns }"          keyField="con.id"         onrowselection="{! c.getSelectedName }"/&gt; &lt;/aura:component&gt;   Controller:  ({     init: function (cmp, event, helper) {     cmp.set('v.mycolumns', [                 {label: 'Contact Name', fieldName: 'Name', type: 'text'},                 {label: 'Phone', fieldName: 'Phone', type: 'phone'},                 {label: 'Email', fieldName: 'Email', type: 'email'},                 {label: 'Account Name', fieldName: 'Account.Name', type: 'text'}             ]);         helper.getData(cmp);     }  })   Helper:  ({     getData : function(cmp) {         var action = cmp.get('c.getContacts');         action.setCallback(this, $A.getCallback(function (response) {             var state = response.getState();             if (state === "SUCCESS") {                 cmp.set('v.mydata', response.getReturnValue());             } else if (state === "ERROR") {                 var errors = response.getError();                 console.error(errors);             }         }));         $A.enqueueAction(action);     } })   Apex Controller:  @AuraEnabled     public static List&lt;Contact&gt; getContacts() {         List&lt;Contact&gt; contacts =                  [SELECT Id, Name, Phone, Email,Account.Name FROM Contact];         return contacts;     } A half covered lens Let's say there's an object in front of a convex lens. I have a piece of paper behind the lens at the right location such that it will the lens will form an image on the paper. The object is illuminating.  Now if I put another piece of paper right before the lens, and cover up half of the lens. The image, instead of only half being visible, it will actually remain the same. The only difference is that it will be dimmer.  Now, the question is what if I remove the paper at the location where the image forms, and put my eye there. What will I see? Will I see the piece of paper which is blocking half of the lens at all? Does that mean I will just "see through" the paper?  I wanted to try this out myself, but unfortunately I don't have a lens besides me. What is the reason that the value "47" is so popular in electrical engineering? Show that $\frac 1{1+x+y^{-1}}+\frac1{1+y+z^{-1}}+\frac1{1+z+x^{-1}}=1$ if $xyz=1$ Why do high resolution cameras shoot stills at high resolutions, but only typically shoot video at 1080p which is about 2 megapixels?  For example I have a Sony-NEX 6 which can shoot stills at 16 megapixels but only 1080p by 1920p video.  Also how do digital cameras separate the frames in video if the lens shutter never closes?  And if you can shoot video at 30 fps or 60 fps then why can't cameras have a continuous drives at 30 to 60 fps? Yesterday, I have received two : Revival, and Self-Learner. However I was only notified of the Revival badge, because apparently the Self-Learner badge is not considered "".  What badges have their notification suppressed if the user has a 200-rep account somewhere on the Stack Exchange network, i.e. they won't trigger a new item in our achievements dialog? "He was neither seer nor prophet" How would you explain the absence of an article? Here's a fragment from Jack London's Star Rover:     Wordsworth knew. He was neither seer nor prophet, but just ordinary man like you or any man. What he knew you know, any man knows. But he most aptly stated it in his passage that begins "Not in utter nakedness, not in entire forgetfulness.   To the best of my — admittedly sketchy — knowledge of grammar, the second sentence should read neither a seer nor (a) prophet, but just an ordinary man. Even if we accept the seer and the prophet as "poetic entities" ("father and son," "robber and robbed," "man to man," or whatever), logic would still dictate that ordinary man should be preceded by an an.  It is a well-known fact that Jack London's usage wasn't always up to par; his grammar, on the other hand, was always top-notch.  Logically, the sentence is grammatically incorrect (correct me if I'm wrong: no pun intended).  Illogically, it reads smoothly: intuitively, a native speaker understands that there's nothing wrong here.  However, those to whom English is not the first language cannot be expected to be intuitive in this case and would want an explanation. Any suggestions? Targeting only Firefox with CSS I have an issue which I could not solve, although I tried and I got some help on R forum.  I am trying to calculate Mahalanobis distances on a data.frame, where I have several hundreds of groups and several hundreds of variables. Whatever I do, I get the system is computationally singular: reciprocal condition number error.   It is clear that it is singular, but is there any way to get rid of it and run Mahalanobis? Should I forget solve this using another approach? If yes, then what else to use?  I have uploaded the data file to my :  It is a tab delimited txt file with no headers.  I was working with the R StatMatch Mahalanobis (also tried stats Mahalanobis) function. I have a deadline for this project (not a homework!), and I could always use this function, so I thought I will be able to keep the calculations short, but now I am lost.  Migrated . The positive integer solutions for $2^a+3^b=5^c$ What are the positive integer solutions to  the equation     $$2^a + 3^b = 5^c$$    Of course $(1,\space 1, \space 1)$ is a solution. $a, b, c$ are positive real numbers.   Prove that $$8abc\le (a+b)(b+c)(c+a)$$  I haven't really gotten anywhere, just tried to open up $(a+b)(b+c)(c+a)$ and got null. Can I run my CPU at 100% usage for a long time? Eclipse Optimize Imports to Include Static Imports Is there anyway to get Eclipse to automatically look for static imports? For example, now that I've finally upgraded to Junit 4, I'd like to be able to write:  assertEquals(expectedValue, actualValue);   hit Ctrl + Shift + O and have Eclipse add:  import static org.junit.Assert.assertEquals;   Maybe I'm asking too much. How is "I have come" + infinitive different from Present Perfect? Cannot translate vertice/edge will duplicate Why don't we double the final consonant in the word cooking SO here is the rule I find about doubling consonant     if a word ends with a short vowel sound plus a consonant, and the stress is on the last syllable, then the final consonant is doubled if you add an ending that starts with a vowel.    I find this rule to be much more powerful than the one I learned at school, aka:V+C, But the rule doesn't seem to apply to cooking, which is not doubled. Is this a contradiction of the rule I quoted above? (I am not so sure about the short vowel but, but simple Google tells me that ʊ in cooking is indeed a short vowel. )  Also, if cooking is indeed an exception to this rule, are there any other similar exceptions that I should be aware of? Background: I'm giving a presentation to colleagues at work on hypothesis testing, and understand most of it fine but there's one aspect that I'm tying myself up in knots trying to understand as well as explain it to others.  This is what I think I know (please correct if wrong!)   Statistics that would be normal if variance was known, follow a $t$-distribution if the variance is unknown CLT (Central Limit Theorem): The sampling distribution of the sample mean is approximately normal for sufficiently large $n$ (could be $30$, could be up to $300$ for highly skewed distributions) The $t$-distribution can be considered Normal for degrees of freedom $&gt; 30$   You use the $z$-test if:   Population normal and variance known (for any sample size) Population normal, variance unknown and $n&gt;30$ (due to CLT) Population binomial, $np&gt;10$, $nq&gt;10$   You use the $t$-test if:   Population normal, variance unknown and $n&lt;30$ No knowledge about population or variance and $n&lt;30$, but sample data looks normal / passes tests etc so population can be assumed normal   So I'm left with:    For samples $&gt;30$ and $&lt;\approx 300$(?), no knowledge about population and variance known / unknown.   So my questions are:   At what sample size can you assume (where no knowledge about population distribution or variance) that the sampling distribution of the mean is normal (i.e. CLT has kicked in) when the sampling distribution looks non-normal? I know that some distributions need $n&gt;300$, but some resources seem to say use the $z$-test whenever $n&gt;30$... For the cases I'm unsure about, I presume I look at the data for normality. Now, if the sample data does looks normal do I use the $z$-test (since assume population normal, and since $n&gt;30$)? What about where the sample data for cases I'm uncertain about don't look normal? Are there any circumstances where you'd still use a $t$-test or $z$-test or do you always look to transform / use non-parametric tests? I know that, due to CLT, at some value of $n$ the sampling distribution of the mean will approximate to normal but the sample data won't tell me what that value of $n$ is; the sample data could be non-normal whilst the sample mean follows a normal / $t$.  Are there cases where you'd be transforming / using a non-parametric test when in fact the sampling distribution of the mean was normal / $t$ but you couldn't tell?