I am attempting to program an onJoin() event so any user who connects gets their gamemode set to the server default. However, whenever a player joins, it raises a NullPointerException.  public class ListenerPlayerLogin implements Listener {     @EventHandler(priority = EventPriority.HIGH) // This needs to run correctly.     public void onLogin(PlayerLoginEvent event) {         Logger console = Bukkit.getLogger();         console.info("onLogin called.");         Server server = Bukkit.getServer();         GameMode defaultGamemode = server.getDefaultGameMode();         console.info("Default Gamemode: " + defaultGamemode.toString());         HumanEntity player = event.getPlayer();         console.info("Target: " + player.getName());         player.setGameMode(defaultGamemode);         String playGM = player.getGameMode().toString();         console.info("Player Gamemode: " + playGM);         player.sendMessage("§eRandomos framework loaded.");     } }   The error I'm getting is:  org.bukkit.event.EventException: null         at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:320) ~[spigot-1.15.2.jar:git-Spigot-800b93f-8160e29]         at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[spigot-1.15.2.jar:git-Spigot-800b93f-8160e29]         at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:529) [spigot-1.15.2.jar:git-Spigot-800b93f-8160e29]         at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:514) [spigot-1.15.2.jar:git-Spigot-800b93f-8160e29]         at net.minecraft.server.v1_15_R1.PlayerList.attemptLogin(PlayerList.java:513) [spigot-1.15.2.jar:git-Spigot-800b93f-8160e29]         at net.minecraft.server.v1_15_R1.LoginListener.c(LoginListener.java:134) [spigot-1.15.2.jar:git-Spigot-800b93f-8160e29]         at net.minecraft.server.v1_15_R1.LoginListener.tick(LoginListener.java:53) [spigot-1.15.2.jar:git-Spigot-800b93f-8160e29]         at net.minecraft.server.v1_15_R1.NetworkManager.a(NetworkManager.java:220) [spigot-1.15.2.jar:git-Spigot-800b93f-8160e29]         at net.minecraft.server.v1_15_R1.ServerConnection.c(ServerConnection.java:129) [spigot-1.15.2.jar:git-Spigot-800b93f-8160e29]         at net.minecraft.server.v1_15_R1.MinecraftServer.b(MinecraftServer.java:1105) [spigot-1.15.2.jar:git-Spigot-800b93f-8160e29]         at net.minecraft.server.v1_15_R1.DedicatedServer.b(DedicatedServer.java:399) [spigot-1.15.2.jar:git-Spigot-800b93f-8160e29]         at net.minecraft.server.v1_15_R1.MinecraftServer.a(MinecraftServer.java:984) [spigot-1.15.2.jar:git-Spigot-800b93f-8160e29]         at net.minecraft.server.v1_15_R1.MinecraftServer.run(MinecraftServer.java:824) [spigot-1.15.2.jar:git-Spigot-800b93f-8160e29]         at java.lang.Thread.run(Unknown Source) [?:1.8.0_251] Caused by: java.lang.NullPointerException         at uk.kaidev.randomos.ListenerPlayerLogin.onLogin(ListenerPlayerLogin.java:25) ~[?:?]         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_251]         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_251]         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_251]         at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_251]         at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:316) ~[spigot-1.15.2.jar:git-Spigot-800b93f-8160e29]         ... 13 more```
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?
After upgrading from 10.04 to 12.04 I am trying to install different packages.  For instance ia32-libs and skype (4.0).  When trying to install these, I am getting the 'Unable to correct problems, you have held broken packages' error message.   Output of commands:  sudo apt-get install -f Reading package lists... Done Building dependency tree        Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.   After running this:  sudo dpkg --configure -a foo@foo:~$ sudo apt-get install -f Reading package lists... Done Building dependency tree        Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Disable emojicons introduced with WP 4.2 So WP 4.2 introduced emojis (smileys) that basically adds JS and other junk all over your pages. Something some people may find shocking. How does one completely erase all instances of this? Are there guidelines on how much free RAM a phone should have - specifically Samsung Galaxy S? I have a Samsung Galaxy S (AT&amp;T Captivate) that is rooted.  I have various ways to tweak the amount of free RAM the OS leaves on the phone.  The default is 48 MB, but I was wondering if I could actually go lower without impacting phone performance.  Are there guidelines posted anywhere, or that can be deduced based on knowledge of the Android platform?  Or should I trust that the default settings are appropriate?  I understand that when it comes to free RAM, more isn't necessarily better, but I understand that there is still a threshold that I don't want to dip below.   I'm running a 2.3.6 Gingerbread based ROM.  For what it's worth, I'm running the Zeam launcher. How much meat should I serve per person? A very basic question concerning the $R^2$ of OLS regressions   run OLS regression y ~ x1, we have an $R^2$, say 0.3 run OLS regression y ~ x2, we have another $R^2$, say 0.4 now we run a regression y ~ x1 + x2, what value can this regression's R squared be?   I think it's clear the $R^2$ for the multiple regression should be no less than 0.4, but is it possible for it to be more than 0.7? Is there a theorem that says that QFT reduces to QM in a suitable limit? Of course, it should be, as QFT is relativisitc quantum mechanics. But, is there a more manifest one? such as Ehrenfest's theorem which dictates the transition from QM to Classical Mechanics.  I am curious as the basic object in QM is wave function whereas the basic object in QFT is quantized operator, which looks very different, and wondering how the comparison works.  (Of course, I am aware that QFT can calculate corrections for Coulomb potential energy, which may seem to be a transition from QFT to QM, but I want one more manifest than that.) I understand we cannot state with arbitrary precision the position and momentum of a micro-particle as we superpose infinite waves to create a wave packet at the exact position of the particle and hence cannot say which wave is corresponding to its momentum. This is theoretically said. Also some people say that measurement of one disturbs the other and some say it's reality.  Firstly, the theoretical explanation: why should I consider that a wave out of many superposed will give us the momentum or position? We might use another single wave which is not sine in nature and might get the results. Or why won't a single sine wave suffice? This all considers the micro-particle as wave because of de Broglie.  Secondly, the practical thing seems legit.  Thirdly, the electron must have some kinetic energy and position. It is who we are measuring and can't get it exact so why blame the electron as in theoretical concept. How we quantify the uncertainty, it must depend on the measuring device and various other factors.  I might need to edit this post based on your answer so that I can explain more clearly my thinking.  Edit: From here is what gets the measurement problem:        Text: Imagine that you're blind and over time you've developed a technique for determining how far away an object is by throwing a medicine ball at it. If you throw your medicine ball at a nearby stool, the ball will return quickly, and you'll know that it's close. If you throw the ball at something across the street from you, it'll take longer to return, and you'll know that the object is far away.   The problem i­s that when you throw a ball -- especially a heavy one like a medicine ball -- at something like a stool, the ball will knock the stool across the room and may even have enough momentum to bounce back. You can say where the stool was, but not where it is now. What's more, you could calculate the velocity of the stool after you hit it with the ball, but you have no idea what its velocity was before you hit it.   This is the problem revealed by Heisenberg's Uncertainty Principle. To know the velocity of a quark we must measure it, and to measure it, we are forced to affect it. The same goes for observing an object's position. Uncertainty about an object's position and velocity makes it difficult for a physicist to determine much about the object.   Edit: After seeing this answer one of my doubts is very well cleared, the other answers are also written and helpful:        Text: There is a definine velocity and momentum, we just don't know it.   Nope. There is no definite velocity--this was the older interpretation. The particle has all (possible) velocities at once;it is in a wavefunction, a superposition of all of these states. This can actually be verified by stuff like the double-slit experiment with one photon--we cannot explain single-photon-fringes unless we accept the fact that the photon is in "both slits at once".So, it's not a knowledge limit. The particle really has no definite position/whatever. The default in lyx is to have   I. First part (roman number)   Section 1   1.1 Subsection 1  and I'd like to have   First part (arabic number)   1.1 Section 1  1.1.1 Subsection 1  etc.   Any suggestion? Thanks a lot in advance! Linear regression best polynomial (or better approach to use)? Any ideas on other polynomials I could successfully use for applying regression? My goal is a solution that has fit error strictly based on the noise. Is this possible since it is a bell-like curve? The tails can be long, short or non-existent. Am I looking for the impossible? Please note it has been a while since I have plunged this far into linear regression.   Anyway, my data points do not fit the $ax+bx^2+c$ polynomial well enough. I would like a replacement for this polynomial to apply regression (or different approach). In the following example, each point misses the fit curve by $20\%$ of the $Y$ range on average (of the data points). I looked at splines, but I do not know how to apply the regression since they look piece-wise.   Example $Y$ values (evenly spaced in $X$). It looks kind of like a bell curve. I would be applying 5 to 50 data points to determine the polynomial coefficients. Ultimately, I am interested in the best $X$ location for the peak based on the data points.     X      Y -40    -21142.1111111111 -30    -21330.1111111111 -20    -12036.1111111111 -10      7255.3888888889   0     32474.8888888889  10     32474.8888888889  20      9060.8888888889  30    -11628.1111111111  40    -15129.6111111111 I run windows 7. I run a Minecraft server, but I can only host around 9 players before lag appears.   I heard that Ubuntu can run a server with much better performance than Windows 7. I kind of like the whole idea of Ubuntu, but I don't want to change my OS to Unix or anything else.  Basically, my question is, does running a server (specifically and Minecraft server) run easier and faster on a Ubuntu server? On top of that, how would one set that up? Is there a better way than the following to check to see if a string is nil OR has a length of 0 in Ruby?  if !my_string || my_string.length == 0   return true else   return false end   In C# there's the handy  string.IsNullOrEmpty(myString)   Anything similar to that in Ruby? Value passed with request.setAttribute() is not available by request.getParameter() Is your MAC address revealed when you hit up a website? When you hit up a site, such as cnn.com, does the TCP/IP packet contain the MAC address of your network card?  Could cnn.com theoretically record my MAC address? How to show hyperlink in LWC toast How to determine if Javascript object is an event? Playing a remote movie on the remote computer I have two computers (a desktop and a laptop) running linux connected to my local area network. I like to ssh from my laptop over to my desktop and run programs there, and sometimes listen to music on my desktop, which is connected to my stereo system. Lately, I've been wanting to play movies on the desktop and desktop screen, but cue them from my laptop across the room.   Unfortunately, I cannot play a movie in the current X session running on my Desktop on from my laptop. What is odd about this is that I can listen to the audio coming from the speakers that are hooked up to my desktop, by playing the audio files over ssh! This tells me that there must be a way to send the movie to that Xsession, from the ssh shell that I am connected to.  Does anyone have any ideas about this? Simple question.   SO had turned me into a better developer by far, I like to browse questions that strike my interest and curiosity and just read through the answers. I never fail to learn something new everyday, whether it's something trivial or something much more complex.  When I receive reputation it means a lot to me, almost a self achievement of sorts. Something I can show to someone to prove my "worth". I think it works for me as a great confidence booster, also its something I can show my friends who don't understand what I do.   It almost feels like I can finally have something to back me up if need to be.  So the question is what does YOUR reputation mean to YOU? Is it simply a number, is it a score as if you're playing a game, or does it help you mentally achieve your goals and improve yourself like it does for me. When I want to register an account with Gmail now, it says "Google will send a text message containing a verification code to your mobile phone."  I don't want to give Google my mobile phone number!!  How do I get around this? We've been talking a lot about the efficacy of community self-evaluations lately, both internally on the Community Team and out in the open . Lots of ideas were tossed around, but the underlying theme of these discussions has been that site self-evaluations are not useful in their current form. The review queue format hampers discussion, the meta thread posted by the Community user is trivially ignored, and the sample question size is far too small to be useful, but big enough to be non-trivial for participants. They also don't provide much in the way of useful information to community managers behind the scenes.  So we're going to shut them down this week, and we'll be using the time it saves us to digest the ideas y'all have thrown out in the previous discussions and figure out where to go from here.   I'll be going over the previous threads with a fine-toothed comb to try and suss out what worked well and what was broken and determine a more useful mechanism - if one is required at all. I'd also welcome continued suggestions from the communities about how to continue capturing what the evals accidentally did right - encouraging communities to stop and examine how they're doing at somewhat regular intervals.   So: if you have ideas on how to get communities to monitor their own Q&amp;A quality and get a little introspective, feel free to sound off in the answers.  Update: with a creative application of per-site feature toggles, we've shut down evaluations except on a handful of sites where they're currently running. Once those evaluations run their course, no new ones will be started anywhere on the network. What are the areas where graph theory can be applied?  Cause I wonder what applications this have on the real world.  Does it solve certain problems and stuff?  Areas such as communication networks and coding in IT, genomics, computation, and scheduling in operations research