i m getting strange behavior. when i m accessing my list in QuestionMenuAdapter. I have four classes.  1.TestActivity 2.TestActivityDrawerFragment 3.QuestionMenuAdapter 4.QuestionFetch  what i m doing is that... i m creating the object of QuestionFetch class in my TestActivity class. then i m passing the list of Question (that i m getting from QuestionFetch class) to TestActivityDrawerFragment via setUp method, and here list obtain form TestActivity is passing to QuestionMenuAdapter.  now in QuestionMenuAdapter ,in the onBindViewHolder() i m getting my question one by one .... but i got NPE  below is my Code QuestionFetch Class  public class QuestionFetch { List&lt;Question&gt; questionList=new ArrayList&lt;&gt;();  public List&lt;Question&gt; getQuestionList() {     return questionList; }   public QuestionFetch() {      for(int i=0;i&lt;15;++i)     {          String option[]=new String[4];         Question item=new Question();         item.setQuestion("What is my name"+i);         item.setCorrectOptionIndex(i%4);         item.setNegativeMarks("1/2");         item.setSolution("deepak is name set by mom"+i);         item.setTypeOfQuestion("four");         for(int j=0;j&lt;4;++j)             option[j]="deepak"+(i+j);         item.setOptions(option);         questionList.add(item);      } }   }  now in TestActivity i m creating the object of QuestionFetch Class  questionFetch=new QuestionFetch();     drawerFragment=(TestActivityDrawerFragment) getSupportFragmentManager()             .findFragmentById(R.id.test_navigation_drawer_fragment);      // here passing the list of Questions to setUp method of TestActivityDrawerFragment     drawerFragment.setUp((DrawerLayout) findViewById(R.id.test_drawer_layout),questionFetch.getQuestionList());   now in TestActivityDrawerFragment class  public void setUp( DrawerLayout drawerLayout,List&lt;Question&gt; data) {      this.data=data;}   and in onCreateView passing this list to QuestionMenuAdapter  @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,                          Bundle savedInstanceState) {     // Inflate the layout for this fragment      data=new QuestionFetch().getQuestionList();     // here is list is in data     adapter=new QuestionMenuAdapter(getActivity(),data);     adapter.setOnClickListener(this);     return inflater.inflate(R.layout.fragment_navigation_drawer, container, false); }   and finally i m accessing my list in onBindViewHolder() in QuestionMenuAdapter class  public class QuestionMenuAdapter extends RecyclerView.Adapter&lt;QuestionMenuAdapter.PageViewHolder&gt;{    Context context; boolean addOrRemoveItemClicked=false; private LayoutInflater inflater; ClickListener clickListener; List&lt;Question&gt; data= Collections.emptyList();  public QuestionMenuAdapter(Context context, List&lt;Question&gt; data) {     inflater = LayoutInflater.from(context);      this.context=context;     this.data=data;     //here i have checked that my question is getting but not in onBindVievHolder    Toast.makeTosat(context,""+this.data.get(0).getQuestion,Toast.LENGTH_SHORT).show();   }  @Override public void onBindViewHolder(QuestionMenuAdapter.PageViewHolder holder, int position) {      holder.customTextView.setText(""+(position+1));    // here i m getting NPE     holder.questionText.setText(data.get(position).getQuestion()); }
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?
What is syntax highlighting and how does it work? I noticed that sometimes my code gets highlighted in different colors when rendered.   What is syntax highlighting? How does it work? Why isn't my code being highlighted correctly? How do I report a bug or request a new language? How do I use syntax highlighting? What languages are currently available on Stack Exchange? My book uses the argument that the multiplicities of a few macrostates in a macroscopic object take up an extraordinarily large share of all possible microstates, such that even over the entire lifetime of the universe, if each microstate had an equal chance of being accessed, fluctuations away from equilibrium would never occur.  My question to this statistical proof is this: In the real world, is there really an infinitesimal but nonzero chance that macroscopic systems could access some of the more unlikely macrostates (e.g. heat transfer from a cold object to a hot object)? How to install applications to a separate hdd? I was so good with windows, now I’m feeling like a complete idiot.  I have an SSD for ubuntu and want to install the majority of my programs to a separate HDD but I have no clue how. All searches I have tried only turn up with dual-boot installations.   (RESOLVED -> ) I am also having trouble locating "/etc/". Specifically, to modify Conky. Searching for this term only turns up instances where people are telling you to access this file, not how to get to it. Command and Conquer 3 exeption in exception handler I have command and conquer 3 from Origin, but when I try to start it, I get the 'exception in exception handler' error and the game exits.   I've tried the Origin launcher fix as well as -runver to make the game run a different version (although this just says that it can't find any version). I run Windows 10 (I know, experimental) but this game worked at one point, and then stopped working suddenly - there wasn't even an update in between.   I suspect that it's got to do with Origin, but any help would be appreciated. Can I add some HTML in my SO Profile 'About me' text box to show some button from linkedin? First order differential equations with 2 varriables Does anybody know how to solve the following differntial equation?  $$w^2\cdot r+\frac{dw}{dt}\cdot r+\frac{dr}{dt}\cdot w=3g$$  where w and r are a function of time so $w(t)$ and $r(t)$. $g$ is a constant  EDIT: This equation came from a thought problem of mine which I will now explain since I still do not know how to approach the problem.  Basically I want to design a spiral track in which a vehicle will accelerate. However the total acceleration needs to be constant.   The vehicle will have 2 acceleration components, a radial component ($a_r$) and a change in speed component ($a_s$). Since we want constant acceleration: $a_r + a_s = constant$  From circular motion we know that $a_r = \omega ^2 r$ where $r$ is the radius, and $\omega$    Further we know that $v=\omega*r$, therefore: $a_s=\frac{d}{dt}(\omega r)$  For constant acceleration $a_{total} = a_r + a_s = \omega ^2 r + \frac{d}{dt}(\omega r) =constant$  Further usefull information: Length of the track covered at a certain time $l=v*t=\omega r t$  With all this the radius will be a function of time, $r(t)$ and the angular velocity will be a function of time, $\omega (t)$  Boundary conditions: $r(0)  = 0$ $\omega (0) = 0$  Now I would like to find a possible set of solutions to create a track by implementing end boundary conditions that i choose e.g. $v(t_{end})=100 [m/s]$ and $l(t_{end})=5000 [m]$  Here is a diagram for clarity: Open Mapping Theorem: counterexample The Open Mapping Theorem says that a linear continuous surjection between Banach spaces is an open mapping. I am writing some lecture notes on the Open Mapping Theorem. I guess it would be nice to have some counterexamples. After all, how can you appreciate it's meaning without a nice counterexample showing how the conclusion could fail and why the conclusion is not obvious at all.  Let $\ell^1 \subset \mathbb{R}^\infty$ be the set of sequences $(a_1, a_2, \dotsc)$, such that $\sum |a_j| &lt; \infty$. If we consider the $\ell^1$ norm $\|\cdot\|_1$ and the supremum norm $\|\cdot\|_s$, then, $(\ell^1, \|\cdot\|_1)$ is complete, while $(\ell^1, \|\cdot\|_s)$ is not complete.  In this case, the identity $$   \begin{array}{rrcl}     \mathrm{id}:&amp; (\ell^1, \|\cdot\|_1)&amp; \to &amp;(\ell^1, \|\cdot\|_s)     \\                 &amp; x &amp; \mapsto &amp; x   \end{array} $$ is a continuous bijection but it is not open.  I want a counterexample in the opposite direction. That is, I want a linear continuous bijection $T: E \to F$ between normed spaces $E$ and $F$ such that $F$ is Banach but $T$ is not open. This is equivalent to finding a vector space $E$ with non-equivalent norms $\|\cdot\|_c$ and $\|\cdot\|_n$, such that $E$ is complete when considered the norm $\|\cdot\|_c$, and such that $$   \|\cdot\|_c   \leq   \|\cdot\|_n. $$ The Open Mapping Theorem implies that $\|\cdot\|_n$ is not complete.  So, is anyone aware of such a counterexample? Automating the appearance of email addresses as images Publishing pdf manuscripts on the web with emails embedded in the file results in spam.  More generally, I am looking for a way to automate the conversion of a string to an image.  It's quite easy to solve this old problem using  (more ). The trouble is that you need a distinct file and typesetting run, and you end up with unnecessary image files that you cannot delete carelessly lest you also delete non-generated images.  Can you think of a way to do this on the fly? It's understood that people will have to type the email addresses if they need to message you, but that's the point.  More briefly/concretely...  With what can one replace #1  \documentclass{article} \newcommand\showasimage[1]{#1} \begin{document} \showasimage{joe@foo.bar} \end{document}   such that #1 appears as an image?  Edit  It would be really nice if the pdf file remains vectorial. List all files in all subfolders In windows, is there any way to get a list of all files in a folder, including all the files within all the subfolders? What punctuation should follow after a list introduced by a colon? The whole department: John, Jeff, Jean, and the accountant [?] were thrown into jail. For context, see .  In essence:     "This question is protected to prevent "thanks!", "me too!", or spam answers by new users. To answer it, you must have earned at least 10 reputation (not including the ) on this site."   Suggested addition to existing message is in bold. "Software Updater" & "Software & Updates" not working I havent used my Ubuntu for quite a long time.  Today, when I booted Ubuntu (14.04 LTS), the software updater and Software &amp; Updates (from Settings) are not working.  The software updater's window will show up for around 1 sec, but it will close automatically. Software &amp; Updates is never shown, no matter how many times I click the icon. Note that neither of them show any error message.  Those 2 features were working perfectly the last time I used Ubuntu. I want to do some system upgrade and update.  For now, I use sudo apt-get update &amp;&amp; sudo apt-get upgrade. This command runs very fast, meaning (I think) my Ubuntu is not updated properly. The update from software updater always has a big size hence the download should be slower.  What should I do?   Can I just uninstall and reinstall both of them? If I can, how to do it?  Just to clarify, I don't want to upgrade my Ubuntu version (I want the LTS one), I just want to upgrade the software/packages I used.  Thanks for your time. How do I run a command before or after every command written in the console? Do I have to enter the UK on my UK passport? How to find $\lim_{n\to\infty}\frac{1!+2!+\cdots+n!}{n!}$? Better to buy an older high-level camera or newer entry-level camera? What are the pros and cons of buying an older higher-level camera if the price is about the same as a new entry-level one? Stitch first and edit later or vice versa? I have a set of three images imported in Lightroom 3.6 which I want to stitch into one panorama using Photoshop's CS5.5 Merge to Panorama tool. As I see it I have two options in doing so.   Doing all modifications (colour, brightness, contrast, etc...) first, syncing the changes between the three photos and then stitch them together. Stitching the photos first and then use Lightroom to apply modification to the whole image.   Which of these two methods is considered to be best practice? The following question was asked on a high school test, where the students were given a few minutes per question, at most:     Given that,   $$P(x)=x^{104}+x^{93}+x^{82}+x^{71}+1$$   and,   $$Q(x)=x^4+x^3+x^2+x+1$$   what is the remainder of $P(x)$ divided by $Q(x)$?     The given answer was:     Let $Q(x)=0$. Multiplying both sides by $x-1$:   $$(x-1)(x^4+x^3+x^2+x+1)=0 \implies x^5 - 1=0 \implies x^5 = 1$$   Substituting $x^5=1$ in $P(x)$ gives $x^4+x^3+x^2+x+1$. Thus,   $$P(x)\equiv\mathbf0\pmod{Q(x)}$$     Obviously, a student is required to come up with a “trick” rather than doing brute force polynomial division. How is the student supposed to think of the suggested method? Is it obvious? How else could one approach the problem? Updated Ubuntu 16.04, now I'm running Kali? Updated Ubuntu 16.04 today using the software updater. Now my PC is running Kali? There were something like 2Gb of updates, which I thought at first was because I haven't updated in a while. Now I'm thinking that it was downloading Kali. Here's a  of the new boot-up process.  The screen will continue to flicker for another 30 seconds or so, then stop flickering leaving the text on the screen. I tried switching the display manager from gdm to lightdm, which will boot me straight to the console and without flickering, but still no desktop.  I'm not altogether sure how I managed to accomplish this. It must have been when I was trying to get Katoolin running.  Any tips as to how I can either get the desktop or revert the updates?  Contents of cat /etc/lsb-rolling:  DISTRIB_ID=Kali DISTRIB_RELEASE=kali-rolling DISTRIB_CODENAME=kali-rolling DISTRIB_DESCRIPTION="Kali GNU/Linux Rolling" Nice proofs of $\zeta(4) = \frac{\pi^4}{90}$? I know some nice ways to prove that $\zeta(2) = \sum_{n=1}^{\infty} \frac{1}{n^2} = \pi^2/6$.  For example, see  or the answers to the question "?"  Are there any nice ways to prove that $$\zeta(4) = \sum_{n=1}^{\infty} \frac{1}{n^4} = \frac{\pi^4}{90}?$$  I already know some proofs that give all values of $\zeta(n)$ for positive even integers $n$ (like #7 on Robin Chapman's list or Qiaochu Yuan's answer in the linked question).  I'm not so much interested in those kinds of proofs as I am those that are specifically for $\zeta(4)$.  I would be particularly interested in a proof that isn't an adaption of one that $\zeta(2) = \pi^2/6$.