I am new to weka. Currently I am working on text classification using weka and java. My training data-set has one String attribute and one class attribute.   @RELATION test  @ATTRIBUTE tweet string @ATTRIBUTE class {positive,negative}   I want to create a test instant dynamically and get it classified using Naive-Bayes classifier.      public static void main(String[] args) throws FileNotFoundException, IOException, Exception {      StringToWordVector filter = new StringToWordVector();      //training set     BufferedReader reader = null;     reader = new BufferedReader(new FileReader("D:/suicideTest.arff"));      Instances train = new Instances(reader);     train.setClassIndex(train.numAttributes() -1);     filter.setInputFormat(train);     train = Filter.useFilter(train, filter);      reader.close();        Attribute tweet = new Attribute("tweet");     FastVector classVal = new FastVector(2);     classVal.addElement("positive");     classVal.addElement("negative");       FastVector testAttributes = new FastVector(2);     testAttributes.addElement(tweet);     testAttributes.addElement(classVal);      Instance testcase;     testcase = null;      testcase.setValue(tweet,"Hello my world");     testcase.setValue((Attribute)testAttributes.elementAt(1),"?");      Instances test = null;      test.add(testcase);      test = Filter.useFilter(test, filter);      NaiveBayes nb = new NaiveBayes();     nb.buildClassifier(train);      Evaluation eval = new Evaluation(train);     eval.crossValidateModel(nb, train, 10,new Random(1));       double pred = nb.classifyInstance(test.instance(0));      System.out.println("the result is   "+ pred);  }   I have followed this previous question .  But still I am getting and java.lang.NullPointerException when I tried to set values to test instance,  testcase.setValue(tweet,"Hello my world");
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?
Problems with booting the system I have yesterday updated packages and today the system cannot boot properly. After seeing the Kubuntu logo there is a black screen which shows repeatedly.     Stopped User Manager for UID 121.      Removed slice User Slice of gdm.      Created slice User Slice of gdm.       Starting User Manager for UID 121...      Started Session c3 of user gdm.       Started User Manager for UID 121.   Please see the screenshot below How come the PHP private class var is not private? Best way to obtain clarifying information when reputation doesn't allow comments? Hyperref "enquotes" metadata unbalaced data set in classification tasks Copyright of a set of colors? I often see color combinations on webpages, images, posters, products etc. that harmonize really well. Am I allowed to use those colors in my own design?   This is solely about the colors. I will not use images, logos or shapes from that source, and my content is not related to the original color source. I am also far from any commercial aspect here. Show $$\lim_{h \to \ 0} \frac{f(x + 2h) - 2f(x+h) + f(x)}{h^{2}} = f''(x)$$   Proof:  By definition:    $$f'(x) = \lim_{h \to \ 0} \frac{f(x + h) - f(x)}{h}$$  Using this idea it would imply:   $$1)\ \ f''(x) = \lim_{h \to \ 0} \frac{f'(x + h) - f'(x)}{h}$$  As such it is required that I find an expression for $f'(x+h)$. This is where I'm not sure if the step I took is legitimate.  An expression for $f'(x + h)$ is:  $$f'(x+h) =  \lim_{h \to \ 0} \frac{f(x + 2h) - f(x + h)}{h}$$  Combining this with the definition of $f'(x)$ and inserting it into 1) you arrive at: $$\lim_{h \to \ 0} \frac{f(x + 2h) - 2f(x+h) + f(x)}{h^{2}} = f''(x)$$   As required.    Concern: I feel a discomfort with this solution. Even though "mechanically" it worked out, if I am taking the limit as $h \rightarrow 0$ that would mean $x + 2h$ and $x + h$ both go to $x$. But I am attempting to use the idea that $x +2h$ goes to $x + h$. Perhaps it is a notation idea that I need to communicate better, but I feel it is larger than just that. example.com is hosted on IP address c.c.c.c at host1, no access any windows server admin at all blog.example.com is  on IP a.a.a.a at host2, full access to Linux server admin, using WordPress   So basically, I can fiddle with subdomain all I want.  I can't 301 redirect because the content on host 1 is an eCommerce site that I have no server control over. Can't put WordPress on it, can't run scripts, can't do anything on the server period.  Is there a method to "mask" all the URLs on root blog.example.com so they appear as example.com/blog/ folder?  They can't actually be sent to example.com/blog/ as that doesn't exist. It just needs to look to the surfer as if they are there.  Can this be done with some kind of masking or something?  Will this be better for SEO as hopefully search engines will see the blog in a directory on the main domain? I am an undergrad in economics and really want to get a helping hand as I get from math and stats from a Stack Exchange site for economics. Where can I post my questions on economics topics? Clearing Recently used coordinate reference systems using QGIS? After using some non usual SRC for demonstration purpose, I wish to clear my  "Recently used coordinate reference systems" list for the sake of praticity.  Is it possible?   I am using QGIS 2.10.1. Can a magus with a high BAB cast two spells or attack and cast, with their full attack action? Suppose you are a level 10 Magus or something similar. (Something with a decent BAB progression and spellcasting abilities) When you hit +6/+1, can you cast a spell, then attack, vice-versa, or simply case two spells? Everywhere I look I can't get a clear answer. How does one prove that every finite group is isomorphic to a subgroup of an alternating group? Regulated AC power supply? If $X$ is separated over $\operatorname{Spec} \Bbb Z$, is it separated over any other scheme? How to calculate time difference in java? Sum of items in a collection How to search for email of a particular date from years ago in Gmail There are similar questions and several answers. I tried to follow the methods provided in the answers.  They did not work. So I am going to ask it again with more specifics.  I only knew the date of the email in the in-box in 2012 and the content of it but did not know the exact wording of the subject. Is it possible to find this email? How do I find the caller of a method using stacktrace or reflection? A question in Complex Analysis $\int_0^{2\pi}\log(1-2r\cos x +r^2)\,dx$ My problem is to integrate this expression:  $$\int_0^{2\pi}\log(1-2r\cos x +r^2)dx.$$ where $r$ is any constant in $[0,1]$.  I know the answer is zero. Can you explain you idea to me or just prove that? Maybe you will use the "Cauchy integral theorem ". Can a deb package contain a PPA dependency and install packages from the PPA? When creating a .deb package I create a file named control that contains some fields:  Package: my-qt-app-name Version: 0.01 Architecture: all Maintainer: my name &lt;my email address&gt; Installed-Size: 2 Depends: some-package-from-ppa Section: extras Priority: optional Homepage: my homepage Description: some description   some-package-from-ppa is not installed on the computer. It can be installed only adding a PPA, running apt-get update and then apt-get install some-package-from-ppa.  Can a control file from a deb package contain a PPA address and install that package when the deb file is installed?