How can I remove trailing certain blocks of whitespaces from a string in javascript? I need to adjust a string like so:  Cases where things should be adjusted:  Case a: "        ", becomes "" Case b: "z       ", becomes "z" Case c: "        z", becomes "z"   Cases where things shouldn't be adjusted:      Case d: "   z   ", stays the same  Case e: "zzz zz          zzz", stays the same   How can I achieve this in javascript?
Trim string in JavaScript? How do I trim a string in JavaScript? That is, how do I remove all whitespace from the beginning and the end of the string in JavaScript?
I want to append this text:  &lt;Directory "/var/www/*"&gt;     Order allow,deny     Allow from all     AllowOverride All &lt;/Directory&gt;   to the file /etc/apache2/apache2.conf  I have access via SSH but I don't know how to use VIM. I would like to do this via a command. Obfuscation is one way, but it can't protect from breaking the piracy protection security of the application. How do I make sure that the application is not tampered with, and how do I make sure that the registration mechanism can't be reverse engineered?  Also it is possible to convert a C# application to native code, and  is too costly.  C# provides lot of features, and is the ideal language for my code, so writing the whole codebase again in C++ is out of the question.  Secure certificates can be easily removed from the signed assemblies in .NET. I've seen a couple questions around here like , which mentions:     Unfortunately that same browser won't allow me to test HTTP PUT, DELETE, and to a certain degree even HTTP POST.   I've also heard that browsers support only GET and POST, from some other sources like:        However, a few quick tests in Firefox show that sending PUT and DELETE requests works as expected -- the XMLHttpRequest completes successfully, and the request shows up in the server logs with the right method. Is there some aspect to this I'm missing, such as cross-browser compatibility or non-obvious limitations? How did the Wampa freeze Luke's feet into the ceiling of the cave? I was just thinking about this recently, and I thought of a possible bijection between the natural numbers and the real numbers.  First, take the numbers between zero and one, exclusive.  The following sequence of real numbers is suggested so that we have bijection.    0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.01, 0.02, ... , 0.09, 0.10, 0.11, ... , 0.99, 0.001, 0.002, ... , 0.999, 0.0001, etc.  Obviously, this includes repeats, but this set is countable.  Therefore, the set of all numbers between zero and one is a subset of the above countable set, and is thus countable.  Then we simply extend this to all real numbers and all the whole numbers themselves, and since the real numbers, as demonstrated above, between any two whole numbers is countable, the real numbers are the union of countably many countable sets, and thus the real numbers are countable.    Please help me with this.  I understand the diagonalization argument by Cantor, but I am curious specifically about this proof which I thought of and its strengths and flaws.  Thanks. How can I automate the workflow for producing multiple versions of a document? Say you have two versions of the same LaTeX document.    For instance, you have one version of your lecture slides for actually delivering a lecture: as you're really not a big fan of the "wall of text", this version would be parsimonious in terms of text content, allowing the audience to listen to what you're talking  about instead of reading the slides, and giving graphical content centre stage.  Another version of those slides, made available to the audience after the lecture, for self-study, would be more self-contained and include a summary of what you said during that lecture along with the graphical content mentioned above.  Consider that you can toggle between the two versions by either changing a class option or by changing the value of some dedicated counter in your input file; something relatively simple to do "by hand".  To produce two different versions of the same document, my current workflow is   "manually" compile the first version, change the filename of the output produced (in order to prevent overwriting in step 4) make appropriate changes in my input file to switch to the second version, "manually" compile the second version.   However, this workflow is tedious and error-prone, especially when the number of different versions increases. I would like to automate it as much as possible. Is there a way to batch compile all the versions of my document, each getting a different output filename?  I guess that would involve modifying the input file at the command line (I'm on Mac OS X), but I don't know how to do that.  Do you have an automated workflow for compiling multiple versions of the same document? How do you do it?  Edit: I figured it out using  and  on , of which my question is a duplicate. Can anyone show me how to find invertible elements in $\mathbb{Z}/m\mathbb{Z}$, $m$ is say $28$?  Also I'm not very clear about what it mean by 'invertible element in $\mathbb{Z}/m\mathbb{Z}$' How to disable pagebreak on \hline in longtable? How to disable pagebreak on \hline in longtable?  This is an example illustrating my problem:  \documentclass[12pt,a4paper,oneside]{letter}  \usepackage{longtable}  \begin{document}  \begin{longtable}{ | p{5cm} | } \hline Table header\\* \hline Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris pharetra porttitor turpis, id egestas neque congue in. Nam sed lorem lorem, ac tristique tellus. Nunc ornare feugiat orci, a blandit turpis facilisis ut. Aenean pharetra ornare ante. Sed tempus leo in dolor eleifend placerat. Integer at enim augue. Ut nisl tortor, interdum ac porttitor ac, sagittis quis libero. Vivamus nibh metus, ornare vel pulvinar nec, fringilla nec orci. Maecenas mollis nulla a nibh fringilla nec convallis augue varius. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere   cubilia Curae. \\ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris pharetra porttitor turpis, id egestas neque congue in. Nam sed lorem lorem, ac tristique tellus. Nunc ornare feugiat orci, a blandit turpis facilisis ut. Aenean pharetra ornare ante. Sed tempus leo in dolor eleifend placerat.  Integer at enim augue. Ut nisl tortor, interdum ac porttitor ac, sagittis quis libero. Vivamus nibh metus, ornare vel pulvinar nec, fringilla nec    orci. Maecenas mollis nulla a nibh fringilla nec convallis augue varius.   Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere   cubilia Curae. \\ \hline Table header\\* \hline Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris pharetra porttitor turpis, id egestas neque congue in. Nam sed lorem lorem, ac    tristique tellus. Nunc ornare feugiat orci, a blandit turpis facilisis ut. Aenean pharetra ornare ante. Sed tempus leo in dolor eleifend placerat.    Integer at enim augue. Ut nisl tortor, interdum ac porttitor ac, sagittis  quis libero. Vivamus nibh metus, ornare vel pulvinar nec, fringilla nec    orci. Maecenas mollis nulla a nibh fringilla nec convallis augue varius.   Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere  cubilia Curae. \\ \hline \end{longtable}  \end{document}   I'd like to have second header on page 3. I do not control table contents, so I can not do page breaks manually. Importing users that will be installed by programs An improved \rowstyle that takes the cell contents as an argument It is possible to format the column entries of a tabular in an argument-style fashion using the lrbox environment to   store the column cell in a box (say) \mybox; and supply \mybox as an argument to some other macro.   Here is a short example illustrating this fact*:  \documentclass{article} \usepackage{array}% http://ctan.org/pkg/array \begin{document} \newsavebox{\mybox} \begin{tabular}{c&gt;{\begin{lrbox}{\mybox}}c&lt;{\end{lrbox}\fbox{\usebox{\mybox}}}c}   One &amp; Two &amp; Three \\ \hline   1 &amp; 2 &amp; 3 \\   4 &amp; 5 &amp; 6 \\   7 &amp; 8 &amp; 9 \\ \hline \end{tabular} \end{document}     The above example uses the  to achieve this column-specific formatting. More specifically, each cell in the column is supplied as an argument to \fbox. Does there exist an equivalent automation that would yield    \documentclass{article} \begin{document} \begin{tabular}{ccc}   One &amp; Two &amp; Three \\ \hline   1 &amp; 2 &amp; 3 \\   \fbox{4} &amp; \fbox{5} &amp; \fbox{6} \\   7 &amp; 8 &amp; 9 \\ \hline \end{tabular} \end{document}   without having to specify \fbox for each entry in the row?  As a start, I know that the  provides \rowfont[&lt;alignment&gt;]{&lt;font specification&gt;}. However, this only applies macros &lt;font specification&gt; to each cell in a row and these macros can't take the cell contents as an argument. Moreover, you need to use the tabu environment in order to use this. So that's a little restricting. Also, trying to decipher the  macros for colouring a tabular or array row is just confusing.  The UK TeX FAQ entry on  modifies the row entries via column specifications and therefore requires the addition of "subtle" identifiers like  \begin{tabular}{|$l|^l|^l|}   to initiate $ and propagate ^ whatever row style is defined. Is there a way around this or at least a cleaner alternative that doesn't use columns to format entries in a row? In particular, a solution should provide an lrbox-style flexibility, since the contents of the cell in the to-be-styled row could be anything, even a paragraph (say).  * There are other alternatives, as indicated by the post . Does "no larger than" imply shapability? Negation in English 8 bits representing the number 7 look like this:  00000111   Three bits are set.     What are algorithms to determine the number of set bits in a 32-bit integer? Where do I put item tags on items inside a chest or your inventory? Test for convergence of the series $\sum_{n=2}^\infty\frac{1}{(\ln n)^{\ln n}}$ Could I have a hint for testing the convergence of the following series please?  $$\sum_{n=2}^\infty\frac{1}{(\ln n)^{\ln n}}$$  Edit  The integral test does not work because $\int_1^n\frac{1}{(\ln x)^{\ln x}}dx$ has not an elementary primitive.  Thank You. Database design for products with bundles of products I am building a database system for my retail business. I have set some tables which are:   Product Purchase Sales Balance   All are connected one another and are able to show my inventory level.  The problem I am having is I also sell bundles of products - that have different prices than their individual prices. Example: I sell an orange for $1, an apple for $1.2; I sell fruit package 1 (2 oranges and 2 apples) for $3.8, package 2 (4 oranges and 4 apples) for $7.  Is there a right way how to create relationship for these product bundles?  PS: I am using FileMaker Pro creating this. Why is $L^1(\mathbb{R}^n) \cap L^2(\mathbb{R}^n)$ dense in $ L^2(\mathbb{R}^n)$? The most common way to refer to non-immediate family? We have previously determined that  or  can attune to magic items, but one of those is a sapient creature, and the other "always obeys your commands".  A paladin's steed (per the Find Steed spell) is also 'unusually intelligent' and falls within the score range for sapient creatures.  But what about a regular old animal? If my ranger has a wolf companion, can he make that wolf attune to, say, an Amulet of Health? According to the Beast Master archetype, a companion animal "obeys your commands as best it can".  Is spending an hour 'focused only on the item' (as required for attunement) something a beast can manage?  Or what if it's not an Animal Companion, but just a riding horse, a pet dog, a trained magpie?  I know, probably this is going to be down to the DM to determine, but is there any guidance we can use to help decide whether my cat can attune to an item, and whether rubbing it with catnip would help? is it possible to create this kind of material with the standard textures? The Voronoi texture (set to cells) is coming close but I don’t know if it is possible to a) set the single cells apart from each other and b) to give them seperate colors.