JavaScript adding decimal numbers issue So I am making a script that adds two numbers (decimal numbers) together, which I have encountered a problem.    I made the script, it turns out pretty good:  0.1 + 0.5  //0.6 0.2 + 0.3  //0.5   But soon I see:  0.1 + 0.2  //0.30000000000000004 0.01 + 0.06  //0.06999999999999999   And it does not look right to me. I know it is a shortcoming of using float point with finite bits, but I can't find a way to fix that.  Math.ceil   //No Math.floor  //No .slice      //No   UPDATE  Is it possible to multiply the numbers by 1000 first, then add them then divide it by 1000?
Is floating point math broken? Consider the following code:   0.1 + 0.2 == 0.3  -&gt;  false   0.1 + 0.2         -&gt;  0.30000000000000004   Why do these inaccuracies happen?
How can I get a reference to a method? Is it possible in Ruby to get a reference to methods of an object ( I would like to know if this can be done without procs/lambdas ) , for example , consider the following code :   class X   def initialize     @map = {}     setup_map   end    private   def setup_map     # @map["a"] = get reference to a method     # @map["b"] = get reference to b method     # @map["c"] = get referebce to c method   end    public   def call(a)     @map["a"](a) if a > 10     @map["b"](a) if a > 20     @map["c"](a) if a > 30   end    def a(arg)      puts "a was called with #{arg}"   end    def b(arg)      puts "b was called with #{arg}"   end    def c(arg)     puts "c was called with #{arg}"   end end   Is it possible to do such thing ? I would like to avoid procs/lambdas because I want to be able to change the behaviour of A,B,C by subclassing . std::string formatting like sprintf Optimal drive configuration for SQL Server 2008R2 I have a fairly busy database server running SQL Server 2008 R2 that has the following setup:   SATA RAID 1 (2 Drives)  - OS / Programs SAS  RAID 10 (4 Drives) - Sql Database Files (data and logs) SAS  RAID 1 (2 Drives)  - TempDB (data and logs)   Assuming I can't add additional drives into this server, have I made the best use of the configuration I have available? Or should I consider another scheme here where logs are isolated from the data files, for example?  Update:  For those that requested further hardware details:   The SATA drives (used for the OS / Program partition) are: WD 7200 RPM 3 Gb/s 3.5 Inch SATA The SAS drives used in the other arrays are: Seagate 15K RPM 6 Gb/s 3.5 inch SAS The RAID controller used is an: LSI 9260-8i SAS/SATA 6 Gb 8 port   Update 2:  Based upon the feedback I've received, it looks like I have the following viable options to choose from - I will award the bounty to someone that can tell me which is likely to be the best in the environment that I've outlined:   Leave everything as is - I probably won't do much better  Move my 2 SAS RAID 1 drives into my existing RAID 10 array to have it composed of 6 disks in total  Move my log files onto the SAS RAID 1 and/or relocate TempDB (data or logs) back to the RAID 10 Sort Array Elements (string with numbers), natural sort Should a toggle button show its current state or the state to which it will change? I have a quick question about buttons that toggle between two states. (Think Play/Pause, or Shuffle/Regular Play.) As the title says, should the toggle show it's current state or the state to which it will transition?  I think people are used to the Play/Pause convention. But the Shuffle/Regular play might be more confusing if you show the transition state instead of current. For example, the built-in music player on the Xbox 360 does it this way: when it's in shuffle mode, it shows the icon for direct play and vice versa and it always confuses me (am I in shuffle mode or straight play).  I see it this way: Play/Pause is more like action as in begin playing or pause playing. Yes behind the scenes it is a state transition but to the user, there is an action. Whereas Shuffle/Straight Play is an option and it's best to show the current state (and possibly have only one icon and change button to show that the option is enabled/disabled). Thoughts? Photoshop layers into SVG paths mod_rewrite to redirect URL with query string VS Code Setup - Create project with manifest error When I try to create project with manifest it is giving me this error:    Starting SFDX: Create Project  12:39:56.757 sfdx force:project:create --projectname Dev --outputdir c:\ --template standard --manifest { AssertionError [ERR_ASSERTION]: Trying to copy from a source that does not exist: C:\Program Files (x86)\Salesforce CLI\client\node_modules\salesforcedx-templates\lib\templates\project\standard\ScratchDef.json     at EditionInterface.exports.copy (C:\Program Files (x86)\Salesforce CLI\client\node_modules\salesforcedx-templates\node_modules\mem-fs-editor\lib\actions\copy.js:49:3)     at EditionInterface.module.exports [as copyTpl] (C:\Program Files (x86)\Salesforce CLI\client\node_modules\salesforcedx-templates\node_modules\mem-fs-editor\lib\actions\copy-tpl.js:29:8)     at ProjectGenerator.writing (C:\Program Files (x86)\Salesforce CLI\client\node_modules\salesforcedx-templates\lib\generators\projectGenerator.js:57:17)     at Object.&lt;anonymous&gt; (C:\Program Files (x86)\Salesforce CLI\client\node_modules\salesforcedx-templates\node_modules\yeoman-generator\lib\index.js:427:27)     at C:\Program Files (x86)\Salesforce CLI\client\node_modules\run-async\index.js:25:25     at new Promise (&lt;anonymous&gt;)     at C:\Program Files (x86)\Salesforce CLI\client\node_modules\run-async\index.js:24:19     at self.env.runLoop.add.completed (C:\Program Files (x86)\Salesforce CLI\client\node_modules\salesforcedx-templates\node_modules\yeoman-generator\lib\index.js:428:13)     at runCallback (timers.js:705:18)     at tryOnImmediate (timers.js:676:5)   generatedMessage: false,   name: 'AssertionError [ERR_ASSERTION]',   code: 'ERR_ASSERTION',   actual: false,   expected: true,   operator: '==' } { AssertionError [ERR_ASSERTION]: Trying to copy from a source that does not exist: C:\Program Files (x86)\Salesforce CLI\client\node_modules\salesforcedx-templates\lib\templates\project\standard\ScratchDef.json     at EditionInterface.exports.copy (C:\Program Files (x86)\Salesforce CLI\client\node_modules\salesforcedx-templates\node_modules\mem-fs-editor\lib\actions\copy.js:49:3)     at EditionInterface.module.exports [as copyTpl] (C:\Program Files (x86)\Salesforce CLI\client\node_modules\salesforcedx-templates\node_modules\mem-fs-editor\lib\actions\copy-tpl.js:29:8)     at ProjectGenerator.writing (C:\Program Files (x86)\Salesforce CLI\client\node_modules\salesforcedx-templates\lib\generators\projectGenerator.js:57:17)     at Object.&lt;anonymous&gt; (C:\Program Files (x86)\Salesforce CLI\client\node_modules\salesforcedx-templates\node_modules\yeoman-generator\lib\index.js:427:27)     at C:\Program Files (x86)\Salesforce CLI\client\node_modules\run-async\index.js:25:25     at new Promise (&lt;anonymous&gt;)     at C:\Program Files (x86)\Salesforce CLI\client\node_modules\run-async\index.js:24:19     at self.env.runLoop.add.completed (C:\Program Files (x86)\Salesforce CLI\client\node_modules\salesforcedx-templates\node_modules\yeoman-generator\lib\index.js:428:13)     at runCallback (timers.js:705:18)     at tryOnImmediate (timers.js:676:5)   generatedMessage: false,   name: 'AssertionError [ERR_ASSERTION]',   code: 'ERR_ASSERTION',   actual: false,   expected: true,   operator: '==' } 12:40:03.206 sfdx force:project:create --projectname Dev --outputdir c:\ --template standard --manifest  ended with exit code 0   Can you please let me know what I am missing:   I have:   installed vs code, salesforce extension pack, salesforce cli, set the environment variable for my user, there is jdk installed (I have not set the path for it, not sure if it is required?)    What I am missing?   Thanks in Advance!! How to debug a Custom Timer Job in SharePoint 2010? I have a Storex eZee Tab 702 tablet. My Google Play Store was working very well until a few weeks ago, when it started saying,     Error while retrieving information from server [DF-DFERH-01]   I tried to clear the cache, clear the data, force stop, and downloading another Google Play Store, but I'm still having the same problem.  How can I fix this issue? Fundamental group of a torus with points removed If a SHA256 hash with high entropy is then hashed with one made from low entropy, is the resulting hash higher/same/lower entropy? If one were to create a SHA256 hash using 256 coin flips converted to hex (which, as I understand it, is as "entro-phized" as one can capture in SHA256) then take that hash as a string, combine that with a hash of the word "cat" and hash the resulting 512 character string, would the resulting hash from that exercise be any less random than our "perfect" hash we began with?  My thinking is the final string would capture the same amount as the original randomness as what we started with because the "extra" entropy can not be captured and is lost. Is this the case and am I thinking about this correctly? Would hashing something with high entropy with something simpler ever cause a lower amount of randomness or does it only go up?  Thanks to anyone who can help explain this a little better. Error reading from file: Input/output error Closed unit disk homeomorphic to $\mathbb{R}^2$? I've already shown the existence of a homeomorphism between the open unit disc and $\mathbb{R}^2$ and now I'm trying to work out whether the closed unit disc is homeomorphic to $\mathbb{R}^2$ or not. Clearly the only real difference is the fact it includes the points actually on the circle, but because the continuous, invertible, bijective map I defined for the open disc was $\dfrac{x}{1-|x|}$ this clearly is not defined for the points on the line.   Intuitively I'm thinking it's not possible to form a homeomorphism with the closed disk precisely because of these points on the circle but can't really form a decent argument. I was thinking along the lines of showing that the non-open, closed subset $\bar{D}(0,1) \backslash D(0,1)$ (which is just the set of points on the actual circle i.e the boundary/frontier of the closed disk) can't possibly bijectively map to a closed subset of $\mathbb{R}^2$ - which clearly would have to be the case in a homeomorphism.   Any advice would be greatly appreciated. The difference between a poor or meh question and a stellar question can often simply be someone understanding it and providing it a great answer. I can't begin to count the number of times I've justified re-opening a question as a moderator by saying:     Look at the answer it got, though. This isn't something we want deleted, this is something we want fixed, because it's obviously valuable. Someone with domain knowledge can easily edit that question based on the answer it received.   This doesn't only apply to borderline-poor or poor questions – sometimes a good edit means the difference between 100 and 10,000 people finding something through typing things into Google. Good titles are hard.   We think we've come up with a way to provide incentive for good, opportunistic edits to happen more often, ideally without questions needing to go through closure or collecting a centimeter of dust before they do. What if we simply rewarded folks that answered and edited questions with a special, relatively difficult to earn badge?  Let's say that you answer something, and:   You edit the question 12 hours before or after answering it. This allows you to edit now, answer later &mdash; or answer now and edit later, when you have the time. Your edit isn't rolled back, or outright rejected if it was a suggested edit The question is not closed for any reason, even simply being a duplicate Your answer has a score of 1 or higher   &hellip; then you've done something that we probably want to recognize. You understood something, you provided the knowledge that you have, and then you provided an edit to make sure that more people in need of this knowledge can find it, while raising the overall quality of the site.  Here's the proposed tiers for the badge (within the above stated criteria):   Explainer (Bronze): Answered &amp; edited 10  questions Refiner (Silver): Answered &amp; edited 50 questions Illuminator (Gold): Answered &amp; edited 500 questions   We think this is going to be pretty hard to game. You can't go leaving streaks of terse snark all over the place on questions you know are going to be closed anyway, and junk edits aren't going to fly.  We're talking about rewarding folks that take a tiny bit more time out of their day just to write a more descriptive title so that folks can find the awesome answer that they wrote. Just doing that alone can make a big difference. Sure, it's a tad hard to get at the gold level, but it's supposed to be. If you routinely edit questions that you answer and have done so for some time, you'd probably get it the day we roll it out.  While this is technically something that we came up with on the quality initiative ( | ) &mdash; this badge could be earned on all of our sites.  What do you think? What did we miss? What could be better about the idea? Defragmenting an SSD drive is a bad idea and Windows 7 is (should be?) smart enough not to schedule defragmentation on such drives.  However, I've opened up Disk Defragmenter on my system and found, to my surprise, that my SSD has indeed been defragmented... recently!  Then I checked the disks selected for the scheduled defrag (I have one SSD and one normal disk), and there the list correctly shows only the non-SSD drive.   MSDN forum post seems to suggest that, at least on Windows 8, defragmenting an SSD drive will just cause the TRIM command to be sent to the drive, but there's no word on what actually happens if you try to defrag an SSD drive on Windows 7 (aside from the fact that it shouldn't happen automatically).  What happens in Windows 7 if one chooses to defrag and SSD? What could possibly have been the reason my SSD drive got been defragmented?  EDIT:  I just remembered - I've moved some folders (Users and ProgramData) from my SSD drive to my normal drive using junctions.  question suggests that this shouldn't have any effects at all on the defragmentation process, but could it have an effect on the "last run" in Disk Defragmenter? Let $P$ be a prime. Show that $\exists$ $x \in \mathbb{N}$ such that $f(x) = p$ then $\exists$ $y \in \mathbb{N}$ such that $g(y) = p$ What is given?  $$\text{Let P be a prime}$$ $$\text{Let} \space f(x)= 3x+1$$ $$\text{Let} \space g(x)= 6x+1$$  Show that: If there exists $x \in \mathbb{N}$ such that $f(x) = P $ , then there exists a $y \in \mathbb{N}$ , such that $g(y) = P$  What have I tried?   Given the question says 'show that', that leads me to believe I need to do a proof of sorts. I'm guessing it might be a proof by either strong induction, or just induction (or maybe just a direct proof?).  I don't even know how to set this up If $f(x) =$ $3x + 1 = $ prime...for any integer $x$, then there exists an integer $y$ such that $g(y) = 6y + 1 = $ prime?   Any hints or starting points would be greatly appreciated.   $$\text{Thanks in advance!}$$ "1 in 10 are" or "1 in 10 is"? Take the examples:   "One in ten children are dyslexic."  "One in ten children is dyslexic." "One in ten children has dyslexia." "One in ten children have dyslexia."   The "one" is singular so 2 and 3 should be correct. But the "one in ten" is a fraction" so 1 and 4 should be correct. And yet I think I usually say 1 and 3. Which is/are correct?! If a microsite uses the same logo as the main site, which "home" should it link to? Which 'home' should the microsite's logo link to - the main site or the microsite?  Consider that...    The content and layout of the microsite is the only differentiator  Half the users reach the microsite from the main site.   The microsite doesn't have it's own URL (it's www.mainurl/microsite) The microsite has the same logo and header style (so you almost can't tell you've left the main site) Express the complex numbers given in Problem in the form $a+ib$