I am successfully create an onClick based on adapter getPosition.  the common way is that making onClicklistener at onBindViewHolder  @Override public void onBindViewHolder (final MyViewHolder holder, final int position){ holder.mId.setText(itemList.get(position).getId());  holder.itemView.setOnClickListener(new View.OnClickListener(){  public void onClick(View view) {  final Intent intent; if (position == 0) { intent = new Intent(context, MyActivity.class); } else if (position == 1) { intent = new Intent(context, MyActivity2.class); } else { intent = new Intent(context, MyActivity3.class); } context.startActivity(intent);   But, what I am trying achieve is, the parameter that I'm gonna use to go to next Activity is the getId.      I've modified my code to this.  holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { final String idNumber = itemList.get(position).getId(); final Intent intent; if (idNumber == "7") { intent = new Intent(context, MyActivity.class); } else if (idNumber == "10") { intent = new Intent(context, MyActivity2.class); } else { intent = new Intent(context, MyActivity3.class); } context.startActivity(intent); Log.e("YOUR ID NUMBER IS", idNumber); Toast.makeText(context, "Recycle Click" + idNumber,Toast.LENGTH_SHORT).show(); } });   When I run it, and when I click on any item, it keeps going to MyActivity3  But, on the Log and toast says, the right idNumber that I click.
I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug.  Is == bad? When should it and should it not be used? What's the difference?
I'm getting a NoSuchMethodError error when running my Java program.  What's wrong and how do I fix it? Layers with same coordinates not lining up I have a project where I have a few layers (State of Texas, cities, roads, etc.). They are all resaved and projected to NAD83 / UTM zone 14N EPSG: 26914. The project CRS is also NAD83 / UTM zone 14N EPSG: 26914 and on the fly projection is enabled. I added a text delimited file and cannot get them to line up. I checked the attribute table of the delimited file and the coordinates are correct. I cross-checked this with a point close to where a few of the points from the delimited file are and they are very close so in theory they should be lining up. I tried to save the delimited file and save it with the same projection and add the shp file back in and that did not work. Anyone have any ideas? I can't think of anything else to try. For which values $r, s \in \mathbb R$ is the set $\{u, v, w\}$ linearly independent? If $f$ is entire and $|f|\geq 1$, then show $f$ is constant. How can I clear the water out of this area? I've sectioned of this area in the sea near my base, and I need to get rid of all the water from it.  From what I've tried the only way I can see to clear it is fully cover one layer, delete the blocks, then go down to the next layer. Is that the only way I can clear the area or is there a better approach?  Ideally I'd like a survival method (if there is a better one), but any commands what could be used I'd like to hear just so I can learn more commands :) How to learn physics effectively and efficiently Modified Hamilton's Principle overconstraining a system by imposing too many boundary conditions In Hamiltonian Mechanics, a version of Hamilton's principle is shown to evolve a system according to the same equations of motion as the Lagrangian, and therefore Newtonian formalism. In particular, letting $\delta$ indicate a variation of the path through phase space, $$ \delta \int_{t_1}^{t_2} \big(p_i \dot{q}_i - H(p_i,q_i,t)\big)dt = 0 $$ is shown to generate the same motion equations as those found by the Legendre transform of the Lagrangian equations of motion. Essentially, when we calculate the Euler-Lagrange equations for the above integrand, we find $$ \dot{p}_i + \frac{\partial H}{\partial q_i} = 0\text{, } \dot{q}_i - \frac{\partial H}{\partial p_i} = 0. $$ Now, since these are both first-order equations of motion, we require $2n$ boundary conditions to obtain a solution, where $n$ is the number of particles. This is perfectly consistent with the Lagrangian formalism which had $2n$ boundary conditions due to its $n$ distinct second-order motion equations.   An important thing to note is that since $p_i\dot{q}_i - H(p_i,q_i,t)$ contains no $\dot{p}_i$ dependence, the variation in $p_i(t)$ need not be zero at the endpoints of the path. This is not the case with $q_i(t)$ because the $\dot{q}_i$ dependance results in the appearance of boundary terms that must be set to zero in order to obtain the motion equations.  Now, as far as the boundary conditions are concerned, this makes sense. For the path to be uniquely specified given Newtonian mechanics, we require $2n$ boundary conditions. These can either be the usual Newtonian choice of initial positions and velocities/momenta, or they can be the initial and final positions. Both are perfectly acceptable mathematically speaking. If we were required, in the modified Hamilton's principle variation, to enforce that the variations in the momenta also be zero at the initial and final times, this would mean $2n$ additional boundary conditions, which would generally over constrain a Newtonian system.   However, my confusion is this: when textbooks (Goldstein in particular) consider generating functions, they require that the integrand be invariant to the addition of a total time derivative of a function $F(q_i,p_i,t)$ of the phase space coordinates. However, adding such a function will in general add some $\dot{p}_i$ dependence to the integrand, which will then add boundary terms to the equations of motion unless we require that the $p_i(t)$ variations be zero at the boundaries. This is fine as far as it goes. We can always define the variation however we like. The point is just that it spits out the right motion equations at the end of the day. But my confusion lies in how this doesn't generally over constrain the system. If we specify all the positions and momenta at both the initial and the final times, might not the required path to connect those points in phase space be non-Newtonian? Does this only matter if you're actually trying to use the stationary action principle to find the paths, rather than just using it to find the motion equations? YA dystopia novel of battle school with unusual military control scheme How should one maintain and update a MiKTeX installation? Do I need a visa for Paris, if my connecting flight stops for 24 hours in Paris? Do I need visa for Paris, if my connecting flight stops at Paris for 24hrs and I want to visit Paris during that 24hrs? I have US B1 visa. I'll be travelling from San Francisco to Bangalore (India) via Paris. I hold Indian passport. If yes, what is the procedure for that visa? I realize this isn't possible, but I can't see why not, especially if you change the model a little bit so that the balls simply travel through a tube of water on the way up, rather than exactly this model.  Please be clear and detailed.  I've heard explanations like "the balls wouldn't move" but that doesn't do it for me - I really do not see why the balls on the right would not be pulled/pushed up, and the rest of the chain wouldn't continue on. Limit point compactness implies compactness. I have a question about the following counterexample, why  $U_n = \{n\} \times Y$ has not finite collection covering $X$?   Is it because if you take a finite set $S\subset U_n$ then it's impossible to have $X\subset \bigcup S$ since X is infinite?  Counterexample:  Let $Y$ consist of two points; give $Y$ the topology consisting of $Y$ and the empty set. Then the space $X = \mathbb{Z}_{+} \times Y$ is limit point compact, for every nonempty subset of $X$ has a limit point. It is not compact, for the covering of $X$ by the open set $U_n = \{n\} \times Y$ has not finite collection covering $X.$ ls command operating differently depending on recipient How does commands like ls know what its stdout is?  It seems ls is operating different depending on what the target stdout is. For example if I do:  ls /home/matt/tmp    the result is:  a.txt b.txt c.txt   However if I do  ls /home/matt/tmp | cat   the result is (i.e. new line per result):  a.txt b.txt c.txt   The process is passed a file descriptor 1 for stdout right? How does it determine how to format the result? Does the file descriptor reveal information? Jordan form, number of blocks. How to set up RAID 1? Configure HAProxy to include host headers for different backends I am exploring the use of HAProxy as a balancer in front of a set of web apis that run on IIS.   node1.myapp.mycompany.com node2.myapp.mycomapny.com   We are currently using Host Headers to correctly resolve the right web application on IIS.  For example, we may have otherapp.mycompany.com running on the same server/port, but using Host Headers IIS knows which one to serve up.  My initial attempt at HAProxy left me with 404 errors, because I was not including the host headers in my request, and so IIS was serving back the default site bound to the given IP, and not resolving by host name.    The fix left me with something like this:  frontend localnodes     bind *:80     mode http     default_backend nodes  backend nodes     mode http     balance roundrobin     option forwardfor     reqirep ^Host: Host:\ node1.myapp.mycompany.com     server web01 node1.myapp.mycompany.com:80   This works great for a single backend, but I am left scracthing my head on how to include the correct host headers depending on which backend is serving up the request:  backend nodes     mode http     balance roundrobin     option forwardfor     reqirep ^Host: Host:\ node1.myapp.mycompany.com     server web01 node1.myapp.mycompany.com:80     server web02 node2.myapp.mycompany.com:80   The above does not work whenever node2 is used because it doesn't resolve correctly in IIS (node2 in this case is on a different server, and therefore different IP.  In fact, if they were running on the same server/ip I suspect the request work "work", but they would all be served by node1 per the host header).     Is it possible to set the host based on the url of the backend used to serve up the request? If so, this implies my checks also need to provide the correct host header based on backend, how would that be done?   Edit: Am using HA-Proxy version 1.7.9 2017/08/18  Let me give this just a little more background.  We used to have just myapp.mycompany.com serving up api requests.  We need to expand it.  Our clients will still call myapp.mycompany.com, but that will just point to the HAProxy, which will balance it out to node1.myapp.mycompany.com and node2.myapp.mycompany.com.  Our current server configurations have us binding a single IP address on each server, so we use host headers to resolve. Just doing this for revision, seems much harder than it should be, should I use $x=\tan u$ ? Any help appreciated. Can I have 8 GB RAM on 32-bit Win 7? Possible Duplicate:             According to , Win 7 only supports 4 GB of RAM. I, however have been reading some forums and some say they are using 8 GB RAM with good performance. I am wondering if I can use 8 GB before I purchase. Support for N-Gons (polygons consisting of more than 4 vertices) has been in Blender for a while now, but many of us still may not know when to use them, and how to do so effectively.  In what situations do N-Gons really come in handy? When should they be just plain left out? Do they have any place in finished models? I know that if we solve the Maxwell equation, we will end up with the phase velocity of light being related to the permeability and the permittivity of the material. But this is not what I'm interested in - I want to go deeper than that. We know that the real speed of light is actually not changing, the decrease in speed is just apparent. Material is mostly empty, the light will still travel with $c$ in the spacing. The rare atoms will disturb the light in some way. So I am interested in how the atoms affect the light. Photon absorption-emission theory Some textbooks that I read explain it in a way kind of like this: In a material the photons are absorbed by atom and then re-emitted a short time later, then they travel a short distance to the next atom and get absorbed&amp;emitted again and so on. How quickly the atoms in a material can absorb and re-emit the photon and how dense the atoms decides the apparent speed of light in that material. So the light appears slower because it has a smaller “drift speed”. Interference theory But recently I realize an alternative explanation: Atoms respond to the light by radiating electromagnetic wave. This “new light” interferes with the “old light” in some way that results in delayed light (advanced in phase), this can easily be shown by using simple phasor diagram. Consequently effectively the light covers a smaller phase each second, which gives the impression of a lower phase velocity. However the group velocity is changing in a complicated way. I think that the first explanation does not explain the change in phase velocity of light. if we consider light travelling into a slab of negative refractive index non-dispersive material, let’s say the light is directed perpendicular to the slab. The phase velocity’s direction will be flipped, but group velocity’s direction in the material will not change. Only the second explanation can explain the flipped phase velocity direction. I guess that the velocity that we get in the first explanation is actually belongs to the group velocity. It makes sense to me that the front most of the photon stream determines the first information that the light delivers. So the question is What really cause the phase velocity of light to be decreased?  &quot;drift velocity&quot; of photons (they aren't the same photons, they are re-emitted all the time) phase difference between absorbed and emitted light something else  And also, I still don't really understand detailed explanation of the absorption-emission process for small light's wavelength (for large lambda compare to the atoms spacing, the photons will be absorbed by the phonons). The dispersion relation that we know is continuous and also some material is non-dispersive, therefore the absorption process must occur in all frequency for a certain range. So definitely it doesn't involve the atomic transition, otherwise it will be quantized. My guess is that the relevant absorption process gets smooth out by the dipole moment. What makes the spectrum continuous? EDIT: link for dispersion relation: