Layout  &lt;?xml version="1.0" encoding="utf-8"?&gt;   &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_height="match_parent" android:id="@+id/llist" tools:context="com.android.parteek.contentprovider.Main2Activity"&gt;  &lt;android.support.v7.widget.SearchView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/serch"&gt; &lt;/android.support.v7.widget.SearchView&gt;  &lt;ListView     android:id="@+id/list"     android:layout_width="match_parent"     android:layout_height="match_parent"     tools:context="com.android.parteek.contentprovider.Main2Activity"&gt;  &lt;/ListView&gt;  &lt;/LinearLayout&gt;   Code  package com.android.parteek.contentprovider;  import android.content.ContentResolver; import android.content.DialogInterface; import android.content.Intent; import android.database.Cursor; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.SearchView; import android.util.Log; import android.view.Menu; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import android.widget.Toast;  import java.util.ArrayList;  public class Main2Activity extends AppCompatActivity implements AdapterView.OnItemLongClickListener, SearchView.OnQueryTextListener { ListView l; ArrayList&lt;Bean&gt; arrayList; UserAdapterr userAdapterr; ContentResolver contentResolver; SearchView searchView; Bean b,b1; int pos; void views(){     l=(ListView)findViewById(R.id.list);     searchView=(SearchView)findViewById(R.id.serch);  } @Override protected void onCreate(Bundle savedInstanceState) {     super.onCreate(savedInstanceState);     setContentView(R.layout.activity_main2);     views();     contentResolver=getContentResolver();     retrieve(); } @Override public boolean onCreateOptionsMenu(Menu menu) {     getMenuInflater().inflate(R.menu.searchmenu,menu);     searchView=(SearchView)menu.findItem(R.id.search).getActionView();    searchView.setIconifiedByDefault(true);    searchView.setOnQueryTextListener(this);    searchView.setQueryHint("search.....");      return super.onCreateOptionsMenu(menu); }   @Override public boolean onQueryTextSubmit(String query) {     return false; }  @Override public boolean onQueryTextChange(String newText) {     return false; } }   Error   java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.SearchView.setIconifiedByDefault(boolean)' on a null object reference                                                                                          at com.android.parteek.contentprovider.Main2Activity.onCreateOptionsMenu(Main2Activity.java:147)
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?
How can I get octal file permissions from command line? Get e-mail addresses from Gmail messages received Why didn't the Hobbits get frostbite? Whatsapp, Keeping the number on the new phone but without the old sim card Whatsapp, Keeping the number on the new phone but without the old sim card. Ok the situation is I love my old number and to be honest don't want to ask everybody to change my number again and again. But I do not have the old sim card, and that bums me out. If there is any way to achieve this? How do you explain cubic growth of a function When reading scientific papers I have seen people explain the growth of a variable linearly, exponentially. However how would one say for a variable which grows in quadratic fashion, or cubic?  I don't remember reading something like: "y grows cubically with x"  Can I say, y grows cubically with x?  What would be the proper way to explain cubic or quadratic growth of a variable as a function of another one?  How would you explain the given lines: iptables drop all incoming ICMP requests except from one IP Currently, I have something like:  iptables -A INPUT -p ICMP --icmp-type 8 -j DROP iptables -A INPUT -s x.x.x.x -p ICMP --icmp-type 8 -j ACCEPT   However, when I run the second command, it looks as if iptables just stops.  I have to break out of it to get back to terminal.  Perhaps I am doing it all wrong, but some insight would be helpful. How to find a computer name in a LAN from the IP address? My network includes machines running Linux and others running Windows. And my machine is running Linux. What is the formula for armor/magic resist reduction? As far as I can tell, it's something like this:  damage reduction = armor / (armor + 100)   Is this accurate? Square root of Positive Definite Matrix How to evaluate potential advisers on grounds other than their research/publications? While accepting an offer to grad school, one is basically entering into a lasting relationship with one's adviser - most likely, someone whom the applicant has never met before, and the only exposure has been through the potential adviser's website/publications. It is in the interest of both parties to ensure (to the greatest possible extent) that there are no personal/professional traits of either that hamper the formation of a pleasant working relationship - no-one would want to go through the ordeal of having to change advisers midway!  While the faculty has a chance to have a good look at the applicant's profile as well as his motivations (through his grades and SOP), the applicant doesn't have a similar opportunity. So, I'm interested to know what parameters can be used to gauge a potential fit. I've thought of the following:   Past students:  Did anyone ever drop out/change advisers midway, and if so, for what reasons? These would be a bit hard to find though, as I don't expect the faculty concerned would list them on their website. It would be great if anyone could let me know how to find out the list of incoming students to a department for any year. Publication rate, taking into account the venues where they were accepted. Time taken to graduate - though I accept this is more dependent on the student, a median figure should be telling ... What they did post Ph.D. - did anyone get tenure if they went into academia, or is almost everyone unable to break out of being a post-doc?  Tenure status: I'm a bit unsure about this, so wanted the community's opinions about it. Just so that I'm clear, I'm only trying to calibrate the applicant's expectations about the working style of his potential adviser - and hence need to know to what extent are the following "typical" assumptions valid.  Tenured professor  A full professor is more likely to get grant funding, hence less time spent on TAship - but could also mean less time/effort spent on interactions with students (either being busy with other projects/talks, or due to more commitments to family at that age).  Tenure-track faculty (Assistant profs)  More likely to be young and energetic, and could translate to more time spent on one-to-one discussions with grad students - but funding may prove to be an issue, and may have to be on TA for a longer period.   What other factors would be relevant in this matter, and to what extent am I correct/incorrect in either the factors considered, or for undertaking this exercise at all? How to install TP-LINK T2UH Wireless adapter Driver (Ralink mt7610u) Evaluate the following limit of finite sum Evaluate the limit $$\lim_{n\to \infty}\frac{1}{n}\sum_{k=0}^{[n/2]}\cos \left(\frac{k\pi}{n}\right)$$  I tried through considering two cases : (i) When $n$ is even (ii) when $n$ is odd.  When $n$ is even then the limiting value is $\frac{1}{\pi}$. But when $n$ is odd then ??  Case 1 : $n$ is even..  Then , take $n=2p$ where $p$ is positive integer. Then $$\lim_{n\to \infty}\frac{1}{n}\sum_{k=0}^{[n/2]}\cos \left(\frac{k\pi}{n}\right)$$  $$=\lim_{p\to \infty}\frac{1}{2p}\sum_{k=0}^{p}\cos\left(\frac{k\pi}{2p}\right)$$  $$=\frac{1}{2}\int_0^1\cos(\pi x/2)\,dx$$  $$=\frac{1}{\pi}.$$  Case 2 : When $n$ is odd.  Take, $n=2p+1$ , where $p$ is a positive integer. Then ,   $$\lim_{n\to \infty}\frac{1}{n}\sum_{k=0}^{[n/2]}\cos \left(\frac{k\pi}{n}\right)$$  $$=\lim_{p\to \infty}\frac{1}{2p+1}\sum_{k=0}^p\cos\left(\frac{k\pi}{2p+1}\right)$$  From here how I proceed ? Do Ryzen 3 2200u laptops with Vega 3 work out of the box with major Linux distros? I am using QGIS 3.2.0 on a Mac (and also have QGIS 2), and I have a fishnet grid (probably created in Arc) that comprises of nearly 2 million grid cells. As a result, every change I make to the attribute table takes hours, so I can't experiment as I would usually.  I need to label each grid cell such that the north-westernmost cell is "1", and the numbers proceed by rows, until the last number goes into the south-easternmost cell. Using the row-number doesn't work, as that's not how the table is sorted. I've done this before, but cannot remember how. My change password interface is not working on java eclipse web application If parsing the output of ls is dangerous because it can break on some funky characters (spaces, \n, ... ), what's the best way to know the number of files in a directory?  I usualy rely on find to avoid this parsing, but similarly, find mydir | wc -l will break for the same reasons.  I'm working on Solaris right now, but I'm looking for a answer as portable across different unices and different shells as possible. sObject ' ' type is not supported Hey everyone I've been seeing this a lot lately and am trying to figure out why this error is thrown when querying the SOAP API directly. I've tried several very basic SOQL queries such as  SELECT Body FROM AssetFeed   Only to be met with the sObject type 'AssetFeed' is not supported. error.  The account that I'm currently querying is just a standard user who accepted permission from an app that was created by a Developer Account, so I'm wondering if it might be permissions from the user or permission from the app itself? Possibly because Developer accounts cannot use 95% of whats offered?  The WSDL used is a v27.0 generated Partner WSDL if that helps narrow it down.  I've noticed this in multiple standard objects, so I'm wondering what the trend really is? Seems like a good informational question for future googling of others?  Running describeGlobal()  Array (     [0] =&gt; AggregateResult     [1] =&gt; Attachment     [2] =&gt; ChatterActivity     [3] =&gt; CollaborationGroup     [4] =&gt; CollaborationGroupFeed     [5] =&gt; CollaborationGroupMember     [6] =&gt; CollaborationGroupMemberRequest     [7] =&gt; CollaborationInvitation     [8] =&gt; ContentDocument     [9] =&gt; ContentDocumentFeed     [10] =&gt; ContentDocumentHistory     [11] =&gt; ContentDocumentLink     [12] =&gt; ContentVersion     [13] =&gt; ContentVersionHistory     [14] =&gt; EntitySubscription     [15] =&gt; FeedComment     [16] =&gt; FeedItem     [17] =&gt; FeedLike     [18] =&gt; FeedTrackedChange     [19] =&gt; Group     [20] =&gt; GroupMember     [21] =&gt; HashtagDefinition     [22] =&gt; Name     [23] =&gt; TaskPriority     [24] =&gt; TaskStatus     [25] =&gt; User     [26] =&gt; UserFeed     [27] =&gt; UserPreference     [28] =&gt; UserRecordAccess     [29] =&gt; UserRole )   Where would all the rest of my SOAP SObjects be? This seems like a very thin list compared to the 295 SObjects advertised Picturing the how the covariant derivative acts on vector fields How does PK know better than Jaggu? I'm developing some scripts. One for the  that popped in Ubuntu 16.04 even though pcspkr is blacklisted. Another to fix a  where sound switches off from TV to the laptop.  What is the best directory to put my bash scripts in?  I've searched the Q&amp;A database but I get a bunch of different answers for a bunch of different scenarios.  /usr/local has been recommended by one person because it's in the PATH$. Is that the right thing to do?  Thank you for your advice.    Even though I accepted below answer over a year ago, I ended up using:   /usr/local/bin for scripts needing sudo powers /home/me/bin for scripts running at user level   After creating directory /home/me/bin you need to log out and in again for it to get into your PATH.