Can we capitalize the first letters of words in a string to Uppercase and return the string without using slice(1) in javascript? If possible please help me find this out?  function titleCase(str) {   str=str.toLowerCase().split(" ");   for(var i=0;i&lt;str.length;i++){     str[i] = str[i].charAt(0).toUpperCase()+str[i].slice(1);   }   str=str.join(" ");   return str; } titleCase("sHoRt AnD sToUt");
Is there a simple way to convert a string to Title Case? E.g. john smith becomes John Smith. I'm not looking for something complicated like , just (hopefully) some kind of one- or two-liner.
I have to create a report on some student completions. The students each belong to one client. Here are the tables (simplified for this question).  CREATE TABLE  `clients` (   `clientId` int(10) unsigned NOT NULL auto_increment,   `clientName` varchar(100) NOT NULL default '',   `courseNames` varchar(255) NOT NULL default '' )   The courseNames field holds a comma-delimited string of course names, eg "AB01,AB02,AB03"  CREATE TABLE  `clientenrols` (   `clientEnrolId` int(10) unsigned NOT NULL auto_increment,   `studentId` int(10) unsigned NOT NULL default '0',   `courseId` tinyint(3) unsigned NOT NULL default '0' )   The courseId field here is the index of the course name in the clients.courseNames field. So, if the client's courseNames are "AB01,AB02,AB03", and the courseId of the enrolment is 2, then the student is in AB03.  Is there a way that I can do a single select on these tables that includes the course name? Keep in mind that there will be students from different clients (and hence have different course names, not all of which are sequential,eg: "NW01,NW03")  Basically, if I could split that field and return a single element from the resulting array, that would be what I'm looking for. Here's what I mean in magical pseudocode:  SELECT e.`studentId`, SPLIT(",", c.`courseNames`)[e.`courseId`] FROM ... I need a quick algorithm to select 5 random elements from a generic list. For example, I'd like to get 5 random elements from a List&lt;string&gt;. Good way to make \textcircled numbers? This question led to a new package:      I'm trying to make some good-looking numbers in a circle, using the simple command:  \textcircled{1}   However, the circle is misaligned vertically with the number, and look a bit sloppy:    Any suggestions how can I adjust the vertical alignment so that the numbers look more centered w.r.t to the circles? Or, if that's not an option, what other ways to achieve the same results are possible?  I will use those only for numbers, and in very few places, so manual adjustment per glyph is an option.  I'm using pdfLaTeX with Computer Modern, if that matters. How should I parse user input in a text adventure game? Parsing user commands in a text adventure is a spectrum from 's simple "go north" to some mind-bogglingly clever ones in .  I seem to remember reading nice how-tos in computer magazines back in the 80s, but now I find almost nothing on the 'net except a .  How would you do it?    Update: I went with the simplest approach possible in . There are two 9-digit numbers on the back of the Global Entry card. The one on the upper left corner is the Known Traveler Number or PASSID. But on the upper right hand corner there is another 9-digit number, slightly larger than the PASSID. What is the purpose of this second 9-digit number? Simple extension fields If I am correct simple extension fields are extensions generated by one element. I have learned that this means that elements of a simple extension can be written as powers of that element as long as the power is greater than the degree of that element. Also this means that all elements of the simple ext. Can be written in terms of decending powers of the generating element where the highest power is the degree of the generator minus 1. This concept seems to work for generating elements whose irreductable in a certain field is a descending degree polynomial. Looking at the construction of the complex numbers by starting with $\Bbb R$ (and doing $\Bbb R [x]/\langle x^2+1\rangle$), it is said that all elements are of the form $a+b\cdot \text{generator}$. But when the generator is evaluated for the irreductable, $x^2+1$, we see... $(\text{generator})^2=-1$. Thus there is no first power of gen. Can someone explain where all elements of the extension just explained are of the form $a+b\cdot \text{generator}$ comes from or explain this situation for anytime where the irreduc ( gen, F)  is not a descending degree polynomial. I hope my question is clear.  Thank you Broken "Network profile" link when Area51 is their only account Can someone provide a proof that every quadratic residue, when working in $\mathbb Z_p$, where $p$ is a prime, has exactly two roots? Indeed, there cannot be only one root as for any $a^2$, we know $a$ and $-a$ are both roots. So then we need only show that there cannot be more than two- does this follow from some argument for the number of roots a quadratic can have modulo a prime? I'm not well-acquainted with the theorems pertaining to prime moduli. Since there are  complex numbers (2 dimensions) and quaternions (4 dimensions), it follows intuitively that there ought to be something in between for 3 dimensions ("triernions").   Yet no one uses these. Why is this? If you are reading this, you may have been affected by one of our post quality bans. If so, it is important that you  to understand what has happened and how to regain the permissions that you lost. While trying to ask a question, one could see:  We are no longer accepting questions from this account. See  to learn more.  Likewise, for answers:  We are no longer accepting answers from this account. See  to learn more.   Why am I getting this message? Are deleted posts taken into account too? Is a question/answer ban the same as a suspension? How do I avoid getting a question ban? How long do I have to wait before I can post again? What can I do to release the ban? How can I reactivate my account? Can I simply create a new account? I'll just ask somewhere else on the SE network, and they'll migrate my question to the correct site! Will a ban on one Stack Exchange site affect my standing on other sites in the network? Does this apply to meta sites too? My account is in good standing. Why am I still blocked? Show that $d(z,a)=|\frac{z-a}{1-\overline{a}z}|$ is a metric on the unit disk For any $z, a$ in the open unit disk, we define$$d(z,a)=\left \vert \frac{z-a}{1-\overline{a}z} \right \vert$$  Show that $d$ is a metric on the open unit disk.     It is easy to show $d(z,a)=d(a,z)$ and $d(z,a)=0$ $\rm iff$ $z=a$. However, I am having trouble showing that it satisfies triangle inequality. Any help would be appreciated! Why does $(x \to a) ≠ (x = a)$ , But $f(x \to a) = f(x = a)$ Do extension fields always belong to a bigger field? Let $F$ be a field, $E_1$ and $E_2$ are two distinct extension fields of $F$. Is it the case that we can always somehow find a field $G$ that contains both $E_1$ and $E_2$? In other words, could extensions of fields have different 'direction's such that they are incompatible?  Edit: I began to think about this problem while reading a proof. $F$ is a field. $a$ and $b$ are algebraic over $F$. $p(x)$ and $q(x)$ are two polynomials in $F[x]$ of minimum degree that respectively make $a$ and $b$ a zero. The proof claims that there is an extension $K$ of $F$ such that all distinct zeros of $p(x)$ and $q(x)$ lie in $K$. For a single polynomial, I know this kind of field exists because of the existence of splitting field, why it is true for two polynomials? How to choose which FaceTime number to call I have a friend with two iPhones, two different numbers.  When I call her with FaceTime audio, only phone A rings.  How can I call phone B?  The phones have two separate Apple ID addresses, but they are both set to receive Facetime calls on their 10 digit phone numbers.  I have both numbers listed in my contacts as 'Home' and 'Work' for the same person. I couldn’t find any proof on the internet. I would appreciate an elementary proof , but any help would be appreciated!  Thank you. Separate Models vs Flags in the same model I have customer data from 2 brands. The data structure are the same, but I expected the customer behaviour to be different in different brand.  So I could train 2 models, 1 for each brand, or I could train one model on both brands, but flag which brand the customers belongs to within the data.  So my question is, would training on both brands with flags be too much more work for the Machine Learning (I'm using neural network), and therefore be harder to achieve good accuracy than to have dedicated models for each brand? How to install Google Chrome How do you install Google Chrome on Ubuntu? Capturing screenshots on the Mac has gotten very slow recently.  It used to be nearly instantaneous but now it is taking more than 10 seconds for the image to appear on the desktop.  I seem to recall having this problem years ago. The workaround was to delete a large accumulation of log files that the os had built up. After I deleted these log files, the screen capture worked very fast again.  Problem is that I cannot remember where these log files are. Searched for quite some time and could not find the information. How to animate text over a twisted mesh (or text flowing along an infinity loop) Is it legal to use car manufacturers' names in a game? Is it legal to use car manufacturers' names in a game?   For example:   to describe Audi's quattro drive system? to display a rendering of an Audi? to include a photo (to which I have rights) of an Audi?