I'd like to forward several ports from my local machine to a remote machine through SSH tunneling. However, I want this to happen across a single port. Is there a protocol or tool that can multiplex between a single port and multiple applications?  Edit: I am forwarding a lot of ports from a lot of machines to a single remote, and I want to multiplex them at the application level per machine to use as few ports on that remote as possible. I see solutions like sshl that can multiplex certain protocols, but I don't know of any generic solutions that can wrap the messages in a protocol-independent way.
I am trying to monitor multiple JVMs running on different servers through an ssh tunnel.  Thanks to one of the UNIX gurus here, I have managed to get this running for a single server by:   Run jstatd on the target server Set up Visual VM to use 9696 as its socks proxy port. On my local PC, run:  ssh -L 2222:server1:22 bastion-host  On my local PC, run:  ssh -o port=2222 -D 9696 -L 1099:localhost:1099 localhost    This does the trick. Now when I try and tunnel to a second server I try:   On my local PC, run:  ssh -L 3333:server2:22 bastion-host  On my local PC, run:  ssh -o port=3333 -D 9696 -L 2099:localhost:1099 localhost    However, the last step complains with:  bind: Address already in use channel_setup_fwd_listener: cannot listen to port: 9696   Has anyone managed to do something similar?  Update:  The reason this is so complex is that jstatd is an RMI server application:    As with RMI applications, these register with an rmiregistry. Using rmi through a firewall requires me to use SOCKS as described here:    Unfortunately, visualvm only lets me set the SOCKS proxy port once, and the -D option won't allow me to forward the same local port to both servers...
AC: Why differentiate between Ground and Neutral? Current flows through a conductor connecting points at different potentials.  Leaving aside multi-phase details, common/conventional AC systems use a 3-wire setup:   Wire-1: a line/live/hot/phase wire presenting a point that oscillates between 2 potentials. Wire-2: a neutral wire presenting a point of unknown/unspecified and varying potential, that nevertheless presents some fixed/specified potential difference to Wire-1 at least some of the time. Wire-3: a ground/earth wire presenting a point at 0V potential difference to its immediate physical surroundings.   Wire-1 and Wire-2, in addition to some device that is to be powered, are used to construct a closed electrical circuit. Wire-3, leaving aside EMI/shielding concerns, is used to ensure that current will flow through it, rather than the device's user, if there ever occur any faults and the device's user comes in contact with Wire-1 or Wire-2.  Additionally to this however, Wire-2 and Wire-3 are at some point connected. This is done to ensure that Wire-2's potential remains close to that of Wire-3 .. which seems to be important for some reason.  Now the part I don't understand is why there needs to be a distinction between Wire-2 and Wire-3 at the power socket, if there is none a few meters further down the line.  I have tried to look this up, but all answers I could find so far seem incomplete. The answers depend on how the question is phrased:   If the question is phrased as "Why do we need Wire-3 in addition to Wire-2" the answer is because "Wire-2 may be at a substantial potential difference to its surroundings/user and thus endanger him/her if he/she ever comes in contact with it or Wire-1". If the question is phrased as "Why do we need Wire-2 in addition to Wire-3" the answer is because "Wire-2 is needed to form a closed electrical circuit" or phrased somewhat differently "Wire-2 is needed to create a potential difference to Wire-1 and thus for current to flow" .. with the argument further being that when taking practical considerations into account Wire-3 can't provide a reliable/stable potential difference to Wire-1 like Wire-2 can.   This doesn't really answer why there's a need to differentiate between Wire-2/Wire-3 though, considering how    Wire-3 remains Wire-3 and maintains 0V potential difference to its surroundings/user, regardless of whatever else happens around it .. since that is what it's supposed to do, or phrased differently, since that is the reason for Wire-3 being useful in the first place .. right?   and   Wire-2 is connected to Wire-3   What am I missing here?    Why is it safe to touch Wire-3 but not Wire-2, or why can Wire-3 provide a level of protection that Wire-2 can't?  Why differentiate between Wire-2 and Wire-3 at the power socket but then connect them further down the line? Can I successfully bake previously-frozen bread dough? What happens if you increment an iterator that is equal to the end iterator of an STL container I know that there are questions asking like "intersection of a infinite collection of sets" and I can understand that the answer for that one is a null set, but I got a question here, in which all sets are finite and nonempty. Please take a look at the pic below.  It's a True/False question.  What I'm confused about is that the "infinity" sign in the interception. Since all sets are finite, does it mean that there are many sets in the chain are the same? (because the symbol used is for subsets not for proper subsets). Please give me some hints how I should think about this question.  Thank you How to unprotect GeneratingFunction The only solutions that I know of till now are $(x,y) = (1,1) \space , (19,7)$. We can note that: $$x^2-x+1 = y^3 \implies (2x-1)^2 = 4y^3-3$$ Thus, if odd prime $p \mid y$, then $(2x-1)^2 \equiv -3 \pmod{p}$ and thus, $-3$ is a quadratic residue. This implies that $p \equiv 1 \pmod{6}$ .  How can we further proceed into this problem?  Note: As mentioned in one of the links in the comments, if we instead replace $x$ by $x+1$, we get $x^2+x+1 = y^3$. Thus, the solutions for this is $(x,y) = (0,1) \space, (18,7)$. ... but still be required for applications that need admin privilegies?  In order to allow the following:  $ apache2ctl restart httpd not running, trying to start (13)Permission denied: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs  $ sudo !! sudo apache2ctl restart             #no password asked $                                   #works!   For reference I've seen this setup on amazon's e3 instances  Any idea? What is the Big-O time complexity of the following nested loops: for (int i = 0; i &lt; N; i++) {     for (int j = i + 1; j &lt; N; j++) {         System.out.println(&quot;i = &quot; + i + &quot; j = &quot; + j);     } }  Would it be O(N^2) still? I want to make a generic class that accepts only serializable classes, can it be done with the where constraint?  The concept I'm looking for is this:  public class MyClass&lt;T&gt; where T : //[is serializable/has the serializable attribute] Where are packages stored installed with APT in Ubuntu 16.04? I know that packages installed with apt-get are stored in /var/cache/apt/archives.  I just installed mariadb server in Ubuntu 16.04 with following command:  sudo apt install mariadb-server   When I tried to find packages in /var/cache/apt/archives, there are no packages. Where are they stored if it's not in this directory? After an AJAX request, sometimes my application may return an empty object, like:  var a = {};   How can I check whether that's the case? Cannot downgrade wpa_supplicant to fix Wi-Fi connection to a corporate network (WPA2/PEAP with no CA certificate) in Ubuntu 18.04 I recently upgraded my Ubuntu from 16.04 to 18.04 (clean install, full wipe). Now I can no longer connect to the corporate network at my office (perhaps related to these bugs: , ). What proved to fix this issue in Ubuntu 16.04 is the answer to ; Downgrade wpa_supplicant to 2.1.  However, even with the linode repository, this fix can no longer be applied. There is no version for wpa_supplicant below 2.6 to the best of my knowledge for Ubuntu 18.04.  My question is this: How can I downgrade wpa_supplicant to 2.1 for Ubuntu 18.04?  Configuration needed for corporate the wifi connection:   Security: WPA &amp; WPA2 Enterprise Authentication: Protected EAP (PEAP) Checkbox No CA certificate required. Inner authentication: MSCHAPv2 Can you enter the Schengen area with a UK visa? Can I submit an edit for approval after earning 2k reputation? I have now enough reputation points on Stack Overflow to edit every post directly. But sometimes (especially if this is about a field where I'm not savvy, or when I try to edit a question title without having understood the question itself) I might be not totally sure about whether my edit really is an improvement.  For now, I have these options:   Do the edit anyway, hope that someone else will catch it if it is wrong Don't do the edit, and hope that someone else will see this post and edit it in the right way Let a comment and hope that someone will see it (either after editing or instead of it). Flag the post for moderator attention (but will the moderators know it better?) Search the right chat room to find someone who knows more about the topic.   All these are not really optimal, I think.  I would like to have a check box     [_] Submit this edit for approval   which, when checked, would submit the edit into the usual edit approval queue. Then I would get at least one or two other pairs of eyes looking over my edit, and maybe even improving it.  (I don't really care about the +2 reputation for the edit - I think it should be without any reputation difference here.)  There's an  for nearly giving everyone the ability to suggest edits that the post owner can approve, but I'm simply interested in being able to insert them into the general edit queue where anyone can approve them.  Actually, I could do this right now by having a low-reputation sock puppet (or a totally anonymous edit), but I think this is not the intended use for sock puppets, is it? Also, I would like to be able to get feedback for my edit. How many bandits must agree? Problem  A group of $n~(1 \leq n \leq 30)$ bandits hid their stolen treasure in a room.  The treasure needs to be locked away.  The bandits want to ensure that at least $k~(1 \leq k \leq n)$ of the bandits must agree in order to retrieve the treasure.  They have decided to place multiple locks on the door such that the door can be opened if and only if all the locks are opened.  Each lock may have up to n keys, distributed to a subset of the bandits.  A group of bandits can open a particular lock if and only if someone in the group has a key to that lock.  Given $n$ and $k$, how many locks are needed such that if the keys to the locks are distributed to the bandits properly, then every group of bandits of at least size $n$ can open all the locks, and no smaller group of bandits can open all the locks?  For example, if $n=3$ and $k=2$, only 3 locks are needed - keys to lock 1 can be given to bandits 1 and 2, keys to lock 2 can be given to bandits 1 and 3, and keys to lock 3 can be given to bandits 2 and 3.  No single bandit can open all the locks, but any group of 2 bandits can open all the locks.  My thoughts  At first glance, I thought it was just a simple combinations problem ($nCr$), and the provided test cases confirmed my suspicions: when $n=3$ and $k=2$, $\binom{3}{2}=3$.  Likewise, when $n=5$ and $k=3$, $\binom{5}{3}=10$.  However, two cases where this doesn't work are where $n=2$ and $k=1$ and $n=5$, $k=4$ (it gives $2$ and $5$, respectively, when the correct answer according to the judging data should be $1$ and $10$).  Next, I bothered a colleague who's a math major, and he briefly glanced at it and suggested it might be a hypergeometric distribution problem.  However, if this is correct, I'm having trouble wrapping my head around it - all the examples I can find have 2 distinct categories, e.g. red and green marbles being drawn from an urn, and I don't see that here.  An example in the terms of this problem would be extremely helpful.  If this isn't correct, where do I go from here?  I've been spinning my wheels on it for quite a while.  Background  This is for homework for a CS class (I'm a CS major with 2 semesters of calc plus discrete).  I'd like to be able to understand the math behind it, because once I can understand it, I can program it.  This problem originally came from an ACM ICPC regional contest this year, but my professor has made it into a challenge homework problem. iPhone Apps section not showing up in iTunes how to use \input{file.tex} correctly? Suppose I have two latex files file1 and file2 with the same preamble and so on. Then I want to create a file called bigfile which just puts the two files together. This is not working for some reason. Therefore I first tried to include just file1, this is what I have done:  \documentclass .... %% same as file1 ... same preamble as file1 \begin{document} \input{file1} \end{document}   The result is that I not only get file1, but also the preamble and so on. This is my first experience with putting files together in 1 file. Kindly provide me a solution :) I have an app installed on my phone, which I've installed from the Google Play Store.  If I update the app and don't like the upgraded version, is there a way to undo the update and downgrade back to the version of the app that I had previously installed?  I tried searching a bunch on this site, and I found lots of questions about downgrading the OS/ROM/firmware, but nothing about downgrading app versions or reverting an app update. Map matrix element to string What does the "yield" keyword do? What is the use of the yield keyword in Python? What does it do? For example, I'm trying to understand this code1: def _get_child_candidates(self, distance, min_dist, max_dist):     if self._leftchild and distance - max_dist &lt; self._median:         yield self._leftchild     if self._rightchild and distance + max_dist &gt;= self._median:         yield self._rightchild    And this is the caller: result, candidates = [], [self] while candidates:     node = candidates.pop()     distance = node._get_dist(obj)     if distance &lt;= max_dist and distance &gt;= min_dist:         result.extend(node._values)     candidates.extend(node._get_child_candidates(distance, min_dist, max_dist)) return result  What happens when the method _get_child_candidates is called? Is a list returned? A single element? Is it called again? When will subsequent calls stop?   1. This piece of code was written by Jochen Schulz (jrschulz), who made a great Python library for metric spaces. This is the link to the complete source: [Module mspace][1].