I'm getting a NullPointerException while making a ListView using a custom adapter and don't know the part of code causing the error. Following is the code snippet:  ChatMessageAdapter.java  package com.myappcompany.rajan.thefictionalchat;  import android.content.Context; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView;  import java.util.ArrayList;  public class ChatMessageAdapter extends ArrayAdapter&lt;ChatText&gt; {      ChatMessageAdapter(Context context, ArrayList&lt;ChatText&gt; list) {         super(context, 0, list);     }      @NonNull     @Override     public View getView(int position, View convertView, ViewGroup parent) {          View currentView = convertView;         if(currentView==null) {             LayoutInflater.from(getContext()).inflate(R.layout.list_items, parent, false);         }         ChatText chatText = getItem(position);          TextView textView;         textView = (TextView)currentView.findViewById(R.id.chat_text);         textView.setText(chatText.getMessage());          if(chatText.getMessageType().equals("PERSON_1")) {             textView.setGravity(Gravity.LEFT);         }         else if(chatText.getMessageType().equals("PERSON_2")) {             textView.setGravity(Gravity.RIGHT);         }         else {             textView.setGravity(Gravity.CENTER_HORIZONTAL);         }          return currentView;     } }    list_items.xml  &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:orientation="vertical"     android:layout_width="match_parent"     android:layout_height="wrap_content"     &gt;      &lt;TextView         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:id="@+id/chat_text"         tools:text="Hello" /&gt;  &lt;/LinearLayout&gt;   I'm getting the following run-time error from the log as the app crashes:  java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference         at com.myappcompany.rajan.thefictionalchat.ChatMessageAdapter.getView(ChatMessageAdapter.java:32)
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 happened to the idea of getting inbox notifications for favorited questions? I have a cron job that runs every minute on an Ubuntu 12.04 box  $sudo crontab -e * * * * * mylogin /pathto/file.sh &gt; /log/filelog   If I run file.sh, the bash script does some stuff and echos out runs:  $ ./file.sh  runs   If I check the log of cron tab it shows that the job is running:  Jul 10 12:41:01 localhost CRON[1811]: (root) CMD (mylogin /pathto/file.sh &gt; /log/filelog) Jul 10 12:41:01 localhost CRON[1810]: (CRON) info (No MTA installed, discarding output) Jul 10 12:42:01 localhost CRON[1813]: (root) CMD (mylogin /pathto/file.sh &gt; /log/filelog)   However, the script is not running. It is not doing it's work and not echoing runs to /log/filelog.  $cat /log/filelog  #shows nothing   What other steps can I take to debug this problem? Explicit bijection between the successor of $\alpha$ and $\alpha$ (infinite ordinal). I would like to construct an explicit bijection from $\alpha^*$ to $\alpha$, where $\alpha$ is an infinite ordinal. I have been told a possible bijection would be:  \begin{equation} f(\beta) = \begin{cases} 0 &amp; \text{if } \beta = \alpha \\ \beta^* &amp; \text{if } \beta \text{ is finite} \\ \beta &amp; \text{otherwise} \end{cases} \end{equation}  I don't understand how this is constructed, or why it is a bijection. I am building a regression model and I need to calculate the below to check for correlations   Correlation between 2 Multi level categorical variables Correlation between a Multi level categorical variable and continuous variable  VIF(variance inflation factor) for a Multi level categorical variables   I believe its wrong to use Pearson correlation coefficient for the above scenarios because Pearson only works for 2 continuous variables.   Please answer the below questions   Which correlation coefficient works best for the above cases ?  VIF calculation only works for continuous data so what is the alternative?  What are the assumptions I need to check before I use the correlation coefficient you suggest?  How to implement them in SAS &amp; R? I've discovered a new pattern.  Is this pattern well known or what is the opinion about it?  Basically, I have a hard time scrubbing up and down source files to figure out what module imports are available and so forth, so now, instead of  import foo from bar.baz import quux  def myFunction():     foo.this.that(quux)   I move all my imports into the function where they're actually used., like this:  def myFunction():     import foo     from bar.baz import quux      foo.this.that(quux)   This does a few things.  First, I rarely accidentally pollute my modules with the contents of other modules.  I could set the __all__ variable for the module, but then I'd have to update it as the module evolves, and that doesn't help the namespace pollution for code that actually lives in the module.  Second, I rarely end up with a litany of imports at the top of my modules, half or more of which I no longer need because I've refactored it.  Finally, I find this pattern MUCH easier to read, since every referenced name is right there in the function body. Trying to install Steam ERROR: You are missing the following 32-bit libraries, and Steam may not run: not I've already installed Steam, but when I click on the program I get this message  ERROR- You are missing the following 32-bit libraries, and Steam may not run: not   I don't know what to install or even do. why normalize and the definition of directional derivative I'm not understanding how to solve this problem.  I think the problem lies in the fact that I don't understand why normalize and the definition of directional derivative... It's in Portuguese. The question would be: Determine the directional derivative of f in P in direction of vector u: Does anybody know how to easily undo a git rebase?  The only way that comes to mind is to go at it manually:   git checkout the commit parent to both of the branches  then create a temp branch from there cherry-pick all commits by hand replace the branch in which I rebased by the manually-created branch   In my current situation this is gonna work because I can easily spot commits from both branches (one was my stuff, the other was my colleague's stuff).  However my approach strikes me as suboptimal and error-prone (let's say I had just rebased with 2 of my own branches).  Any ideas?  Clarification: I'm talking about a rebase during which a bunch of commits were replayed. Not only one. Quoted headings are rendered properly on preview but not when posted With markdown, you can use some dashes for headings. For example, this: Hello ---- this is some other text  renders as this: Hello this is some other text This is fine and works well. When I want to quote that text is when the problem arises, since this Markdown: &gt; Hello &gt; ---- &gt; this is some other text  When written down shows well in the preview but not when posted:  Hello this is some other text   As an example, see an screenshot of the preview:    and a screenshot of the posted content, where the ---- becomes a &lt;hr&gt;:  Note a similar bug I also reported: . Anthology for children; contains story about friendly Martian on postapocalyptic Earth I'm looking for the title of an anthology of children's science fiction stories from the 1950s. The best of the bunch involved a Martian who visited earth, and realized we'd blown ourselves up in a nuclear war and had fallen into savagery. The Martian is a vegetarian who subsists on biscuits made by a machine he brought with him, and communicates by using one of his tentacles to feed messages direction to/from the brain of the person he's talking to.  Inadvertently left behind by his expedition, he initially befriended some children, and eventually managed to rebuild civilization. Presently he dies, but when another expedition comes a generation later, they find the civilization he rebuilt.  there were other stories, but that was the best one.   If I can't find the name of the book it was in, I'd be happy to settle for the name of the author and the title of the story. What's the difference between Normalization and Standardization? In Book 1, Artemis et al escaped from the time stop by drugging themselves to sleep.  In the same time stop, Julius Root "accidentally" plugged Briar Cudgeon with a tranquilizer dart.  Cudgeon fell asleep, but did not disappear from the time stop.  Why not? Do Indian citizens need transit visa for Thailand if going through DMK? I am traveling from Chennai to Don Mueang International Airport, Bangkok, Thailand, and from there to Mandalay, Myanmar. In Bangkok, the layover time is 8 hours. Do I require transit visa? How to generate a random alpha-numeric string I've been looking for a simple Java algorithm to generate a pseudo-random alpha-numeric string.  In my situation it would be used as a unique session/key identifier that would "likely" be unique over 500K+ generation (my needs don't really require anything much more sophisticated).    Ideally, I would be able to specify a length depending on my uniqueness needs. For example, a generated string of length 12 might look something like "AEYGF7K0DM1X". How the `\alignat` works in ams package I have read the related question(), which had detailed answer but still don't know what the meaning of the \alignat's argument. It is said in  that      This environment takes one argument, the number of “equation   columns”: count the maximum number of &amp;s in any row, add 1 and and   divide by 2.   What is the meaning of adding one in &amp; number and divide by two? I presumed the argument is given by the user, not automatically generated by the system? How can I make an object show up on different layers Possible to have 2 unity launchers? ASP.NET MVC JsonResult Date Format I have a controller action that effectively simply returns a JsonResult of my model. So, in my method I have something like the following:  return new JsonResult(myModel);   This works well, except for one problem. There is a date property in the model and this appears to be returned in the Json result like so:  "\/Date(1239018869048)\/"   How should I be dealing with dates so they are returned in the format I require? Or how do I handle this format above in script? Headphones microphone is not working I'm trying to use my headphones with my Ubuntu 13.10. My headphones are Nokia BH-905i, which can be connected via Bluetooth or green+pink wires.  If I use bluetooth, voice quality is terrible or microphone doesn't work. If I try to choose "Headset" option from In and Out tabs in Sound Settings, they're disabling each together.  In Out tab, I'm using "High sound quality A2DP", because it betters voice quality.  How could I get my microphone working? Sound out works fine. Proving $\mathbb{Q}$ isn't homeomorphic to $\mathbb{Z}$