I have created the next code, where I have an ArrayList of Doubles "solution". I want to multiply all the doubles inside this ArrayList. For example, if the solution is [0.9,0.5,0.2], the code returns "0.09000000000000001" and not the real result of 1*0.9*0.5*0.2 = 0.09      double actualCost = 1;     for(int j = 0; j &lt; solution.size(); j++) {         actualCost *= solution.get(j);     }     return actualCost;   I don't know why I have this problem, if someone can help me to fix it I'll really appreciate it.  Thanks in advance.  (sorry for my english lvl)
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 dynamically load the functions of java.lang.Math This is from problem $8$, Chapter II of Rudin's Real and Complex Analysis.  The problem asks for a Borel set $M$ on $R$, such that for any interval $I$, $M \cap I$ has measure greater than $0$ and less than $m(I)$.  I was thinking of taking the Cantor approach: taking $R$ to be the union of $[a,b]$ with $a$ and $b$ rationals, and for each $[a,b]$ we construct Cantor sets inside it. During theconstruction of each Cantor set, in order to have positive measure on it, we need to take off smaller and smaller intervals from it, namely the proportion goes to $0$. As a result, these Cantor sets are extremely "dense" on their ends. If for an interval $I$ it intersects with the Cantor set on $[a,b]$ while $b-a&gt;&gt;m(I)$, we shall expect the measure of intersection to be rather close to $m(I)$ and then we lose control on these cases.  Is there any way to fix this or shall I consider other approaches?  Thank you Different behaviour for list.__iadd__ and list.__add__ Motivation behind standard deviation? Let's take the numbers 0-10.  Their mean is 5, and the individual deviations from 5 are -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 And so the average (magnitude of) deviation from the mean is $30/11 \approx 2.72$.  However, this is not the standard deviation.  The standard deviation is $\sqrt{10} \approx 3.16$.  The first mean-deviation is a simpler and by far more intuitive definition of the "standard-deviation", so I'm sure it's the first definition statisticians worked with.  However, for some reason they decided to adopt the second definition instead.  What is the reasoning behind that decision? Why Windows sets new created file's "created time" property to old time? Making a Comment on a page without being on that page? I have a built a Wordpress site that enables comments on pages and I am using them as reviews, what I would like to do is for someone to be able to make a comment on a page without being on that page.    On the link above, the top right, there is a link that says have your say about a university, it would be good to have a HTML form and then a dropdown box of all the child pages of university-guide; which is where all the universities are stored, and then I can put my comments.php file into this.  So my HTML form appears and when a page is picked from a dropdown box, the comment will then be assigned to that page.  Any help or direction?    New Question for Toscho:  Below is your tweaked plugin to fit into my website, as you can see I have added the select option yearSelect and need this to appear when the comments appear. How would I go about doing this? - Could you provide ay help please?      &lt;?php /* Plugin Name: haveyoursay */  /**  * Call the form in your template with:  * do_action( 'wpse_67527_comment_form' );  */ add_action( 'wpse_67527_comment_form', 'wpse_67527_comment_form' );  /**  * Create a review form.  *  * @return void  */ function wpse_67527_comment_form() {     $select_id = 'page_select';     $url = 'http' . ( is_ssl() ? 's' : '' ) . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];     $url = esc_url( $url );     ?&gt; &lt;form action="&lt;?php echo site_url( '/wp-comments-post.php' ); ?&gt;" method="post"&gt; &lt;h3&gt;Leave us your student perspective &lt;img src="/wp-content/themes/blue-and-grey/images/hmepage-tri.png"&gt;&lt;/h3&gt;     &lt;p&gt;         &lt;label for="author"&gt;&lt;?php _e( 'Name' ); ?&gt;&lt;/label&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;         &lt;input id="author" name="author" type="text" size="40" /&gt;     &lt;/p&gt;     &lt;p&gt;         &lt;label for="email"&gt;&lt;?php _e( 'Email' ); ?&gt;&lt;/label&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;         &lt;input id="email" name="email" type="text" size="40" /&gt;     &lt;/p&gt;     &lt;p&gt;         &lt;label for="&lt;?php echo $select_id; ?&gt;"&gt;             &lt;div class="clear"&gt;&lt;/div&gt;             Pick a university from the list: &amp;nbsp;&amp;nbsp;         &lt;/label&gt;         &lt;?php         // Ordered by page name automatically         wp_dropdown_pages(             array (                 'name' =&gt; 'comment_post_ID',                 'id'   =&gt; $select_id,                 'child_of' =&gt; 2,             )         );         ?&gt;       &lt;/p&gt;     &lt;div class="clear"&gt;&lt;/div&gt;     &lt;p style="margin:10px 0px 0px 0px;"&gt;Please select your year of study: &amp;nbsp;&amp;nbsp;     &lt;select name="yearSelect"&gt;     &lt;option value="1st"&gt;First Year&lt;/option&gt;     &lt;option value="2nd"&gt;Second Year&lt;/option&gt;     &lt;option value="2nd"&gt;Third Year&lt;/option&gt;     &lt;/select&gt;     &lt;/p&gt;     &lt;br /&gt;     &lt;p&gt;         &lt;textarea name="comment" cols="45" rows="8"&gt;&lt;/textarea&gt;     &lt;/p&gt;     &lt;p&gt;         &lt;?php         wp_nonce_field( 'unfiltered-html-comment_' . get_the_ID(), '_wp_unfiltered_html_comment_disabled', FALSE );         ?&gt;         &lt;input type="hidden" name="redirect_to" value="&lt;?php echo $url; ?&gt;" /&gt;         &lt;input type="submit" style="margin:15px 0px 0px 0px; padding:4px 10px;" /&gt;     &lt;/p&gt; &lt;/form&gt;     &lt;?php }  add_filter( 'comment_post_redirect', 'wpse_67527_redirect' );  /**  * Strip '#comment-number' from redirect url.  *  * @param  string $url  * @return string  */ function wpse_67527_redirect( $url ) {     $parts = explode( '#', $url );     return $parts[0]; } ?&gt; Automatically capitalise the first word in each sentence I have a problem with arscalssica style in combination with classicthesis.  The text under the chapter title starts always at the same position, independently on how long is the chapter title, which produce this ugly behaviour:   The code I used to generete this output is really basic:  \documentclass[10pt,a4paper,twoside,openright,titlepage,fleqn,headinclude,footinclude,BCOR5mm,numbers=noenddot,cleardoublepage=empty,tablecaptionabove]{scrreprt} \usepackage{subfig} \usepackage[eulerchapternumbers,subfig,beramono,eulermath,pdfspacing]{classicthesis}  \usepackage{arsclassica}  \usepackage{blindtext}  \begin{document}     \chapter{\blindtext}     \blindtext \end{document}   The compilation raises the following warnings:  C:\Program Files (x86)\MiKTeX 2.9\tex\latex\koma-script\scrreprt.cls: Class scrreprt Warning: You've used obsolete option `tablecaptionabove'. C:\Program Files (x86)\MiKTeX 2.9\tex\latex\classicthesis\classicthesis.sty: Class scrreprt Warning: Usage of package `titlesec' together(scrreprt)              with a KOMA-Script class is not recommended. C:\Program Files (x86)\MiKTeX 2.9\tex\latex\titlesec\titlesec.sty: Package titlesec Warning: Non standard sectioning command detected(titlesec)                Using default spacing and no format. C:\Program Files (x86)\MiKTeX 2.9\tex\latex\titlesec\titlesec.sty: Package titlesec Warning: Non standard sectioning command detected(titlesec)                Using default spacing and no format. C:\Program Files (x86)\MiKTeX 2.9\tex\latex\titlesec\titlesec.sty: Package titlesec Warning: Non standard sectioning command detected(titlesec)                Using default spacing and no format. C:\Program Files (x86)\MiKTeX 2.9\tex\latex\titlesec\titlesec.sty: Package titlesec Warning: Non standard sectioning command detected(titlesec)                Using default spacing and no format. C:\Program Files (x86)\MiKTeX 2.9\tex\latex\titlesec\titlesec.sty: Package titlesec Warning: Non standard sectioning command detected(titlesec)                Using default spacing and no format. C:\Program Files (x86)\MiKTeX 2.9\tex\latex\classicthesis\classicthesis.sty:373: Package scrreprt Warning: Activating an ugly workaround for a missing(scrreprt)                feature of package `titlesec` on input line 373. C:\Program Files (x86)\MiKTeX 2.9\tex\latex\arsclassica\arsclassica.sty:192: Package hyperref Warning: Option `hyperfootnotes' has already been used,(hyperref)                setting the option has no effect on input line 192. C:\Program Files (x86)\MiKTeX 2.9\tex\latex\arsclassica\arsclassica.sty:192: Package hyperref Warning: Option `pdfpagelabels' has already been used,(hyperref)                setting the option has no effect on input line 192   The behaviour is ok if I do not use arsclassica but only classicthesis: How do I prevent and/or handle a StackOverflowException? I would like to either prevent or handle a StackOverflowException that I am getting from a call to the XslCompiledTransform.Transform method within an Xsl Editor I am writing. The problem seems to be that the user can write an Xsl script that is infinitely recursive, and it just blows up on the call to the Transform method.  (That is, the problem is not just the typical programmatic error, which is usually the cause of such an exception.)  Is there a way to detect and/or limit how many recursions are allowed?  Or any other ideas to keep this code from just blowing up on me? I have a table:  table votes (     id,     user,     email,     address,     primary key(id), );   Now I want to make the columns user, email, address unique (together).  How do I do this in MySql?  Of course the example is just... an example. So please don't worry about the semantics. The command history between sessions is not getting saved. I'm using guake and the history for the session is working fine. I noticed that .bash_history had some commands I executed in sudo -s mode and tried the same again and all the commands while in the session got saved so I tried: chmod 777 .bash_history  Now the old commands appear at the start of a session but no new commands are getting saved. Get top results for each group (in Oracle) Every once in a while I see users having issues to update due to errors like this:  E:Type 'ain' is not known on line 1 in source list /etc/apt/sources.list.d/some-ppa.list'   with varying types/line numbers/source list files (often after removing a PPA).  How can such an error be fixed? If I design a PC for use as an NPC, how much XP should he give when killed? Case-insensitive attribute-value selector with Jquery Is there a way to reset/change my Steam email without being logged on? I cannot access the email that is linked to my Steam account and need to change it. However, Steam Guard sends a verification code to that email address.  Is there any way around this? Allow User to input HTML in ASP.NET MVC - ValidateInput or AllowHtml Electrical potential energy stored in vacumm for a single point charge? I have come to know the electrostatic potential energy in vacuum is given by $${\frac{1}{2}} \epsilon_0\int d^3x {E^2} $$ and this energy  is due to the mutual electrostatic coulomb potential energy. So only a single point charge in space also contributes to some electrostatic potential energy according to $${\frac{1}{2}} \epsilon_0 \int d^3x {E^2} $$  as due to a single point charge also we have an electric field at every point in space. Now I am not getting it physically, why should there be any Coulomb energy in this case as there is no other charge to provide the electrostatic coulomb potential energy? why is my screen black after rdp connection? After connecting from my home via remote desktop, both my screens are black when I arrive at work. The only thing I can see is a mouse pointer on one of the screens. I then seem to have only two choices: rebooting or working from a remote desktop connection, which works fine.  It did happen every time I tried last week.  However, I did the same from my laptop in a meeting room today, and I didn't have any problem. How do you disable browser autocomplete on web form field / input tags?