In an application I am building, so far I have three classes for the user interface. I have a FrameGUI class which extends JFrame and acts as a container for two other classes I have created: StartScreenGUI and MainGameGUI - both of which extend JPanel and hold different buttons depending on the job of the interface.  FrameGUI (very simplified version):      class FrameGUI extends JFrame     {         private Container contentPane;         private StartScreenGUI screenFirst;         private MainGameGUI gameScreen;          public FrameGUI()         {             gameScreen = new MainGameGUI();             screenFirst = new StartScreenGUI();             contentPane.add(screenFirst);         }          public void swapScreen(MainGameGUI gameScreen)         {             contentPane.remove(screenFirst);             contentPane.add(gameScreen);         }     }   The problem is, in the StartScreenGUI class there is a button Continue that when clicked I want to call the swapScreen method so the user can progress to the next screen. However it cannot access the method as it isn't "aware" of the instance of the FrameGUI class defined in the main method.  Is there a way around this or an entirely different approach I could take that is much better? If possible I would like to avoid having multiple frames and just closing the top most frame when it is finished with.
To put it simple, there's a simple java swing app that consists of JFrame with some components in it. One of the components is a JPanel that is meant to be replaced by another JPanel on user action.  So, what's the correct way of doing such a thing? I've tried  panel = new CustomJPanelWithComponentsOnIt(); parentFrameJPanelBelongsTo.pack();   but this won't work. What would you suggest?
htdigest file format Show that quotient rings are not isomorphic I've been given a homework problem that requires me to show that the rings $\mathbb{C}[x,y]/(y - x^2)$ and $\mathbb{C}[x,y]/(xy-1)$ are not isomorphic.    This is my attempt at a solution:  For $\mathbb{C}[x,y]/(y - x^2)$, we can parametrize in the following way: $x = t$ and $y = t^2$. Then this ring is isomorphic to $\mathbb{C}[t]$.  For $\mathbb{C}[x,y]/(xy-1)$, we can parametrize $x = t$ and $ y = 1/t$. Then this is isomorphic to $\mathbb{C}[t, 1/t]$.   But $\mathbb{C}[t, 1/t]$ is not isomorphic to $\mathbb{C}[t]$.  Am I on the right track? If not, any helpful hints? Syntax highlighting in app differs from normal web view Iterating each character in a string using Python How do I read an entire file into a std::string in C++? $$f(x,y) = \left\{\begin{array}{cc} \frac{xy}{x^2+y^2} &amp; (x,y)\neq(0,0) \\ f(x,y) = 0 &amp; (x,y)=(0,0) \end{array}\right.$$  In order to verify if this function is differentiable, I tried to prove it by the theorem that says that if $\frac{∂f}{∂x}$ and $\frac{∂f}{∂y}$ exist and are continuous at the point $(x_0,y_0)$, then the function is differentiable at this point. So I did:  $$\frac{\partial f}{\partial x}(0,0) = \lim_{h\to 0}\frac{f(0+h,0)-f(0,0)}{h} = 0$$ $$\frac{\partial f}{\partial y}(0,0) = \lim_{h\to 0}\frac{f(0,0+h)-f(0,0)}{h} = 0$$  so we have that the partial derivatives at point $(0,0)$ is $0$. Now, if we take the derivative at $(x,y)\neq (0,0)$ and then take the limit of it as $(x,y)\to(0,0)$, we can see if the derivatives are continuous or not. So here it is:  $$\frac{\partial f}{\partial x}(x,y) = \frac{y(y^2-x^2)}{(x^2+y^2)}$$  but   $$\lim_{(x,y)\to(0,0)} \frac{y(y^2-x^2)}{(x^2+y^2)} $$ does not exist (by wolfram alpha... but can anybody tell me an easy way to prove this limit does not exist? easier than taking the limit in different directions?), therefore the derivative is not continuous at $(0,0)$, so we can't say $f$ is differentiable at $(0,0)$, but for $(x,y)\neq (0,0)$ the function is continuous, as it is a quotient of continuous functions. So $f$ is at least differentiable at $(x,y)\neq (0,0)$.   Now, to verify differentiability at $(0,0)$ I think we must use the limit definition of differentiablity: A function is differentiable at $(0,0)$ iff: $$\lim_{(h,k)\to (0,0)} \frac{f(0+h,0+k)-f(0,0)-\frac{\partial f}{\partial x}(0,0)-\frac{\partial f}{\partial y}(0,0)}{\|(h,k)\|} = 0$$  Let's calculate this limit:  $$\lim_{(h,k)\to (0,0)} \frac{f(0+h,0+k)-f(0,0)-\frac{\partial f}{\partial x}(0,0)-\frac{\partial f}{\partial y}(0,0)}{\|(h,k)\|} = \\ \lim_{(h,k)\to (0,0)} \frac{\frac{hk}{h^2+k^2}}{\sqrt{h^2+k^2}} = \\ \lim_{(h,k)\to (0,0)} \frac{hk}{(h^2+k^2)\sqrt{h^2+k^2}}$$  which I think, it's a limit that does not exist, therefore the function isn't differentiable at $(0,0)$ As an Indian citizen, can I apply and have both a B1 and F1 visa? A Banach space is reflexive if and only if its dual is reflexive How to show that a Banach space $X$ is reflexive if and only if its dual $X'$ is reflexive? Why does Ubuntu 14.04 LTS use a non-LTS kernel version? Is a constant condition more costly than switching shaders? I'm trying to prove : Given a simple graph $G$ with $n$ vertices, where $n$ is even, prove that if every vertex has degree $\dfrac n2 + 1$, then $G$ must contain a (simple) $3$-cycle. A (simple) $3$-cycle is a set of $3$ (distinct) vertices, $a, b, c$ such that $ab$ is an edge, $bc$ is an edge and $ac$ is an edge.  I know there are similar ones already on here, but I can't comprehend any of the answers. This is what I have so far:  Base Case: Since the graph has to have at least $3$ vertices to have a simple $3$-cycle, the lowest possible even number of vertices is $n = 4$.   $\dfrac42 + 1 = 3$ degree (edges attached to node). This means each vertex connects to each of the other $3$ vertices since $G$ is a simple graph. Thus, any combination of $3$ vertices will be a simple $3$-cycle.  Inductive Hypothesis: Assume a simple graph with $k$ vertices, where $k$ is even, contains a simple $3$-cycle if each vertex has degree $\dfrac k2 + 1$.  Inductive Step: Since only concerned about when the graph has an even number of vertices, going to show a simple graph with $k + 2$ vertices, where $k$ is even, contains a simple $3$-cycle if every vertex has degree $\dfrac{k+2}{2} + 1$   This is as far as I get and don't know how to finish the Inductive Step (Also please feel free to let me know if I messed anything up, up to this point) Does separation of variables in PDEs give a general solution? When a partial differential equation is solved using the separation of variables method, is the produced solution the most general one that satisfies the equation or have we lost some forms of the solution because of the assumption that it is in the form of separated variables? Looking for a short story about a boy discovering that the government puts mind control chemicals in his cereal I would have read this around 1985-1998 because I remember being in school at the time. It may have been in a short story collection with "The Ugly Little Boy" and a story about a family dealing with people in the future coming back to enhance the intelligence of their baby with enfante terrible results. A boy, grade school age or so and very intelligent, discovers (or possibly just decides) that there are drugs in the food that prevent one from thinking critically. The details are kind of fuzzy in my head, but I remember that he at one point distills the chemical from his cereal, which he'd detected as having a high concentration, and overdoses. He's convinced that the government is trying to silence him — a scene that sticks out in my mind was him falling on a moving sidewalk and tearing his clothing as he tries to escape two "men in black" type figures that are pursuing him. The short story ended with him deciding that he was better off just consuming the food and being happy in his ignorance.  Years later, as an adult learning about mental illness, it struck me that the story was slightly ambiguous as to whether there actually were chemicals, and that the use of drugs that dulled his creativity and intelligence, and the decision to take them anyhow, was reminiscent of the feelings that manic people have toward their medications.  Anyone know what this one was? Good tool for finding photo duplicates based on image data What is a good (and preferably free) tool for finding photo duplicates based on the photos themselves?  So, not filename, filesize etc., but how the photos look like. It would be nice if it managed to match photos that were the same image, but not exactly the same size for example too. Why do we need to set swap space as twice big as our physical memory? When we want to setup a linux system, there is a common a suggestion to set the swap space  twice as big as your physical memory. I want to know why do we need this, and how it is this suggestion come to be? Let $y$ be a differentiable function on $\mathbb{R}$. If  $$\lim_{x\rightarrow \infty}(y(x)+y'(x))=0$$ Then how does one show that $$\lim_{x\rightarrow \infty}y(x)=0$$ I'd appreciate some help on this problem. Thanks a lot. What methods can I use to infer a distribution if I know only three percentiles?  For example, I know that in a certain data set, the fifth percentile is 8,135, the 50th percentile is 11,259, and the 95th percentile is 23,611.  I want to be able to go from any other number to its percentile.  It's not  my data, and those are all the statistics I have.  It's clear that the distribution isn't normal.  The only other information I have is that this data represents government per-capita funding for different school districts.  I know enough about statistics to know that this problem has no definite solution, but not enough to know how to go about finding good guesses.  Would a lognormal distribution be appropriate?  What tools can I use to perform the regression (or do I need to do it myself)? Design review - RGB LED color mixer using PWM The dissolve tool (vector>geoprocessing tools>dissolve) renders some artifacts on shapes with high number of polygons. I’m using a  with 3222 polygons and I’m trying to dissolve it using the field “municipio”, but when the dissolve tool ends calculating the new shape has some artifacts     Does anyone had a similar problem? How to work around it?  I’ve also used v.dissolve from GRASS and the dissolve polygon from SAGA, but the problem persists. I’ve used the same shapefile on ArcGIS 9.3 with the dissolve tool. None artifact/error was produced.  Edit 1  I'm trying to use the v.clean tool as sugested by WhiteboxDev. However I'm getting this error:     An error has occured while executing Python code:      Traceback (most recent call last):   File   "C:/PROGRA~1/QGISCH~1/apps/qgis/./python/plugins\processing\gui\ProcessingToolbox.py",   line 181, in executeAlgorithm   File   "C:/PROGRA~1/QGISCH~1/apps/qgis/./python/plugins\processing\algs\grass7\Grass7Algorithm.py",   line 511, in checkBeforeOpeningParametersDialog   File   "C:/PROGRA~1/QGISCH~1/apps/qgis/./python/plugins\processing\algs\grass7\Grass7Utils.py",   line 361, in checkGrass7IsInstalled   File   "C:\PROGRA~1\QGISCH~1\apps\Python27\lib\ntpath.py", line 96, in join   TypeError: object of type 'NoneType' has no len()      Python version:   2.7.4 (default, Apr  6 2013, 19:54:46) [MSC v.1500 32 bit (Intel)]      QGIS version:   2.4.0-Chugiak Chugiak, 8fdd08a      Python path:   ['C:/PROGRA~1/QGISCH~1/apps/qgis/./python/plugins\processing',   'C:/PROGRA~1/QGISCH~1/apps/qgis/./python',   u'C:/Users/CERCOTRICHAS/.qgis2/python',   u'C:/Users/CERCOTRICHAS/.qgis2/python/plugins',   'C:/PROGRA~1/QGISCH~1/apps/qgis/./python/plugins',   'C:\PROGRA~1\QGISCH~1\bin\python27.zip',   'C:\PROGRA~1\QGISCH~1\apps\Python27\DLLs',   'C:\PROGRA~1\QGISCH~1\apps\Python27\lib',   'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\plat-win',   'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\lib-tk',   'C:\PROGRA~1\QGISCH~1\bin',   'C:\PROGRA~1\QGISCH~1\apps\Python27',   'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages',   'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages\GDAL-1.11.0-py2.7-win32.egg',   'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages\PIL',   'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages\jinja2-2.7.2-py2.7.egg',   'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages\markupsafe-0.23-py2.7-win32.egg',   'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages\python_dateutil-2.2-py2.7.egg',   'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages\pytz-2014.2-py2.7.egg',   'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages\win32',   'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages\win32\lib',   'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages\Pythonwin',   'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages\Shapely-1.2.18-py2.7-win32.egg',   'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages\six-1.6.1-py2.7.egg',   'C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages\wx-2.8-msw-unicode',   'C:\PROGRA~1\QGISCH~1\apps\qgis\python\plugins\fTools\tools',   'C:\Program Files\SpiderOak\shell_extension_lib\shared.zip']   Not entirely sure if this error is QGIS related... Any idea why I'm getting this error and how can I solve it? Number of ways to write n as a sum of k nonnegative integers How many ways can I write a positive integer $n$ as a sum of $k$ nonnegative integers up to commutativity?  For example, I can write $4$ as $0+0+4$, $0+1+3$, $0+2+2$, and $1+1+2$.    I know how to find the number of noncommutative ways to form the sum: Imagine a line of $n+k-1$ positions, where each position can contain either a cat or a divider. If you have $n$ (nameless) cats and $k-1$ dividers, you can split the cats in to $k$ groups by choosing positions for the dividers: $\binom{n+k-1}{k-1}$. The size of each group of cats corresponds to one of the nonnegative integers in the sum.