New to collections and trying out the below code, I am getting the below excpetion:     Exception in thread "main" java.lang.NullPointerException      at org.first.collectionsframework.CollectionsFirsttest.addCountytolist      at org.first.collectionsframework.CFTmain.main(CFTmain.java:16)    My classes are as shown below, can some onepoint me to what I am doing wrong:     1st: CollectionsFirsttest       2nd: CFTmain   public class CollectionsFirsttest {    String name;   int employeeID;   String city;   List&lt;String&gt; county;  /* constructor*/ public CollectionsFirsttest(){ }  public String getName() {     return name; }  public void setName(String name) {     this.name = name; }  public int getEmployeeID() {     return employeeID; } public void setEmployeeID(int employeeID) {     this.employeeID = employeeID; } public String getCity() {     return city; } public void setCity(String city) {     this.city = city; }  public void addCountytolist(String x) {     this.county.add(x);     System.out.println("County added is:" +x); }   }      2nd: CFTmain  public class CFTmain {  public static void main(String[] args) {     CollectionsFirsttest CFTobject1=new CollectionsFirsttest();     CollectionsFirsttest CFTobject2=new CollectionsFirsttest();     List&lt;Object&gt; objlist= new ArrayList&lt;Object&gt;();      CFTobject1.setName("Dummy");     CFTobject1.setEmployeeID(001);     CFTobject1.setCity("Wonderland");     CFTobject1.addCountytolist("cvs1");     CFTobject1.addCountytolist("cvs2");     CFTobject1.addCountytolist("cvs3");      CFTobject2.setName("Pumkin");     CFTobject2.setEmployeeID(002);     CFTobject2.setCity("Wonderland");     CFTobject2.addCountytolist("mtv1");     CFTobject2.addCountytolist("mtv2");     CFTobject2.addCountytolist("mtv3");      objlist.add(CFTobject1);     objlist.add(CFTobject2);      display(objlist);  }        public static  void display(List&lt;Object&gt; l) {             System.out.println(" The values in list:"+System.identityHashCode(l));             for (Object d: l)             { System.out.println("the values in the first object  is"+System.identityHashCode(d));                 System.out.println ("The name in"+ d.getClass());             } } }   To some people my error might be pretty simple, but since I am new, hope its eating me up. I am running into error as soon as I am trying to enter county into the List. CFTobject1.addCountytolist("cvs1");
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?
why is nautilus slow? I'm wondering why Nautilus is very slow when opening a directory containing lots of files. My /usr/lib dir for example has 1900 files and it takes approximately 5+ seconds to show everything. It has been like this since I installed Ubuntu few months ago and it's really quite annoying sometimes. I don't have powerful hardware but I know that Windows Explorer is so much faster than this.   Is there anything that can be done to speed it up?  Ubuntu 10.04 Counting integer partitions of n into exactly k distinct parts size at most M How can I find the number of partitions of $n$ into exactly $k$ distinct parts, where each part is at most $M$?  The number of partitions $p_k(\leq M,n)$ of $n$ into at most $k$ parts, each of size at most $M$, is given by the generating function: $$  \binom{M+k}{k}_{x} = \prod_{j=1}^{k}\frac{1-x^{M+k-j+1}}{1-x^j}= \sum_{n=0}^{kM} p_{k}(\leq M,n) x^n $$  For the number of the partitions $p_k(\mathcal{D},n)$ of $n$ into at most $k$ parts there is the recurrence relationship: $$   p_{k}(\mathcal{D},n) = p_{k}(\mathcal{D},n-k) + p_{k-1}(\mathcal{D},n) $$  But what, if I want to count only the partitions with distinct parts and restricted number of parts and restricted part size?  Update: Now I know the generating function for the number of distinct restricted partitions $p_k(\leq M, \mathcal{D},n)$ of $n$ into exactly $k$ distinct parts, all at most $M$ is $$    \prod_{j=1}^{M} (1+xq^{j}) = \sum_{k,n=0}^{\infty}p_k(\leq M, \mathcal{D},n)x^{k}q^{n} $$ and there is also a recurrence relation $$    p_k(\leq M, \mathcal{D},n) =         p_{k-1}(\leq M-1, \mathcal{D},n-k) +         p_k(\leq M-1, \mathcal{D},n-k) $$ How can I prove this? Could you recommend a book, where I could read about this? Formerly List of all badges with full descriptions.  What are badge name's requirements? Why didn't I get badge name ? Which badges can I earn multiple times?    Jump to:                    Note: Some badges are awarded based on score. The term score means the total number of upvotes minus the total number of downvotes.  Any badge with a *** next to it is one of 20 badges that count towards the  displayed on a moderator candidate in an election. The candidate score is a total of 40 points: the first 20 are awarded based on the user's rep divided by 1000 and rounded down; the second 20 represents the total number of unique badges earned of the 20 that count. Note that if the same badge is earned multiple times, it will only count once towards the candidate score.  Any badge with a &quot;(retired)&quot; next to it is no longer awarded, but is retained by users who previously earned them. See  for more info on what it means for a badge to be retired.       Visit the  of the  on any site to see a complete list of badges that you can filter by earned, unearned, or type. I want to uninstall VMware Player on my Ubuntu 12.04 LTS system. How should I uninstall it? How should you interview for QA *Automation* positions? Best way to implement keyboard shortcuts in a Windows Forms application? I'm looking for a best way to implement common Windows keyboard shortcuts (for example Ctrl+F, Ctrl+N) in my  application in C#.  The application has a main form which hosts many child forms (one at a time). When a user hits Ctrl+F, I'd like to show a custom search form. The search form would depend on the current open child form in the application.  I was thinking of using something like this in the ChildForm_KeyDown event:     if (e.KeyCode == Keys.F &amp;&amp; Control.ModifierKeys == Keys.Control)         // Show search form   But this doesn't work. The event doesn't even fire when you press a key. What is the solution? Has there ever been a warp / non-warp collision? Like something going at warp hits a planet, star, another ship, moon, satellite, alien, tribble, etc.... Basically, can stuff in subspace (warped stuff) hit stuff in real space (not warp)?  Star Trek: The Voyage Home shows us clearly that entering warp speed within Earth's atmosphere has no adverse consequences for the starship or the environment.  HMS Bounty went through miles of atmosphere, dust, birds, and clouds and nothing entered  to hit her. Enterprise did this again by dropping out of warp in Titan's atmosphere.  which explains some tech used, but now we have to ask if there is even a hazard of collision at warp. Has there ever been a collision in the franchise - any normal object being hit at warp speed? (This obviously doesn't include things traveling at warp together, like photon torpedoes from one ship to another).  Closest example I found: In  Enterprise attempts warp before balancing their warp drives and creates a wormhole instead. They nearly collide with an asteroid which was already inside the wormhole, but neither the ship not the asteroid were traveling at warp.  Compressing Space Real-world (non-canon) attempts to explain ST warp technology rely on compressing space itself in front of the vessel. The image sequence below from Star Trek: Into Darkness (canon) shows Enterprise warping past the USS Vengeance and confirms that Enterprise actually gets smaller (or compresses the space around it). The light on Vengeance shows that at the instant the two ships are side-by-side Enterprise looks like a toy beside it. (Large image needed for detail - sorry):    Thus objects at warp occupy less real space - possibly none at - because , which according to Memory-Alpha is implied to be the medium which FTL travel happens. Normally subspace and real space do not interact. When they do it is called a .  Also, objects inside the warp bubble are not moved by the warp drive:     The observer(spaceship) is still immersed in the interior of the warp bubble and this bubble is carried   out by the spacetime ”stream” at faster than light velocities with the observer at the rest with respect to   its local neighborhoods  (p. 25)   It is my belief that to be consistent with warp bubble physics derived from the Einstein Field Equations in general relativity, the ST interpretation of warp speed travel should not allow collisions between n-space objects and objects within a warp bubble and remove the phenomenon from any plotlines such that warp travel is intrinsically safe for the traveller, but possibly greatly impactful for the normal world outside.  But has it happened?  Points of clarification raised by comments  Deflector Shields: Yes, ships have them. Gene Roddenberry envisioned Navigational Shields which would deflect anything in front of the ship, from a single hydrogen atom to an asteroid (see his notes below).    It's important to note that much of what he had in this guide was changed in final production. In fact, based on this guide we could write an entire episode on a simple deflector sabotage resulting in them hitting a hydrogen atom. Real science calculations tell us that even hitting a photon of light would release incalculable energy.  These notes very much explain the many questions asking why ships don't go to warp inside a solar system. Solar systems are FULL of particles and debris, which would require a great deal of energy to deflect. Interstellar space simply draws less power because the shields work less. It's possible to define dependent picklist in the setup and the are supported out-of-the-box in Visualforce.  Are they also supported in Lightning natively? Is it on the roadmap to support them soon? If not: is there a best practice or a easily reusable workaround available right now? If I know the index node (inode) of a file, but I don't know its path (or any of its paths), is it possible to create a hard link to that inode directly?  I could find the file using sudo find / -inum 123546 and then create a hardlink, but that would be way too slow for my application.  N.B. I'm using an ext4 filesystem. UIRefreshControl without UITableViewController What can I do if a repository/PPA does not have a Release file? When updating, I get the following error message:   W: The repository 'http://ppa.launchpad.net/mc3man/trusty-media/ubuntu xenial Release' does not have a Release file.   Here, I find another statement on this error:   This recommends removing certain PPAs; and, I'm not sure if I should do that since it might mean not getting the updates that I need.    Is this what I should do? REST API composite query: How do I use the result of a query subrequest in the referenceId of another subrequest? I am using Salesforce's REST API to (1) retrieve a list of object IDs according to a query, then (2) retrieve the records that correlate to those IDs.  I am familiar with the Salesforce composite documentation .    My request looks like this:  POST: /services/data/v48.0/composite  {     "allOrNone":false,     "compositeRequest": [ {         "method":"GET",         "url": "/services/data/v48.0/query?q=SELECT+Id+FROM+My_Entity+WHERE+(CreatedById+!=+'asdfghjkl')",         "referenceId": "myEntity"         },{         "method":"GET",         "url": "/services/data/v48.0/composite/sobjects/My_Entity?ids=@{myEntity.records[0].Id}",         "referenceId":"myObject"     }] }   My response:  {     "compositeResponse" : [ {         "body" : {             "totalSize" : 21,             "done" : true,             "records" : [ {                 "attributes" : {                     "type" : "My_Entity",                     "url" : "/services/data/v48.0/sobjects/My_Entity/a0D6g000xxxxxxx"                 },                 "Id" : "a0D6g000xxxxxxx"                 }, {*record2*}, {*etc*}             ]},             "httpHeaders" : { },             "httpStatusCode" : 200,             "referenceId" : "myEntity"         }, {         "body" : [ {         "errorCode" : "PROCESSING_HALTED",         "message" : "'myEntity.records' references an invalid Datatype. Only Strings and primitive data types are allowed to be referenced from previous operations."         } ],         "httpHeaders" : { },         "httpStatusCode" : 400,         "referenceId" : "myObject"     } ] }   The first subrequest (the query) executes without errors.  My problem is the second subrequest.  I understand from  that I can refer to the ID of a single item (e.g. myEntity.records[0].Id).  Question: How do I use all items from myEntity.records in the second subrequest? Thunderbolt 2 docks have been quite expensive and they will be obsolete once I purchase the new Macbooks with USB-C ports. I currently use a 2014 MacBook Pro with Thunderbolt 2 ports, and I want to futureproof my purchase by acquiring a cheaper USB-C dock now.  The cheapest Thunderbolt 2 dock costs around $200 while USB-C docks cost around $30. Being able to use a USB-C dock with older Thunderbolt 2 Macbook Pros would not only be cheaper but also allows me to use the same USB-C dock if I decided to upgrade to a future Macbook.  For that to work I need a Thunderbolt 2 (male) to USB-C female adaptor, after some searching it doesn't seem to exist. Is there a reason why something like this hasn't been made? Or is the USB-C specification designed such that it is impossible? (hence businesses can still continue to sell expensive Thunderbolt 2 docks...)  I will accept an answer that meets the following requirements:   If there is such an adapter please give a link and some form of evidence that these would have 100% compatibility with USB-C docks. If there is no such adapter please explain:   Is it impossible to produce? If not, why hasn't a vendor created one yet? I've explained that its a better financial investment than buying a TB2 dock... surely there's a market for those still using TB2 MBPs wanting to upgrade in the next couple of years. Not only docks but it would open a gateway to cheaper alternatives to those hideously expensive TB2 peripherals. Possible Duplicate:             Well, I remembered this after having Algebra II a year ago, is it possible that this is a valid proof that $1 = -1$?  $$ 1 = \sqrt{1} = \sqrt{-1\cdot-1} = \sqrt{-1} \cdot \sqrt{-1} = i \cdot i = i^2 = -1 $$  $$ \therefore 1 = -1 $$  So is this actually fully valid? Or can it be disproved? When should \cdot be used to indicate multiplication? Is this purely personal style, or are the generally accepted guidelines? Clearly, when dealing with numbers either $2 \cdot 2$ or $2 \times 2$ is needed, but within formulae where an absence of an operator implies multiplication, when should a \cdot be used? I tend to use it only sparingly if it aids in grouping. (Of course, barring the cases where it's required, e.g. a dot product.) How does one attack a two-time pad (i.e. one time pad with key reuse)? Custom bokeh shapes need a large aperture. The max aperture my lens can reach is f3.5. Is it big enough for a custom bokeh? I tried but it doesn't work. Is there a way to refresh Notepad? Say, for example, that there's one process that's writing to a file. While the process is running, I opened the file in notepad. The process keeps  writing to the file.   Other than closing and reopening the file, is there any way for me to "refresh" the data that notepad is showing? How do I spamtrap with Postfix? How do I setup spamtraps with Postfix so clients that send to trapped addresses are prevented from sending me more spam? Sound of a next scene starts one moment earlier than video