I'm having a problem swapping two strings in my array. Let's say Array[0] is "Daniel" and Array[1] is "Paul", how do you go about switching them?  This is my code and it just throws a bunch of errors at me.  public void swap() {     String name1;     String name2;     String temp1;     String temp2;     System.out.print("\nWhich person would you like to swap?: ");     name1 = input.next();     System.out.print("Who are they swapping with?: ");     name2 = input.next();      for (int i = 0; i &lt;= 10; i++)     {         if(seats[i] == name1)         {             temp1 = name1;             temp2 = name2;             name1 = temp2;             name2 = temp1;               return;         }     }      System.out.println(name1 + " and " + name2 + " have been swapped.\n"); }   Any help would be greatly appreciated, thanks in advance.
I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug.  Is == bad? When should it and should it not be used? What's the difference?
There's a problem statement:     For each $m \in \mathbb{N}$, we construct a sequence $m_0$, $m_1$, $m_2,\dots$ denoted $S_m$, recursively via $m_0=m$ and      $$m_{i+1} = m_i + \left\lfloor \sqrt{m_i} \right\rfloor$$      for all $i \ge 0$.   Here, $\lfloor x \rfloor$ is the floor of $x$, the greatest integer less than or equal to $x$.   Hence, we have $\left\lfloor \sqrt{10} \right\rfloor=3$ and $\left\lfloor \sqrt{29} \right\rfloor=5$.      Show that for each positive integer $m$, the sequence $S_m$ contains the square of some integer.   I'm pretty certain that this can be proved with induction. I am just not quite sure what to induct on. Examining examples shows that $S_m$ always results in a perfect square eventually, though I'm not sure how to prove it. Which is correct, "neither is" or "neither are"? Grandi's Series; tends to $1/2$, but why is this considered a valid sum? Problem with IPv6 sudo apt-get update/upgrade I am using Ubuntu 16.04 Beta 2 at the moment and every time I try to update at home via sudo apt-get update or upgrade trough sudo apt-get upgrade I wont get any feedback. Even installing of anything will have the same result. It will just "hang up" on 0% while fetching data.  $ sudo apt-get update [sudo] password for niclas:  0% [Connecting to archive.ubuntu.com (2001:67c:1560:8001::11)] [Connecting to archive.canonical.com (2001:67c:1360:8c01::1b)]   I have no idea how to solve the problem. I already tried to ping6 archive.ubuntu.com with 100% packet loss while just ping wont have any loss.  I changed the DNS-Server (IPv4 &amp; IPv6) to Google's one no solution either. If a mass moves close to the speed of light, does it turn into a black hole? I'm a big fan of the podcast Astronomy Cast and a while back I was listening to a Q&amp;A episode they did. A listener sent in a question that I found fascinating and have been wondering about ever since.   From the show :      Arunus Gidgowdusk from Lithuania asks: "If you took a one kilogram mass and accelerated it close to the speed of light would it form into a black hole? Would it stay a black hole if you then decreased the speed?"   Dr. Gay, an astrophysicist and one of the hosts, explained that she'd asked a number of her colleagues and that none of them could provide a satisfactory answer. I asked her more recently on Facebook if anyone had come forward with one and she said they had not.  So I thought maybe this would be a good place to ask. Prove that $C\exp(x)$ is the only set of functions for which $f(x) = f'(x)$ How do I change the shortcut-key of show the unity dash? I don't want to use the Super for that, I want to use Alt+Space instead. What do I need to install LED strip lighting? I've been looking to install LED strips, either RGB or white for lighting and ambiance. It wouldn't be the main lighting of the room, so no necessity for high power LEDs.  The perimeter of the room is a little less than 25 meters. Looking around in online stores, I saw that the reels come in maximum lengths of 5 meters, so I would need five of those.  What I'm not sure is how to connect the strips together.  I was looking at , or  with .  If I choose the white LEDs, what power supply, controller, and connector would you recommend to be able to daisy chain the strips?  If I choose the RGB LEDs, what kind of data repeaters would work to be able to control all the strips at once? How can I remove excess fat from stews or soups without refrigerating? I have a TikZ picture with a node containing a minipage with an itemize environment; each item is a hyperref to other sections of the document.   When scaling the image (for example with \begin{tikzpicture}[scale=.7, transform shape] I've a strange behavior: links in itemize are not in the right place: they present a somewhat vertical offset, as if they don't scale as the rest of image.   Here the MWE:  \documentclass[a4paper]{article} \usepackage{tikz} \usepackage[pdftex]{hyperref} \begin{document}  Here something interesting\label{text:interesting-one} \newpage  Here something interesting, too\label{text:interesting-two} \newpage  and here there are very very interesting stuff\label{text:interesting-three} \newpage  \newpage Now the problem: links rectangles have some offset, making links unusable in case of long itemize  \begin{figure}[htb] \begin{tikzpicture}[scale=.7, transform shape] \node at (0,0) (mynode) { \begin{minipage}{4cm} \begin{itemize} \item \hyperref[text:interesting-one]{First link} \item \hyperref[text:interesting-two]{Second link} \item \hyperref[text:interesting-three]{Third link} \item \hyperref[text:interesting-one]{First link again} \item \hyperref[text:interesting-two]{Second link again} \item \hyperref[text:interesting-three]{Third link again} \end{itemize} \end{minipage} }; \end{tikzpicture} \end{figure} \end{document}   And here a snapshot of the problem    Note: This is evident using the default settings of hyperref package, which draws the red rectangle around links, but it took me some time to found it when only the text is coloured, i.e. when using \usepackage[linkcolor=blue,colorlinks=true]{hyperref} How to stop "Monkey Test" and "Time Service" apps When I long-press the "home" button to close all apps, there is an app named "time service" with android symbol and another named "monkey test" that are always open.   How to stop this? Let $f \in L^1(\mathbb{R})$, for $a\in \mathbb{R}$ let $f_a(x)=f(x-a)$, prove that: $$\lim_{a\rightarrow 0}\|f_a -f \|_1=0$$  I know that there exists $g\in C(\mathbb{R})$ s.t $\|f-g\|_1 \leq \epsilon$, this is also true for $f_a$ and $g_a$.  Now I have the next estimation:  \begin{align*} \|f_a-f\|_1 &amp;= \int_{\mathbb{R}} |f(x)-f(x-a)| dx \\ &amp;= \int |f(x)-g(x)+g(x)-g(x-a)+g(x-a)-f(x-a)| \\ &amp;\leq \|f-g\|_1 + \|f_a-g_a\|_1 + \int |g(x)-g(x-a)| \end{align*} my question is: I can argue that $\lim_{a\to0} \int |g(x)-g(x-a)| = \lim_{a\to0} \lim_{T\to\infty} |g(x_0)-g(x_0-a)| 2T$, now I think that I can change the order of the limits here, but I am not sure why?  P.s $x_0$ is some point in $[-T,T]$, and the above is valid from the intermediate integral theorem for continuous functions, right?  Thanks. kidle_inject causing very high load Whenever kidle_inject starts running on my system the load shoots up. In general it only gets to a load of around this 5.23, 3.65, 2.54 but a lot of the time it jumps up past the 15 mark on each of them. At that point the system grinds to a halt and I have to power it off.  This only happens when the kidle_inject process starts. How can I disable this process so my machine can work and I can get some work done.  Example top:  top - 12:43:48 up  3:02,  3 users,  load average: 6.57, 5.53, 3.33 Tasks: 256 total,   3 running, 253 sleeping,   0 stopped,   0 zombie %Cpu(s):  5.9 us, 16.6 sy,  0.0 ni, 74.7 id,  0.5 wa,  0.0 hi,  2.3 si,  0.0 st KiB Mem:   8080252 total,  7937856 used,   142396 free,   258904 buffers KiB Swap:        0 total,        0 used,        0 free.  4061336 cached Mem    PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND 13509 root     -51   0       0      0      0 S  54.7  0.0   3:29.47 kidle_inject/1 13511 root     -51   0       0      0      0 S  54.1  0.0   3:30.92 kidle_inject/3 13510 root     -51   0       0      0      0 S  48.8  0.0   3:11.60 kidle_inject/2 13508 root     -51   0       0      0      0 S  47.6  0.0   3:08.47 kidle_inject/0 What is the difference between 'git pull' and 'git fetch'? What is the name of the problem where lines appear in a photo where there should just be a smooth gradient? How do I forward/NAT all traffic to one interface/IP to a remote IP? I have one "server A" that has multiple IPs attached to it, like so:  eth0:0 1.1.1.1 eth0:1 1.1.1.2 eth0:2 1.1.1.3   I have another "server B" that also has multiple IPs attached to it, like so:  eth0:0 2.2.2.1 eth0:1 2.2.2.2 eth0:2 2.2.2.3   Now, I want to setup iptables on "Server A" to forward/NAT all incomming traffic on "eth0:2" to IP 2.2.2.3 on "Server B".  I have verified that "Server A" is able to "talk" to "Server B" on IP 2.2.2.3. Ping and telnet to open ports works just fine and I have the forward-flag turned on (net.ipv4.ip_forward=1)  I have tried multiple different ways, DNAT, SNAT, MASQUERADE etc, but I cannot get anything to work.  This line works fine if I try to forward traffic between IPs on the SAME server:  iptables -t nat -A PREROUTING -d 1.1.1.3 -j DNAT --to-destination 1.1.1.2   But if I switch out the "1.1.1.2" for "2.2.2.3", it does not work.  I assume that I need a second iptable rule to solve it. I have tried with the following POSTROUTING rules without any luck (not at the same time):  iptables -t nat -A POSTROUTING -d 2.2.2.3 -j MASQUERADE iptables -t nat -A POSTROUTING -d 2.2.2.3 -j SNAT --to 1.1.1.3 iptables -t nat -A POSTROUTING -j MASQUERADE   What am I missing?  EDIT 1:  I finally got it to work by using the following:  net.bridge.bridge-nf-call-iptables=0  iptables -t nat -A PREROUTING -d 1.1.1.3 -j DNAT --to-destination 2.2.2.3 iptables -t nat -A POSTROUTING -d 2.2.2.3 -j SNAT --to 1.1.1.3   However, now another problem appeared. All logs etc on server 2.2.2.3 shows that ALL traffic now comes from 1.1.1.3, like apache logs, mail logs etc. I assume this is the nature of NAT.   However, when I do standard port forwarding on my home-router to my laptop that is running apache, I see the original "requester IP" in the logs. So, how does the router do this? And how can I do the same on my server setup?  Bottom line, I want to forward all traffic from Server A (1.1.1.3) to Server B (2.2.2.3), BUT I also want to be able to see where the traffic came from on Server B (2.2.2.3), i.e the apache logs should show the original IP of the requester.  I assume I should use some other way than NAT to make this happen, and it should be possible, as even my simple home-router is able to do this.  One extra thing, the IPs attached to Server A and Server B is LOCKED to each respective server. Thus, Server A is NOT able to send out traffic FROM IP 2.2.2.3. It is locked by my provider in the router. What rules govern forced removal from flights (due to overbooking)? I was recently surprised to see  because his flight was overbooked.  He was reportedly a doctor who needed to see patients the next morning, so he did not really want to get off, justifying the use of force.  I knew that airlines could overbook flights and deny boarding to some passengers, but I thought that kind of boarding denial would happen at the gate and that once folks had been let on, those denied boarding would be those arriving later to the gate.    Why or in what conditions is this kind of forcible removal considered OK?    Clarification following close votes from people who think this question is primarily opinion-based: By "OK" I mean the sense of "legally OK," "officially accepted," "instantiated as policy," "sanctioned by authorities," or "OK according to the regulations and policies and laws and whatever other formal rules govern forced removal from flights due to overbooking." Whether or not you personally consider it socially acceptable does not matter as an answer, unless you have formalized that into a citeable adopted form that governs what happens and want to explain the reasoning behind that rule. Categorize my data into 3 groups Adding values to a C# array Ubuntu 14.04 System Logging