Why is "==" working when it should be .equals() comparing Strings in the array list?
How do I compare strings in Java?
What I get:  host:~ user$ cat example.txt some texthost:~ stas$   What I want to get:  host:~ user$ cat example.txt some text host:~ stas$   Is there a way I can make cat behave like this?  I'm using bash on Mac OS X. How did Stannis's army get north of the wall? If Mance Rayder had to attack Castle Black to use the tunnel to get through the Wall and get out of the north, how did Stannis get his army across the Wall into the north without anyone knowing? If there was another way over the Wall wouldn't the wildings go that way too? Can you win a game of Splendor if you still have cards in reserve? How to calculate the difference between two dates using PHP? Present-perfect-tense vs. Simple-past-tense Prove: If a linear map, $φ: U→V$ is bijective, then $φ(x)=0$ has only the solution $x=0$. I am trying to achieve something like this:     This image is linked from .  also provides a solution and seems simpler. Both answers deal with the algorithmicx package however. I am interested in the solution for the algorithm2e package.   I read the documentation of the algorithm2e package but didn't find an answer.   How can I achieve the colored effect?  EDIT:  Here is sample code to create a minimum working example.  \documentclass{article}  \usepackage[ruled]{algorithm2e} % http://www.ctan.org/pkg/algorithm2e  \begin{document}  \begin{algorithm}[h]  \caption{Evolutionary algorithm}   initialize population \;  \For( \emph{Evolutionary loop}){$g := 1$ to $G_{max}$}  {     do things \;     evolve population \;  }  celebrate \; \end{algorithm}  \end{document} Making extra parameters optional I've setup a very specific function and it works well but I'd like to make the parameters optional but I can't get a handle on the regex bit:  add_rewrite_rule('whats-on/([^/]+)/([^/]+)/([^/]+)/?$', 'index.php?page_id=71&amp;event_year=$matches[1]&amp;event_month=$matches[2]&amp;event_day=$matches[3]','top');   /whats-on/2012/01/25 I'll show all events on this date.  /whats-on/2012/01 goes to 404 but I'd like the parameter to be optional so I can show all January dates and the same for /whats-on/2012 all dates in year 2012  Any help will gratefully received - thanks Is Tactical Down-Voting ever valid? Has anyone noticed any tactical downvoting of their, or other people, answers?  For example, in a recent answer to a question, my answer described a possible solution.  Shortly afterwards, another answer appeared following the solution I had mentioned.    I know that this is completely in the spirit of the site, however my answer had been down voted even though it was still as valid as it ever was.  Another poster also had his equally valid solution down voted.  There is no way of knowing the reason behind the down voting, as no comments were left, but I am suspicious as to the ethics behind down voting someone else's valid answer in the hope of making their own answer more prominent.  Are people really that desperate to gain reputation?  I have seen comments in other posts that suggest that tactical downvoting has occurred.  So, does anyone think that it is acceptable to downvote another post, even though it is still correct but may not provide a complete answer, to make their own appear more favourably? Is there an easy way to attach source in Eclipse? I'm a big fan of the way Visual Studio will give you the comment documentation / parameter names when completing code that you have written and ALSO code that you are referencing (various libraries/assemblies).  Is there an easy way to get inline javadoc/parameter names in Eclipse when doing code complete or hovering over methods? Via plugin? Via some setting? It's extremely annoying to use a lot of libraries (as happens often in Java) and then have to go to the website or local javadoc location to lookup information when you have it in the source jars right there! I want to change the default timeout in Chrome. In Firefox I can set the value of network.http.connection-timeout in about:config - but how can I do that in Chrome? Process Unicode files with BOM correctly with POSIX tools How do I create a file and mount it as a filesystem? How do I create a file of size 10M, format it with ext3 filesystem and then mount it in /media/fuse?  I tried with  mkfs -t ext3 file   then to mount it  mount -t ext3 file /media/fuse   It didn't work because it said that file wasn't a block device. Can anybody help me? Warning when battery is fully charged I would like to get an alert (with sound) when my laptop battery is fully charged.  How can I do that? How to access Render Result pixels from python script? Render Result exists in bpy.data.images["Render Result"] but it contains no data.  Also bpy.data.images["Render Result"].size[0] is 0, even if the render shows as an image in the UV/Image Editor with a width of 1366.  Maybe the render result cannot be accessed as an image or I missing some update or refresh call somewhere but I can't find such a thing in the 2.68 API documentation.  Any tip in the correct direction appreciated. Evaluating the integral $\int_0^\infty \frac{\sin x} x \,\mathrm dx = \frac \pi 2$? How to update Ubuntu terminal? How to update Ubuntu terminal? Why is observing 100 heads for a fair coin flips surprising? Assume that we have a fair coin. We flip it 100 times. The outcome is all heads. Why is it surprising? Doesn't all outcomes have the same probability? Any particular outcome, including irregular ones, would have the same very small probability. Why is it that observing an irregular outcome is less surprising to us than a regular one? Deciding what answer to accept: the correct one-liner or the later elaborate one with code? Lately I've been getting some good answers to some specific questions. However, I've been hesitating on what answer I should accept.  Do I go with the short quick answer or do I accept a later answer where someone has elaborated on the previous answer with some code?  It's not really important but it kind of bugs me to not accept an answer when people have taken the trouble of replying.  Here's two examples: Hardware issue on iMac, flashing question mark I have an iMac 2008/2009 issue and recently the computer would not boot and I would get a flashing question mark. Ran through all the usual steps, try boot in safe mode, flash RAM,  try single user for fdisk, put in OS disk and boot from CD, etc... No dice.   Replaced the hard drive and put the OS disc in the system, press and hold option. (holding C didn't work) I can see the OS disk but when I click on it the system will act like it is going to run and then freeze. The best I got was the OS X disc that changed the screen to dark grey and told be the system had to restart.  Purchased a usb mount for an external hard drive. Was able to mount the old hard drive to a laptop and run disk utility. Everything checked out.  At this point I am pretty sure it isn't the hard drive.   Any other hard ware items this can point too? My iMAC can also "see" the hard drive (and the recovery partition) when connected via the USB and I hold "option" on start up. But it crashes when trying to boot from either.  I am going to take out and re-install the RAM for giggles but I am not sure what else to do.   Ideas are welcome.