When running this code the application crashes instantly.      Error: java.lang.RuntimeException: Unable to instantiate activity   ComponentInfo{(...).MainActivity}: java.lang.NullPointerException:   Attempt to invoke virtual method 'android.view.Window$Callback   android.view.Window.getCallback()' on a null object reference   Through research I was able to find out the cause of the crash is likely to be that I name two Views before the onCreate() method has run. I could name these Views within the onCreate() method and the following listeners but then the Views cannot be public, so they would be independent from each other which would prevent my App from working as intended. Does someone have any idea on how to prevent this problem without making these Views independent from each other?  MainActivity.java:  public class MainActivity extends AppCompatActivity {     public ConstraintLayout constraintLayout = (ConstraintLayout) findViewById(R.id.constraint_layout0);     LayoutInflater inflater = getLayoutInflater();     public View rectimage3 = inflater.inflate(R.layout.my_rectview, constraintLayout, false);      @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_main);          final ImageView rectimage = (ImageView) findViewById(R.id.rectimage);          //set Listeners         rectimage.setOnTouchListener(new MySecOnTouchListener());         rectimage3.setOnTouchListener(new MyOnTouchListener());         constraintLayout.setOnDragListener(new MyDragListener());     }      //OnTouchListener of the first Rect     private final class MySecOnTouchListener implements View.OnTouchListener {         public boolean onTouch(View sview, MotionEvent motionEvent){             int action = motionEvent.getAction();             if(action == MotionEvent.ACTION_DOWN);                 rectimage3.setVisibility(View.VISIBLE);                 constraintLayout.addView(rectimage3);                  ClipData data = ClipData.newPlainText("", "");                 View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(rectimage3);                 rectimage3.startDrag(data, shadowBuilder, rectimage3, 0);                 rectimage3.setVisibility(View.INVISIBLE);                 return true;             } else{                 return false;             }         }     }      //OnTouchListener of the movable Rects     private final class MyOnTouchListener implements View.OnTouchListener {         public boolean onTouch(View view, MotionEvent motionEvent){             int action = motionEvent.getAction();             if (action == MotionEvent.ACTION_DOWN) {                 ClipData data = ClipData.newPlainText("", "");                 View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);                 view.startDrag(data, shadowBuilder, view, 0);                 view.setVisibility(View.INVISIBLE);                 return true;             } else {                 return false;             }         }     }      //OnDragListener of the Layout     class MyDragListener implements View.OnDragListener{         @Override         public boolean onDrag(View v, DragEvent event) {             View view = (View) event.getLocalState();              switch (event.getAction()) {                 case DragEvent.ACTION_DRAG_STARTED:                     view.setVisibility(View.VISIBLE);                     break;                 case DragEvent.ACTION_DRAG_LOCATION:                     view.setX(event.getX()-(view.getWidth()/2));                     view.setY(event.getY()-(view.getHeight()/2));                     break;                 case DragEvent.ACTION_DROP:                     break;             }             return true;         }     } }
What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?
I'm sure everyone is familiar with the Ship of Theseus paradox, basically "If you replace parts of a ship over time until none of the original ship is left, is the end product still the same ship?"  I just read pop philosophy books, so spare me if this is an idiotic question, but could this be applied to the Brain and consciousness? If you were the take individual atoms/neurons, and somehow replace them with its exact copy one at a time, how would the person experience that?   I don't think there would be an interruption of consciousness, but at the end it's a completely separate (but identical) brain from the one you started with. Exactly as if you had just cloned the whole thing, right? But without interruption.  What interests me is the gradual transition of consciousness here, is it possible to know how that would  work?  I think I remember hearing people argue similarly for both the existence of a transcendent soul and also AI consciousness. And the only other discussion I found of this was on a flat earth forum, so I don't know what to make of that.   I hope I articulated my question clearly. Thank you! I use babelbib and I have a source with two authors. Contrarily to when using the plain bib style, as soon as I switch to babplain, the author names are formatted like this:  [1] Müller, Jan und Eva Schulze: Name of the book, 2015.   While I would like both author names to be formatted the same way, that is one of these:  [1] Müller, Jan und Schulze, Eva: Name of the book, 2015. [1] Jan Müller und Eva Schulze: Name of the book, 2015.   sources:  % test.tex \usepackage[ngerman]{babel} \usepackage[fixlanguage]{babelbib} \selectbiblanguage{ngerman} \bibliographystyle{babplain} \bibliography{test}  % test.bib @manual{foo,     author = "Müller, Jan and Schulze, Eva",     title = "Name of the book",     year = "2015", }   I can fix it by specifying and {Schulze, Eva}, but that way all is treated as the last name, that cannot be the solution, can it? We were trying to come up with an easy way to generate a rational number in between two existing rational numbers with a fairly low numerator and denominator (the way we were doing this earlier was to find the average of the two rationals, but that results in a denominator of up to $c * d$. Does this inequality hold for all values of $a, b, c, d$? "Track changes" in LaTeX I am writing a scientific paper with my collaborator. We have submitted a version to a journal and now we got a review from them, so we need to fix a few things. In Microsoft Word there is the option to "track changes", which displays the deleted text as crossed out and the new text bolded (if I remember the details correctly). Is there a way to achieve a similar result in LaTeX?  I was thinking to create a new file for the revised version and then write a script which would basically compare the two files and make the differences either bold or crossed out before sending it to latex. Is there a tool that already does it? Is it possible to have f.lux (software that adjusts display's color temperature) on Ubuntu 14.04? f.lux is software which adjusts temperature of your display according to time of the day. Is it possible to make f.lux work in Ubuntu 14.04? If so, maybe you can share your knowledge or point me to a guide. Proving that $f(x) = g(x)$ for some $x \in [a,b]$ if $f,g$ continuous, $f(a)  g(b)$ Suppose $f$ and $g$ are continuous on $[a,b]$ and that $f(a) &lt; g(a)$ but $f(b) &gt; g(b)$.   Prove that $f(x) = g(x)$ for some $x \in [a,b]$.     I did try and actually did get as far as coming up with $f-g$. Would I set $h(x)= f(x)- g(x)$ and say $h(a) &lt;x&lt; h(b)$? List user's folder access permissions How to access namespace which is part of different project? Can you explain the "Axiom of choice" in simple terms? After purge mussels 6 time in salt water 20 mins each, why they still exude much grime? I  buy mussels at Pusateri and Whole Food Market for a year in Toronto. They sell them on ice and dry, not in running water.      , Bart teaches add salt to cold water and  soak for 20 mins. But I repeat 6 times...so 20 mins x 6 times = 120 mins of soaking!!! Mussels exudate less black grime every next time, but even after 6 times, water still has much black grime! See my pic under! Why? This happening for a year!     Part 2,  has GIF that shows you what I mean. The specified DSN contains an architecture mismatch Error How do I apply differential cryptanalysis to a block cipher? I have read a lot of summaries of block ciphers particularly with regards to the NIST competitions stating that reduced-round block ciphers are – for example – vulnerable to differential cryptanalysis.  I have a general idea that the application of differential cryptanalysis is to look at the difference between inputs;  makes that fairly clear. However, I could take any two inputs for any given block cipher and I am pretty certain I'd be staring at random differences.    I am aware this is the idea of a well written block cipher; however, assuming a broken or vulnerable cipher (feel free to provide simple examples) how do I go about choosing differences to try?  Are there any clues in algorithm design that would inform a decision on which values to choose?  How does being vulnerable to differential cryptanalysis impact a cipher in the wild?  If all I have are differences between known plain-texts and known keys as my analysis and a captured ciphertext as my data to exploit, what can I actually deduce? Mean, Average and Expectation What is the precise difference between the Mean, Average and Expectation ? Is there any mathematical formaulation to show the difference ? I see that often they are used interchangeably. Scale and Rotate Stopped Working [2.8] Selecting faces on object from UV editor window I can't see this as an option so is there a way to select faces or islands and have them show up as selected faces on the object in 3D view.  In programs such as maya it is possible to work from either view and makes selection and mapping a little more user friendly.  I suspect it isn't possible in Blender but welcome your feed back.  Edited as flag as already answered, although the question was not asked in the other post in a way that showed in my search.  I was looking for face and island selection to show in both views. The other asked about unselected vertices this obviously did not appear in the results. See , page 2: the internal logic diagram for the MM74HC138.    The diagram shows logic inverters with bubbles at the input or at the output. Is there an actual difference between them? Converting MultiLinestring to Linestring with PostGIS I have a multiline string and want to convert it to a linestring in order to use some functions that only work with linestrings. I used ST_Dump() and got a collection of my geometries. If I merge them back together, I still get the multilinestring. Should I get the Npoints and combine them together or something, in order to end up with a simple linestring? ST_LineMerge() also does not work on my multilinestring, it returns the same. my example,  MULTILINESTRING((-3.16420835153456 55.9269166007097,-3.164222 55.926918),(-3.1642070167833 55.9269296196706,-3.16421351659546 55.9268662214904),(-3.16421351659546 55.9268662214904,-3.16421636372824 55.9268384509897),(-3.16421636372824 55.9268384509897,-3.16422182573761 55.9267851753802),(-3.16422182573761 55.9267851753802,-3.16422870102352 55.926718114886),(-3.16422870102352 55.926718114886,-3.16423309121073 55.926675293667),(-3.16423309121073 55.926675293667,-3.16423565148822 55.9266503211093),(-3.16423565148822 55.9266503211093,-3.16424103159897 55.9265978443265),(-3.16424103159897 55.9265978443265,-3.16424680776317 55.9265415044985),(-3.16424680776317 55.9265415044985,-3.16425267254583 55.9264843002995),(-3.16425267254583 55.9264843002995,-3.16425541048045 55.9264575949012),(-3.16425541048045 55.9264575949012,-3.16426111146586 55.9264019883556),(-3.16426111146586 55.9264019883556,-3.1642667032531 55.9263474469124),(-3.1642667032531 55.9263474469124,-3.16426957768543 55.9263194101362),(-3.16426957768543 55.9263194101362,-3.16427488261739 55.9262676666359),(-3.16427488261739 55.9262676666359,-3.16428009893088 55.9262167875066),(-3.16428009893088 55.9262167875066,-3.164282741107 55.9261910161221),(-3.1642875546472 55.9261440655823,-3.164282741107 55.9261910161221),(-3.1642875546472 55.9261440655823,-3.16429466890915 55.9260746741522),(-3.16429466890915 55.9260746741522,-3.16430092974527 55.9260136069079),(-3.16430092974527 55.9260136069079,-3.16430822838418 55.9259424170929),(-3.16430822838418 55.9259424170929,-3.16431547242401 55.925871759829),(-3.16431547242401 55.925871759829,-3.16431448732505 55.9258328901507),(-3.16431770120536 55.9257327846001,-3.16431547242401 55.925871759829),(-3.164339 55.925777,-3.16431770120536 55.9257327846001)) What is an "AppImage"? How do I install it? I just read . It talks about downloading an AppImage.     Yes, Linux; the Linux packages is distributed as an .appimage for 32-bit and 64-bit distributions, and should run across all major Linux distributions without any issues. The team currently have no plan to provide a native .deb (or .rpm) installer.   What are AppImages? How do they differ from snaps? I'm hoping someone could check my work. I'm trying to simplify the equation for $x$. $$(\frac{x}{a})^{3.2} + (\frac{y}{b})^{3.2} = 1$$ $$\frac{a}{b} = \frac{174.1}{86}$$ Thus I began by substituting $a$ with: $$a = \frac{174.1}{86}b$$ $$((\frac{86}{174.1})(\frac{x}{b}))^{3.2} + (\frac{y}{b})^{3.2} = 1$$ $$((\frac{86}{174.1})(\frac{x}{b}))^{3.2} = 1 - (\frac{y}{b})^{3.2}$$ $$(\frac{x}{b})^{3.2} = \frac{(1 - (\frac{y}{b})^{3.2})(174.1)^{3.2}}{(86)^{3.2}}$$ $$x^{3.2} = \frac{(1 - (\frac{y}{b})^{3.2})(174.1)^{3.2}(b)^{3.2}}{(86)^{3.2}}$$ $$x^{3.2} = \frac{(1 - (\frac{y}{b})^{3.2})((174.1)(b))^{3.2}}{(86)^{3.2}}$$ $$x^{\frac{16}{5}} = \frac{(1 - (\frac{y}{b})^{3.2})((174.1)(b))^{3.2}}{(86)^{3.2}}$$ $$x = [\frac{(1 - (\frac{y}{b})^{3.2})((174.1)(b))^{3.2}}{(86)^{3.2}}]^{\frac{5}{16}}$$ Is my work correct, or am I completely off the board? CSS two divs next to each other