processing fill() nullPointer I'm trying to recreate tetris using processing for a school project. But I keep getting nullPointerExceptions when trying to call the fill function  this is the class:  package nl.HAN.game.eindOpdracht;  import processing.core.PApplet;  public class Block {     private PApplet app;     private int xPos;     private int yPos;     private int width;     private int height;     private boolean exploded;      public Block(PApplet app, int xPos, int yPos) {         //standaard         this.app = app;         this.xPos = xPos;         this.yPos = yPos;          this.width = (app.width / 3) / 10;         this.height = app.height / 20;         this.exploded = false;     }      public boolean isExploded() {         return exploded;     }      public void explode(){         this.exploded = true;     }      public void drop(){         this.yPos++;     }      public void move(int direction){         if(direction == 0){             this.xPos++;         } else {             this.xPos--;         }     }      public void draw(){         if(!exploded){             app.fill(200, 100, 100);         }     } }   this is the main class:  public static void main(String[] args) {      PApplet app = new PApplet();      //app.print("test");      Block block = new Block(app, 1, 1);      //block.draw();     app.fill(255);      String[] processingArgs = {"nl.han.ica.oopd.waterworld.WaterWorld"};     Main mySketch = new Main();      //PApplet.runSketch(processingArgs, mySketch); }   and this is the error:  Exception in thread "main" java.lang.NullPointerException     at processing.core.PApplet.fill(PApplet.java:14739)     at nl.HAN.game.eindOpdracht.Main.main(Main.java:18)
What is a NullPointerException, and how do I fix it? 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?
Using `\input` to insert a section of a document into another Is there any way one can use \input to insert only a specific section of a document into another? I intend on using this to improve the readability of an article with lots of pgfplots graphs in it, by moving all of my graphs to another file, and using something like \input{file.tex:graph1} to insert each graph where it is needed, rather than have all of them displayed together Expected Number of coin flips for 2 consecutive heads for first time. I was working on problems on expectation and found this one as a question from a well-known exam  Assume that you are flipping a fair coin, i.e. probability of heads or tails is equal. Then the expected number of coin flips required to obtain two consecutive heads for the first time is.  (A)4  (B)3  (C)6  (D)10  (E)5  I worked up like Let N be the number of tosses required untill 2 consecutive heads are obtained for the first time.  Let the probability of obtaining heads be p and tails be q and for a coin p=q=1-p=1-q.  For N=2, the probability will be $p^2$  For N=3, the probability will be $p^2.q$  For N=4, the probability will be $q^2.p^2$  For N=5, the probability will be $q^3.p^2$  and so on...  Now, $E[N]=2(p^2)+3(p^2.q)+4(q^2.p^2)+5(q^3.p^2)+......$  and this comes out to be $\frac{3}{2}$ but it matches with none of the options.  Please tell me where I am wrong and what should I do to reach the correct solution? checking apt-get update lock file default constructor for int I'm writing a linguistics paper that uses a large amount of linguistic examples from a wide variety of languages, using the gb4e package. I want to be able to label each example with information about the language it comes from, as I've seen in some texts, sort of like this:   Language (family, citation, etc.)      (1) example text          glosses        'translation'    gb4e is great at formatting the examples themselves, but I can't seem to get the label placed where I want it, that is, placed immediately before the example and without an indent. Here's some example code:  \documentclass{article} \usepackage{gb4e} \usepackage{lipsum}  \begin{document} \lipsum[2]  Hungarian (Finn-Ugric, \emph{reference})   \begin{exe}   \ex \gll    J\'anos h\'aza\\               John house.his\\       \glt    `John's house'   \end{exe}  \lipsum[3] \end{document}   If the label text is outside the exe environment, it's treated like a regular paragraph, but if I try to put it inside, it gives me an error. How can I make it look the way I want? I've looked at other packages that do numbered examples, but they don't seem to have solutions either, and they also don't have the same functionality as gb4e that I need.  Any help would be greatly appreciated. I know how to CALCULATE dot product, but still don't understand MEANING of it.  I mean, If I have to explain vector addition I would say that "Sum of two vectors give you the third vector that has the same effect as other two combined"  But I don't know how to explain dot product. For example we have two vectors: v=(3,1) and w=(2,4). Dot product of these two is 3*2 + 1*4 = 10. What does this result (10) tell us? How do I get $\cos{\theta} \lt \frac{\sin{\theta}}{\theta} \lt 1$? File l3backend-pdfmode.def not found when loading expl3 I updated my TeXlive distribution a couple times in the past week, and now I get this error when I include package expl3 (or any other package that includes it, such as fontspec). Before the updates it was working fine. Am I missing any package that should be installed? I tried searching for l3backend-pdfmode.def, but I found no results.  \documentclass{article} \usepackage{expl3} \begin{document} Hi \end{document}   λ lualatex a This is LuaTeX, Version 1.10.0 (TeX Live 2019)   restricted system commands enabled. (./a.tex LaTeX2e &lt;2018-12-01&gt;  luaotfload | main : initialization completed in 0.042 seconds (/opt/texlive/2019/texmf-dist/tex/latex/base/article.cls Document Class: article 2018/09/03 v1.4i Standard LaTeX document class (/opt/texlive/2019/texmf-dist/tex/latex/base/size10.clo)) (/opt/texlive/2019/texmf-dist/tex/latex/l3kernel/expl3.sty (/opt/texlive/2019/texmf-dist/tex/latex/l3kernel/expl3-code.tex)  ! LaTeX Error: File `l3backend-pdfmode.def' not found.  Type X to quit or &lt;RETURN&gt; to proceed, or enter new name. (Default extension: def)  Enter file name:  ! Emergency stop. &lt;read *&gt;   l.282   }   379 words of node memory still in use:    2 hlist, 1 rule, 1 dir, 3 kern, 1 glyph, 4 attribute, 48 glue_spec, 4 attrib ute_list, 1 write nodes    avail lists: 2:9,3:3,4:1,5:2,7:2,9:2 !  ==&gt; Fatal error occurred, no output PDF file produced! Transcript written on a.log. The server version of Ubuntu does not have the  command. How can I add a  (PPA) to the server without this command? Is there any hint of of the first Wizarding War being an international event? Is there any hint that the MoM or anywhere else got support in combating voldemort the first time around? Or is everything completely UK-centric?  I can't remember anyone in the second war being specifically sent from europe to help, even though we see international wizards in book 4. But I don't think all the events of the first war are covered in the books.  So are other bodies like the MoM involved in the first war, or was it isolated in the UK? I have a powershell script that I am trying to add in to a sql agent job, but the job step is failing with the following error      A job step received an error at line 1 in a PowerShell script. The corresponding line is 'import-module SQLPS  -DisableNameChecking'. Correct the script and reschedule the job. The error information returned by PowerShell is: 'Could not load file or assembly 'file:///C:\Program Files (x86)\Microsoft SQL Server\130\Tools\PowerShell\Modules\SQLPS\Microsoft.SqlServer.Management.PSSnapins.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.   I assumed that the error was being caused by differences in the module path, so I explicitly set the path via $env:PSModulePath to match the path of my powershell session where the code runs fine.  I am pretty new to powershell, so any help you could provide would be appreciated  I am just doing some testing right now, so everything is running locally on my desktop.  I am running SQL Server 2012. For example:     Ever wish you could share information broadly   Could it be rewritten to:     Ever wish you could broadly share information   Are there any rules for the position of the adverbs. Why doesn't PHP DOM include slash on self closing tags? Deriving Newton's Third Law from homogeneity of Space How can I safely create a nested directory in Python? How to get permission number by string : -rw-r--r-- What is the probability that all three tosses result in the same outcome? A coin is tossed three times: The probability of zero heads is 1/8 and the probability of zero tails is 1/8.  And my question is: What is the probability that all three tosses result in the same outcome?   So, if P(zero heads)= 1/8 , then that should be the same of p(all tails)?  If so, we could use the Addition Rule which is $P(A \cup B) = P(A) + P(B)$  where A and B are disjoint events, i.e. $A \cap B = \emptyset$, A is the event of tossing all heads and B is the event of tossing all tails.  I'm not sure how to continue after that... would the complement be used? My Ubuntu laptop which was working fine until recently. My desktop disappeared and all the desktop icons are gone. All I have access to is the terminal. In an attempt to fix the problem, I installed GNOME but it made the computer give the error:     Warning! Failed to connect to lvmetad. No such file or directory Falling back to internal scanning.    I can press Ctrl+Alt+F1 to start tty1 but I can't get to a graphical user interface. What did I do wrong and how do I fix it?.  The operating system is ubuntu Linux Incredible frequency of careless mistakes Looking for a single word for 'blind worship' Is there a single word for 'blind worship' as in worshiping an actor blindly notwithstanding the bad performance?