(Or does not start with certain letter) Consider the array:  myArray = ['M1','M2','A1']   And:  if ( myArray[1] !== *START WITH M* ) { // something };   Is there a selector which I can use?  Thanks in advance.
How would I write the equivalent of C#'s  in JavaScript?  var haystack = 'hello world'; var needle = 'he';  haystack.startsWith(needle) == true   Note: This is an old question, and as pointed out in the comments ECMAScript 2015 (ES6) introduced the  method. However, at the time of writing this update (2015) .
Adapt BibTeX style to give all initials I'm using a modification of the plainyr BibTeX style. Although my bib-file contains all initials for some authors (e.g. B.D. McKay), I end up with just the first initial in my document (e.g. B. McKay). I thought about editing the BibTeX style myself, but after seeing the code, I decided against it. Maybe there are some people who are more knowledgeable in this area of expertise.  I want my final document to include the initials for all the names, and not just those of the first name.  This is the relevant code of the BibTeX style, or at least, I think it is the relevant code.  FUNCTION {format.names} { 's :=   #1 'nameptr :=   s num.names$ 'numnames :=   numnames 'namesleft :=     { namesleft #0 &gt; }     { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't :=       nameptr #1 &gt;         { namesleft #1 &gt;             { ", " * t * }             { numnames #2 &gt;                 { "," * }                 'skip$               if$               t "others" =                 { " et~al." * }                 { " and " * t * }               if$             }           if$         }         't       if$       nameptr #1 + 'nameptr :=       namesleft #1 - 'namesleft :=     }   while$ } $$L~=~ \frac{1}{2} \dot{q}  \sin^2{q} $$  Is it zero or not defined? Is it ok to say 'sorry' where you otherwise would use 'excuse me'?  Example: "Sorry, but could you show me the way to the next train station?" A potentially dangerous Request.Form value was detected from the client Every time a user posts something containing &lt; or &gt; in a page in my web application, I get this exception thrown.  I don't want to go into the discussion about the smartness of throwing an exception or crashing an entire web application because somebody entered a character in a text box, but I am looking for an elegant way to handle this.  Trapping the exception and showing     An error has occurred please go back and re-type your entire form again, but this time please do not use &lt;   doesn't seem professional enough to me.  Disabling post validation (validateRequest="false") will definitely avoid this error, but it will leave the page vulnerable to a number of attacks.  Ideally: When a post back occurs containing HTML restricted characters, that posted value in the Form collection will be automatically HTML encoded. So the .Text property of my text-box will be something &amp; lt; html &amp; gt;  Is there a way I can do this from a handler? Tor browser not opening What are the best workarounds for using a SQL IN clause with instances of java.sql.PreparedStatement, which is not supported for multiple values due to SQL injection attack security issues: One ? placeholder represents one value, rather than a list of values.  Consider the following SQL statement:  SELECT my_column FROM my_table where search_column IN (?)   Using preparedStatement.setString( 1, "'A', 'B', 'C'" ); is essentially a non-working attempt at a workaround of the reasons for using ? in the first place.    What workarounds are available? I'm working on a web application that needs to prints silently -- that is without user involvement.  What's the best way to accomplish this?  It doesn't like it can be done with strictly with Javascript, nor Flash and/or AIR.  The closest I've seen involves a Java applet.  I can understand why it would a Bad Idea for just any website to be able to do this.  This specific instance is for an internal application, and it's perfectly acceptable if the user needs to add the URL to a trusted site list, install an addon, etc. Say I have 12 and have to factorize it in 2 factors. Now possible factors are 1, 12 2, 6 3, 4   Now 3,4 is such that value of maximum factor i.e. 4 is minimized among all pairs.  How to find the solution in generic case where a number N is to be divided in K factors minimizing maximum value. How do I see the extensions loaded by PHP? How general is the Lagrangian quantization approach to field theory? It is an usual practice that any quantum field theory starts with a suitable Lagrangian density. It has been proved enormously successful. I understand, it automatically ensures valuable symmetries of physics to be preserved. But nevertheless the question about the generality of this approach keeps coming to my mind. My question is how one can be sure that this approach has to be always right and fruitful. Isn't it possible, at least from the mathematical point of view that a future theory of physics does not subscribe to this approach? How to avoid perceived circularity when defining a formal language? Suppose we want to define a first-order language to do set theory (so we can formalize mathematics). One such construction can be found . What makes me uneasy about this definition is that words such as "set", "countable", "function", and "number" are used in somewhat non-trivial manners. For instance, behind the word "countable" rests an immense amount of mathematical knowledge: one needs the notion of a bijection, which requires functions and sets. One also needs the set of natural numbers (or something with equal cardinality), in order to say that countable sets have a bijection with the set of natural numbers.  Also, in set theory one uses the relation of belonging "$\in$". But relation seems to require the notion an ordered pair, which requires sets, whose properties are described using belonging...  I found the following in Kevin Klement's,  (pages 2-3).  "You have to use logic to study logic. There’s no getting away from it. However, I’m not going to bother stating all the logical rules that are valid in the metalanguage, since I’d need to do that in the metametalanguage, and that would just get me started on an infinite regress. The rule of thumb is: if it’s OK in the object language, it’s OK in the metalanguage too."  So it seems that, if one proves a fact about the object language, then one can also use it in the metalanguage. In the case of set theory, one may not start out knowing what sets really are, but after one proves some fact about them (e.g., that there are uncountable sets) then one implicitly "adds" this fact also to the metalanguage.  This seems like cheating: one is using the object language to conduct proofs regarding the metalanguage, when it should strictly be the other way round.  To give an example of avoiding circularity, consider the definition of the integers. We can define a binary relation $R\subseteq(\mathbf{N}\times\mathbf{N})\times(\mathbf{N}\times\mathbf{N})$, where for any $a,b,c,d\in\mathbf{N}$, $((a,b),(c,d))\in R$ iff $a+d=b+c$, and then defining $\mathbf{Z}:= \{[(a,b)]:a,b\in\mathbf{N}\}$, where $[a,b]=\{x\in \mathbf{N}\times\mathbf{N}: xR(a,b)\}$, as in  question or  on Wikipedia. In this definition if set theory and natural numbers are assumed, then there is no circularity because one did not depend on the notion of "subtraction" in defining the integers.  So my question is:     Question Is the definition of first-order logic circular?   If not, please explain why.   If the definitions are circular, is there an alternative definition which avoids the circularity?   Some thoughts:   Perhaps there is the distinction between what sets are (anything that obeys the axioms) and how sets are expressed (using a formal language). In other words, the notion of a set may not be circular, but to talk of sets using a formal language requires the notion of a set in a metalanguage. In foundational mathematics there also seems to be the idea of first defining something, and then coming back with better machinery to analyse that thing. For instance, one can define the natural numbers using the Peano axioms, then later come back to say that all structures satisfying the axioms are isomorphic. (I don't know any algebra, but that seems right.) Maybe sets, functions, etc., are too basic? Is it possible to avoid these terms when defining a formal language? How can I prove $n - 2\sqrt{n} = \Theta(n)$ I want to prove the following $$n - 2\sqrt{n} = \Theta(n)$$  It's $n - 2\sqrt{n} \leq n = O(n)$  How can I prove the same for $\Omega(n)$ Can you deliver it [when,after] it [is | will be] assembled? Is there a ZIP code I can enter when paying-at-the-pump in the USA with a foreign credit card? Ask question post button remains disabled I've noticed this twice in the last ~2 weeks or so. The &quot;post your question&quot; button can remain disabled for some reason even when your question is shown as &quot;ready to publish&quot;. I.e., you've gotten to the &quot;review&quot; page after the initial edit. If I remember correctly, one case was on Stack Overflow, and the other was on . I'm not sure what exact scenario leads up to this. I haven't paid attention to the button until the last step when I'm ready to click it. The workaround has been to reload the page. (I copied my content for safe-keeping first.) This works, and the button then shows up as active. Afterwards, however, on both occasions, it forced me through the &quot;are you a human&quot; verification.  Update - this question itself did not exhibit this, nor did it do the .  Update - I'm using Chrome on Windows and am not sure what version it was when this happened.  It has  installed, but there aren't any scripts for any Stack Exchange sites.  It has  installed.  The virus scanner on the PC I probably was using was Suppose that $(U,V)$ has the following joint pdf: $$f_{U,V}(u,v)=\exp(-\theta u-\theta^{-1}v)$$ , where $u\geq0$, $v\geq0$, $\theta&gt;0$. Define $X=UV$ and $Y=U/V$. Find the marginal pdf of $X$ and $Y$.  With transformation, I got $U=\sqrt{XY}$ and $V=\sqrt{X/Y}$ and the absolute value of Jacob is $1/2Y$. Then, the joint pdf of $(X,Y)$ is  $$f_{X,Y}(x,y)=\exp(-\theta \sqrt{XY}-\theta^{-1}\sqrt{X/Y})1/2Y, X,Y&gt;0.$$  But I am not sure how to get the marginal pdf?  Thank you! Related:   I know I must describe my past and current research in my personal/research statement or statement of purpose. But do I use technical terms?  I was given the advice that since the people reading my statement are mathematicians (I am applying to US for applied mathematics), they should know what I am talking about.  Although I am applying to applied mathematics, it would also be nice to hear from other fields (biology, computer science, engineering etc) about this. How can I utilize the whole terminal, like htop or emacs do? I want to write a program that can "draw" in the terminal the same way as htop or emacs. By that I mean "get rid of the prompt and make the output dependent on the current size of the terminal".   To make this a bit more clear:   I want to use the terminal this way:     in stead of this way: $\DeclareMathOperator{\Char}{char}$$\DeclareMathOperator{\Aut}{Aut}$ Let $G$ be a finite group, $H$ a subgroup, such that $H \Char G$. If $\phi \in \Aut(H)$ is there an automorphism $\widehat{\phi} \in \Aut(G)$ such that $\widehat{\phi}|_H$ = $\phi$?  In words, if $\phi$ is an automorphism of $H$, is there necessarily an automorphism $\widehat{\phi}$ of $G$ where $\widehat{\phi}$ maps the elements in $H$ to $H$ in exactly the same way?  I am thinking this is false (consider the non-finite example of $\bar{Q}$ and $\mathbb{C}$), but would like a counter example (for the finite case). I set up a new VPS instance of Ubuntu and am wondering what the easiest way is to get up and running with a basic LAMP stack (i.e. which packages are required, which configuration options need to be tweaked, if any, etc.).