I am making a retrofit POST request using Paging library.  When the first page is loaded the next page is automatically called.  But when it comes to the last page (assume page 5), it requests for page 6, then on response the app crash with error  java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference  when it queries for page 6, from my LogCat, an HTTP response is OK with Content length 0. But when i do checking it crashes          //...code         private final ReplaySubject&lt;Rating&gt; ratingReplaySubject;          //...code         @Override         public void onResponse(Call&lt;ArrayList&lt;Rating&gt;&gt; call, Response&lt;ArrayList&lt;Rating&gt;&gt; response) {             if (response.isSuccessful()) {                 callback.onResult(response.body(), Integer.toString(page.get()+1));                 mutableLiveData.postValue(NetworkState.LOADED);                  //First i tried this,                 //response.body().forEach(ratingReplaySubject::onNext);                  //Then I tried this,                 //ArrayList&lt;Rating&gt; ratingArrayList = new ArrayList&lt;&gt;();                 //ratingArrayList = response.body();                 //if(ratingArrayList == null &amp;&amp; !ratingArrayList.isEmpty()){                 //    for(int i=0; i&lt;ratingArrayList.size(); i++){                 //        ratingReplaySubject.onNext(ratingArrayList.get(i));                 //    }                 //}              } else {                 mutableLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, response.message()));                 Log.e("API CALL", response.message());             }         }
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?
Which of the following sets are compact in $\mathbb{M}_n(\mathbb{R})$[NBHM_PhD Screening Test-2013, Topology] Which of the following sets are compact in $\mathbb{M}_n(\mathbb{R})$ (a) The set of all upper triangular matrices all of whose eigenvalues satisfy $|\lambda|≤2 $. (b) The set of all real symmetric matrices all of whose eigenvalues satisfy $|\lambda|≤2 $. (c) The set of all diagonalizable matrices all of whose eigenvalues satisfy $|\lambda|≤2 $.  (a) &amp; (c) are not true. But I am not sure about (b).can anybody help me please. How can I convert a Unix timestamp to DateTime and vice versa? There is this example code, but then it starts talking about millisecond / nanosecond problems.  The same question is on MSDN, .  This is what I've got so far:  public Double CreatedEpoch {   get   {     DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime();     TimeSpan span = (this.Created.ToLocalTime() - epoch);     return span.TotalSeconds;   }   set   {     DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime();     this.Created = epoch.AddSeconds(value);   } } Does electron orbital theory contradict the Heisenberg uncertainty principle? When I use ssh -X on my Mac (running OS X 10.6.7) to connect to my Ubuntu (11.04) box, I get the following warning:     Warning: untrusted X11 forwarding   setup failed: xauth key data not   generated Warning: No xauth data;   using fake authentication data for X11   forwarding.   Is there something I can do to make this warning go away?  If not, can I safely ignore it?  X11 forwarding seems to work fine, though I do see this message:     Xlib:  extension "RANDR" missing on   display "localhost:10.0".   Is that related to the warning?  (I'm guessing not.  If it's not, I'll file a new question about that.) read.csv warning 'EOF within quoted string' prevents complete reading of file Sorting citations using \cites command in biblatex I am using biblatex for citations and bibliography. Now I often have lists of multiple citations, for which biblatex has the \cites command. Now I can get citations to automatically sort if I don't want page numbers, but I cannot get it right with page numbers.  What I want is all citation ordered chronological (oldest first). Is this possible, or must I just do this by hand?  Here is an example.  \documentclass[11pt,oneside]{memoir}  \usepackage[     style=authortitle,     useprefix=false,     maxnames=2,     firstinits=true,     sortcites=true,     uniquename=init,     abbreviate=true,     backend=biber,     sorting=ynt ]{biblatex}  \begin{filecontents}{jobname.bib} @book{tom1,   author = {Author, A.},   year = {2001},   title = {This book is from 2001},   shorttitle = {2001}, } @book{tom2,   author = {Author, A.},   year = {1999},   title = {This book is from 1999},   shorttitle = {1999}, } \end{filecontents}  \addbibresource{jobname.bib}   \begin{document} This one is corrent.\footnote{\Cites{tom1,tom2}.} This one is corrent.\footnote{\Cite{tom1,tom2}.}   This one is incorrent.\footnote{\Cites{tom1}{tom2}.} This one is incorrent.\footnote{\Cites[1]{tom1}[12]{tom2}.} \end{document} Why is my camera limited to a shutter speed of 1/250th when the flash is up? Sometimes in bright backlight and with large aperture (f2.8) I want flash at high shutter speeds.  But when I pop the flash up on D7000 it caps the shutter speed to 1/250th, which overexposes the shots and makes everything look like a nuclear bomb just went off.  What's the logic behind the limiting of the shutter speed when using flash? Is there anything I can do to get flash  + faster shutter speeds? One-byte-off pointer still valid in C? Accepted answers don't float "on top" when self-answered? On , the accepted answer doesn't float on top. Apart from that, the display is correct (i.e. the V mark and the green border)  If I sort by "vote", I've got the following answer order:   Jezell Marc Gravell chilltemp (Accepted) Shaun Bowe   By "oldest":   Marc Gravell Jezell chilltemp (Accepted) Shaun Bowe   and by "newest":   Shaun Bowe chilltemp (Accepted) Jezell Marc Gravell     I'm using Firefox V.3.5 : Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5 (.NET CLR 3.5.30729)  Feel free to ask for more debug information if needed. As far as I can tell downvoting is mostly useless.     For questions the only people who get downvoted are lower rep users, or incredibly stupid questions    most questions that are downvoted get closed anyway which should be sufficient downvoting doesn't have too much affect on your rep anyway a negative comment is more useful and more of a push too change or delete the question  For answers downvoting is often used incorrectly as well   people commonly competitively downvote (downvoting another answer to a question that you also answered) obviously not a good behavior downvoting (and upvoting) are contagious, meaning one downvote leads to a bunch of others even though downvotes don't effect rep that much they create a negative environment, no one wants their post downvoted, on the other hand criticizing comments, I think, are far more welcome      So basically in a nutshell a downvote serves no real purpose even if a post deserves it. Flagging, closing and commenting are much more useful to everyone including the poster than downvoting so why have it.    I now see from the answers and comments that downvotes do serve a purpose and would like to retract my request. In my Java application, I want to run a batch file that calls "scons -Q implicit-deps-changed build\file_load_type export\file_load_type"  It seems that I can't even get my batch file to execute. I'm out of ideas.   This is what I have in Java:  Runtime.    getRuntime().    exec("build.bat", null, new File("."));   Previously, I had a Python Sconscript file that I wanted to run but since that didn't work I decided I would call the script via a batch file but that method has not been successful as of yet. My processor is 64-bit - does that mean I need the amd64 image? I want to run a script to simply change the current working directory:  #!/bin/bash cd web/www/project   But, after I run it, the current pwd remains unchanged! How can I do that? What are the shortcomings of the Mean Absolute Percentage Error (MAPE)? The  () is a common accuracy or error measure for time series or other predictions,  $$ \text{MAPE} = \frac{100}{n}\sum_{t=1}^n\frac{|A_t-F_t|}{A_t}\%,$$  where $A_t$ are actuals and $F_t$ corresponding forecasts or predictions.  The MAPE is a percentage, so we can easily compare it between series, and people can easily understand and interpret percentages.  However, I hear that the MAPE has drawbacks. I'd like to understand these drawbacks better so I can make an informed decision about whether to use the MAPE or some alternative like the MSE (), the MAE () or the MASE (). Cannot vote to close immediately after edit Does proving (second countable) $\Rightarrow$ (Lindelöf) require the axiom of choice? Regularization using methods such as Ridge, Lasso, ElasticNet is quite common for linear regression. I wanted to know the following: Are these methods applicable for logistic regression? If so, are there any differences in the way they need to be used for logistic regression? If these methods are not applicable, how does one regularize a logistic regression? I did a fresh install of Ubuntu 16.04. /dev/md1 contains an ext4 filesystem that is mounted at /:  /dev/md1 on / type ext4 (rw,relatime,data=ordered)   Now I want to set the automatic filesystem check interval to one month, but I'm getting a strange error that I find no useful information about:  &gt; tune2fs -i 1m /dev/md1 tune2fs 1.42.13 (17-May-2015) tune2fs: Filesystem has unsupported read-only feature(s) while trying to open /dev/md1 Couldn't find valid filesystem superblock.   Rebooting didn't help. On another machine running Ubuntu 12.04, the same command works like a charm.  Does anyone have an idea what's wrong?  The command tune2fs -l /dev/md1 works fine, by the way. Here is its output:  tune2fs 1.42.13 (17-May-2015) Filesystem volume name:   &lt;none&gt; Last mounted on:          / Filesystem UUID:          38366a40-bbe1-476b-acfe-d271be6335eb Filesystem magic number:  0xEF53 Filesystem revision #:    1 (dynamic) Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum Filesystem flags:         signed_directory_hash Default mount options:    user_xattr acl Filesystem state:         clean Errors behavior:          Continue Filesystem OS type:       Linux Inode count:              8380416 Block count:              33521664 Reserved block count:     1676083 Free blocks:              32419430 Free inodes:              8312762 First block:              0 Block size:               4096 Fragment size:            4096 Group descriptor size:    64 Reserved GDT blocks:      1024 Blocks per group:         32768 Fragments per group:      32768 Inodes per group:         8192 Inode blocks per group:   512 Flex block group size:    16 Filesystem created:       Thu May 31 10:01:27 2018 Last mount time:          Thu May 31 10:49:41 2018 Last write time:          Thu May 31 10:15:14 2018 Mount count:              7 Maximum mount count:      -1 Last checked:             Thu May 31 10:01:27 2018 Check interval:           0 (&lt;none&gt;) Lifetime writes:          5782 MB Reserved blocks uid:      0 (user root) Reserved blocks gid:      0 (group root) First inode:              11 Inode size:               256 Required extra isize:     32 Desired extra isize:      32 Journal inode:            8 First orphan inode:       4325378 Default directory hash:   half_md4 Directory Hash Seed:      9d55d989-2c2b-4ad8-a29e-53c8798ec68e Journal backup:           inode blocks Checksum:                 0x3d9f8d23 How do you write (and run) a correct micro-benchmark in Java?  I'm looking for some code samples and comments illustrating various things to think about.  Example: Should the benchmark measure time/iteration or iterations/time, and why?  Related: Newton's third law does not apply to the kinetic energy formula? Here is a classic problem:     A 60kg boy and a 40kg girl are sitting in front of each other on skateboards on a frictionless horizontal surface. The boy pushes the girl and the girl gains a velocity of 0.3m/s during the 0.5s the boys hand was in contact with her. What is the boy's resulting velocity?   Considering Newton's Third Law, the best way is to find the total force applied and rearrange the formula to find the boy's speed.  Newton's Law Method:  $F = m*a$  $a=\frac{0.3m/s}{0.5s}$  $F = 40kg * 0.6m/s^2$  $F = 24N$  Therefore the boy's speed will be:   $\frac{24N}{60kg} = a$  $a = 0.4m/s^2$  $v = 0.4m/s^2 * 0.5s$  $v = 0.2m/s$  Kinetic Energy Method:  $E_{k}=\frac{1}{2}*m*v^2$ the girl's kinetic energy  $E_{k}=\frac{1}{2}*40kg*(0.3m/s)^2$  $E_{k}=1.8J$  Since every action has an equal and opposite reaction the boy should have the same amount of kinetic energy.  $E_{k}=\frac{1}{2}*60kg*(0.2m/s)^2$  $E_{k}=1.2J$  As you can see, using Newton's Third Law, the kinetic energy was not the same. So what's going on here? I thought that in this case they should both have the same amount of kinetic energy due to Newton's Law. I must be missing something since there is more energy going in one direction than the other after meeting. My book used the first method as the answer and, well, it feels wrong.