in below code although I am updating StringBuilder roar3 inside roar(String roar1, StringBuilder roar3) method but how it affects roar2 in main() method? Same thing does not affect int x or y in intUpdate(int  x, int y) also not for String roar1.  public class TestReference {      public void roar(String roar1, StringBuilder roar3) {         roar1.concat("!!!");         roar3.append("!!!");     }      public void intUpdate(int  x, int y) {         x=1;         y=2;     }      public static void main(String[] args) {         String roar1 = "roar";         StringBuilder roar2 = new StringBuilder("roar");         new TestReference().roar(roar1, roar2);          System.out.println(roar1 + " " + roar2);           int x=-1,y=-2;         new TestReference().intUpdate(x, y);          System.out.println(x + " " + y);     } }
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?
Laws and theories What is a , a , and what is the relationship among them?  I know this is a very basic question, so any reference to epistemology will be greatly appreciated :) java.lang.LinkageError: javax.servlet.jsp.JspApplicationContext.getExpressionFactory Setting up a bicycle for someone with restricted knee articulation My father, now in his 70's, had a left knee replacement several years ago. He has limited movement in that knee - probably about 85 degrees on a good day. His knee can extend fully, but cannot bend as much as it should. As a result, he cannot pedal a bike he cannot get his left leg over the top of the pedal stroke.   He is desperate to get back onto a bike, he knows he won't be ripping up the road and winning races like the old days, but wants the freedom to go for a slow easy rides.    Does anyone have suggestions as to a solution to the problem. We don't mind spending money if we know the solution will work, but he can't afford to throw big money at wild ideas that may or may not work. If we find a solution, a new bike is likely.   We have access several mountain bikes in a range of sizes to trail ideas, and we have all the tools and skills to build bikes up from parts and rearrange things as needed.    EDIT: Thanks everyone - all great suggestions. What am am going to do is got tto the LBS and get hold of a cheap set of short cranks for around $30- probably from a kids bike, in the 120-150 size range, and see if he can ride that. Depending how he goes, I'll try a standard right crank and a short left crank. If all else fails, we will go for the Power Cranks   UPDATE: In case anyone else has similar problems. Got some 152mm cranks for $30. Set an old  mountain bike up with the seat as far back as possible. The old man is able to ride reasonably comfortably, now has a smile from ear to ear - any suggestions how to remove it - doesn't fit with the grumpy old man image :)   Has got me wondering how many people with minor knee problems would benefit from short(er) cranks....... A doubt regarding change of variables in Double Integrals. So I have recently learnt to calculate &quot;Double Integrals&quot; and I have a doubt on change of variables. Lets say we are evaluating a double integral of the form I = $\int\int _R F(x,y) dx dy $ , where $F(x,y)$ is an integrable smooth function and $R$ is the region of integration in the $xy$ plane. Now I want to convert to polar co-ordinates $x(r,\theta)=r \cos(\theta)$ and $y(r,\theta) = r \sin(\theta)$. Now the region $R$ in the $xy$ palne can be suitably converted to some region $R'$ in the $r \theta$ plane. The function $F(x,y)$ may take the form of some smooth and integrable $G(r,\theta)$. My main doubt is with the change of the area element. According to my textbook, $dx dy = \frac{\partial (x,y)}{\partial(r,\theta)} = rdrd\theta$. So the area element in the $r\theta$ plane is $rdr d\theta$. Now I want to experiment a little bit with my understanding : I write $dx = d(r\cos\theta) = -r\sin\theta d\theta + \cos \theta dr$  and $dy = d(r\sin\theta)=r\cos\theta d\theta + \sin\theta dr $. And now I multiply the two expression for $dx$ and $dy$ : $dxdy= -r^2\sin\theta\cos\theta d\theta d\theta - r \sin^2 \theta drd\theta + r \cos^2 \theta dr d\theta + \sin \theta \cos\theta dr dr$. Why isn't this expression equal to $rdrd\theta$ ? The $d\theta d\theta$ and $dr dr$ terms look very odd to me. Am I commiting some abuse of notation or something ? Also there are no higher order terms like $dr dr d\theta$ which I can ignore. I am totally confused with all this. Can someone explain this to me a bit clearly? Thanks in Advance :). EDIT 1 : I know differentials are not the &quot;usual&quot; kind of algebraic quantities and we can't just add and multiply them casually. I am just multiplying $dx$ with $dy$ with the spirit of multiplying some $\delta x$ and $\delta y$ and letting both $\delta x$ and $\delta y$ tend to zero. EDIT 2 : Is there a branch of Mathematics where addition and multiplication of differentials is very common? Is there something like differential of a differential ? Apologies in advance for the long question.  My understanding is that in GR, massive observers move along timelike curves $x^\mu(\lambda)$, and if an observer moves from point $x^\mu(\lambda_a)$ to $x^\mu(\lambda_b)$, then his clock will measure that an amount of time $t_{ba}$ given by the curve's arc length; $$   t_{ba} = \int_{\lambda_a}^{\lambda_b}d\lambda \sqrt{-g_{\mu\nu}(x(\lambda))\dot x^\mu(\lambda)\dot x^\nu(\lambda)} $$ will have elapsed where $g_{\mu\nu}$ is a metric on spacetime with signature $(-,+,+,+)$.    Why is this so?     Here is how I would attempt to justify this fact in special relativity with $g_{\mu\nu} = \eta_{\mu\nu}$.  Consider an inertial observer $O$ in $\mathbb R^{3,1}$, and suppose that this observer sees a clock, which I'll call observer $O'$ moving around on a curve $x^\mu(\lambda)$.  If $O'$ were also an inertial observer, then given any event with coordinates $x^\mu$ as measured by $O$, observer $O'$ would measure the coordinates of the event to be $x'^\mu = \Lambda^\mu_{\phantom\mu\nu} x^\nu + x_0^\mu$ for some Lorentz transformation $\Lambda$.  If $O'$ is not inertial, then this is no longer true, and there is some more complicated family of transformations, say $T_\lambda$ between events as seen by both observers.  I would argue, however, that if we were to partition the interval $[\lambda_a, \lambda_b]$ into a large number $N$ of intervals $I_1=[\lambda_a, \lambda_i], \dots, I_N=[\lambda_{N-1}, \lambda_b]$ with $\lambda_n = \lambda_a+n\epsilon_N$ and $\epsilon_N=(\lambda_b-\lambda_a)/N$, then on each interval $I_n$, $O'$ is approximately an inertial observer in the sense that $$   T_{\lambda_n} = P_n + \mathcal O(\epsilon_N), \qquad (\star) $$ for some Poincare transformation $P_n$.  Then we would note that since $O'$ is stationary in his own reference frame, he measures his worldline to have the property $\dot x'^\mu(\lambda) = (\dot t(\lambda), \mathbf 0)$ so that $$   I_{ba}=\int_{\lambda_a}^{\lambda_b}d\lambda \,\sqrt{-\eta_{\mu\nu}\dot x'^\mu\dot x'^\mu} = \int_{\lambda_a}^{\lambda_b} d\lambda \, \sqrt{\dot t^2} = t(\lambda_b) - t(\lambda_a) = t_{ba} $$ On the other hand the integral on the left can be written as a Riemann sum using the partition above, and we can invoke ($\star$) above to get \begin{align}   I_{ba}  &amp;= \lim_{N\to\infty}\left[\sum_{n=1}^N \epsilon_N\sqrt{-\eta_{\mu\nu}\dot x'^\mu(\lambda_n)\dot x'^\nu(\lambda_n)}\right] \notag\\ &amp;= \lim_{N\to\infty}\left[\sum_{n=1}^N \epsilon_N\sqrt{-\eta_{\mu\nu}\dot x^\mu(\lambda_n)\dot x^\nu(\lambda_n)} + \mathcal{O}(\epsilon_N^2)\right] \notag\\ &amp;= \int_{\lambda_a}^{\lambda_b}d\lambda \,\sqrt{-\eta_{\mu\nu}\dot x^\mu\dot x^\mu} \end{align} Combining these two computations gives the desired result.  How do others feel about this argument?  I'm not completely comfortable with it because of the assumption $(\star)$ I made on $T_\lambda$.  I imagine that in GR a similar argument could be made by invoking local flatness of the metric. iPhone asks for Mac password (or Mac asks for iOS password) During iPhone update to iOS 10.3.1, I was asked for my password using the correct machine name for my Mac mini. To be clear, the request was not for my iCloud password, my actual local user account password for macOS. This can also happen in the other direction - setting up a Mac may ask for verification for you to enter your iPhone / iPad passcode (and not your iCloud password)  I could not find any information about this kind of access. I was thinking it was security for iCloud and possibly related to two step authorization or two factor authorization. This is the first time I can think of that I entered a desktop password outside of that actual desktop.  I don't have a screen shot but I recall an implication that some files in my Mac are encrypted and need my password. '... need to enter the password for .'   Are there settings I can I control this assuming it's a legitimate part of iCloud setup process or iOS setup process? Select Permissions Across Multiple Schemas Within the Same Database I have been asked by a client to implement some views for reporting purposes, the views will be accessed via PowerBI, Excel and SSRS. The designated user will only have access to the view and no underlying tables must be available to the user.  The problem I have encountered in that the SQL within the view touches 3 different schemas (All within the same database):   Pupil Provider  Security   The view is:  CREATE VIEW dbo.vTestPermissions AS SELECT a.Column1,        b.Column1,        c.Column1 FROM Pupil.Table1 a JOIN Provider.Table2 b ON a.Column1 = b.Column1 JOIN Security.Table3 c ON a.Column1 = c.Column1   The owners of the Tables/View are as follows:   Pupil.Table1 - Owner Pupil Provider.Table2 - Owner Provider Security.Table3 - Owner Security vTestPermissions - Owner dbo   When I select from the view I get an error:     The SELECT permission was denied on the object 'table3', database   'TEST', schema 'Security'   I have tried giving SELECT permission with and without the GRANT option to the schema, and the tables, but that makes the underlying tables available to the user.  Any help on this will be greatly appreciated. Modified files in a git branch are spilling over into another branch One of my players has a +1 shortbow, and recently found some +1 arrows. If he fires a +1 arrow from a +1 bow, will the bonus to attack and damage be +1, or +2? Search in favorited questions? Prove that $(p+q)^m \leq p^m+q^m$ If $p,q$ are positive quantities and $0 \leq m\leq 1$ then Prove that $$(p+q)^m \leq p^m+q^m$$    Trial: For $m=0$, $(p+q)^0=1 &lt; 2= p^0+q^0$  and for $m=1$, $(p+q)^1=p+q =p^1+q^1$.   So, For $m=0,1$ the inequality is true.How I show that the inequality is also true for $0 &lt; m &lt; 1$.   Please help. The indefinite article applied to a group of things Extract all the polygon coordinates from a SpatialPolygonsDataframe? I want to do something relatively simply but it seems to be very difficult to do, though I am very new to using R for spatial data so apologies if I've missed something obvious.  I have a list containing 161 shapefiles of bird distributions in the world, they are each in the format of a SpatialPolygonsDataFrame. I also have world climate data in a raster stack format for 8 variables. Both sets of files are in the same projection (lat and long WGS84). I want to create new columns for the climate data with 1's where the species polygon overlaps with the climate data and 0 where it doesn't. I tried various functions to do this, quite a few initial options didn't work, the best option appeared to be:  pnt.in.poly(XY coordinates of climate data points, XY coordinates of species polygon)   I changed my raster of climate data into points to get the XY coordinates. I unified the polygons for each species shapefile and then used:  species@polygons[[1]]@Polygons[[1]]@cords   to get the coordinates for my species polygons as a matrix. However, I discovered that:  species@polygons[[1]]@Polygons[[1]]@coords    wasn't actually getting all the coordinates of the polygons only some of them.  I tried using fortify from the ggplot package, and it gives me a dataframe with coordinates but some of them are for holes in the polygons. I ran that with the pnt.in.poly function excluding the holes but it took an hour to run and when I looked at the output maps after it matched for some of the range but not all of it- there were holes in the distribution where there shouldn't be holes.   I also tried this method that I found somewhere else:  lonlat &lt;- lapply(slot(species, "polygons"), function(x) lapply(slot(x,"Polygons"), function(y) slot(y, "coords")))    which gives me a list with 436 items- but I'm still not sure how to get the coordinates into a matrix form that will work in pnt.in.poly.  I'm sure this should be easier to do! Does anyone know a better way? How can I prove $\sqrt{2} ^{\sqrt{2}}$ is irrational? Change Folder Permissions I would like to set up an APT repository on a server that will provide a couple of packages.  Is there a way to set one up without installing any software on the server?  How do the files have to be organized?    Edit: I must be doing something wrong... can someone please help me? I have the repository at   I'm not sure where or what, but something's misconfigured. I only currently have one package and it's for all architectures.  Here's what's been added to my /etc/apt/sources.list:  deb http://quickmediasolutions.com/apt stable main How to open terminal, split to 9 terminals and switch between them using one script? Android: TextView automatically truncate and replace last 3 char of String Recommended way to initialize srand? I need a 'good' way to initialize the pseudo-random number generator in C++. I've found  that states:     In order to generate random-like   numbers, srand is usually initialized   to some distinctive value, like those   related with the execution time. For   example, the value returned by the   function time (declared in header   ctime) is different each second, which   is distinctive enough for most   randoming needs.   Unixtime isn't distinctive enough for my application. What's a better way to initialize this? Bonus points if it's portable, but the code will primarily be running on Linux hosts.  I was thinking of doing some pid/unixtime math to get an int, or possibly reading data from /dev/urandom.  Thanks!  EDIT  Yes, I am actually starting my application multiple times a second and I've run into collisions. Can you find shadow orbs in terraria demo? I have the PS vita demo, and was wondering if you could find any shadow orbs in that tutorial world. Thanks.