I have below code to show popup menu when user click on the overflow image in each row item. Unfortunately i have no idea how to pass the context to the fragment which caused the onClick() didnt get the context value. I managed to show the popup menu if i create the listener directly in the getView() of the adapter class but i cant get the expected result if i passed the listener to the fragment. May i know how can i adapt my code below?  My current coding is as below:  public class SubProductCustomAdapter extends BaseAdapter {  ... @Override public View getView(int position, View convertView, ViewGroup parent) {     //RecyclerView (Android 5.0) - To avoid app crash when there are too many records when user scroll     ViewHolder viewHolder;     LayoutInflater mInflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);      //First Created     if(convertView == null )     {         convertView = mInflater.inflate(R.layout.item_sub_product, null);         viewHolder = new ViewHolder();          viewHolder.sub_product_name = (TextView)convertView.findViewById(R.id.txt_pdt_name);         viewHolder.popup_menu = (ImageView) convertView.findViewById(R.id.product_overflow);          SubRowProducts subRowPro = subRowProducts.get(position);         viewHolder.sub_product_name.setText(subRowPro.getSub_product_name());          //Managed to display popup menu using below method         /*viewHolder.popup_menu.setOnClickListener(new View.OnClickListener() {             @Override             public void onClick(View v) {                 PopupMenu popupMenu = new PopupMenu(context,v);                  popupMenu.getMenuInflater().inflate(R.menu.drawermenu, popupMenu.getMenu());                  popupMenu.show();             }         });*/          //Not managed to display popup menu using below method         viewHolder.popup_menu.setOnClickListener(new MySubProductListFragment());          //Store object inside convert view         convertView.setTag(viewHolder);      }      else{         //Reused or recycle the convertView         viewHolder = (ViewHolder)convertView.getTag();     }      //viewHolder.sub_product_name.setText(subRowProducts.get(position).getSub_product_name());      return convertView; }   .  ************************************************************************************************************  public class MySubProductListFragment extends ListFragment implements View.OnClickListener {  ...   @Override public void onClick(View v) {      PopupMenu popupMenu = new PopupMenu(getActivity(),v);      popupMenu.getMenuInflater().inflate(R.menu.drawermenu, popupMenu.getMenu());      popupMenu.show();  }   }
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?
My computer is loud: How do I tell which fan is the issue? On my new computer, my fan(s) is/are plain LOUD! Using SpeedFan, I find that my temps are all under 32 degrees C under my normal use (IDK how accurate that is but the CPU itself says 27 C).  The fan doesn't sound unbalanced and it isn't making sounds in rhythm (Not the usual rrrrrrrRRRRRR... rrrrrrrRRRRRR... rrrrrrrRRRRRR... rrrrrrrRRRRRR), just a constant fan. I am thinking about oiling the fans, but I can't decide if it is the PSU fan or a case fan or the CPU fan. If it's the CPU fan I will most likely just replace that with a quiet fan. How can I tell which fan is making the noise (if not multiple)?  One thing that I am thinking may be the problem is my CPU fan isn't PWM so would swapping that out help? There is no "linear voltage" or etc thing in BIOS so I think it may be running at full speed. Also, I could have too much airflow because it is also making a whistling noise that you can hear close to it that sounds like when I accedentially put part of the side cover over my floor vent to get it out of the way. Finding real roots of $ P(x)=x^8 - x^7 +x^2 -x +15$ Let $ P(x)=x^8 - x^7 +x^2 -x +15 $, Descartes' Rule of Signs tells us that the polynomial has 4 positive real roots , but if we group the terms as $$ P(x)= x(x-1)(x^6+1) +15 $$ we find that $ P(x) $ does not have any positive roots.  Where did I err ? Requirements for a clan war? I am currently in a clan with three members. When we tried to initiate a clan war it said we had insufficient clan requirements. Does anyone know what the full requirements are? Is there a minimum clan member requirement? How can blackbody radition be explained by quantization? I don't understand why quantization makes a peak on the blackbody radiation curve (so there is no ) and the relationship between that peak and quantization concept.  When the blackbody is heated, it starts to glow. All atoms start to vibrate. Total heating energy must be divided and equally shared by all atoms of blackbody. Right?  But what happens next?  Do some atoms get much more energy to radiate at higher frequency and waste the energy? What happens at the atomic level, so quantization can explain it? What does classical physics claim, so it can not explain the radiation curve? How can I set my Ubuntu 12.04 LTS to boot to console without GUI? So I installed Ubuntu server to run some tests on a VM. For various reasons I couldn't get a specific DEB file, and instead of using a shared folder I decided it would be a good idea to install ubuntu-desktop so I can run Firefox and grab the file directly from the web.   Now, every time I boot my machine I get the graphical interface, but I have no reason for it since I'm running tests with the LAMP server.  I tried this    And this    If anyone has any idea for a solution, I'd appreciate it.   BTW: I thought about simply uninstalling ubuntu-desktop, but I feel like I might need it in the future, so, I really just want to disable the GUI.  EDIT:  While this solution is not perfect I realized, it works for now:  On the  question, user Michael K mentions that:  " Okay another way would be to disable the lightdm service in init:  /etc/init/lightdm.conf   in there there is a section like this:  start on (filesystem and started dbus and (drm-device-added card0 PRIMARY_DEVICE_FOR_DISPLAY=1 or stopped udev-fallback-graphics))   "  While this worked perfectly, I can't access the GUI with the startx command - the system just crashes. And I guess I'll need to uncomment the section to load startx.  Considering the fact that I want to keep the server running for as long as possible, having to restart it every time I want to log in the GUI is kinda unproductive.  EDIT2:  I guess it's possible simply to kill the GUI (  ) when I log in the system, it's still counter productive, but it works too.   EDIT3:   Michael K's reply worked fine. I just realized that to call the GUI I need to run lightdm and not startx Categorical Principal Component Analysis - using Count, Continuous, Ordinal variables together I have some variables and I want to reduce their number for further analysis. I initially thought of combining them using factor analysis. But since the variables are of all kinds (rating, count, ordinal, continuous dollar amount) I am thinking about using CATPCA for it. However, I have some questions about the technique -   Is CATPCA the right approach or Latent Class Factor Analysis would be the better one? By using the different kinds of variables together - how will the object scores be interpreted? For example - The rating question is on a 10 point scale but the dollar amount ranges from 0 to 1000s, so what will the object score obtained after CATPCA represent? And is it comparable to the Factor Score obtained from traditional PCA? For ordinal variables - Do all of them need to be in the same form, e.g. 1 meaning lowest and 10 meaning highest? Or can they be used in whatever form they are? Is it good to categorize the count and continuous variables based on their distribution and then treat then as ordinal/categorical variables?   I would highly appreciate any help you can provide! running rmi server, classnotfound After Factory Reset, In order to use Play store and Gmail I want to setup Google account on Samsung GT-S6802. When I tries to setup Google Account, In-spite of right user-name and password, following window appearers:    When I open gmail form browser, I've mail from google subject:Sign-in attempt prevented and says:     Someone just tried to sign in to your Google Account hidden@gmail.com from an app that doesn't meet modern security standards.     When I review, it shows unknown device but on browser it detects my device.  So, How do I face this issue and setup google account? Let $f:\mathbb{R}\longrightarrow \mathbb{R}$ a differentiable function such that $f'(x)=0$ for all $x\in\mathbb{Q}$ Let $f:\mathbb{R}\longrightarrow \mathbb{R}$ a differentiable function such that $f'(x)=0$ for all $x\in\mathbb{Q}.$ $f$ is a constant function? From A Classical Introduction to Modern Number Theory by Ireland and Rosen, page 33:     Corollary 1 (Euler's Theorem). If $(a,m) = 1$, then $a^{\phi(m)} \equiv 1\,(m)$.      Proof. The units in $\mathbb{Z}/m\mathbb{Z}$ form a group of order $\phi(m)$. If $(a,m) = 1$, $\bar{a}$ is a unit. Thus $\bar{a}^{\phi(m)} = \bar{1}$ or $a^{\phi(m)} \equiv 1\,(m)$.   If I'm interpreting this correctly, this proof implicitly uses the fact(?) that if $G$ is a group and $x\in G$, then $x^{|G|}=1$, where $1$ is the identity element of $G$.  If this is indeed true, can someone explain why? (I have had no prior exposure to group theory.) I have the following equation, where there is a lot of stuff under the sum symbol:  \begin{equation} d(\vec{x},\vec{y})=   \sum_{Z_{xy}\in\vec{Z}_{xy},\forall x\in\vec{x},\forall y\in\vec{y}}      f(Z_{xy}) \end{equation}   In the resulting document, I find it kind of hard to read. Is there a way to write the equation to make the result more readable, e.g. putting the stuff under the sum symbol on different lines? What methods of ‘clearfix’ can I use? I have the age-old problem of a div wrapping a two-column layout. My sidebar is floated, so my container div fails to wrap the content and sidebar.  &lt;div id="container"&gt;   &lt;div id="content"&gt;&lt;/div&gt;   &lt;div id="sidebar"&gt;&lt;/div&gt; &lt;/div&gt;   There seem to be numerous methods of fixing the clear bug in Firefox:   &lt;br clear="all"/&gt; overflow:auto overflow:hidden   In my situation, the only one that seems to work correctly is the &lt;br clear="all"/&gt; solution, which is a little bit scruffy. overflow:auto gives me nasty scrollbars, and overflow:hidden must surely have side effects. Also, IE7 apparently shouldn't suffer from this problem due to its incorrect behaviour, but in my situation it's suffering the same as Firefox.  Which method currently available to us is the most robust? I am looking for a way to convert a long string (from a dump), that represents hex values into a byte array.  I couldn't have phrased it better than the person that posted .  But to keep it original, I'll phrase it my own way: suppose I have a string "00A0BF" that I would like interpreted as the  byte[] {0x00,0xA0,0xBf}   what should I do?  I am a Java novice and ended up using BigInteger and watching out for leading hex zeros. But I think it is ugly and I am sure I am missing something simple. What's the meaning of 90-plus? What's the meaning of 90-plus? More than 90? If so, please tell me more ways to say "more than 90". Thank you! Vertical alignment in tabularx X column type I'd like to create a new column type which works exactly like a X column from tabularx but that also has the text vertically centered. I tried with the newcolumntype command but I can't figure out where to put the second column type? Example:  \newcolumntype{n}{&gt;{\centering\arraybackslash}X}   Where should I put the mto specify that the cells content should be vertically centered? I am a Bangladeshi citizen. Back in 2013, I went to India with a tourist visa and overstayed for four days. It was due to a gout attack in my feet but I don't have my medical papers to prove that.  I applied again in 2015 for a visa, at Dhaka, and they refused my visa and blacklisted my passport, writing some numbers and date on it. Now I am not able to get an Indian visa.  How I can remove my passport from the blacklist and get a new Indian visa? Do I need a Indian immigration lawyer to do this? Identifier for win64 configuration in Qmake Is there a "win64" identifier in Qmake project files?  documentation does not mention other than unix / macx / win32.  So far I've tried using:  win32:message("using win32") win64:message("using win64") amd64:message("using amd64")   The result is always "using win32".  Must I use a separate project-file for x32 and x64 projects, so they would compile against correct libraries? Is there any other way to identify between 32-bit and 64-bit environments? How should I print types like off_t and size_t? Is it "I" or "me" in "Keep Tom and I/me updated"? How to cite sources written in a different language than English? Assume one wants to cite a paper written in a different language than the article citing said paper (e.g., ones own article is written in English, but the source is French).   How to properly handle citation in such a case?  Do I cite the original (French) title or a translated title? If I use a translated title, people might have a hard time to find the source; if the original (French) title is cited, people might have a hard time understanding it.