My input String is like   abc,def,wer,str   Currently its splitting  only on comma but in future it will contain both comma and newline. Current code as below:     $scope.memArray = $scope.memberList.split(",");     In future I need to split on both comma and newline what should be the regex to split both on comma and newline. I tried - /,\n\ but its not working.
How do I split a string with multiple separators in JavaScript? I'm trying to split on both commas and spaces, but AFAIK JavaScript's split() function only supports one separator.
Will doing timelapses break my camera? I was planning to do some timelapses in the near future, until I realised that if I leave my camera taking pictures for a week or 2, I will soon reach the max number of shutter count and my camera would break.   Then I read from an unverified source that during timelapse the shutter doesn't move, so there is no way to break it. I am confused.   Is it possible to take timelapses without physically destroying the shutter in a month? In particular, I am interested in Canon 80D model. My 3 years old doesn't tell me when he needs to use the bathroom My son is 3 years old and doesn't tell me when he needs to use the bathroom. It has been 5 months now that I took his diaper off him. I just do not know what I should do.  Should I put a diaper on him again?  I mean, is this normal? Please help. I get frustrated sometimes.  He doesn't want to potty at all! I did train him before but now that he understands, he doesn't want to go to potty. URL regex passed by regex buddy but failed by Dart Prove that $\left(1+\dfrac{1}{1^3}\right)\left(1+\dfrac{1}{2^3}\right)\cdots\left(1+\dfrac{1}{n^3}\right)&lt;3$   for all positive integers $n$   This problem is copied from Math Olympiad Treasures by Titu Andreescu and Bogdan Enescu.They start by stating that induction wouldn't directly work here since the right hand side stays constant while the left increases.They get rid of this problem by strengthening the hypothesis.$$\left(1+\dfrac{1}{1^3}\right)\left(1+\dfrac{1}{2^3}\right)\cdots\left(1+\dfrac{1}{n^3}\right)\le3-\dfrac{1}{n}$$ and then proceed by induction.  The problem is that I can't find a motivation for the above change.I mean,we could have subtracted a lot of things from the RHS but what should nudge us to try $\dfrac{1}{n}$?The rest of the proof is quite standard,but I can't see how I am supposed to have thought of it.Is it just experience?Or is it a standard technique?A little guidance and motivation will be appreciated. Identity involving Euler's totient function: $\sum \limits_{k=1}^n \left\lfloor \frac{n}{k} \right\rfloor \varphi(k) = \frac{n(n+1)}{2}$ Let $\varphi(n)$ be Euler's totient function, the number of positive integers less than or equal to $n$ and relatively prime to $n$.    Challenge: Prove  $$\sum_{k=1}^n \left\lfloor \frac{n}{k} \right\rfloor \varphi(k) = \frac{n(n+1)}{2}.$$   I have two proofs, one of which is partially combinatorial.    I'm posing this problem partly because I think some folks on this site would be interested in working on it and partly because I would like to see a purely combinatorial proof.  (But please post any proofs; I would be interested in noncombinatorial ones, too.  I've learned a lot on this site by reading alternative proofs of results I already know.)  I'll wait a few days to give others a chance to respond before posting my proofs.  EDIT: The two proofs in full are now given among the answers. xdg-open on debian 9 fails to open browser I decided to try lxdm (was using fluxbox and xfce), and discovered that for many programs the url handler was failing, producing this error message;   Quite strange as you can see, it's prepending the user directory to the url.  The example here is from telegram, but it happens in discord, as well as when executing from the command line; xdg-open https://www.google.com produces a similar error. xdg-settings get default-web-browser output's firefox.desktop which works as a link in both xfce and lxdm.  More information; I ran bash -x on it and...  $ bash -x /usr/bin/xdg-open http://www.google.com + check_common_commands http://www.google.com + '[' 1 -gt 0 ']' + parm=http://www.google.com + shift + case "$parm" in + '[' 0 -gt 0 ']' + '[' -z '' ']' + unset XDG_UTILS_DEBUG_LEVEL + '[' 0 -lt 1 ']' + xdg_redirect_output=' &gt; /dev/null 2&gt; /dev/null' + '[' xhttp://www.google.com '!=' x ']' + url= + '[' 1 -gt 0 ']' + parm=http://www.google.com + shift + case "$parm" in + '[' -n '' ']' + url=http://www.google.com + '[' 0 -gt 0 ']' + '[' -z http://www.google.com ']' + detectDE + unset GREP_OPTIONS + '[' -n LXDE ']' + case "${XDG_CURRENT_DESKTOP}" in + DE=lxde + '[' xlxde = x ']' + '[' xlxde = x ']' + '[' xlxde = x ']' + '[' xlxde = xgnome ']' + '[' -f /run/user/1000/flatpak-info ']' + '[' xlxde = x ']' + DEBUG 2 'Selected DE lxde' + '[' -z '' ']' + return 0 + case "${BROWSER}" in + case "$DE" in + open_lxde http://www.google.com + pcmanfm --help -a is_file_url_or_path http://www.google.com ++ file_url_to_path http://www.google.com ++ local file=http://www.google.com ++ echo http://www.google.com ++ grep -q '^file:///' ++ echo http://www.google.com + local file=http://www.google.com + echo http://www.google.com + grep -q '^/' ++ pwd + file=/home/nesmerrill/.local/share/applications/http://www.google.com + pcmanfm /home/nesmerrill/.local/share/applications/http://www.google.com + '[' 0 -eq 0 ']' + exit_success + '[' 0 -gt 0 ']' + exit 0   The important part seems to be pcmanfm --help -a is_file_url_or_path http://www.google.com but, that command if that's how it was used, doesn't seem to do much of anything?  $ pcmanfm --help -a is_file_url_or_path http://www.google.com Usage:   pcmanfm [OPTION…] [FILE1, FILE2,...]    Help Options:   -h, --help                   Show help options   --help-all                   Show all help options   --help-gtk                   Show GTK+ Options  Application Options:   -p, --profile=PROFILE        Name of configuration profile   -d, --daemon-mode            Run PCManFM as a daemon   --no-desktop                 No function. Just to be compatible with nautilus   --desktop                    Launch desktop manager   --desktop-off                Turn off desktop manager if it's running   --desktop-pref               Open desktop preference dialog   --one-screen                 Use --desktop option only for one screen   -w, --set-wallpaper=FILE     Set desktop wallpaper from image FILE   --wallpaper-mode=MODE        Set mode of desktop wallpaper. MODE=(color|stretch|fit|crop|center|tile|screen)   --show-pref=N                Open Preferences dialog on the page N   -n, --new-win                Open new window   -f, --find-files             Open a Find Files window   --role=ROLE                  Window role for usage by window manager   --display=DISPLAY            X display to use Add Virtualbox Shortcut in Unity Launcher to boot to a VM What is a good way to draw images using pygame? options for appearance of links in hyperref Definition of Statistic I keep seeing conflicting definitions of a statistic. Is a statistic a random variable such that it is a function of the random variables of a random sample? Or is it the value of the function of the random sample, after each random variable of the random sample has taken on a specific value?   $$(1) \ S=f(X_1,X_2...X_n)$$  $$(2) \ s=f(x_1,x_2...x_n)$$  I haven't been able to get any clarification for this and I've seen the term statistic describe both situations How can I find out which app is putting ads in my notification bar? Possible Duplicate:          Recently advertisements have started appearing as notifications in my phone's notification bar. The icon on the ad are either a green plus sign or a white star with a red circle inside it. There is no indication in the notification as to which app it came from.  I haven't installed any new applications, so I assume that some application updated to include this intrusive new ad system. Ads only show up at irregular intervals once every few hours, so removing all my apps one by one until the ads stop is not really a viable option, since I would have to wait several hours in between each uninstall to see if another ad appears. (I'm sure this is by design.)  So is there any way to figure out the source application of these notification ads?  My phone is a rooted/unlocked/whatever HTC Droid Incredible running MIUI. Why does $(\frac{p-1}{2}!)^2 = (-1)^{\frac{p+1}{2}}$ mod $p$? Assume $p$ is prime and $p\ge 3$.  Through experimentation, I can see that it's probably true. Using Wilson's theorem and Fermat's little theorem, it's equivalent to saying $2^2 4^2 6^2 \cdots (p-1)^2 = (-1)^{\frac{p+1}{2}}$ mod $p$, but I can't figure out any more than that. If A and B are symmetric is AB=BA true? Question  if we have matrices $A$ and $B$ which are symmetric. Both of these satisfy: $$  A=A^T$$ Is $AB=BA$ true ?  Attempt to solve  Now if $A$ and $B$ are symmetric then $AB$ most be symmetric too.  $$ AB=(AB)^T=B^TA^T=BA $$  problem is how do you proof that if $A$ and $B$ are symmetric also $AB$ is symmetric ?  If somone could provide some insight on this that would ge highly appreciated.  Thanks,  Tuki cron job schedule How do I implement a draggable tab using Java Swing? Instead of the static JTabbedPane I would like to drag-and-drop a tab to different position to rearrange the tabs.  EDIT: . Can I reposition AdSense ads with Javascript (for responsive purposes)? I have a responsive blog where ads are displayed in the sidebar. On mobile devices however, the sidebar is pushed to the bottom below the posts.   So what I'd like to do is move the ads from the sidebar and insert them into the post itself on mobile devices   I do this using javascript:  &lt;div id="main"&gt;     &lt;div id="article"&gt;         &lt;div class="post"&gt;             &lt;p class="intro"&gt;&lt;/p&gt;             &lt;p class="text"&gt;&lt;/p&gt;         &lt;/div&gt;     &lt;/div&gt;     &lt;div id="sidebar"&gt;         &lt;div class="adbox-1"&gt;&lt;/div&gt;     &lt;/div&gt;     &lt;/div&gt;  &lt;script&gt;     jQuery(document).ready(function(){          // AD REPOSITION         if ($(window).width() &lt; 769) {             $('.ad-box1').insertAfter($('.intro'));                    }      }); &lt;/script&gt;   The ads are always loaded in the sidebar, but if the screen width is below 768px, they will be moved somewhere else.  I wonder if this would violate AdSense terms of service? CSS3 selector to find the 2nd div of the same class I need a CSS selector that can find the 2nd div of 2 that has the same class. I've looked at nth-child() but it's not what I want since I can't see a way to further clarify what class I want. These 2 divs will be siblings in the document if that helps.  My HTML looks something like this:  &lt;div class="foo"&gt;...&lt;/div&gt; &lt;div class="bar"&gt;...&lt;/div&gt; &lt;div class="baz"&gt;...&lt;/div&gt; &lt;div class="bar"&gt;...&lt;/div&gt;   And I want the 2nd div.bar (or the last div.bar would work too). Inverse Laplace transform of $\frac{1}{s\sinh{c\sqrt{s}}}$ I have some questions.  I have to take the inverse Laplace transform of the given function below by residue theorem:   $\frac{1}{s\sinh{c\sqrt{s}}}$   where s is Laplacian variable and c is a real constant. Actually it has a very crowded numerator which I do not need to define. So far I know that it has a simple pole at s = zero and infinitely many poles at c√s = nπi  Questions:  1- What is the order of the poles at nπi? Is it 1/2?  2- At zero, what is the order? (Because to residue at zero, s also contributes)  3- What is the way of solving this question at nπi by residue theorem (without defining sinh function as exponential function)?  Thanks for any help. Why is gradient the direction of steepest ascent? How to find all the available tools in mac terminal? I am trying to setup a bunch of development projects in my Mac. I have to run various tools like python, ruby, scala, groovy etc.  To see if a tool is available I use options like   ruby --version.    Instead I would like to see all the list of tools available in Mac terminal via a single command. What is the command/options for it?