JavaScript has parseInt() and parseFloat(), but there's no parseBool or parseBoolean method in the global scope, as far as I'm aware.  I need a method that takes strings with values like "true" or "false" and returns a JavaScript Boolean.  Here's my implementation:  function parseBool(value) {     return (typeof value === "undefined") ?             false :             // trim using jQuery.trim()'s source             value.replace(/^\s+|\s+$/g, "").toLowerCase() === "true"; }   Is this a good function? Please give me your feedback.  Thanks!
Can I convert a string representing a boolean value (e.g., 'true', 'false') into a intrinsic type in JavaScript?  I have a hidden form in HTML that is updated based upon a user's selection within a list. This form contains some fields which represent boolean values and are dynamically populated with an intrinsic boolean value. However, once this value is placed into the hidden input field it becomes a string.  The only way I could find to determine the field's boolean value, once it was converted into a string, was to depend upon the literal value of its string representation.  var myValue = document.myForm.IS_TRUE.value; var isTrueSet = myValue == 'true';   Is there a better way to accomplish this?
declare property as object? Singular or plural "set"? When in Demon Form, are demons vulnerable to mortal frailties? When a Demon is in Demonic Form, does he gain any intrinsic protection against mundane concerns like breathing or falling unconscious? In particular, when in Demonic Form do/are demons:  need to breath? immune to poisons? fall unconscious? (ie do they stay conscious on full lethal?) suffer from wound penalties for having damage in last 3 boxes? need to consume food/water? need to sleep?  The last two are only really a concern to demons who have burnt their last cover. However this can happen in play, and is pretty significant for any burnt NPCs. Is seems odd that a swarm of glass beetles clinging together into the shape of a man might have any issues with being poisoned. But I can't find it clearly stated, whereas it is clearly stated in Werewolf (the Forsaken). Regard this statement $ x \ge 0$. According to my teacher, by negating this statement, it will become $ x &lt; 0$. Why is this so; why does the $\ge$ morph into $&lt;$, and not into $\le$? Quotient rings of Gaussian integers How to interpret these acf and pacf plots @future method: Unsupported parameter type Does magic jack work on Ubuntu? Does magic jack work with Ubuntu? I originally had my magic jack on a computer with windows XP and I decided to switch to Ubuntu but I still want Magic jack. While the etiquette of dealing with duplicate answers , there hasn't been a great way to deal with these, "Uh, yeah, I said this, too" types of behavior than the almighty downvote.   It would be nice to have a "Duplicate Answer" option on the flag menu. Five flags auto-deletes the answer, as with any other flag. In order to prevent abuse, the flagged answer would have to have the last owner edit (including original post) be younger than the original answer's original posting by at least 2 minutes.  Also, this ability should be a 5,000+ rep privilege, since we currently have no fanfare of rep from 3,001 to 9,999, and a power like this has a bit more umph than closing a question.  Thoughts? ArrayList vs List I saw this reply from Jon on :     If you want a single collection to   contain multiple unrelated types of   values, however, you will have to use   List&lt;object&gt;   I'm not comparing ArrayList vs List&lt;&gt;, but ArrayList vs List&lt;object&gt;, as both will be exposing elements of type object. What would be the benefit of using either one in this case?  EDIT: It's no concern for type safety here, since both class is exposing object as its item. One still needs to cast from object to the desired type. I'm more interested in anything other than type safety.  EDIT: Thanks Marc Gravell and Sean for the answer. Sorry, I can only pick 1 as answer, so I'll up vote both. How to make a WPF application a 30 day trial version, and make it licensed using product key? How to open a PDF file from terminal? I used to work on the Mac terminal before and I used:   open file2open.pdf   and the PDF file would be opened on preview or whatever my default viewer was. When I use it in the terminal in Ubuntu I get this error message:   Couldn't get a file descriptor referring to the console How was Will aware of the lights? In  (2016) Will Byers gets taken to the "Upside Down". But he manages to communicate with his mother, e.g through the christmas lights.  &nbsp;   When Joyce is in the cupboard and says "Once for YES, twice for NO.", how would Will make that happen? He can't see his mother, but does he see the lights she is holding?  &nbsp;   Does the alphabet Joyce draws just appear on the wall in the Upside Down, together with the lights?  In the last episode Joyce and Hopper enter the house in the Upside Down, and when they go through the hallway the kids on the other side see the lights go on (suggesting that just standing close to those lights is enough to make them turn on).    But those lights don't seem to be there in the Upside Down.    My Question:   Is there a reasonable explanation on how Will managed to communicate with his mother through the christmas lights? In PCA, when the number of dimensions $d$ is greater than (or even equal to) the number of samples $N$, why is it that you will have at most $N-1$ non-zero eigenvectors? In other words, the rank of the covariance matrix amongst the $d\ge N$ dimensions is $N-1$.  Example: Your samples are vectorized images, which are of dimension $d = 640\times480 = 307\,200$, but you only have $N=10$ images. Overview of basic facts about Cauchy functional equation "No such file or directory" when trying to remove a file, but the file exists? I am trying to remove a png image that was uploaded to my server via a PHP script. Whenever I try to delete it both through ftp and terminal, I get the error   No such file or directory   However, when I ls in the dir, the file is listed and it is also listed in my ftp client. I have tried creating a file with the same name and I end up getting two files with the same name.   I can open the file that supposedly does not exist, but I still can't remove it. I have also tried rebooting my server. Any ideas what may be the issue? I am running a 64 bit version of Ubuntu, but I don't think its a 32/64 bit issue. I should also note I have removed many other png files uploaded by the same PHP script.  Output for ls -l  total 224  -rw-r--r-- 1 www-data www-data 222838 May 13 04:14 qyxdshyikfr_fishing_timeout.png  -rw-r--r-- 1 root root 272 May 14 06:54 upload.php   Output when trying to rm  rm: cannot remove ‘qyxdshyikfr_fishing_timeout.png’: No such file or directory   upload.php: When am I entitled to participate in a stock split? — record date, split date, ex date Stock split announcements usually mention a few dates — record date (&quot;date of record&quot;), split date (&quot;distribution date&quot;, &quot;pay date&quot;, or &quot;payment date&quot;), ex date (&quot;ex-split date&quot;). Examples:  :  Each Apple shareholder of record at the close of business on August 24, 2020 will receive three additional shares for every share held on the record date, and trading will begin on a split-adjusted basis on August 31, 2020.   :  Each stockholder of record on August 21, 2020 will receive a dividend of four additional shares of common stock for each then-held share, to be distributed after close of trading on August 28, 2020. Trading will begin on a stock split-adjusted basis on August 31, 2020.    In the case of the Tesla split, the record date is August 21, the split date is August 28 (Friday), and the ex date is August 31 (Monday). Apple's  provides definitions of these dates:  What is the effective date of the split? There are several key dates. The Record Date – August 24, 2020 - determines which shareholders are entitled to receive additional shares due to the split. The Split Date – August 28, 2020 - shareholders are due split shares after the close of business on this date. The Ex Date – August 31, 2020 - the date determined by Nasdaq when Apple common shares will trade at the new split-adjusted price.  However, further down in the FAQ, there is an explanation that seems to contradict the definition of the record date given above:  What happens if I buy or sell shares on or after the Record Date and before the Ex Date? [...] If you buy shares on or after the Record Date but before the Ex Date, you will purchase the shares at the pre-split price and will receive (or your brokerage account will be credited with) the shares purchased. Following the split, you will receive (or your brokerage account will be credited with) the additional shares resulting from the stock split.  Judging by the Apple FAQ, the way the record date works for stock splits is completely different from the way the record date works for cash dividends. With cash dividends, people who become shareholders of record after the record date are not entitled to the dividends. With stock splits, however, people who purchase shares after the record date (but before the ex date) are entitled to the stock split. Furthermore, for stock splits, the record date comes before the ex date, whereas for cash dividends, the record date comes after the ex date. It appears that I am not the only one confused about this. A quick internet search reveals years and years of confusion regarding the record date for stock splits. An extremely common point of confusion is the apparently incorrect assumption that the record date for stock splits works in the same way as the record date for cash dividends. A few questions:  Am I right that the record date for stock splits works differently from the record date of cash dividends? The only relevant dates for a stock split seem to be the split date (on which I will receive new shares after the market closes), and the ex date (on which I can sell the new shares on stock exchanges at a post-split price). It seems that the record date is completely irrelevant. What is the record date for? From my understanding, the price of the stock will be reduced at the instant the new shares are distributed (on the split date). Is this correct? It's essential that the documents (should)/(ought to) be destroyed immediately.   Which one is more suitable one as I know "ought to" and "should" are synonyms. Is there a possibility to change the font-style in the table of contents? Everything I wrote down in my document was written with Times. However, the ToC does not have the same font family. Is there a way to change the font of the ToC to Times New Roman? Thank you : )    \documentclass[a4paper, fontsize=11pt]{scrbook} \usepackage{geometry} \geometry{a4paper, top=25mm, left=25mm, right=25mm, bottom=20mm, headsep=10mm, footskip=12mm}  \usepackage[ngerman]{babel}  \usepackage[T1]{fontenc}        \usepackage[latin1]{inputenc} \usepackage{acronym}      \usepackage{anyfontsize}  \begin{document}  \tableofcontents  \chapter{Test} Is there a possibility to change the font-style in the table of contents? Everthing I wrote down in my document was written with Times. However, the ToC does not have the same font family. Is there a way to change the font of the ToC to Times New Roman?  \end{document} Every Christmas, Harry receives a mediocre gift from the Dursleys. In Harry Potter and the Chamber of Secrets he gets a toothpick.     At that moment, Hedwig swooped into the room, carrying a very small package in her beak.     “Hello,” said Harry happily as she landed on his bed. “Are you speaking to me again?”     She nibbled his ear in an affectionate sort of way, which was a far better present than the one that    she had brought him, which turned out to be from the Dursleys. They had sent Harry a toothpick    and a note telling him to find out whether he’d be able to stay at Hogwarts for the summer    vacation, too.    They hate owls, but obviously use them to contact Harry at school?