So I created a method that takes in a 2D char array that was originally from a text file and would end up outputting a string array. The only problem is the string.split() method doesn't take into account new lines or empty lines and I need the string.length() to be accurate to obtain a word count. Is there code that I am missing? This is the code I have so far.      public static String[] textString(char[][] text) {     String string = "";     for (int i = 0; i &lt; text.length; i++) {         for (int k = 0; k &lt; text[i].length; k++) {             string += text[i][k];         }         string += "\n";     }     String[] stringA = string.split(" ");     return stringA; }
I'm trying to split text in a JTextArea using a regex to split the String by \n However, this does not work and I also tried by \r\n|\r|n and many other combination of regexes. Code:  public void insertUpdate(DocumentEvent e) {     String split[], docStr = null;     Document textAreaDoc = (Document)e.getDocument();      try {         docStr = textAreaDoc.getText(textAreaDoc.getStartPosition().getOffset(), textAreaDoc.getEndPosition().getOffset());     } catch (BadLocationException e1) {         // TODO Auto-generated catch block         e1.printStackTrace();     }      split = docStr.split("\\n"); }
Mount cifs Network Drive: write permissions and chown I have access to a cifs network drive. When I mount it under my OSX machine, I can read and write from and to it.   When I mount the drive in ubuntu, using:  sudo mount -t cifs -o username=${USER},password=${PASSWORD} //server-address/folder /mount/path/on/ubuntu   I am not able to write to the network drive, but I can read from it. I have checked the permissions and owner of the mount folder, they look like:  4.0K drwxr-xr-x  4 root root    0 Nov 12  2010 Mounted_folder   I cannot change the owner, because I get the error:  chown: changing ownership of `/Volumes/Mounted_folder': Not a directory   When I descend deeper into the network drive, and change the ownership there, I get the error that I have no permission to change the folder´s owner.  What should I do to activate my write permission? My keyboard is typing by itself, could there be a ghost in it? When I was using ubuntu 14.04, it's easy to set title. Just press F2 or move mouse to top menu. But there is no menu on ubuntu 16.04 and press F2 can't change the title. What should I do? I've been using the $K$-fold cross-validation a few times now to evaluate performance of some learning algorithms, but I've always been puzzled as to how I should choose the value of $K$.  I've often seen and used a value of $K = 10$, but this seems totally arbitrary to me, and I now just use $10$ by habit instead of thinking it over. To me it seems that you're getting a better granularity as you improve the value of $K$, so ideally you should make your $K$ very large, but there is also a risk to be biased.  I'd like to know what the value of $K$ should depend on, and how I should be thinking about this when I evaluate my algorithm. Does it change something if I use the stratified version of the cross-validation or not? Find all solutions to the functional equation $f(x) +f(x+y)=y+2 $ Is it possible to make LaTeX mark overfull boxes in the output? Is it possible to make LaTeX mark overfull boxes in the output, for example by drawing red rectangles in the PDF where the boxes overflow? The purpose -- to more easily "see" where the problems are in the output. I am reading separable extension. I don't quite understand why $\text{char} 0$ fields must be perfect. If $F$ is a $\text{char} 0$ field, $f(x)$ is an irreducible polynomial in $F[x]$. Then why $f$ must be separable? Assume $f$ has multiple roots, say $r$ is a multiple root of $f(x)$. Then $r$ is also a root of $f'(x)$. $r$ is in the splitting field of $f(x)$ over $F$, denote it as $E$. Then why $f$ must divide $f'$? I know $f$ is irreducible but I don't know how the argument goes on. Thanks for any help! I came across the following question:    This can be easily flagged for too broad or opinion based, but I wonder on which stack-exchange site can one ask answers for such a question? How to interpret a quantum circuit as a matrix? If $a,b,c$ are positive , show that $$\dfrac{b^2+c^2}{b+c}+\dfrac{c^2+a^2}{c+a}+\dfrac{a^2+b^2}{a+b} \ge a+b+c$$  Trial: Here  I proceed in this way $$\dfrac{b^2+c^2}{b+c}+\dfrac{c^2+a^2}{c+a}+\dfrac{a^2+b^2}{a+b} \ge  \dfrac{2bc}{b+c}+\dfrac{2ca}{c+a}+\dfrac{2ab}{a+b}$$ then how I proceed. Please help. How can I join these two meshes in a proper way? I know I can Ctrl J to join them, but how can I do so without having overlapping faces? Different results between individual and batch clip of rasters in QGIS? How to choose a specific weight from a font family using fontspec and XeLaTeX Why Did Anakin Skywalker Believe that Turning to the Dark Side of the Force Would Save Padmé? Just as the question asks: Why did Anakin come to believe that Padmé could be saved if he embraced the Dark side of the Force? Padmé clearly didn't believe it. Why was Anakin so driven to save Padmé through the dark side? Question: Let $a, b \in \mathbb{R}$ with $a &lt; b$ and let $f: [a,b] \rightarrow [a,b]$ continuous. Show: $f$ has a fixed point, that is, there is an $x \in [a,b]$ with $f(x)=x$.  I suppose this has to do with the basic definition of continuity. The definition I am using is that $f$ is continuous at $a$ if $\displaystyle \lim_{x \to a} f(x)$ exists and if $\displaystyle \lim_{x \to a} f(x) = f(a)$. I must not be understanding it, since I am not sure how to begin showing this... Should I be trying to show that $x$ is both greater than or equal to and less than or equal to $\displaystyle \lim_{x \to a} f(x)$ ? When did you wake up?      I woke up at 10.   But then if I say, “When did you sleep?”     I slept at 10. – seems difficult to digest!   That's because sleep is a process that includes duration.     I slept for 10 hours. – this way, it's digestible!   But when I mention the point of time, is it okay?   Strange thing is, if I'm describing my habit/routine, it's perfectly fine..     I sleep at/by 10     I request not to take this question 'logically'. It's about English. Nobody is perfect in timing. Please don't argue that you cannot have 'perfect time' of sleeping because you don't know when you slept. I'm talking about the sentence structure and not precise timings.   By the way, “I slept at 10” is very common in India. Reputation block layout after earning new privilege On the mobile web after new privilege is earned, reputation block contains some design issues:   no margins poor text color inside bar         By tapping on "track the next one" link, page have been refreshed:   no margins empty block in the middle obscure content         Only after manual refreshing, page looks fine again:        It is hard to reproduce because you need to earn next privilege which takes a lot of time. But I believe it's no too hard for developers :) What would be the Slater's determinant representation for an excited state? Setup  Introducing this spinorbital notation:  \begin{align} \Psi_1=\chi_{(r1)}\alpha_{(\omega1)}  = 1 \\ \Psi_1=\chi_{(r1)}\beta_{(\omega1)}  = \bar{1} \end{align}  and the Slater's determinant, for a system of two electrons, is:  \begin{align} |\Psi\rangle = \frac{1}{\sqrt{2}} \Big|  \begin{array}{cc} 1 &amp; \bar{1}  \\ 2 &amp; \bar{2}  \\ \end{array}  \Big| = \frac{|1\bar{2}\rangle-|\bar{1}2\rangle}{\sqrt2} \end{align}  Question  Based on the example, what would be the Slater's determinant representation for an excited state like $\Psi_a^r$ (i.e. with parallel spins like: $|\bar{1}\bar{2}\rangle$) and $\Psi_{ab}^{rs}$ (feel free to use any number) ? distribution upgrade 14.04 to 15.04 halted due to multiple errors Can we get wordpress.stackexchange.com added to the list of off-topic redirection sites? I'm noticing a lot of WordPress questions being asked on Stack Overflow lately. I can't flag these to be moved to wordpress.stackexchange.com because it's not in the list:    Can it be added? Are there any other Stack Exchange sites worth adding?