I'm having a problem in my abstract class and its subclass. ActionDeck is a subclass of Deck which contains a no-argument constructor for ActionDeck, but whenever I get NullPointerException for the deque and array list instance variables my superclass has. It also marks it as unused in VScode. I'm not sure if I am implementing it correctly. What is wrong with my code? Deck.java abstract class Deck&lt;C&gt; {      protected Deque&lt;C&gt; deck;     protected ArrayList&lt;C&gt; temp;          public Deck () {         Deque&lt;C&gt; deck = new ArrayDeque&lt;&gt;();         ArrayList&lt;C&gt; temp = new ArrayList&lt;&gt;();       }  ActionDeck.java public class ActionDeck extends Deck&lt;ActionCard&gt; {      public ActionDeck() {         super();     }  So when I tried to add something into the arraylist in ActionDeck it spits out an error: Exception in thread &quot;main&quot; java.lang.NullPointerException: Cannot invoke &quot;java.util.ArrayList.add(Object)&quot; because &quot;this.temp&quot; is null         at ActionDeck.generateDeck(ActionDeck.java:26)         at Board.initializeData(Board.java:30)         at Main.main(Main.java:10)  Help would be appreciated, thank you!
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 wondering how can I simulate a sample of n Weibull distribution lifetimes that include Type I right-censored observations. For instance lets have the n = 3, shape = 3, scale = 1 and the censoring rate = .15, and the censoring time = .88.  I know how to generate a Weibull sample but I do not know how to generate a censored data that have type I right-censored in R.  T = rweibull(3, shape=.5, scale=1) How to tile textures in Cycles? Revert new tab page behavior in Google Chrome 29+ I don’t like the behavior of the new tab page in Google Chrome 29+. How can I restore the old behavior?  The new tab page (if you have Google set as the default search engine) now shows the Google logo (or, apparently, the doodle of the day if there is one), a search box, and a few recently visited websites. It also added an Apps button to my favorites bar, seemingly the only way to access my apps page, which has easy access to things I use regularly (Calendar, Gmail, Docs, G+, Facebook, Feedly, Google News, Netflix, Play Music, Pandora, Drive, Keep, etc.) I don’t like this behavior. I actually don’t mind having the logo of the day and search box, but I want my apps linked to on my new tab page.  Is there any way to get the old behavior back? I checked the settings and it doesn’t seem like it’s possible to set chrome://apps to be the new tab page (which would restore the old behavior) or to configure the new new tab page to display apps instead of recently visited sites. A game called  is making rounds on social media. I am trying to determine the maximum score attainable for this game.  Let's assume WLOG that only 2s are returned (if 4s are possible the max score is doubled).  First, I'll relax some of the rules to create a game, $\mathcal{G}$, that can achieve a score at least as high as the original, 2048 game.  A run $R$  of $\mathcal{G}_n$ consists of a sequence of moves $m_1,\ldots,m_k$ which manipulate a multiset, $\mathcal{S}$ of maximum size n.  Each $m_i$ is either:   a put $p$, which inserts a 2 into $\mathcal{S}$, or a merge, $\alpha_i$, which replaces two $2^i$ elements from $\mathcal{S}$ with a single $2^{i+1}$ elt.   I allow sequential moves of the same type because 2048 allows multiple merges or no-merge turns.  The score of a position is the sum of $\mathcal{S}$.  What is the maximum score possible on a game of order n?  Note: The final position must have only unique values, else a merge and put would be possible in increase score.  I claim it is $\sum_{i=1}^{n} 2^i$, but couldn't come up with any good induction arguments.  It's pretty easy to prove that an element $2^k$ is producible in a game $\mathcal{G}_k$, but proving an upper bound for production got a bit hairy, and also doesn't cover the full space. How to delete entry in Auto Complete in Microsoft Edge How do I delete an unwanted entry in AutoComplete in Microsoft Edge?  I have tried everything including highlighting with the down arrows and nothing works. Novel about a teleportation device and a con artist alien How to redirect output of a running program to /dev/null I know that in order to suppress the output of a program I can redirect it to /dev/null, for example to hide all error and warning messages from chromium I can start the program like this  chromium-browser 2&gt; /dev/null &amp;   However, if I happen to forget about the error messages and type  chromium-browser &amp;   (which is quite annoying when they appear in the middle of a command) I don't know what to do except for stopping the application and starting it again properly.  Can I somehow redirect error output without restarting the application? I have a polygon layer in QGIS, and would like to represent the polygons like in the below image:    I have tried two different approaches, none of which are satisfactory.    Using a line pattern fill, the entire polygon is filled with the line pattern. I need a blank area in the middle which is not filled in.    Using a marker line fill, I am able to keep a blank area in the middle, but the markers are rotated to align with the edges of the polygon. I need the markers to preserve the same rotation along all edges, like in the example above.  Any ideas? Calculating sequential numbers into sorted table using ArcGIS Desktop? Is there a way to calculate a sorted field with sequential numbers?  I have seen  that outlines how to calculate sequential numbers, but this is always calculated on FID order, not on sorted order.  #Pre-logic Script Code: rec=0 def autoIncrement():      global rec      pStart = 1       pInterval = 1      if (rec == 0):           rec = pStart       else:           rec += pInterval       return rec  #Expression: autoIncrement()   An example of what I'm trying to do.  I've used an advanced sort to sort by year, month, day, and now want to have sequential numbers in the Seq field.  You'll see that my OBJECTID field is not in order, so the above code won't work.    Can this be done either in the Field Calculator or using an Update Cursor in arcpy? What is the Necessity of $...$ Around Numbers? I typed up an assignment with a lot of numbers in LaTeX and turned it in to my adviser.  When he returned it to me with some corrections, one of which was a lot of $ around my numbers.  I understand that $ are necessary around some mathematical formulas, but I was just using numbers like -2 and 4.  I did not see any change in the font of the numbers when I added the $ either.  Since my adviser did not want to give me an explanation, what is the rationale? Stripped out bottom bracket How to prove the divisibility rule for $3\, $ [casting out threes] The divisibility rule for $3$ is well-known: if you add up the digits of $n$ and the sum is divisible by $3$, then $n$ is divisible by three.  This is quite helpful for determining if really large numbers are multiples of three, because we can recursively apply this rule:  $$1212582439 \rightarrow 37 \rightarrow 10\rightarrow 1 \implies 3\not\mid 1212582439$$ $$124524 \rightarrow 18 \rightarrow 9 \implies 3\mid 124524$$  This works for as many numbers as I've tried.  However, I'm not sure how this may be proven.  Thus, my question is:     Given a positive integer $n$ and that $3\mid\text{(the sum of the digits of $n$)}$, how may we prove that $3\mid n$? How can I measure the actual memory usage of an application or process? This question is covered  in great detail. How do you measure the memory usage of an application or process in Linux? From the blog article of , ps is not an accurate tool to use for this intent.  Why ps is &quot;wrong&quot; Depending on how you look at it, ps is not reporting the real memory usage of processes. What it is really doing is showing how much real memory each process would take up if it were the only process running. Of course, a typical Linux machine has several dozen processes running at any given time, which means that the VSZ and RSS numbers reported by ps are almost definitely wrong. How to change geometry for one page without using \newgeometry or \restoregeometry What does high credit utilization really mean? Find all $x$ such that $$x^6=(x+1)^6.$$   So far, I have found the real solution $x= -\frac{1}{2}$, and the complex solution $x = -\sqrt[3]{-1}$.  Are there more, and if so what/how would be the most efficient find all the solutions to this problem? I am struggling to find the rest of the solutions. How to inject Spring Bean for factory method requiring MyClass.class parameter When I visit a website it sometimes puts cookies on my browser. Usually cookies keep track of browsing info from that particular site. If I don't delete those cookies and browse other websites, will the cookies be able to know which site I am browsing? Also, can any website read browsing history which is saved by browsers? Can any website know about my browsing history by help of cookies, browsing histories saved by browsers, or by any scripting language e.g. javascript? Does someone falling into a black hole see the end of the universe? This question was prompted by . Notoriously, if you calculate the Schwarzschild coordinate time for anything, matter or light, to reach the event horizon the result is infinite. This implies that the universe ages by an infinite time before someone falling into the black hole reaches the event horizon, so could that person see the universe age by an infinite time?  To be more precise, suppose the observer starts falling from rest at time $t = 0$ and some initial distance $r &gt; r_s$. If we wait for some time $T$ then shine a light ray at the falling observer. Will the light ray always reach the falling observer before they cross the event horizon? If not, what is the formula for the longest time $T$ that we can wait and still be sure the ray will catch the observer? If $T$ is not bounded it implies that observer could indeed see the end of the universe.  I can think of a qualitative argument for an upper limit on $T$, but I'm not sure how sound my argument is. The proper time for the observer to fall to the event horizon is finite - call this $\tau$. The proper time for the light ray to reach the horizon is zero, therefore the light ray will reach the observer before they cross the event horizon only if $T &lt; \tau$. Hence $T$ is bounded and the observer won't see the end of the universe.  I think a more rigorous approach would be to determine the equations of motion (in the Schwarzschild coordinates) for the falling observer and the light ray, and then find the condition for the light to reach the falling observer at some distance $\epsilon$ from the event horizon. Then take the limit as $\epsilon \rightarrow 0$. In principle this seems straightforward, but in practice the algebra rapidly defeated me. Even for a light ray the radial distance:time equation isn't closed form (Wolfram claims it needs the $W$ function) and for the falling observer the calculation is even harder. for $f\in L^1[0,2\pi]$ define $$\hat{f}(n)=\int_{0}^{2\pi} f(t)e^{-int} dt$$ for $n\in\mathbb{Z}$, $X$ is a closed linear subspace of $L^1[0,2\pi]$ such that $\sum_{n} |\hat{f}(n)|&lt;\infty$ for each $f\in X$, we need to show that there is $M&lt;\infty$ such that  $\sum_{n} |\hat{f}(n)|\le M\int_{0}^{2\pi}|f(t)|dt$ for each $f\in X$  please tell me how to solve this one, I have no clue.