Disclaimer: This is homework, so I am not looking for an exact answer because I'd like to do this on my own. I have to read a matrix from a text file that is filled with doubles and put into a 2D array. I'm currently struggling to find where exactly my problem lies in my code because I know how to use the built in Java Scanner for a normal array. My code below always give me a NullPointerException error which means my matrix 2D array is empty.  public Matrix(String fileName){     //reads first double and puts it into the [1][1] category     //then moves on to the [1][2] and so on     //once it gets to the end, it switches to [2][1]     Scanner input = new Scanner(fileName);     int rows = 0;     int columns = 0;     while(input.hasNextLine()){         ++rows;         Scanner colReader = new Scanner(input.nextLine());         while(colReader.hasNextDouble()){             ++columns;         }     }     double[][]matrix = new double[rows][columns];     input.close();      input = new Scanner(fileName);     for(int i = 0; i &lt; rows; ++i){         for(int j = 0; j &lt; columns; ++j){             if(input.hasNextDouble()){                 matrix[i][j] = input.nextDouble();             }         }     } }     My text file:   1.25 0.5 0.5 1.25 0.5 1.25 0.5 1.5 1.25 1.5 0.25 1.25
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?
Show that every irrational number in $\mathbb{R}$ is the limit of a   sequence of rational numbers. Every rational number in $\mathbb{R}$ is   the limit of a sequence of irrational numbers.   How can I prove this? Agreement in "[Singular Noun] Is/Are [Plural Noun]"? My fish's native habitat is rice fields. My fish's native habitat are rice fields.   Which one is correct? I'm pretty sure it's the first, since 'is' modifies 'habitat,' but it still sounds weird... Intuition on the Kullback-Leibler (KL) Divergence This has come up    : migrating old questions causes problems.   The most popular solution to this to date has been to . This is do-able, but frankly it feels like treating a symptom, and doing so in a way that penalizes folks who answer what are by all appearances valid, on-topic questions.   Migration works best as a way to salvage good but off-topic questions and give them new life on a site where they can thrive. But shuffling old, answered, on-topic questions around for the hell of it is a waste of everyone's time.   Therefore, I think the real solution is much simpler: just disable the migration of old questions. They're rarely welcomed or heavily improved post-migration, often overtly disliked by folks on the destination site, and can end up causing a rather bad experience for folks who were participating in good faith on the original.   I suggest that questions older than 601 days should not be eligible for migration, either by normal user close-votes or by moderators. In extreme cases, we can perhaps provide an alternate means of moving old questions, but under normal circumstances these should be done quickly or not at all.   1 60 days is actually based on a  introduced this past spring: migrated and then rejected questions older than 60 days cause the authors to suddenly gain (permanent) reputation on the destination. Add the font changes as options in our preferences Showing that $Q_n=D_n+D_{n-1}$ Let $T_n$ be the set of permutations of $\{1,2,\ldots,n\}$ which do not have $i$ immediately followed by $i+1$ for $1\le i\le n-1$; in other words, let \begin{align} T_n=\{\sigma \in S_n: \sigma(i)+1\ne\sigma(i+1) \text{ for all } 1\le i\le n-1\} . \end{align} Let $Q_n$ be the number of elements of $T_n$.    Let $D_n$ be the number of  of $\{1,2,\ldots,n\}$.  It is not hard to show algebraically that $Q_n=D_n+D_{n-1}$, but I am having difficulty coming up with a combinatorial argument to show why this is true.  (I believe there are $D_{n-1}$ elements of $T_n$ that leave $n$ fixed, and $D_n$ elements of $T_n$ that move $n$, but I don't know how to justify this combinatorially.) My English teacher feels very strongly that exact same is redundant and therefore incorrect. I disagree with her.  She feels that exact should be used in place of exact same, but I have rarely heard someone use exact by itself. For example:     I have the exact same shirt   I have the exact shirt   In the same manner, I believe that she shuns exactly the same as well.  What support is there (if any) supporting the use of exact same or exactly the same? What proof can I provide for using exact same when challenged? I would like to know where to find the source code of Ubuntu. I'd like to see how far it is "open source". Why is this simple Excel calculation not netting Zero? Windows 8 opens notepad on boot- no startup entry found I just upgraded from windows 7 to windows 8 and everything is working fine except notepad keeps opening on boot with a "access denied" window that comes up as well. I've ran MBAM and removed some junk, I've disabled every "file not found" item in autoruns as well as something that had a text/xml title in it and I've ran CCleaner a few times. Nothing is working, any help is much appreciated! Powering a WS2812B strip If $z_n \to z$ then $(1+z_n/n)^n \to e^z$ We are dealing with $z \in \mathbb{C}$. I know that $$ \left(1+ \frac{z}{n} \right)^n \to e^{z} $$ as $n \to \infty$. So intuitively if $z_n \to z$ then we should have $$ \left(1+ \frac{z_n}{n} \right)^n \to e^{z}. $$ If $z_n \in \mathbb{R}$ I would be happy writing $$ \exp \left(n \log\left(1+ \frac{z_n}{n} \right) \right) = \exp \left(z_n \frac{\log\left(1+ \frac{z_n}{n} \right)-\log(1+0)}{\frac{z_n}{n}-0} \right) \to \exp(z \cdot 1) $$ where here we are using the definition of derivative. But if $z \in \mathbb{C}$ the logarithm is multivalued and I'm not sure that the same calculation is allowed. Is there a different way to show this for complex $z$? Redefining "cited on" string (and others) in biblatex I'm trying to modify the strings biblatex uses to set the "cited on" string used in the bibliography to identify the pages where a given references has been cited.    What I gather from the biblatex documentation (e.g., § 4.9.2.16) is that something like   \renewbibmacro{backrefpage}{&lt;newtext&gt;} \renewbibmacro{backrefpages}{&lt;newtext&gt;}   ought to work, but they have no effect for me (I'd also like to get this working for the "visited on" string, urlseen).  My MWE is unchanged from , with the addition of these (and related lines) just about anywhere. Why is there no consistency in the plural forms of words ending on an "f" (e.g. safe, roof, dwarf, etc.)? The plural form of leaf is leaves, although according to  leafs is also correct. Dwarf can be pluralized as either dwarfs or dwarves. Conversely, the words roof and safe are pluralized as roofs and safes.  Is there any logic underpinning these variations? Is there a historical trend where words that were previously pluralized as -ves are now being increasingly pluralized as -fs? ok, ive a class and i pass an object as property.  the object that i pass is a List&lt;X&gt;  in my class im trying to access the Object index by reflection BUT I CAN'T!!!   Example:  this class works i just wrote down the part i want to show you and i need help.  class MyClass {     private object _recordSet;     public object RecordSet     {         get { return _recordSet; }         set { _recordSet = value; }     }      public string Draw()     {         system.reflection.Assembly asem = system.reflection.Assembly.getAssembly(_dataSource.GetType());          object instance;          instance = asem.CreateInstance(_dataSource.GetType().UnderlyingSystemType.FullName);          //to access de Count of my List         int recordcount = int.Parse(_dataSource.GetType().GetProperty("Count").GetValue(_dataSource,null));          //i need to do a          for(int cont = 0; cont &lt; recordCount; cont++)         {             _dataSource[cont].Name; // &lt;-- THIS PART IS NOT WORKING!!! because i cant access the Index Directly.... WHAT TO DO!! ???         }     } } Chat Feature-Request: Thumbs-Up Add an additional form of "I agree" besides starring or pinning (since pinning is restricted to a smaller subset to begin with) or something that we can use to not clog up the right hand star bar.  This is because sometimes you want to say "I agree" but you don't want to star it because ... let's face it, that's not star-worthy, and you don't want to clutter the stream with fifty thousand "like totes for sure, hella right!" because then it becomes one big back-patting party and you lose all semblance of conversation.  So I would propose a fourth "flag" for chat, that allows us to say "I {agree with|like|am of the same opinion as} this comment" and that it would only be useful in the live-chat (and maybe but not really in the transcript) and that it have no other useful semantics (no badges, no list of's [unless the list is of comments you've upthumbed]). Opening PDF in Illustrator breaks up text objects I recently had to convert some PDF files to SVG, and did this by opening the PDF in Illustrator, and saving out to SVG.    The issue was that when Illustrator opened the pdf, many (but not all) text objects would be broken up into different text objects.  For instance, the word "policy" wouldn't be one text object, but rather several text objects, "po", "l", "icy".  There didn't seem to be any rhyme or reason to it.    How can I prevent this from happening? How do I share samba via Open VPN? Is that possible? I have configured open VPN in my home so that it can be accessible from my office easily.  Now I want to share samba via my open VPN. How can I share samba over open VPN between Ubuntu and Windows?  Home public IP: HHH.OOO.MMM.EEE Home desktop IP: 192.168.10.10 Office public IP: OOO:FFF:III:CCC Office Windows desktop IP: 192.168.1.10 How do I restrict scaling to a specific axis? Im new to Blender but have some experience with 3dsmax. In blender, when i select some polys and try to scale them, i have no control on the amount and especially relative axis on which the scale would happen, where as with 3ds max i could scale restricted to x, y, z or any combination of using the handy widget. Is there a way to replicate this, or to get any control over the scale ?  thanks, Minimize multi-variable function one variable at a time I am wondering if I can minimize a multi-variable function one variable at a time. In other words, is it true that:  $min_{x_1,x_2} f(x_1,x_2)=min_{x_1} min_{x_2} f(x_1,x_2)$