getMap() NullPointException I know there are much posts like this one around but there was no solution that helped me.  I got a viewpager with two fragments and on the second one is my map. But everytime I try to draw a polyline to that map I got a nullpoint exception. Only when I use setContentView it can find my map fragment (but this destroys my viewpager).  Part of my activity:  public void buttonMaps_Click(View view) {         // setContentView(R.layout.fifth_fragment);         SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);         if (mapFragment != null) {             GoogleMap map = mapFragment.getMap();             // map1 = ((SupportMapFragment)             // getSupportFragmentManager().findFragmentById(R.id.map1)).getMap();             Polyline line = map.addPolyline(                     new PolylineOptions().add(mP0, mP1, mP2, mP3, mP4, mP5, mP6, mP7, mP8).width(5).color(Color.BLUE));         }      }   My fragment xml.  &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@+id/fifth_fragment"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:paddingBottom="@dimen/activity_vertical_margin"     android:paddingLeft="@dimen/activity_horizontal_margin"     android:paddingRight="@dimen/activity_horizontal_margin"     android:paddingTop="@dimen/activity_vertical_margin"    &gt;          &lt;fragment             android:id="@+id/map"             android:name="com.google.android.gms.maps.SupportMapFragment"             android:layout_width="match_parent"             android:layout_height="312dp"             android:tag="lumpeneimer" /&gt;          &lt;Button             android:id="@+id/button1"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_below="@+id/map"             android:layout_centerHorizontal="true"             android:layout_marginTop="29dp"             android:onClick="buttonMaps_Click"             android:text="Button" /&gt;  &lt;/RelativeLayout&gt;   Is there a way to draw the polyline without using setContentView?  Edit: I tried this at my fragment.java:  public class FifthFragment extends Fragment implements OnMapReadyCallback { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstaceState) {         // TODO Auto-generated method stub         SupportMapFragment mapFragment = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map);         mapFragment.getMapAsync(this); return (LinearLayout) inflater.inflate(R.layout.fifth_fragment, container, false);  @Override     public void onMapReady(GoogleMap googleMap) {         GoogleMap map = googleMap;         // TODO Auto-generated method stub           Polyline line = map.addPolyline(                 new PolylineOptions().add(mP0, mP1, mP2, mP3, mP4, mP5, mP6, mP7, mP8).width(5).color(Color.BLUE));     }   but still got the NullPoint at:   mapFragment.getMapAsync(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?
Say we have two integers $n$ and $k$, such that $0 &lt; k &lt; n$ and $gcd(n, k) = 1$.  Why is it that if we take every integer $x\in\{0,\dots, n-1\}$ and compute $k\cdot x \ (mod \ n)$, we get as remainders all numbers from $0$ to $n-1$, with no repeats?  In other words, why is $\ f:\{0,\dots,n-1\}\rightarrow\{0,\dots,n-1\}$, $\ f(x)=k\cdot x\ (mod\ n)$ a bijection for $k,n\in\mathbb{N},\ gcd(k,n)=1$? How to make Portable QGIS 3 Make clear which profile data is visible to whom Install CentOS 7 on HP dl120 gen9 server with b140i raid controller I'm trying to install CentOS 7 on a HP DL120 gen 9 server with a b140i controller. I have 4 1TB HDD setup in a raid 1+0 and the CentOS installer doesn't seem to recognize the logical drive created from the storage utility.  From my understanding i need some drivers for CentOS 7 to recognize the B140i controller. Also, the driver seems to be closed source by HP.  What is my approach here? Is there any other free linux OS that i can use on this server and that would recognize the raid controller?  Thank you. Our company has multiple domains set up with one website hosted on each of the domains. At this time, each domain has its own authentication which is done via cookies.   When someone logged on to one domain needs to access anything from the other, the user needs to log in again using different credentials on the other website, located on the other domain.   I was thinking of moving towards single sign on (SSO), so that this hassle can be eliminated. I would appreciate any ideas on how this could be achieved, as I do not have any experience in this regard.  Thanks.  Edit: The websites are mix of internet (external) and intranet (internal-used within the company) sites. Difference between "should" and "must" What is the difference between "should" and "must"?  e.g. "They should have called the police." Can I use "must" in that sentence or not?  e.g. "You should read his new book." How about this sentence? For example, you're doing a research for a car to purchase. You get a list of cars with engine number, city where a car was assembled, and a color. What's missing is make, model and price. Smoke Generator does not work When I try to run the smoke simulator in Blender 2.62 I get no smoke at all. When I attempt to render, the only output is a black screen. What am I doing wrong here that is making the smoke simulation not render?  Is it a mistake I made, or a problem with Blender version 2.62? What does the function f: x ↦ y mean? I am doing , and am having a few problems with function notation. I understand the form f(x).  What does the form f: x ↦ y mean? Could you also give one or two examples?  And, if possible, state your source. Thank you. Using "the" instead of "a" for something that isn't a specific object I've been curious about this for a while.  Generally, one uses "the" if they mean a specific object ("The copy of Lord of the Rings I bought yesterday") instead of any object that fits a description ("I have a copy of Lord of the Rings").  However I've seen "the" used in some cases where the phrase doesn't refer to a specific object. I've noticed it mostly being about technology, such as "This game requires the Classic Controller" (seen on some Wii Virtual Console games). While saying "This game requires a Classic Controller" seems to be correct as well, using "the" doesn't feel wrong either.  The controller's page on Wikipedia also uses "the":   What is the rule that allows the use of "the" in this context?  I presume it has something to do with "Classic Controller" being a proper noun. How can I take screenshots of YouTube videos in full screen? How come unpolarized light does not undergo destructive interference? Number of integer solutions of $x^2 + y^2 = k$ I'm looking for some help disproving an answer provided on a  I posted about computing the number of double square combinations for a given integer.    The original question is from the Facebook Hacker Cup       Source: Facebook Hacker Cup   Qualification Round 2011      A double-square number is an integer $X$   which can be expressed as the sum of   two perfect squares. For example, 10   is a double-square because $10 = 3^2 + 1^2$.   Given $X$, how can we determine the   number of ways in which it can be   written as the sum of two squares? For   example, $10$ can only be written as $3^2 + 1^2$   (we don't count $1^2 + 3^2$ as being different). On the other hand,   $25$ can be written as $5^2 + 0^2$ or as   $4^2 + 3^2$.      You need to solve this problem for $0 \leq X \leq 2,147,483,647$.      Examples:      $10 \Rightarrow 1$      $25 \Rightarrow 2$      $3 \Rightarrow 0$      $0 \Rightarrow 1$      $1 \Rightarrow 1$   In response to my original question about optimizing this for F#, I got the following response which I'm unable to confirm solves the given problem correctly.       Source:       Again, the number of integer solutions   of $x^2 + y^2 = k$ is four times the   number of prime divisors of $k$ which   are equal to $1 \bmod 4$.      Knowing this, writing a program which   gives the number of solutions is easy:   compute prime numbers up to $46341$ once   and for all.      Given $k$, compute the prime divisors of   $k$ by using the above list (test up to   $\sqrt{k}$). Count the ones which are   equal to $1 \bmod 4$, and sum. Multiply   answer by $4$.   When I go through this algorithm for $25$, I get $8$ which is not correct.          For each prime factor (pf) of $25$ ($5$, $5$ are prime factors of $25$)         if pf % $4$ = $1$ (true for both $5$'s), add $1$ to count      return $4$ * count (count would be $2$ here).          So for $25$, this would be $8$ Let $f:G\to K$ be a surjective group homomorphism and $H$ be a subgroup of $G$ satisfying $N_G(H)=H$. Then $N_K(f(H))=f(H)$. I'm trying to prove or disprove it. perhaps, this proposition is true. But, how can we prove it? Edit: I thought it is true because WIKI said it is true without proof I have a polygon layer in QGIS, and would like to represent the polygons like in the below image:    I have tried two different approaches, none of which are satisfactory.    Using a line pattern fill, the entire polygon is filled with the line pattern. I need a blank area in the middle which is not filled in.    Using a marker line fill, I am able to keep a blank area in the middle, but the markers are rotated to align with the edges of the polygon. I need the markers to preserve the same rotation along all edges, like in the example above.  Any ideas? Is a Squib a Muggle? ‘And what on earth’s a Squib?’ said Harry.   To his surprise, Ron stifled a snigger.   ‘Well – it’s not funny really – but as it’s Filch ...’ he said. ‘A Squib is someone who was born into a wizarding family but hasn’t got any magic powers. Kind of the opposite of Muggle-born wizards, but Squibs are quite unusual. If Filch’s trying to learn magic from a Kwikspell course, I reckon he must be a Squib. It would explain a lot. Like why he hates students so much.’ Ron gave a satisfied smile. ‘He’s bitter.’   Chamber of Secrets - pages 110-111 - British Hardcover   If a Squib is 'kind of the opposite of a Muggle-born wizards' wouldn't that make a Squib more Muggle than wizard? Does a Muggle strictly have to be born to Muggle parents to be considered a Muggle, or can the lack of magic render a person, even of wizarding parentage, a Muggle?  Hermione can say in all truthfulness that she is a 'Muggle-born witch.' The nickname (albeit derogatory) for a Muggle-born is 'Mudblood.' Filch can say in all truthfulness that he is a 'wizarding-born non-magic person,' which, according to Hagrid is a Muggle.  'Squib' may be derogatory in the same way as 'Mudblood' is. Neville laments his family thought he was a Squib when he showed no magical tendencies as a child; the Longbottoms were so rattled at the thought of Neville being a Squib that they, among other things, threw him out a second-story window to see if he would bounce. So could 'Squib' actually be a derogatory term meaning the opposite of 'Mudblood'? After all, the Ministry doesn't allow Squibs to register as magical beings, and many Squibs are schooled and trained in Muggle professions. Squibs don't get a Hogwarts letter.    Wizards can be born to Muggles. Can Muggles be born to wizards?  ETA 11.22.14: In regard to this question, I was glancing through Philosopher's Stone, and I came across this, that Neville said:     ‘Well, my gran brought me up and she’s a witch,’ said Neville, ‘but the family thought I was all Muggle for ages. My great-uncle Algie kept trying to catch me off my guard and force some magic out of me – he pushed me off the end of Blackpool pier once, I nearly drowned – but nothing happened until I was eight.’   Philosopher's Stone - page 93 - Bloomsbury - chapter seven, The Sorting Hat   Could what Neville says contribute to the theory and/or conclusion that Squibs are, or are not, Muggles? How do we apply what Neville said? How to keep an SSD in shape on Yosemite? As of OS X 10.10, Apple uses kext signing. Ever since it has become  to manually activate TRIM for third-party SSDs on OS X. That means users with non-Apple SSDs will sooner or later see degrading write speeds.   So I am wondering what are my options to avoid this situation. Some approaches I could think of imply additional problems:   Are you aware of any alternative approach, that does not require disabling kext signing?  Are there tools or tricks to manually clean up a SSD (i.e. issue a TRIM command)? If I decided to temporarily use a tool like TRIM Enabler how long would it need to be activated, in order to clean the disk?   To summarize: No TRIM on Yosemite. What can I do? I'd like to run a .sh file using bash on logout and shutdown of Ubuntu. I have searched up and down the web and have found only fixes for KDE and GNOME. The script is simple, I just need to know if I can add the line of code to the "logoff/shutdown" file or if I need to reference it in another script. I have been playing around with Ubuntu installing new themes and and docks. Sometimes during the installation, whole screen just hangs. What is the best way in Ubuntu to Kill a process/application? Anything similar to Ctrl + Alt + Del of windows? Express  $$\forall\ n\in\mathbb N\ \exists\ m \in\mathbb N: \ n^4 = m^2$$  in words without using the symbol $\mathbb N$.