package main;  public class Main {     double radius;     public Main(double newRadius) {         radius = newRadius;     }       public static void main (String [] args) {         Main x = new Main(1);         Main y = new Main(2);         Main temp;         // try to swap first time         temp = x;         x = y;         y = temp;         System.out.println(x.radius + " " +  y.radius);         x = new Main(1);         y = new Main(2);        // try to swap second time         swap(x, y);        System.out.println(x.radius + " " + y.radius);     }     public static void swap(Main x, Main y) {         Main temp = x;         x = y;         y = temp;     }  }   Why the first time worked, but the second time didn't? The first one did the swap, but the second one didn't. I'm passing the reference to the function. Why this doesn't work?
I always thought Java uses pass-by-reference. However, I've seen a couple of blog posts (for example, ) that claim that it isn't (the blog post says that Java uses pass-by-value). I don't think I understand the distinction they're making. What is the explanation?
ubuntu 18.04 how do I install drivers for my NVIDIA GeForce GTX 1050? How do I pre-populate a jQuery Datepicker textbox with today's date? I have a very simple jQuery Datepicker calendar:  $(document).ready(function(){     $("#date_pretty").datepicker({      }); });   and of course in the HTML...  &lt;input type="text" size="10" value="" id="date_pretty"/&gt;   Today's date is nicely highlighted for the user when they bring up the calendar, but how do I get jQuery to pre-populate the textbox itself with today's date on page load, without the user doing anything?  99% of the time, the today's date default will be what they want. What happens when yellow light is passed through a prism? What happens when secondary colors like yellow,green and magenta are passed through a prism? Will it split into its component colors(for example yellow split into green and red)?If yes why we are observing secondary colors in the visible spectrum obtained when white light(composite light) is passed through a prism? I am trying to install Linux headers for Kali Linux on my machine and I have tried every possible solution on the internet but it always show "Unable to locate packages "  root@kali:/usr/sbin# apt-get install linux-headers-4.6.0-kali1-amd64 Reading package lists... Done Building dependency tree        Reading state information... Done E: Unable to locate package linux-headers-4.6.0-kali1-amd64 E: Couldn't find any package by glob 'linux-headers-4.6.0-kali1-amd64' E: Couldn't find any package by regex 'linux-headers-4.6.0-kali1-amd64'   Here is my sources.list file :  # Regular Repositories deb http://http.kali.org/kali sana main non-free contrib deb http://security.kali.org/kali-security sana/updates main contrib non-free # Source repositories deb-src http://http.kali.org/kali sana main non-free contrib deb-src http://security.kali.org/kali-security sana/updates main contrib non-free   Uname -a output :   root@kali:/usr/sbin# uname -a Linux kali 4.6.0-kali1-amd64 #1 SMP Debian 4.6.4-1kali1 (2016-07-21) x86_64 GNU/Linux traveller's cheques; customer's requirements: use of the singular Saxon genitive (and the plural attributive) for association May I ask if the following sentence is grammatical?      Our remit is to conduct research on customer's requirements.   In my understanding, as 'customer' is a countable noun, so the plural form 'customers''' should be used instead for this general reference (without specification of certain customers).   However, I know that we can say 'traveller's cheques' - e.g.,      Traveller's cheques are available at the bank.    In this sense, actually can we say 'customer's requirements' in the first case? "INSERT IGNORE" vs "INSERT ... ON DUPLICATE KEY UPDATE" While executing an INSERT statement with many rows, I want to skip duplicate entries that would otherwise cause failure. After some research, my options appear to be the use of either:  ON DUPLICATE KEY UPDATE which implies an unnecessary update at some cost, or INSERT IGNORE implies an invitation for other kinds of failure to slip in unannounced.  Am I right in these assumptions? What's the best way to simply skip the rows that might cause duplicates and just continue on to the other rows? Why does this CSS margin-top style not work? Ubuntu with spyware? Richard Stallman states that Ubuntu "has installed surveillance code". See:   Is this true?   I agree with him that "Any excuse Canonical offers is inadequate....". My 8 year old son won't fall asleep We put him to bed at 9pm and he stays up til 1am or later. When I go to check on him he is always playing with his hands and sometimes talking. I ask him why he is awake and not trying to sleep and he says it's because he just wants to play. He never comes to tell us that he is having a hard time sleeping or that there is anything wrong. The weird thing is that he used to be the first one to fall asleep out of 3 boys and the staying up started a few months ago. He does this every night and on top of keeping us awake, he is now waking up his brothers.   About a month or so ago, we decided to punish him by grounding him from video games. He doesn't want to be grounded, but he still keeps doing it. Nothing we do seems to be helping and it seems to be getting worse. I have talked to him about why it is so important to get enough sleep and why it's even more important for kids. He also gets plenty of exercise and time to play during the day.   I'm really starting to wonder if he is doing it just to be defiant. If anyone has any suggestions I would greatly appreciate it.  The problem is that he is being disruptive to everyone in the house and it has been EVERY night for the last 3 months.   He is tired and emotional during the day, and it is causing his brothers to be tired during the day while they are at school.   Because he is tired during the day he doesn't really want to be as active as he used to be. However, I do still encourage him to be active. We have always had a bedtime routine. We have asked him many different times if he is just having trouble sleeping, if he is uncomfortable, and if there is something wrong. He always tells us that he just wants to play.   At the beginning of all this he told me that he wants to be the one to decide when he goes to sleep and when he wakes up. Which is why I would even ask if it was out of defiance.   We really didn't want to get to the point of punishing him, but nothing else seemed to help and it was only after he started keeping his brothers awake.   It's not like we haven't asked him what he thinks would help or what would help him sleep better. He ALWAYS says that he just WANTS to stay up and play because it is fun. We know it is important for him to get enough sleep, and I'm worried because I don't think he is (and he's preventing the rest of us from getting enough, too). Why are there so many places to put a binary in Linux? There are at least these five:   /bin/ /sbin/ /usr/bin/ /usr/local/bin/ /usr/local/sbin/   And on my office box, I do not have write permissions to some of these.  What type of binary goes into which of these bins? I have some long URLs which doesn't contain special "line break characters" like "-" or "/". How can I automatically break these URLs?  \documentclass{scrreprt}  \usepackage[ngerman]{babel}                     \usepackage[latin1]{inputenc}                 \usepackage[T1]{fontenc} \usepackage[backend=biber]{biblatex} \usepackage{url} \usepackage{dingbat}  % for \carriagereturn symbol \makeatletter \g@addto@macro{\UrlBreaks}{\UrlOrds} \g@addto@macro{\UrlBreaks}{% \do\/\do\d% } \makeatother  \begin{filecontents}{bachelorarbeit_lit.bib} @ONLINE{java96,     author = {{Joe Black}},     title = {Foobar 1.0},     year = {1996},     month = {1},     url = {http://www.aaa.bb.cccc.dh/uploads/dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd.pdf},     urldate = {2011-03-02},     sortname = {Sun},     keywords = {www} } \end{filecontents}  \bibliography{bachelorarbeit_lit}  \begin{document} Test \cite{java96} \printbibliography \end{document}   edit  I don't know why but it still doesn't work. Is there an option to automatically break long URLs. I don't care where the break is but it should be done automatically. Even if I manually specify the "breaking character" it doesn't work (as the example shows). Sorting seach results in Android app The issue is how can user sort questions for a particular search query?   For example, I would want to search questions for  and want to see newest questions first.  Right now If we write any query in Search Questions... input box then users are not able to select sorting options as search questions input box takes whole width of the screen and sorting options box gets hidden.  I have also tried to select sorting options first and then search for  but still its showing questions without considering sorting option I have selected. How do I determine if an array is initialized in VB6? Passing an undimensioned array to the VB6's Ubound function will cause an error, so I want to check if it has been dimensioned yet before attempting to check its upper bound.  How do I do this? Two tables side by side with minipage Using image sequence of medical scans as volume data in cycles I know it's possible to do this in BI, but I need your help to do this in cycles. For now, I have a setup to use an image sequence as volume but it only shows 1 slice/frame. I'm using generated texture coordinates for easy mapping (0-1 on each axis). The images are mapped on XY and I would like to use normalized frame# as Z coordinate to map the sequence as a volume.       Images sequence can be found  (I'm using 16-bit TIF files of MRBrain in this exemple).    Any solution is welcome but try to keep it simple and user friendly :).  Final Edit: I had a hard time choosing between Lemon's and PGmath's answers. Lemon's is more user friendly and flexible, and uses the image sequence without any change inside blender. PGmath's uses a 3rd party converter to make the sequence 1 single image, but allows GPU rendering. Well, ImageMagick's command line is : "convert +append *.tif anim.tif" from the folder where the sequence is unzipped. Not so hard. That's why I accepted PGmath's answer.      Now, i played with it, and here's the result.  The "volume" object contains the volume shader (playing with the color ramp gives funny things) and the boolean modifiers (turn them off to see the complete volume, but reduce the final density multiplier for better view). The "Slice Control" arrow empty controls the slice position/rotation. The "Texture Mapping" object controls...the mapping, if it need some tunning (position, rotation, scale, and then tiling if necessary?). I'm working on a python script that passes file locations to an scp subprocess. That's all fine, but I'm in a situation where I may end up concatenating a path with a filename such that there's a double '/ in the path. I know that bash doesn't care if you have multiple file separators, but I'm wondering how exactly that is rectified. Is it bash that strips extra /s or does it really not matter ever?  I ask because it will save me several lines of code to check for extra /s while concatenating. I know it's not a big deal, but I'm curious as well. I have a bash script that has the line cd //usr (instead of cd /usr), which seems to imply there might be a significance to using multiple /s in a path What's the difference between an id and a class? How do I watch a file for changes? effect of mass of spring on period of oscillation Consider a massless spring system which is hanging vertically. Attach a mass $M$ and set it into simple harmonic motion. Let the period with which the mass oscillates be $T$.   We assume that the spring is massless in most cases. Would taking effect of the non-zero mass of the spring affect the time period ($T$)? Our GM won't let us affect the story; the more I play the less fun I have. What do I do? I was wondering if anyone could give me some advice or anything on a GM situation.   My current GM is running a campaign and it is very video game/anime like. It started out super fun and the deeper we get the less fun I have. The reason is, it feels like GM is telling us a story but we cannot interact or change anything during his, "cut scenes". No matter what any player does he just says, "No it didn't work," or, "Yeah you do that. See if you roll a 20." We also can't damage any boss he has until we reach the point in the story that he has planned, so our interactions we have with villains don't matter.  I feel like he is making us sit there and listen to an anime he has come up with in his head. Since the players can't change or react to the key situations. I find my self sitting there thinking, why would I react, it doesn't matter.  It's not just me either. Another player feels the same way. I am going to talk to my other fellow players soon about it and see how they feel.  Side note: the GM as a person is very defensive and I am afraid to confront him about it because I know he will throw a fit. We have also caught him straight lying about abilities and stats on his own PC in other campaigns, and he doesn't take to kindly when you call him out.  He is new to GMing. This is only the second game I have played with him as a GM. The first one had one session the he just never wrote more for.  Is there anything I can do to maybe get him to more lenient with his story? I really enjoy the story for the most part and if he would just let our characters do things and give us a chance at stopping his villians or letting us change the story based on our actions, everything would be cool.