I am getting a crash (on android 7 only) when setExacctAndAllowWhileIdle in a function where I am create new alarm. I have no idea what is wrong here. And how to fix this crash.  This is my code and getting crash when calling   AlarmManagerCompat.setExacctAndAllowWhileIdle  AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);     if (alarmManager != null) {         final long triggerAt = System.currentTimeMillis() + interval;         AlarmManagerCompat.setExactAndAllowWhileIdle(alarmManager, AlarmManager.RTC_WAKEUP,                 triggerAt, pendingIntent);     }   This is the crash report i am getting:  Caused by java.lang.NullPointerException Attempt to invoke virtual method 'int com.android.server.AlarmManagerService$Batch.size()' on a null object reference android.os.Parcel.readException (Parcel.java:1714) android.os.Parcel.readException (Parcel.java:1661) android.app.IAlarmManager$Stub$Proxy.set (IAlarmManager.java:246) android.app.AlarmManager.setImpl (AlarmManager.java:680) android.app.AlarmManager.setExactAndAllowWhileIdle (AlarmManager.java:893) androidx.core.app.AlarmManagerCompat.setExactAndAllowWhileIdle (AlarmManagerCompat.java:223) **com.mokapos.receiver.AlarmReceiver.setNewAlarm (AlarmReceiver.java:276) com.mokapos.receiver.AlarmReceiver.initServices (AlarmReceiver.java:203) com.mokapos.receiver.AlarmReceiver.onReceive (AlarmReceiver.java:196)** android.app.ActivityThread.handleReceiver (ActivityThread.java:3363) android.app.ActivityThread.-wrap18 (ActivityThread.java) android.app.ActivityThread$H.handleMessage (ActivityThread.java:1800) android.os.Handler.dispatchMessage (Handler.java:110) android.os.Looper.loop (Looper.java:232) android.app.ActivityThread.main (ActivityThread.java:6802) java.lang.reflect.Method.invoke (Method.java) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1103) com.android.internal.os.ZygoteInit.main (ZygoteInit.java:964)
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?
Are there any non-green, non-artifact mana ramp cards? I have looked and can't seem to find any.  I have seen many green cards and some artifacts that do this, but nothing in Red, Blue, Black or White.    Are there any?  Note: By "Mana Ramp" I mean a card that generates mana, or one that lets you play more than one land per turn.  The end result, for example, would be on turn 4, playing a white only deck, I could tap more than 4 mana.  (Normally you only get one land per turn so a max of 4 mana on turn 4.) Order discrete x scale by frequency/value Pause button started working for Chrome / Youtube, messing with audio player controls How to include audio file in PDF If $p$ is a prime and $p \mid ab$, then $p \mid a$ or $p \mid b$. The proof is already given in the textbook but I tried other way around.   Proof by contradiction: Let's assume that $p$ doesn't divide $a$ and $p$ doesn't divide $b$, but $p$ divides $ab$. So $\gcd(p,a)=1$ and $\gcd(p,b)=1$. Given that we can construct linear combinations   $sp+ta=1$ together with $up+wb=1$. Multiplying the left and the right sides of the equations we get  $spup+spwb+taup+tawb=1$ or $p(sup+swb+tau)+ab(tw)=1 \implies \gcd(p,ab)=1$. This is a contradiction.   Is it rigorous and sound proof? What's the best practice of inserting a collection of data into a SQL Server database using apt-cache search I am learning how to use apt. When I do an apt-cache search git to see all packages matching git, I see a bunch of packages whose descriptions have nothing to do with git. Why is this so and how can I fix it? (Ubuntu 12.04.2 LTS).  Also, why is the search functionality found in a command that has "cache" in its name? What does search functionality have to do with caches?  Thanks. Can trusted users be trusted to suggest tag synonyms without a score of 5 in a tag? (on smaller sites, not Stack Overflow) This has been asked before but I feel the original question was more focussed on Stack Overflow than the Stack Exchange network at large.   Related:   Since there are now a lot of sites in the network and many of them use the tag system for categorising questions based on the title of something (for example, Arqade (Gaming), Movies &amp; TV, Sci Fi &amp; Fantasy, etc) I feel that the required knowledge of the subject matter the tag is representing is less of an issue than it perhaps is on other Stack Exchange sites.   In the below screenshot, for example, I shouldn't really have needed a score of 5 in either of the tags to perform what is essentially a cleanup process. I could of course edit all of the posts to delete one tag, so why can't I suggest it as a synonym?    This could be implemented as a per site setting so that it can only be enabled on certain sites if need be.   Can trusted users be trusted to suggest tag synonyms without a score of 5 in a tag? Installing python module within code Rank of a Matrix Sum I have $3\times3$ matrices such that S=A+B. I know there is an inequality connecting rank of the matrices A, B and its sum S. Could you write down that here? It will be a great help for me.  Means equation  or inequality connecting rank(S), rank(A) and rank(B). Unintentional Lies and Misinformation How many constructor arguments is too many? Let's say you have a class called Customer, which contains the following fields:   UserName Email First Name Last Name   Let's also say that according to your business logic, all Customer objects must have these four properties defined.  Now, we can do this pretty easily by forcing the constructor to specify each of these properties.  But it's pretty easy to see how this can spiral out of control when you are forced to add more required fields to the Customer object.    I've seen classes that take in 20+ arguments into their constructor and it's just a pain to use them.  But, alternatively, if you don't require these fields you run into the risk of having undefined information, or worse, object referencing errors if you rely on the calling code to specify these properties.  Are there any alternatives to this or do you you just have to decide whether X amount of constructor arguments is too many for you to live with? How can I calculate the number of work days between two dates in SQL Server?   Monday to Friday and it must be T-SQL. Show that any monotone boolean function can be realize by the following connectives. Number of bins when computing mutual information I want to quantify the relationship between two variables, A and B, using mutual information. The way to compute it is by binning the observations (see example Python code below). However, what factors determines what number of bins is reasonable? I need the computation to be fast so I cannot simply use a lot of bins to be on the safe side.  from sklearn.metrics import mutual_info_score  def calc_MI(x, y, bins):     c_xy = np.histogram2d(x, y, bins)[0]     mi = mutual_info_score(None, None, contingency=c_xy)     return mi Speed $v$ of a wave on a tightrope How many distinct ways to climb stairs in 1 or 2 steps at a time? (Fibonacci puzzle) There is a very interesting puzzle for Fibonacci sequence:     You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb $1$ or $2$ steps. In how many distinct ways can you climb to the top?   The answer is Fibonacci sequence: $F(n) = F(n - 1) + F(n - 2)$. The explanation is that you could reach the $n$th step either from the $(n - 1)$th step or $(n - 2)$th step.  What I fail to understand is why isn't the answer $F(n) = (F(n - 1) + 1) + (F(n - 2) + 2)$. Since, after reaching $(n - 1)$th step I have to take $1$ step to reach the $n$th step and after reaching $(n - 2)$th step I have to take another $2$ steps to reach the $n$th step.  I know I might be ignoring some very stupid detail but it's better to ask and be called a fool once than to remain a fool forever. Drupal out of the box comes with a page (which is the default homepage) that is assigned to the node path.  How do I avoid users reach it, and redirect them to the actual homepage of the site? Why are there no animals in "The Matrix"? I  to the question "" which was specific to the question asked.  Another user engaged positively with my answer, as there was a small conversation thread.  That person then  and made what I would say are minor modifications (the comments I left in my original code that pertained to the specific case are still in the places where he made edits to be more specific).  The answer does acknowledge that it is a general case of my specific code.  Ignoring the fact that I'm involved in it, what should one do when seeing this situation?  The only thing I can think of, and I'm not sure that it's necessarily the right solution, is to flag the answer for moderator attention.  Other possible actions, which I believe are wrong, are:   Editing the answer; that would change its intent Voting the answer down; it's a technically correct answer   One could leave a comment, but that can lead to confrontation and escalation (depending on the parties involved) which would be counterproductive.  The only thing I've done, which is not really related, is edit the answer to hyperlink the already existing attribution (but I do this as a regular edit for any answer which explicitly references another).  What's the best approach here, if any?