I've been trying to create an array which will hold a set of numbers. In this case 10, 33, 55 and 99. What I'm looking for is something flexible to search the array for a variable to see if the number is in it.  var nrArray = [10, 33, 55, 99]; // Any number in this array will decide the function below  if ( 55 = nrArray ) {   // If the number 55 is in the array do the following document.getElementById("demo1").innerHTML = "RUN1"; } else  {             // If the number 55 does not exist in the array do the following document.getElementById("demo2").innerHTML = "RUN2"; }  &lt;p id="demo1"&gt;demo1&lt;/p&gt; &lt;p id="demo2"&gt;demo2&lt;/p&gt;     NOTE 55 in this example will be replaced with a variable that has a number set to it. And this number will vary
What is the most concise and efficient way to find out if a JavaScript array contains a value? This is the only way I know to do it: function contains(a, obj) {     for (var i = 0; i &lt; a.length; i++) {         if (a[i] === obj) {             return true;         }     }     return false; }  Is there a better and more concise way to accomplish this?
Suppose there is a message that is encrypted with AES-128-CBC.  The message is as follows, new lines are used to delimit the 16 byte boundary for each block:  Wire funds from: Alice to Bob in   the amount of $ 1   Because this message is encrypted using CBC mode,  any modification of the first block of cipher text would propagate throughout the message.   However, the amount of the fund transfer falls in the last block.  I am under the assumption that an attacker can use the property of  to alter the last block and produce a valid amount that is greater than \$1 in far fewer than $2^{128}$ operations.   Is this a correct assumption?  Is there a name for this attack or do you know of a real world example?    My instinct is that if you just need one byte of the 16 byte block to be of a specific value then it would only require $2^8$ operations because the other 120 bits of the plain text could be any value. For example lets say we wanted the last block of cipher text to decrypt to 9\0 (where \0 denotes a single null byte, and the message would be interpreted as \$9), then it would take only $2^{16}$ operations to find this cipher text block.  Is there something I am missing? How do I merge 2 VMware disks in to a single one? I have installed an Ubuntu server on a VMWare workstation with a space of 20GB storage as seen below:    After the installation I've attached another 40GB worth storage to the existing Ubuntu server installation (seen below):    Now I want to add this 40GB to my / (root) directory it mean's  I want that my / directory became to 60G , like it will be resize from 20G to 60G (20G + 40G), i don't know what should i do, can any body help me ?  , my df -h result shows;  root@Userver:~# df -h Filesystem      Size  Used Avail Use% Mounted on /dev/sda1        18G  900M   16G   6% / udev            990M  4.0K  990M   1% /dev tmpfs           400M  308K  399M   1% /run none            5.0M     0  5.0M   0% /run/lock none            999M     0  999M   0% /run/shm none            100M     0  100M   0% /run/user root@Userver:~#   it must be 60G !  i have no graphic mode, then i can't use Gparted tools, i'm just have ssh access ! iMac disk partion FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF and fusion drive unlinked Which languages was Gandalf proficient in? So, I'm trying to figure out how to run the scene from the beginning of Lost Mine of Phandelver (5e starter set) where the party is ambushed by goblins and I'm really confused as to how Passive Wisdom (Perception) works.  The included rulebook mentions on page 6 :     When you hide, there’s a chance someone will notice you even if they aren’t searching. To determine whether such a creature notices you, the DM compares your Dexterity (Stealth) check with that creature’s passive Wisdom (Perception) score, which equals 10 + the creature’s Wisdom modifier, as well as any other bonuses or penalties. If the creature has advantage, add 5. For disadvantage, subtract 5. For example, if a 1st-level character (with a proficiency bonus of +2) has a Wisdom of 15 (a +2 modifier) and proficiency in Perception, he or she has a passive Wisdom (Perception) of 14.   So the party is being ambushed by goblins and at that point the DM guide mentions on page 7 :     Check to see who, if anyone, is surprised. [...] Make a Dexterity (Stealth) check for the goblins, rolling once for all of them. Roll a d20, add the goblins' Stealth skill modifier (+6) to the roll and compare the result to the characters' Passive Wisdom (Perception) scores.   So to me this reads like I should roll 1d20+6 for the goblins and compare that to the static Passive Wisdom (Perception) score on the character sheet of a PC. The PCs don't get to roll anything as they're not actively looking for enemies, even though they are investigating the dead horses.  I would also think that if the characters were supposed to roll, the DM guide would clearly instruct so, given that this is the starter set.  However, watching  at around 8:01 I notice that the DM is explicitly asking his party for a perception roll. And the same thing happens on a couple of other videos where people are running the Lost Mine adventure. The DM always requests a roll.  So what gives? Shall I take it that the DMs ask for the roll because they consider the party to be actively seeking for hidden foes? Or am I just misreading the rulebook and the DM guide? How to fix the Brazilian daylight saving time (Summer Time) of 2018 in Olson database files? The Brazilian Government has just issued a law that shifts the beginning of the Brazilian DST (Daylight Saving Time) locally called as Summer Time.   This new DST date will come into force in the next month, to be more precise on 18th of November of 2018. So, we won't have enough time to wait for a new Olson update through the operation system updates, neither downloading a new Olson database package might be enough.  I have downloaded the file tzdb-2018e.tar.tz from . Inside that package I found the file southamerica and I have located the following entry:  ... # From Steffen Thorsen (2017-12-18): # According to many media sources, next year's DST start in Brazil will move to # the first Sunday of November, and it will stay like that for the years after. # ... https://www.timeanddate.com/news/time/brazil-delays-dst-2018.html # From Steffen Thorsen (2017-12-20): # http://www.planalto.gov.br/ccivil_03/_ato2015-2018/2017/decreto/D9242.htm Rule    Brazil  2018    max -   Nov Sun&gt;=1  0:00    1:00    - Rule    Brazil  2023    only    -   Feb Sun&gt;=22 0:00    0   - ...   The comments preceding the entry rule for 2018 matches the old law from the end of 2017, but there's a new law that shifts it to the 3rd Sunday of November of 2018.  How to fix that Olson entry shifting it to the 3rd Sunday of November? I have tried Sun&gt;=3 yet, and it didn't work. Sci-Fi Movie/Show Where a Soul is Captured in a Glass Vessel Is reusing old code for a new assignment considered self plagiarism? How to protect yourself if you consider it to be, and a group partner does not? How to include a document into another document? Prove every odd integer is the difference of two squares I know that I should use the definition of an odd integer ($2k+1$), but that's about it.  Thanks in advance! Looks like flagging has been affected by releases today. Are these intended effects?   Higher daily limits (appear doubled for me, flagging of posts limit also doubled).  Explained by Shog9 below. Soft comment deletion  - e.g. for "accept rate" obsolete comments - it does in fact work, but the immediate feedback is gone.  This is fixed now. Has the throttling rate changed?  Seems possible to repeated flag without waiting 5 seconds.  If it was broken, it isn't anymore. Old soft deletions that were neither categorised as "helpful" or "declined" have all become "helpful".   If limits have been updated, can we get the new formula published? Not changed, as confirmed by Shog9. raw data stationary but still can see trend and seaonality is stl Will be glad for a little hint: let x and n be positive integer such that $1+x+x^2+\dots+x^{n-1}$ is a prime number then show that n is prime After importing KML to Google Maps, point is showing in Antartica What's a word/phrase for a player/seducer? I can't seem to remember this particular word/phrase. I'm almost certain it's a two-word phrase. It specifically refers to someone who is skilled with the ladies, ie, someone who knows the tricks of the trade.  Usage: - "Unless you're a X-Y, that's not going to work with her."  Edit :  I'm not looking for 'ladies man', 'casanova', 'womanizer' etc. This phrase refers to someone who's more of a pro and one who is serious about his business. an "X is an X is an X" what does this mean? I am reading  (I must say, with great delight but that's not relevant) and  Canadian is a Canadian is a Canadian A citizen is a citizen is a citizen.  I do not understand this structure. Why not just &quot;A citizen is a citizen&quot;? What is the meaning of repeating this? This poor creature is taken aboard the spaceship and the humans do not know that it is intelligent.  The alien can repeat what it hears, e,g, "pass the sugar".  It is able to escape at night and it communicates messages to its fellow aliens.  It directs that they turn up the heat of the atmosphere (somehow they can do this) so as to force the humans to leave.  The alien protagonist states that it will die w/ the humans or leave with them. The following is a rigorous proof of De Moivre's theorem by means of mathematical induction. The theorem put simply is that:  Any complex number, $z = a+bi$, on a cartesian plane can be expressed in polar form, where $a=r\cos\theta$ and $b=r\sin\theta$ and $r$ is the absolute distance from the origin to the point $z$. In light of this, the expression for the complex number $z$ in polar form is $z=r(\cos\theta+i\sin\theta)$ In order to find the $n^{th}$ power of $z$, the following rule applies: $$\displaystyle z^n=(r(\cos\theta+i\sin\theta))^n=r^n(\cos n\theta+i\sin n\theta)$$ where $n\in\mathbb N$ (I have confined $n$ to the natural numbers given that I intend on using mathematical induction to prove the theorem.  Base step: We must prove that what is stated is true for $n=1$, hence $$z^1=r^1(\cos 1\cdot\theta+i\sin1\cdot \theta)$$ $$=r(\cos\theta+i\sin\theta)$$ which is true. Next we assume it is true for $n=k$, and therefore proceed to the inductive step. Inductive step: When calculating $z^{n+1}$, it's the same as calculating $z^nz$, hence $$z^{n+1}=(r^n(\cos n\theta + i\sin n\theta))(r(\cos \theta+i\sin \theta))$$ $$=r^nr(\cos n\theta+i\sin n\theta)(\cos\theta +i\sin \theta)$$ $$=r^{n+1}(\cos n\theta\cdot\cos\theta+\cos n\theta \cdot i\sin\theta+i\sin n\theta\cdot\cos\theta+i^2\sin n\theta\cdot\sin\theta)$$ from here, $i^2=-1$, and therefore $+i^2\sin n\theta\cdot\sin\theta$ becomes $-\sin n\theta\cdot\sin\theta$. In addition to this, the following trigonometric identities will be used: $$\sin(n\theta + \theta) = \sin n\theta\cdot\cos\theta+\cos n\theta\cdot\sin\theta$$ $$or$$ $$k\sin(n \theta+\theta)=k\sin n \theta\cdot\cos \theta + \cos n\theta\cdot k\sin\theta$$ $$and$$ $$\cos(n \theta + \theta)=\cos n\theta\cdot\cos\theta-\sin n\theta\cdot\sin\theta$$ by using these, the original equation has now become $$=r^{n+1}(\cos(n \theta + \theta) + i\sin(n \theta + \theta))$$ then, after factoring out $\theta$, the theorem becomes $$=r^{n+1}(\cos((n+1)\theta)+i\sin((n+1)\theta))$$ which completes the proof. Question: is this proof correct all the way through? Or have I missed any conditions? If all is well in the case of this proof, could somebody aid me in proving it for $\{n|n\in\mathbb R,n\geq1\}$ parsing NSJSONReadingAllowFragments Trailing spaces on comment link format