Im trying to find a regex with whom i can split a certain Text by any possible new character. I know that i could use "\\r?\\n" as regex which would work in almost every case and for almost every platform.  But today i faced a problem where im receiving a String from a Swing component which can't be splitted with this regex like i was hoping.  If the String is printed into the eclipse console i can see that there are linebreaks but probably not using \r\n for linebreaks (dont know yet which special character it is actually, i can see only a the newlines in eclipse console and didn't find a way to display the unicode character for example).  After searching a while for a solution how i can determine these newlines i found another regex which is able to find these line breaks:  Matcher matcher = Pattern.compile("^(.*)$", Pattern.MULTILINE).matcher(&gt;&gt;String&lt;&lt;&lt;);   Now im searching for a way how to combine these regex's or use just one expression to find just any newline.  Anyone a idea?  I found the reason:  My Text had some trailing new lines and i was using the wrong String split function. Instead of using  text.split("\\r?\\n")   i had to use   text.split("\\r?\\n", -1)   to get all lines...
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"); }
Transferring a Windows 8 license and proper un- and reinstallation Long story short  I have two computers: a laptop and a desktop computer. Both have Windows 7 on them.  I buy the Windows 8 Pro upgrade. To see if it screws up anything, I install it on my laptop as a guinea pig. I intend to use Windows 8 for my main computer, my desktop, but I want to test it on the laptop, so I know I don’t risk losing access to my desktop and the data on it. I never use my laptop, and only used it, because it already has a Windows 7 installation on it.  The problem  At some point, I must have entered the license key on my laptop, because when I go to the activation screen on my desktop, I get this:    Uh-oh. I can’t use the key on my desktop. Now how the hell do I transfer the key from my laptop to my desktop computer?  Answers and suggestions so far  Let’s just say that I tried everything possible to get some answers on this matter. The best response I got from Microsoft is this:     To install Windows 8 on your desktop, do the following:         Uninstall Windows 8 on your laptop   Afterwards, install Windows 8 on your desktop   If it won’t activate, call product activation at (...)      I am not a fan of that last point. The error message does allude to such a solution, however:     If you’ve reinstalled Windows or made changes to your hardware recently, you may be able to use your current key.   The question  My main question is this: has anyone been in a similar situation, and if so, what did you do to resolve this?  Failing that, what is the proper way to   uninstall the Windows 8 installation on my laptop, and reinstall the Windows 8 installation on my desktop?   Ad 1  I have already tried using the “reset” feature on my laptop, but that only resulted in a new Windows 8 installation that was already activated. But which is the right way to uninstall the installation in a way that allows me to use the license key on the desktop computer?  Ad 2  Which is the proper way to reinstall the Windows 8 installation on my desktop computer? Why do I even have to reinstall it in the first place?  I won’t get around to do this, until my USB key with 3.0 support arrives in the mail, but it is going to be a while, until I find a assuaging response to the best way to go about this anyway. How to select distinct field values using Solr? I have had the last Ubuntu distro (10.something) installed for a year and love it.  But I have run in to an issue when I tried to upgrade it to the latest one it did not work and there has come some serious issues now with almost everything and I want to remove Ubuntu completely and install the new one.  How can I remove the operating system (I don’t mind formatting the whole thing if that’s what’s needed). What is scientific mind? How can you define scientific mind? What i think , it is a bend of mind that can be developed by any person(also one not related to field of science).This mind is fulfilled with abilities to observe clearly and sceptical about what he sees.It means the person will be keen to dig out truth and did not reaches to a conclusion easily. He utilizes facts enhance them with logical reasoning and fills the gap with their imagination.  Is there any disadvantage or any kind of limitation with scientific mind? In HTML5, can the  and  tags appear outside of the  tag? Fastest way to try all passwords Suppose you have a computer with a password of length $k$ in an alphabet of $n$ letters.  You can write an arbitrarly long word and the computer will try all the subwords of $k$ consecutive letters. What is the smallest word that contains all combinations of $k$ letters as subword? (i.e. the fastest way to hack the computer :) )  The smallest word that contains $n^k$ subwords of size $k$ has length $k-1+n^k$ and based on some easy cases, we would like to prove that it is in fact possible to find a word of such length that contains all possible passwords. The problem can be translated into a problem in graph theory, by taking as vertices all words of length $k$.  We tried $k=2$, where you can prove the conjecture by induction. For $n=2$ and small $k$ it also works. Load a resource contained in a jar In my application I load resources in this manner:  WinProcessor.class.getResource("repository").toString();   and this gives me:  file:/root/app/repository   (and I replace "file:" with empty string)   This works fine when I run my application from the IDE, but when I run the jar of my application:  java -jar app.jar   The path becomes:  jar:/root/app.jar!/repository   is there any way to solve this problem?  I'll use the "repository" dir name in order to create this:  ConfigurationContext ctx = (ConfigurationContext) ConfigurationContextFactory.createConfigurationContextFromFileSystem(repositoryString, null);   In the same manner, I'll get one file name (instead of a dir) and I'll use it this way:  System.setProperty("javax.net.ssl.trustStore", fileNameString) For a certain Hibernate entity we have a requirement to store its creation time and the last time it was updated.  How would you design this?   What data types would you use in the database (assuming MySQL, possibly in a different timezone that the JVM)?  Will the data types be timezone-aware? What data types would you use in Java (Date, Calendar, long, ...)? Whom would you make responsible for setting the timestamps&mdash;the database, the ORM framework (Hibernate), or the application programmer? What annotations would you use for the mapping (e.g. @Temporal)?   I'm not only looking for a working solution, but for a safe and well-designed solution. Is there a route that would allow travel to the US from the UK or Schengen area, given the US travel ban? I'm a European citizen living in the US on a work visa. Due to some unfortunate circumstances, I need to urgently visit my home country. However I would like to get back to the US after my visit is complete. Flying from the US to Europe is not a problem as there are still daily flights between some city pairs. However going back could be tricky, as  anyone who has been in the Schengen area in the past 14 days from re-entering the country.   Is there a flight route that would let me from Europe to some country, stay there for 14 days and then fly to the US? Canada is out, as they've banned international visitors. Mexico seems to keep their border open, but I  any direct European flights from their airports. Almost every other country either suspended flights or doesn't allow foreign nationals to enter. Two identical files; Apache says one is forbidden I work behind an really annoying firewall, and I just want the net admin to add all the SE websites to the whitelist. Right now I've lost access to Stack Overflow's authentication, but not Meta's... so I have to come here before I log in there.  It's driving me nuts. Basically I just want to add an exclusion rule for all SE domains; not only the website domains, but also the content domains such as gravatar.com, quantserve.com, the domain that holds static content, etc... Video editing. Audio and Video strip have different length Proving the AM-GM inequality for 2 numbers $\sqrt{xy}\le\frac{x+y}2$ I am having trouble with this problem from my latest homework.  Prove the arithmetic-geometric mean inequality. That is, for two positive real numbers $x,y$, we have $$ \sqrt{xy}≤ \frac{x+y}{2} .$$ Furthermore, equality occurs if and only if $x = y$.  Any and all help would be appreciated. My prof gave us this definition of an Echelon system:     A system of m linear equations in n variables is called an echelon system if         m ≤ n.   Every variable is the leading variable of at most one equation.   Every leading variable is to the left of the leading variables of all lower equations.   Every equation has a leading variable.      I don't understand this definition at all.  Q1)If you have this system of equations:  $ax_1 + bx_2 + cx_3 = z$  $dx_1 + ex_2 + fx_3 = z$  its not an echelon system because of multiple equations having the same variable as the leading variable and therefore violating rule #2.  But if you switch around variables and rewrite the equation as:  $ax_1 + bx_2 + cx_3 = z$  $ex_2 + dx_1 + fx_3 = z$  It becomes an echelon system! Why would the way you write a system of equations affect its definition?  Q2)Why would point number three matter? Can't you just move around the equations so that they are in order of variables?  Q3)Why would point number four matter? If you have a equation in the system that doesn't have a leading variable can't you just disregard it? For example if you have the equation $0x = 0$ in the equation can't you just ignore it to have a echelon system since it doesn't affect the solution of the system? Both apt-get update and upgrade hang:  sudo apt-get update [sudo] password for xxx:  0% [Connecting to archive.ubuntu.com (2001:67c:1360:8001::17)]   I'm able to ping archive.ubuntu.com:  ping archive.ubuntu.com PING archive.ubuntu.com (91.189.88.162) 56(84) bytes of data. 64 bytes from yukinko.canonical.com (91.189.88.162): icmp_seq=1 ttl=50 time=42.2 ms 64 bytes from yukinko.canonical.com (91.189.88.162): icmp_seq=2 ttl=50 time=42.1 ms 64 bytes from yukinko.canonical.com (91.189.88.162): icmp_seq=3 ttl=50 time=42.1 ms ^C --- archive.ubuntu.com ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2002ms rtt min/avg/max/mdev = 42.169/42.206/42.265/0.240 ms   I checked , and I don't think its the same issue.  Any tips for investigating this further? The Time That 2 Masses Will Collide Due To Newtonian Gravity Number of equivalence relations on a set If a set has $n$ elements then what are maximum number of equivalence classes and equivalence relations possible on it? In Pokémon Sun and Moon, when you've finished the game you can switch day and night by going though the wormhole at the altar where you've caught the box legendary. Are there any more differences when going through the wormhole, excluding the day or night difference? For example, the altar of the sunne and altar of the moone switch when going through the portal. How to pick the title of a remote webpage Having Overfull and underfull box warnings. Please help out as there are many matrices and equations