I am developing some code in Java but facing a problem with a NPE.  It happens when I try to use a method in another class.  Here is my code :  public class MyClass{      private Attributes attr = null;  public static void main(String [ ] args) throws ParseException, SAXException, IOException, ParserConfigurationException {          MyClass main = new MyClass();          Options options = main.parseCommandLine();          CommandLineParser parser = new BasicParser();         CommandLine cl = parser.parse(options, args);         main.configureAttributes(main);     }  private void configureAttributes(MyClass main, CommandLine cl) throws ParserConfigurationException, SAXException, IOException {                  String[] attributes = cl.getOptionValues("a");         Integer tag = null;          for(int i = 0; i &lt; attributes.length ; i++) {             String[] parts = attributes[i].split("=");             String tagName = parts[0];             String value = parts[1];              tag = Integer.parseInt(tagName,16);                                          this.attr.setString(tag, DICT.vrOf(tag), value);         }     }            }      But I am getting an NPE on the last line : this.attr.setString(tag, DICT.vrOf(tag), value);  I have all the right imports. It is a Maven project so I also added the dependency to my pom.xml.   Thanks a lot for your help !   V.
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?
Prove : $p$(n│even number of ODD parts)=$p$(n│distinct parts ,number of ODD parts is even ) I'm trying to prove the following Integer Partition claim :   $p$(n│even number of ODD parts) = $p$(n│distinct parts ,number of ODD parts is even) .  So I tried to prove a stronger claim :   $p$(n│number of odd parts) = $p$(n│number of distinct parts) :  Using generating functions :   DISTINCT PARTS =  $$(1+x)\cdot(1+x^2 )\cdot(1+x^3 )\cdot(1+x^4 )\cdot\cdot\cdot\cdot$$  = $$\frac {1-x^2} {1-x} \cdot \frac {1-x^4} {1-x^2} \cdot \frac {1-x^6} {1-x^3} \cdot \frac {1-x^8} {1-x^4}\cdot\cdot\cdot\cdot$$  $$ \frac {1} {1-x} \cdot \frac {1} {1-x^3} \cdot \frac {1} {1-x^5} \cdot \frac {1} {1-x^7} \cdot\cdot\cdot\cdot $$  = ODD PARTS  But I'm not sure regarding the proof , does it really prove that even number of odd parts equals distinct parts ,where number of ODD parts is even ?   Thanks I can’t get used to the new Unity system. I’d like to move the left Unity panel to the bottom of screen (like Windows 7 – more similar is better).  But I can't find a way. Is it possible? Ambiguity of "quite" The adverb "quite" has the following meanings :     1: wholly, completely ("not quite   finished")      2: to an extreme : positively "quite   sure" —often used as an intensifier   with a "quite a swell guy" "quite a   beauty"      3: to a considerable extent : rather   ("quite near")   My understanding is that #1 and #2 conflict with #3. For example, when you say "She's quite right", do you mean "She's completely right" or "To a considerable extent, she's right"? Notice that in the latter case you're not saying that she is completely right.  Another example is "I'm quite sure". Does it necessarily mean "I'm completely sure"?   Does the word really have conflicting meanings that can possibly cause ambiguity? Or am I missing something? Can I charge my laptop with a charger that has different specifications? The difference between "Older" and "Elder" What is the difference between "Older" and "Elder" ?  And are they interchangeable ? Sort and count number of occurrence of lines I have Apache logfile, access.log, how to count number of line occurrence in that file? for example the result of cut -f 7 -d ' ' | cut -d '?' -f 1 | tr '[:upper:]' '[:lower:]' is  a.php b.php a.php c.php d.php b.php a.php   the result that I want is:  3 a.php 2 b.php 1 d.php # order doesn't matter 1 c.php Can't do comparison on PageReference What will happen if I upgrade the laboratory while upgrading a spell or unit? While playing Clash of Clans, I am upgrading my lightning spell then decided to upgrade my laboratory, then I did. What will happen to the lightning spell I am upgrading? I assume it is still upgrading cause they don't refund my elixir. In PHP, the HEREDOC string declarations are really useful for outputting a block of html.  You can have it parse in variables just by prefixing them with $, but for more complicated syntax (like $var[2][3]), you have to put your expression inside {} braces.  In PHP 5, it is possible to actually make function calls within {} braces inside a HEREDOC string, but you have to go through a bit of work.  The function name itself has to be stored in a variable, and you have to call it like it is a dynamically-named function.  For example:  $fn = 'testfunction'; function testfunction() { return 'ok'; } $string = &lt;&lt;&lt; heredoc plain text and now a function: {$fn()} heredoc;   As you can see, this is a bit more messy than just:  $string = &lt;&lt;&lt; heredoc plain text and now a function: {testfunction()} heredoc;   There are other ways besides the first code example, such as breaking out of the HEREDOC to call the function, or reversing the issue and doing something like:  ?&gt; &lt;!-- directly output html and only breaking into php for the function --&gt; plain text and now a function: &lt;?PHP print testfunction(); ?&gt;   The latter has the disadvantage that the output is directly put into the output stream (unless I'm using output buffering), which might not be what I want.  So, the essence of my question is: is there a more elegant way to approach this?  Edit based on responses: It certainly does seem like some kind of template engine would make my life much easier, but it would require me basically invert my usual PHP style.  Not that that's a bad thing, but it explains my inertia..  I'm up for figuring out ways to make life easier though, so I'm looking into templates now. Ratios in Regression, aka Questions on Kronmal Recently, randomly browsing questions triggered a memory of on off-hand comment from one of my professors a few years back warning about the usage of ratios in regression models. So I started reading up on this, leading eventually to Kronmal 1993.  I want to make sure that I'm correctly interpreting his suggestions on how to model these.   For a model with a ratio with the same denominator on both the dependent and independent side: $ Z^{-1}Y = Z^{-1}1_n\beta_0 + Z^{-1}X\beta_X + \beta_Z + Z^{-1}\epsilon $   Regress dependent ratio on the (inverse) denominator variable in addition to the other ratios Weight by the (inverse) denominator variable  For a model with dependent variable as a ratio: $ Y = \beta_0 + \beta_XX + Z1_n\alpha_0 + ZX\alpha_X + Z^{-1}\epsilon $   Regress numerator by original variables, denominator, and denominator times original variables [what about categorical variables?] Weight by (inverse) denominator  For model with only independent variable ratios: $ Y = \beta_0 + X\beta_X + Z^{-1}1_n\beta_{Z^{-1}} + W\beta_W  + Z^{-1}W\beta_{Z^{-1}W} + \epsilon $   Include numerator and (inverse) denominator as main effects, ratio as interaction term.    Are my interpretations here correct? Box Cox Transforms for regression I'm trying to fit a linear model on some data with just one predictor (say (x,y)). The data is such that for small values of x, the y values give a tight fit to a straight line, however as x values increase, the y values become more volatile. Here is an example of such data (R code)  y = c(3.2,3.4,3.5,3.8,4.2,5.5,4.5,6.8,7.4,5.9) x = seq(1,10,1)   I'm curious to know if there exists any power transform (Box cox perhaps?) that lets me get a better fit for the data than simply doing a linear fit as shown below.  fit = lm(y ~ x) GET and POST methods with the same Action name in the same Controller Find the ratio of $\frac{\int_{0}^{1} \left(1-x^{50}\right)^{100} dx}{\int_{0}^{1} \left(1-x^{50}\right)^{101} dx}$ Why is "glide symmetry" its own type? Artin's Algebra pages 155 &amp; 156 list the types of symmetry of a plane figure as:   Reflective Rotational Translational Glide   He then goes on to say "Figures such as wallpaper patterns may have two talk about other figures having combinations of independent" symmetries. EDIT: He says "... having combinations of independent translational symmetries". See Joriki's answer.  Why doesn't glide symmetry count as having two independent (reflection + translation) symmetries? If we're going to count combinations, why not have rotation + translation etc. as their own types too? Noun for "person with intermediate skill" I'm looking for the noun form of "person with intermediate skill". For example, in the context of a particular activity, "person with no skill" might be designated a novice, and "person with much skill" might be designated an expert. However I know of no such word in between these two extremes.   My only thought is amateur, which has a distinct meaning from describing level of skill, although skill level can often be inferred. I'm looking for a better solution.  EDIT: due to the attention this question has received, I'll try to offer some clarification in order to reduce repeat questions.   "Journeyman" would certainly not work. I am a software developer by profession. However the word I'm looking for should hopefully be profession-agnostic. I am trying to designate the skill level of the person that some learning material might be appropriate for. The word that I'm looking for follows the preposition "for".   For Beginners  For [word for intermediate-skilled person] For Experts  Sorry, but even after all the great answers, I'm still learning towards "amateur" even though it is technically incorrect. Also, the word should not be so esoteric that only people with English degrees know what it means. Keep the ideas coming! I was trying to install Linux on my MacBook for class when I bricked my computer, which now in an unbootable state.   I made my partition too small, so I was going to delete and create a larger one. However, Disk Utility did not allow me to delete the small partition. I followed the instructions from   However, not only was I still unable to delete it, but upon restarting I realized my primary partition (located on the same disk) changed into FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF, and I had no options to boot.  (I am sure I performed the command on the correct disk and partition)  I saw some similar threads, but my main bootable drive is the one that got corrupt.   I don't want to lose any data. I'm not the most terminal savvy, so ANY help is appreciated, and I will kindly provide any additional information!  (Disk 0, partition 2 is my main partition, and that only one I care about)  Below are the results of  $ diskutil list and $ gpt -r show disk0.        UPDATE: :  I have followed @klanomath 's instructions. At the last step I received the following error:  Checking prerequisites Checking the partition list Checking for an EFI system partition Checking the EFI system partition's size Checking the EFI system partition's file system Problems were found with the partition map which might prevent booting Error: -69766: The partition map needs to be repaired because there's a problem with the EFI system partition's file system Underlying error: 8: POSIX reports: Exec format error    FINAL UPDATE: SUCCESS!  I just wanted thank @klanomath for helping me through this entire process. He spent 11 hours TeamViewing with me until not only my files were accessible, but until I could access my computer as could before this whole debacle (and this was after 5 hours of email correspondence).   To any future reader with this problem: PLEASE don't give up, it can be fixed! I have a website with url like that :  www.xxxxxx.com/card/wow/20-euros   In term of SEO is it better to use slash or hyphen?  www.xxxxxx.com/card-wow-20-euros   Even though it will be trickier with hyphen to route correctly with only hyphen ...  Or it doesn't matter? Word with the same meaning as "good moments" or "pleasant memories"? Is there a single word with the same meaning as "good moments" or "pleasant memories"? I'm looking for a word which describes good thing(s) that happened to someone. The only word I can think of is "joy".  Some examples might be:   Wayne has many pleasant memories of the days spent with the family. She could remember many good moments from the last weekend. Debugging using Nvidia Nsight 2.2 in Visual Studio 2010 Refresh a section after adding HTML dynamically to jquery mobile