I'm a c++ programmer who wrote some php server code to be translated to java and pretty new to Java. But it feels quite common coming from c++. I have a server up and running and this code:  String req = "&lt;xml&gt;&lt;version&gt;1&lt;/version&gt;&lt;test&gt;&lt;/test&gt;&lt;/xml&gt;"; Document doc = loadXMLFromString (req); Element root = doc.getDocumentElement();    // "xml"  // check version Element e = firstChildElement (root, "version"); String result = e.getTextContent(); // returns "1"! String expected = "1"; if (result != expected) {     out.printLn ("wrong version: (" + result + "), expected: (" + expected + ")!");     return; }   This prints "wrong version: (1), expected (1)". The same holds with if (result != "1"). Now even the debugger (eclipse) shows that result is actually "1", so I'm truly lost here. I seem to be missing the obvious but just can't see it...can you help pls? Thanks!
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?
Laravel loading error in Ubuntu 14.04 Run system commands from QML App I want to run a system command from inside my application. It's suppose to run a command on a remote server using SSH. But that's not really the point. The point is that I don't know how to run any kind of command from the app. I asked in the mail list and they referred me to build a QML extension using C++. But I don't know C++ and it seems that I have to learn so much only to run a simple command.  In Python (as in PHP) it's easy to run a system command. Is there any other way of doing it in my Touch app, or is there someone that could help me even more? Or perhaps have a better solution to my problem? Coffeescript existential operator sometimes checks against undefined, but not always How can I resize a partition with Disk Utility? I have 2 partitions, I reduced the size of one and want to expand the other to fill the now available space.   How do I expand the Lion Partition into the empty grey space beneath Macintosh HD partition? Why is there so much fear surrounding LiPo batteries? I've been trying to design a charging system for a small robot powered by a 2S 20C  (LiPo) battery. Were I to trust everything I read online, I would believe that the LiPo will kill me in my sleep and steal my life savings. The common advice I read, if you are brave enough to use LiPo batteries, is "never leave unattended", "never charge on top of a flammable or conductive surface", and "never charge at a rate faster than 1&nbsp;".  I understand why this is prudent, but what is the actual risk with LiPo batteries?  Nearly every cell phone, both Android and iPhone alike, contains a LiPo battery, which most people, including myself, charge while unattended&mdash;often-times while left on a flammable or conductive surface. Yet you never hear about someone bursting into flames because their cell phone exploded. Yes, I know there are freak accidents, but how dangerous are modern LiPo batteries? Why do so many online commenters treat stand-alone LiPo batteries like bombs waiting to go off, but don't even think twice about the LiPo sitting in their pocket? I remember watching this sci-fi movie where a huge metallic capsule gets dropped from a few hundred meters. The capsule had a chamber inside where only one person could be seated. During the drop, time dilated and the person would transcend to another world, lasting for days, even meeting dead people. Kind of a parallel reality.  It was an amazing movie, but I cannot recall its name. How do I wrap a macro definition in an environment? I'm creating a style file, and want to store the body text of the abstract environment so that I can put it on my custom titlepage. I could have required that my users enter the abstract as  \customabstract{Abstract text goes here}`   which I would have implemented as something like  \newcommand{\customabstract}[1]{\gdef\abstracttext{#1}}   However, I would prefer that the user is able to use environment notation,  \begin{customabstract}Abstract text goes here\end{customabstract}   To do this, I thought I could define something like  \newenvironment{customabstract}{\gdef\abstracttext\bgroup}{\egroup}   But this definition makes \abstracttext expand to \bgroup, which is not what I wanted. I tried to solve the problem by \expandafter,  \newenvironment{customabstract}{\expandafter\gdef\expandafter\abstracttext\bgroup}{\egroup}   but this results in a runaway error.  Is there any way to acheive what I want? Answers that helps me understand the inner workings of TeX (instead of just referring to a custom package) are preferred. I have a CSV containing x,y, and z coordinates. The CSV also has a fourth column containing information on sphere diameter. I need to create a sphere at each coordinate, having the corresponding diameter. Can someone provide me a basic Python script that performs this task? My actual task is much more involved, but I think I can solve it if I have the basics in place. Find the image of (1,1,1) by T Question: Find the image of (1,1,1) by T  $$T(x,y,z) = (y,6y,x+y+z)$$   I found the standard matrix to be:   \begin{bmatrix}0&amp;1&amp;0\\0&amp;6&amp;0\\1&amp;1&amp;1\end{bmatrix}  I'm confused on how to approach this question.   In order to find the image is it possible to inverse the values of it's standard matrix?  Would I able to use the identity matrix of 3 and inverse the values of that to find the image?    Any help will be greatly appreciated. Open existing file, append a single line AutoFixture with AutoMoq and concrete object injection I just attempted to fix a typo on a question on cooking.stackexchange.com and saw this     Oops! Your edit couldn't be submitted because:         Your edit summary must be at least 10 characters   This edit is less than 6 characters; surely more can be improved with your edit?      So, misspelled words have to just be left misspelled?  That could prevent the post from being found in a search. What is $\int_0^1 \frac{\log \left(1-x^2\right) \sin ^{-1}(x)^2}{x^2} \, dx$? How do you disable browser autocomplete on web form field / input tags? How do you disable autocomplete in the major browsers for a specific input (or form field)? I've looked at the resumes of the type of candidates that get into computer science PhD programs at the top few universities (e.g. Stanford, MIT etc.) and a lot of them seem to have multiple publications (2-4) done during their undergraduate years. Is this representative of the entire pool? Or is this just a self-selected group that puts their resumes online.  I currently have one first-author workshop paper (5 pages), and I wonder how this might affect my chances at entry into these top universities. /review tab not accessible on a private beta As made clear in update 3 on , this notation: var hash = {}; hash[X]  does not actually hash the object X; it actually just converts X to a string (via .toString() if it's an object, or some other built-in conversions for various primitive types) and then looks that string up, without hashing it, in &quot;hash&quot;. Object equality is also not checked - if two different objects have the same string conversion, they will just overwrite each other. Given this - are there any efficient implementations of hashmaps in JavaScript? (For example, the second Google result of  yields an implementation which is O(n) for any operation. Various other results ignore the fact that different objects with equivalent string representations overwrite each other. Sudo is also user login password - why? how to change? When installing Ubuntu I can create a user with an encrypted folder, what I always do. Now after the installation the login password for this user is also the sudo password. Is that how it should be? I actually would like to have a different user login and sudo password, does is make sense? Should I do that, how? I found a couple useful threads on this forum with respect to the issues posed by (displaying) images in email signatures-- , for example-- and I've searched all over the web, but still have not found a good solution that sufficiently addresses the problem. A client of mine would simply like his company's logo included in the signature of his emails, and the issues I've encountered can be summarized as follows:   I can export a rasterized version of the logo from AI at actual size, and it will look sharp on the desktop but pixelated/blurry on hi-density (e.g. "retina") displays such as the iPhone. As suggested in the thread I referenced, I can export the logo at 2-3 times the actual, displayed size to target the hi-density displays, but the logo will then look soft on non-hi-density displays when it is scaled down. This is a particular problem in this instance as the logo contains text, which looks terrible when juxtaposed with actual text in the browser/email client. I've considered .svg as an option, but apparently the support is not great; and in this case I'm assuming the vast majority of the users reading this client's email will be using Outlook, so something that only renders properly in iOS/webkit/etc is not a viable option.   I'm at a loss at this point and wondering if there is any other possible option out there. I'm not sure, for instance, if it's possible to implement a hi-density image with lo-res fallback in an email signature?  Any suggestions/insights here are much appreciated. It's bordering on comical how difficult this task has turned out to be. Understanding QGIS buffer tool units I  have had no luck getting the buffer tool to accept anything but degrees as units of measure.  I have found lots of stuff saying the layer needs to be reprojected and saved but it hasn't worked at all for me.   Is there a way I could create a buffer without using ftools or at least force the units to meters somehow?  As a workaround I converted meters to degrees (lat) and used that but the final product needs to be as close to reality as possible.  Things I've tried:   setting every unit option I could find to meters (where possible). setting everything to NAD83/Maryland (data is for Washington, DC) and saving it as such (as layers in ESRI shape files). reimporting the reprojected layers setting relevant layers to Google Mercator   The was tried followed by creating a buffer. Many were tried in combination. QGIS 1.7.3 Slackware64 current (qgis from SBo-13.37 repo, tried on multilib and plain 64it with same results)