I have an activity, say A, which has a fragment with a textview called TotalTimerFragment which contains a countdowntimer. There are 2 other fragments called F1 and F2. Activity A adds F1 and the countdowntimer in fragment TotalTimerFragment starts. After a few seconds F1 is replaced by F2. And here the countdowntimer should continue for few more seconds. But it crashes and gives a NullPointerException for the findViewById in the OnTick method in the class.  Here is the code for the FT fragment: getActivity().findViewById(R.id.total_timer_textview) in onTick method gives NullPointerException  public class TotalTimerFragment extends Fragment{     TextView totalWorkoutTimer;     TotalTimeCounter timeCounter;     static long total_millis;      @Nullable     @Override     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {         return inflater.inflate(R.layout.fragment_totaltimer, container, false);     }      @Override     public void onViewCreated(View view, Bundle savedInstanceState) {         super.onViewCreated(view, savedInstanceState);         totalWorkoutTimer = (TextView) getActivity().findViewById(R.id.total_timer_textview);     }      public class TotalTimeCounter extends CountDownTimer {         TextView totalWorkoutTimer;          public TotalTimeCounter(long millisInFuture, long countDownInterval) {             super(millisInFuture, countDownInterval);         }          @Override         public void onTick(long millisUntilFinished) {             total_millis = millisUntilFinished;             String total_hms = String.format("%02d:%02d:%02d", TimeUnit.MILLISECONDS.toHours(total_millis),                     TimeUnit.MILLISECONDS.toMinutes(total_millis) - TimeUnit.HOURS.toMinutes(TimeUnit.                         MILLISECONDS.toHours(total_millis)), TimeUnit.MILLISECONDS.toSeconds(total_millis) -                         TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(total_millis)));             totalWorkoutTimer = (TextView)getActivity().findViewById(R.id.total_timer_textview);             totalWorkoutTimer.setText(total_hms);         }          @Override         public void onFinish() {          }     } }
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 remap a keyboard key? How do I find out what version of Linux I'm running? Is there a way to determine what version (distribution &amp; kernel version, I suppose) of Linux is running (from the command-line), that works on any Linux system? How can I get the source directory of a Bash script from within the script itself? What's the best way to find the inverse of datetime.isocalendar()? Is it really impossible to calculate in advance the result of throwing dice? Can a wizard under the effects of Feign Death issue telepathic commands to their familiar? A wizard has a summoned familiar within 100 feet that is currently idle and has  (PHB, p. 240) cast on them by another PC. Would the wizard still be able to issue telepathic commands to their familiar?  Specifically, while Feign Death states that they appear dead and are incapacitated and blind, they aren't listed as being unconscious.   doesn't state that issuing telepathic commands requires an action (which you can't do while incapacitated), whereas it does state that seeing through your familiar's eyes requires an action as does dismissing it.  I was DMing a game where this occurred and I hastily ruled that the wizard was unable to issue commands, but I am second guessing myself after the fact. And knowing my PCs this situation is likely to happen again. As my question says,   $$\frac 1{1.2.3}+\frac 1{2.3.4}+\frac 1{3.4.5}+...$$  As far as $\frac 1{1.2}+\frac 1{2.3}+\frac 1{3.4}+...$ is concerned, we can write it as $\frac 1{n-1} - \frac 1{n}$ What can we do here? I just installed Ubuntu and it is great.  However, I installed in beside the Windows Vista OS.  I now want to remove Windows in an effort to improve performance.  What is the easiest way to do this? In Peter Jackson's film The Fellowship of the Ring, when the Council of Elrond takes place it shows a total of 22 members:    We all know the names of the ones who were part of the Fellowship, but I want to know who are the rest of the people in the council. Who are the elves that came with Legolas? The men next to the dwarves? The three old men sitting next to Boromir? Or the two elves next to Aragorn?  Starting from left to right:   Frodo Gandalf Elf Elf Legolas Elf Old Man Old Man Dwalin Gloin Gimli Nori Old Man Boromir Old Man Old Man Elf Elf Aragorn Elladan Elrond Elrohir What is the scientific name of this evergreen plant? This plant is found in India. It is an evergreen plant. Would love to know the scientific name. Lat/Long co-ordinates are not plotting onto EPSG:3857 OSM basemap correctly Excuse me if this is a stupid question, but I've honestly tried to find the answer in a few threads here on SE, and I cannot seem to follow the suggested steps correctly.    Project is in  (WGS 84 / Pseudo-Mercator) BaseMap (OpenStreetMap) layer is set to EPSG:3857 Vector data has been imported from CSV, and has Lat/Long coordinates, set to EPSG:3857.    The layer appears right in the middle of the map, around 0,0 obviously.   Why is this, what am I doing wrong? Can I argue that:  \begin{align} \left(\int_a^b f(x) \,dx\right) \left(\int_c^d g(y) \,dy\right) &amp;= \int_a^b f(x) \int_c^d g(y) \,dy \,dx \\ &amp;= \int_a^b \int_c^d f(x) g(y) \,dy \,dx \end{align}  since the same would be true for a product of finite sums? D&D 5e and "Theatre of the Mind" in combat Our target play style for combat encounters would be to use battle boards roughly half the time (when there is enough of interest in play that the tactics are fun to play out), and to skip that with faster "cinematic" combat otherwise.  We have not been 100% successful. The problem is the numbers-driven descriptions in the rules. Needing to be "adjacent" (within 5 feet) for abilities such as Protection style fighting, ranged weapon ranges, spell effects and movement speeds are all much easier to resolve on a grid. Running those rules without a board rapidly devolves into sketches with numbers written on them and/or "mother, may I?" style of play because the DM needs to rule who is next to who, and which monsters are in the spell radius. These rulings also quickly get out of sync with player expectations when there is no map and we want to run combats quickly.  It doesn't help that the numbers involved come in pretty much all multiples of the base 5 feet. There is no obvious close/short/medium for effects and ranges. If there were such then I think it would be much easier for the DM to categorise and hand-wave things.  I was hoping that both board-based and no-board style of play would feel equally viable. But the focus on numbers seems to push toward board playing, at least for my group.  We would still like to pay heed to the differences in movement, range, area-of-effect etc of the rules in play. At least in the general sense of creature X is faster than creature Y, or weapon/spell A has better range than weapon/spell B.  Going beyond "just don't sweat the details", how can a group like mine play with the D&amp;D 5e rules as written, without a map, but without leaning on the DM to resolve all our questions of "So, am I next to the Paladin?", or "Is it in range?"      Clarifying: "just don't sweat the details" is a welcome approach to solving the problem, but please give some examples of how this works in practice; i.e. which details can be removed and how? Do animagi get to pick their animal? Say that I want to become an Animagus, and am really hoping to be a certain animal (say, a stag). I study a whole bunch and manage to perfect the technique. Do I get to pick the animal I wind up as, so that I wind up being a stag like I want? Or is it something where I just find out what I turn into (and if I wind up as a dung beetle, tough luck)?    This is not a duplicate of  because that question is about which animals an Animagus can potentially transform into. Mine is about if I can decide which potential animal I wind up being. Sending email in .NET through Gmail Problems with \input{table.tex}\hline after 2020 fall LaTeX release Since updating to the 2020 Fall release (MikTeX on Windows but also tested with TeXLive), I can no longer compile files where tables are imported from an external file using \input and followed by \hline (or \bottomrule). Things work perfectly with older releases. Note that it works if the last \\ is outside the file to be imported, but this is not a feasible option if the tables are created automatically from other softwares. Here is a MWE:  \begin{document}  \begin{table}   \caption{Table in text}   \begin{tabular}{lcc}     a &amp; 1 &amp; 2\\     b &amp; 1 &amp; 2\\     \hline   \end{tabular} \end{table}  \begin{table}   \caption{Table in other file 1}   \begin{tabular}{lcc}     \input{table1}     \hline   \end{tabular} \end{table}  \begin{table}   \caption{Table in other file 2}   \begin{tabular}{lcc}     \input{table2}\\     \hline   \end{tabular} \end{table}  \end{document}  with external files: table1.tex:     a &amp; 1 &amp; 2\\     b &amp; 1 &amp; 2\\  table2.tex:     a &amp; 1 &amp; 2\\     b &amp; 1 &amp; 2  Here is the log when it fails: This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 20.10) entering extended mode (MWE.tex LaTeX2e &lt;2020-10-01&gt; patch level 1 L3 programming layer &lt;2020-10-05&gt; xparse &lt;2020-03-03&gt; (&quot;C:\Program Files\MiKTeX\tex/latex/base\article.cls&quot; Document Class: article 2020/04/10 v1.4m Standard LaTeX document class (&quot;C:\Program Files\MiKTeX\tex/latex/base\size10.clo&quot;)) (&quot;C:\Program Files\MiKTeX\tex/latex/l3backend\l3backend-pdftex.def&quot;) (MWE.aux) (table1.tex) ! Misplaced \noalign. \hline -&gt;\noalign                    {\ifnum 0=`}\fi \hrule \@height \arrayrulewidth \futurelet... l.18     \hline                 ! You can't use `\hrule' here except with leaders. \hline -&gt;\noalign {\ifnum 0=`}\fi \hrule                                           \@height \arrayrulewidth \futurelet... l.18     \hline                 ! Missing number, treated as zero. &lt;to be read again&gt;                     \futurelet  l.18     \hline                 ! Illegal unit of measure (pt inserted). &lt;to be read again&gt;                     \futurelet  l.18     \hline                 (table2.tex) [1{C:/Users/Gouel/AppData/Local/MiKTeX/pdftex/config/pdftex.map}] (MWE.aux) ) (see the transcript file for additional information)&lt;C:/Program Files/MiKTeX/fo nts/type1/public/amsfonts/cm/cmr10.pfb&gt; Output written on MWE.pdf (1 page, 14750 bytes). Transcript written on MWE.log.  With an older release under Linux, it works perfectly: This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=pdflatex)  restricted \write18 enabled. entering extended mode (./MWE.tex LaTeX2e &lt;2020-02-02&gt; patch level 2 L3 programming layer &lt;2020-02-14&gt; (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls Document Class: article 2019/12/20 v1.4l Standard LaTeX document class (/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo)) (/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.def) (./MWE.aux) (./table1.tex) (./table2.tex) [1{/var/lib/texmf/fonts/map/pdftex/up dmap/pdftex.map}] (./MWE.aux) )&lt;/usr/share/texlive/texmf-dist/fonts/type1/publi c/amsfonts/cm/cmr10.pfb&gt; Output written on MWE.pdf (1 page, 13788 bytes). Transcript written on MWE.log. What is the best program for image optimizing for the web? What programs besides Photoshop are good for saving and optimizing images for web? My question relates to Chapter 3, Exercise 8 in &quot;Baby Rudin&quot;. It states: If $\sum_n a_n$ converges, and if $\{b_n\}$ is monotonic and bounded, prove that $\sum_n a_n b_n$ converges. My attempt would have been: Since $\{b_n\}$ is monotonic and bounded, $\{b_n\}$ converges and it exists $\inf \{b_n\}$ as well as $\sup \{b_n\}$. But then we have $$ \left| \sum_n a_n \inf \{b_n\} \right| \leq \left| \sum_n a_n b_n \right| \leq  \left| \sum_n a_n \sup \{b_n\} \right| \leq \max \left( \left| \sup \{b_n\} \right|, \left| \inf \{b_n \} \right| \right)\varepsilon \leq \tilde{\varepsilon} $$ since $\sum_n a_n$ converges and $\max \left( \left| \sup \{b_n\} \right|, \left| \inf \{b_n \} \right| \right)$ is a finite number. This would imply, by the comparison test, that $\sum_n a_n b_n$ converges as well. $\quad \Box$ But as there was a way longer, more rigorous proof chosen in this , I'm a bit suspicious that my proof is not complete. Am I missing something?  EDIT: Thanks everyone! @hermes: The last part of your proof gave me the following idea. As $\lim_{n \to \infty} b_n = c$ and $\{b_n\}$ is monotonic, couldn't we just set $b_n = c - c_n$ with a monotonically decreasing sequence $\{c_n\}$ which has $\lim_{n \to \infty} c_n = 0$. Then we have $$\sum_n a_n b_n = \underbrace{c \sum_n a_n}_{\text{converges by assumption}} - \underbrace{\sum_n a_n c_n}_{\text{converges by Theorem 3.42}} \leq \varepsilon_1 - \varepsilon_2 = \varepsilon $$ since  Theorem 3.42 Suppose  the partial sums of $\sum_n a_n$ form a bounded space $\quad \checkmark$ $c_0 \geq c_1 \geq c_2 \geq \dots \quad \checkmark$ $\lim_{n \to \infty} c_n = 0 \quad \checkmark$  Then $\sum_n a_n c_n$ converges.  Thus $\sum_n a_n b_n$ converges as well. $\quad \Box$ Now that should hold, I think. So I wouldn't need to go through all the estimates. How to delete files listed in a text file What are the fundamental differences between the mainstream *NIX shells? What are the fundamental differences between the mainstream *NIX shells and what scenarios might prompt you to use one over the other?  I understand that some of it probably comes down to user preference but I've only ever used Bash and I'm interested to hear where another shell might be useful. Also, is there an impact on user-written shell scripts when running under one shell or another or is it simply a matter of changing the shell at the top of the file?  My instinct says it's not that easy.