Recyclerview on click null object reference My adaptor:  public class Adaptor extends RecyclerView.Adapter&lt;Adaptor.Holder&gt;{  private ArrayList&lt;Winkel&gt; winkels; private LayoutInflater inflater; private ImageView icon; private ItemCLickCallback itemCLickCallback;  public interface ItemCLickCallback {     void onItemClick(int p);     void onSecItemClick(int p);  }  public void setItemCLickCallback(final ItemCLickCallback itemCLickCallback1){     this.itemCLickCallback = itemCLickCallback; }  public Adaptor (ArrayList&lt;Winkel&gt; winkels,Context c){     this.inflater = LayoutInflater.from(c);     this.winkels = winkels; }   @Override public Holder onCreateViewHolder(ViewGroup parent, int viewType) {     View view = inflater.inflate(R.layout.card_item, parent, false);     return new Holder(view); }  @Override public void onBindViewHolder(Holder holder, int position) {     Winkel winkel = winkels.get(position);     holder.title.setText(winkel.getNaam());     if (winkel.isFavourtite()){         holder.icon.setImageResource(R.drawable.ic_star_black_18dp);     }     else{         holder.icon.setImageResource(R.drawable.ic_star_border_black_18dp);     }  }  @Override public int getItemCount() {      return winkels.size(); }  class Holder extends RecyclerView.ViewHolder implements View.OnClickListener{      private TextView title;     private View container;     private ImageView icon;      public Holder(View itemView) {         super(itemView);          title = (TextView)itemView.findViewById(R.id.lbl_item_text);         container = itemView.findViewById(R.id.cont_item_root);         icon = (ImageView) itemView.findViewById(R.id.im_item_icon_secondary);         icon.setOnClickListener(this);         container.setOnClickListener(this);     }      @Override     public void onClick(View v) {         if(v.getId()==R.id.cont_item_root){             Log.d("lol",Integer.toString(getAdapterPosition()));             itemCLickCallback.onItemClick(getAdapterPosition());          }         else{             itemCLickCallback.onSecItemClick(getAdapterPosition());         }     } } }   My overview fragment:  @Override public void onItemClick(int p) {     Log.d("lol",(Integer.toString(p)));     Winkel winkel = (Winkel) mijnwinkels.get(p);      Bundle detailsBundle = new Bundle();     detailsBundle.putString(DETAILS_NAAM,winkel.getNaam());     detailsBundle.putString(DETAILS_ADRES,winkel.getAdres());     detailsBundle.putString(DETAILS_DEELGEMEENTE,winkel.getDeelGemeente());     detailsBundle.putString(DETAILS_GEMEENTE,winkel.getGemeente());     detailsBundle.putString(DETAILS_POSTCODE,winkel.getPostcode());      Details detail= new Details();     detail.setArguments(detailsBundle);     this.getFragmentManager().beginTransaction()             .replace(R.id.details,detail,null)             .addToBackStack(null)             .commit(); }   Error message:  java.lang.NullPointerException: Attempt to invoke interface method 'void com.example.hoofdgebruiker.winkelskortrijk.Utill.Adaptor$ItemCLickCallback.onItemClick(int)' on a null object reference.   My code is working up to the point where I get me recyclerview, the items are in it, but I can't click any of them without getting this error and I don't understand why. What am I doing wrong that it is a null object reference? Neither of my logs are showing up.  Edit: my method onItemCLickCallback is used here:  @Override public void onSuccess(ArrayList&lt;Winkel&gt; winkels) {     mijnwinkels = winkels;     Adaptor adaptor = new Adaptor(mijnwinkels, this.getActivity());     mRecyclerView.setLayoutManager(new LinearLayoutManager(this.getActivity()));     mRecyclerView.addItemDecoration(new VerticalSpace(30));     mRecyclerView.setAdapter(adaptor);     adaptor.setItemCLickCallback(this); }
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?
What does 2>/dev/null mean? I would like a brief explanation of the following command line:  grep -i 'abc' content 2&gt;/dev/null I couldn't add defer tag in plugin javascripts. Google developer pagespeed test suggests me to add defer tag in contact form 7 javascripts.   This is how contact form 7 includes javascript in header.  add_action( 'wp_enqueue_scripts', 'wpcf7_enqueue_scripts' );  function wpcf7_enqueue_scripts() {     // jquery.form.js originally bundled with WordPress is out of date and deprecated     // so we need to deregister it and re-register the latest one     wp_deregister_script( 'jquery-form' );     wp_register_script( 'jquery-form', wpcf7_plugin_url( 'jquery.form.js' ),         array( 'jquery' ), '2.52', true );      $in_footer = true;     if ( 'header' === WPCF7_LOAD_JS )         $in_footer = false;      wp_enqueue_script( 'contact-form-7', wpcf7_plugin_url( 'scripts.js' ),         array( 'jquery', 'jquery-form' ), WPCF7_VERSION, $in_footer );      do_action( 'wpcf7_enqueue_scripts' ); }   Now how to add defer="defer" tag in the above code? Hiding sublayer with toggle button using LayerActions? I have a toggle map (like ) with sublayers. I want all the sublayers to be visible when you open the map, but I would like to hide some sublayers when the toggle buttons are clicked. I've tried adding a hide sublayer code into the LayerActions section of my code, but it's not hiding the sublayers (the button does the same function no matter whether the 'layer.getSubLayer(1).hide()' is there or not). This is the code I'm using:  var LayerActions = {  all: function(){   layer.getSubLayer(1).hide();   sublayers[0].setSQL("SELECT * FROM spreadsheet");   return true;  },  2011: function(){   layer.getSubLayer(1).hide();   sublayers[0].setSQL("SELECT * FROM spreadsheet WHERE year IN ('2011') AND year IS NOT NULL");   return true;  },  2012: function(){   layer.getSubLayer(1).hide();   sublayers[0].setSQL("SELECT * FROM spreadsheet WHERE year IN ('2012', '2012/2013') AND year IS NOT NULL");   return true;  } }   $('.button').click(function() {  $('.button').removeClass('selected');  $(this).addClass('selected');  LayerActions[$(this).attr('id')](); });   Could someone point me to where I'm messing up with my code? Or is it not possible to hide a sublayer using the LayerActions?    I'm now loading my layers differently, and this is my new code:   cartodb.createLayer(map, url1)     .addTo(map, 0)     .done(function (layer) {         console.log('added url1 ',url1);         cartodb.createLayer(map, url2)         .addTo(map, 1)         .done(function (layer) {             console.log('added url2 ',url2);         })         .error(function (){             console.log('problem adding 2nd layer');         });     })     .error(function () {         console.log('There is something wrong with requested data!');     });   So if I wanted to hide the first layer that's loaded (url1) and select only certain points from the second layer (url2), how would I code that in my LayerActions section? I've tried the following, but nothing changes when I click the buttons:  var LayerActions = { all: function(){   layer.getLayer(0).hide;   layer[1].setSQL("SELECT * FROM spreadsheet");   return true; }, 2011: function(){   layer.getLayer(0).hide;   layer[1].setSQL("SELECT * FROM spreadsheet WHERE year IN ('2011') AND year IS NOT NULL");   return true; }, ... I was really happy when I heard that HoTD would be continued. And even happier when the first new chapter actually came. but now after several months of waiting there still has been no other chapter. So my question is, has HoTD gone on hiatus again ? Adding tags to files in OS X: How to use, where are tags stored, and will they work on a network? Java: how do I check if a Date is within a certain range? I have a series of ranges with start dates and end dates. I want to check to see if a date is within that range.  Date.before() and Date.after() seem to be a little awkward to use. What I really need is something like this pseudocode:  boolean isWithinRange(Date testDate) {     return testDate &gt;= startDate &amp;&amp; testDate &lt;= endDate; }   Not sure if it's relevant, but the dates I'm pulling from the database have timestamps. Hide page numbering but retain header/footer I would like to remove page numbering on a specific page. However, the header and footer should remain intact. If I try:  \thispagestyle{empty}   The header and footer disappear. What is the recommended way of removing just the page number? Help with completing the proof: Any unbounded sequence is either infinitely large or has a convergent subsequential limit Given $\{x_n\}$ is an unbounded sequence, prove:   $$ \lim_{n\to\infty}x_n = \infty\ \  \text{or}\ \ \lim_{n_k \to \infty} = A $$   In other words any unbounded sequence either infinitely large or has a convergent subsequence.     Everything before udpate section is wrong.  Part 1. Proving $|x_n| &gt; M \implies \lim_{n\to\infty} x_n = \infty$  $\Box$ Start with the definition of an unbounded sequence: $$ \forall M &gt; 0 \in \Bbb R \ \exists N \in \Bbb N: \forall n &gt; N\implies |x_n| &gt; M $$  Suppose that: $$ \lim_{n\to\infty}x_n \ne \infty $$ That means: $$ \forall n\in\Bbb N\ \exists C &gt;0 \in\Bbb R : |x_n| &lt; C $$  Now taking $M^\prime = \max\{M, C\}$ we have that: $$ \begin{cases} \begin{align} \exists N \in \Bbb N : &amp;\forall n&gt;N \implies &amp;|x_n| &gt; M^\prime \\ &amp;\forall n \in \Bbb N: &amp;|x_n| &lt; M^\prime \end{align} \end{cases} $$  So we have arrived to a contradiction which means the assumption is wrong and: $$ \lim_{n\to\infty}x_n = \infty $$ $\Box$     Part 2. It's not clear to me how to prove that if unboundedness does not imply infinity limit then it must imply the existence of a convergent subsequence.   Two questions is my mind:   Is part 1 correct?  How do I proceed with the second part?     I'm using the following definition. $$ \lim_{n\to\infty}x_n = +\infty \stackrel{\text{def}}{\iff} \forall \epsilon &gt; 0 \exists N \in \Bbb N :\forall n &gt; N \implies x_n &gt; \epsilon \\ \lim_{n\to\infty}x_n = -\infty \stackrel{\text{def}}{\iff} \forall \epsilon &gt; 0 \exists N \in \Bbb N :\forall n &gt; N \implies x_n &lt; -\epsilon \\ $$ A sequence is considered infinitely large when: $$ \lim_{n\to\infty}x_n = \infty\ \ \text{when}\ \ \lim_{n\to\infty}x_n = + \infty \ \ \text{or} \ \ \lim_{n\to\infty}x_n = - \infty $$    Update.   Looks like i've messed up a lot of things. I will try once again. As shown in comments and answers the statement holds only in case: $$ \lim_{n\to\infty} |x_n| = \infty \iff \forall \epsilon &gt; 0 \exists N \in \Bbb N: \forall n &gt; N \implies |x_n| &gt; \epsilon $$  Consider the following: $$ \lnot P = \lnot\left(\lim_{n\to\infty}|x_n| = \infty \right) \iff \exists \epsilon &gt; 0\ \forall N_1 \in \Bbb N : \exists n &gt; N_1 \land |x_n| &lt; \epsilon $$  But on the other hand it is given that $x_n$ is unbounded: $$ Q = \forall M &gt; 0\ \exists N_2 \in \Bbb N : |x_{N_2}| &gt; M $$  Construct a negative expression for boundedness: $$ \lnot P = \exists M &gt; 0\ \forall N_2 \in \Bbb N : |x_{N_2}| &lt; M $$  If $S = \lnot P \implies \lnot Q$ then $S = P \lor \lnot Q$  Let $\epsilon = M$, choose $N = \max\{N_1, N_2\}$ then both statements are true and: $$ \exists \epsilon &gt; 0\ \forall N = \max\{N_1, N_2\}: \exists n &gt; N \land |x_n| &lt; \epsilon $$  Now either $P$ is true, which would mean $\lim |x_n| = \infty$, or $\lnot Q$ is true which would mean the sequence is bounded and hence contains a convergent subsequence. I understand that information cannot be transmitted at a velocity greater than speed of light. I think of this in terms of the radio broadcast: the station sends out carrier frequencies $\omega_c$ but the actual content is carried in the modulated wave, the sidebands $\omega_c\pm\omega_m$. The modulation envelop has its group velocity and this is the speed at which information is being transmitted. We also know, for example, that x-rays in glass have a phase velocity which is greater than the speed of light in vacuum.   My question is, what exactly is it that is travelling faster than the speed of light?    EDIT: I know it couldn't be anything physical as its superluminal. My problem is, what is it that has absolutely no information content yet we associate a velocity with it. Cannot login to chat.meta.stackexchange.com; server error when trying to access chat homepage I just recreated my MSE account after having deleted it a few years ago. Now, I'm trying to log in to Meta Stack Exchange Chat, and whenever I try to do so, it just fails silently and I'm still logged out.  Additionally, in the same browser session that I'm supposedly logged out, I get a server error when accessing the chat homepage or the chat profile page of any user. I don't get any errors when trying to access any of these pages in a private session. I also was able to sign in to Stack Exchange Chat and Stack Overflow Chat without problems, since my accounts on SO and my parent site for SE chat haven't been deleted.  I think it might be because it's trying to sign me in to my old chat profile, which was not deleted, but that is associated to my old, deleted site account, which clash and thus cause it to fail. I don't know if this is a well-known fact, but I have observed that every number, no matter how large, that is equally divided by $9$, will equal $9$ if you add all the numbers it is made from until there is $1$ digit. A quick example of what I mean:  $9*99 = 891$ $8+9+1 = 18$ $1+8 = 9$  This works even with really long numbers like $4376331$ Why is that? This doesn't work with any other number. Similarly for $11$ and alternating digits sums. Proof that no polynomial with integer coefficients can only produce primes Doing a discrete math review and am trying to solve problem 1.6 in the text found here:  - I believe I've gotten parts (a) and (b) correctly, but (c) is a bit tricky for me. Would appreciate a review of a/b and a hint for c if possible. Restatement here:  For n = 40, the value of polynomial $p(n)::=n^2 + n + 41$ is not prime, as noted in Section 1.1. But we could have predicted based on general principles that no nonconstant polynomial can generate only prime numbers.  In particular, let $q(n)$ be a polynomial with integer coefﬁcients, and let $c::=q(0)$ be the constant term of q.  (a) Verify that $q(cm)$ is a multiple of c for all $m \in Z$  Proof: Since q is a polynomial, it will be of the form: $q(x) = a_nx^n+a_{n-1}x^{n-1} + ... + a_1x + c$  If $x = cm$, then notice that cm will be inside every term of the polynomial, and since the final term is c, c can be factored out of every term. Hence, q(cm) is a multiple of c for all $m \in Z$.  b) Show that if q is nonconstant and c > 1, then as n ranges over the nonnegative integers, $N$, there are infinitely many $q(n) \in Z$ that are not primes.  Proof: Continuing from the result found in (a), it is easy to see that for all $m \in Z$, there will be an infinite number of multiples of c that will be generated by q. Since c > 1, these multiples are guaranteed not to be prime.  c) Conclude that for every nonconstant polynomial, q, there must be an $n \in N$ such that $q(n)$ is not prime. Hint: Only one easy case remains.  c = 0 is trivially easy to prove using the (b) above.  I assume the "easy" case is referring to c = 1, but in this case I'm not sure how to continue, since the result of (a) and (b) don't apply: I can't use them since adding 1 to any even number may make it prime. If the result of the terms not including c is odd, then adding 1 to that result makes it even and it is not prime. However, if the terms add up to an even number, I don't see a way of using the knowledge I have so far to prove conclusively that that number + 1 will NOT in fact be prime. How to SEO a Single-Page website I am creating a new website for a client, and I think a single page website / layout will be pretty neat. There is not that much detailed content, it is a company that imports a lot of products from different companies. So it will be a bit of a showcase of the different types of products / equipment you can order. Of the whole catalog only maybe 10 products are actually shown.  Now I have the basic structure with sections and links like:      #home / #products / #equipment / #services / #contact.    Now from what I understand is that Google does not index links containing #, so there will be no problem of duplicate content, everything will be indexed as the frontpage.  Now what I want to optimize is searching. This company is agent of some product in the country, meaning only they have the permission to import and sell that product. This means  that when somebody searches for product x, this website pops up as the first hit.  Now can I make it that they will be automatically brought to the #products part of the website directly from google.  I was thinking of something like having google index the different sections as different pages. Is something like that possible? Add a link to the timeline of a post For the past year I have been quite active on SO and a bit on meta, but I had never heard of the timeline of a post until today in a comment on meta.  There was an  two years ago of this feature as "experimental". ( for that question).  This feature was , answer: this exists, but the link has to be built manually.  I think this could be quite interesting sometimes and I would like to use this, but I will not do so if I have to build the link each time by myself.  This feature has existed for two years and is still "experimental"? Who is using it? Who knows about it?  My feature request: Implement a link in the posts to their timeline. I am sure this nice feature will be used. I have a wireless Access point which is connected to internet and the same being accessing by 2 system, one on windows XP and the other on Ubuntu.  Please let me know if it is possible to access the c:\ d:\ or any drives on windows xp machine directly from ubuntu system ?  I have tried doing this with 2 windows xp system but not sure how to do this from ubuntu.  Any help regarding the same is highly appreciated. (reason to do so is to access files in windows xp machine)  -Thanks &amp; regards, Manju Which one is correct: '3 hour journey' or a '3-hour journey'? Which one of the following is correct (bold part)?      It took us quite a long time to get here. It was 3 hour journey.   or     It took us quite a long time to get here. It was a 3-hour journey. Material setings in properties window is missing Is the git storage model wasteful? Why sometimes evidence is said to be too complex to compute and other times is negelected cause it is fixed? Why do we say "is it" when asking a question rather than "it is"?