Hi there I am new to java, studying in my bs course from a couple of weeks. So please don't mind if I ask something stupid. btw coming to the point. Assignment was that you have to write a program in which I have to break the email address into parts using StringBuffer e.g: if the given email is hassanaqve@gmail.com so I have to break it like username: hassanaqve domain name : gmail extension : .com  I tried myself but it is not working there are no errors but also not giving output      import java.lang.*; public class Lab5 {     public static void main(String[] args) {         StringBuffer email = new StringBuffer ("Hassanaqve@gmail.com");          for ( int i=0; i&lt;= email.length(); i++){              if ( email.substring (i).equals ("@")){                  System.out.println( "Username : " + email.substring(0,i));                  int j=i;                  for ( int p=0; j&lt;= email.length(); p++ ){                    if ( email.substring (p) == (".")){                        System.out.println( "doamin : " + email.substring(j,p));                        System.out.println( "extention : " + email.substring(p+1,p+4));                    }                    }               }          }     }
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 noticed that sometimes my code gets highlighted in different colors when rendered.   What is syntax highlighting? How does it work? Why isn't my code being highlighted correctly? How do I report a bug or request a new language? How do I use syntax highlighting? What languages are currently available on Stack Exchange? Linear functional $f$ is continuous at $x_0=0$ if and only if $f$ is continuous $\forall x\in X$? Let $f$ be a linear functional on a normed space $(X, \|\cdot\|)$. Prove that $f$ is continuous at $x_0=0$ if and only if $f$ is continuous at every $x\in X$.  I understand that the $\Leftarrow$ is trivial but what about the other way? I have a file with the lines like below.  title1:A1 title2:A2 title3:A3 title4:A4 title5:A5  title1:B1 title2:B2 title3:B3 title4:B4 title5:B5  title1:C1 title2:C2 title3:C3 title4:C4 title5:C5  title1:D1 title2:D2 title3:D3 title4:D4 title5:D5  How can I achieve this?   title1    title2     title3    title4 A1         A2         A3         A4 B1         B2         B3         B4 C1         C2         C3         C4 D1         D2         D3         D4 At the end of every day you will be required to write a review.   At the end of each day you will be required to write a review.   Which one of those sentences is better if this action will repeat itself every day for longer period of time, several weeks for example, maybe even months? Cost Distance Analyst In QGIS? Are there any tools, plugins or methods in QGIS which allows for an analysis of the best path between two points using least cost path method? As shown below ArcGIS has several distance tools. How to get hardware specs of Android device? What would happen if you used a dead person's hair in Polyjuice Potion? I am relatively fresh to the DI party and am struggling to get my head around how exactly to use Dependency Injection. I understand that I can pass requirements as part of a service, but what about in my own class?  Say I have the below class where I want the language manager service to be injected:  class Foo implements ContainerInjectionInterface {    protected $languageManager;     public function __construct(LanguageManagerInterface $languageManager) {     $this-&gt;languageManager = $languageManager;   }    public static function create(ContainerInterface $container) {     return new static(       $container-&gt;get('language_manager')     );   } }   When I call new Foo() I am required to pass an instance of LanguageManagerInterface. That makes sense in terms of a normal constructor method, but that would require me to instantiate the class like the below:  $languageManager = \Drupal::service('language_manager'); $foo = new Foo($languageManager)   That just doesn't feel right to me.  Is there something I am missing, or would this class always have to be a service to take advantage of dependency injection? Pass commands as input to another command (su, ssh, sh, etc) How to prove $\cos \frac{2\pi }{5}=\frac{-1+\sqrt{5}}{4}$? I would like to find the apothem of a regular pentagon. It follows from   $$\cos \dfrac{2\pi }{5}=\dfrac{-1+\sqrt{5}}{4}.$$  But how can this be proved (geometrically or trigonometrically)? What is the highest obtainable resolution of FREE elevation data in the UK? Question :   Determine all natural numbers n such that 3   divides $n\cdot2^{n}+1$  Actually I don't have any ideas to approach but  my efforts :   I see $n=1,2,7,8,13,14$ so I think :   $n=6k+1$ and $n=6k+2$ $k\in \Bbb{N} $  If I'm not wrong but I don't know how ? I prove it ? How do I use the Natural Earth SQLite DB with QGIS? I just downloaded the Natural Earth data in SQLite format from . I had assumed that this would be a SpatiaLite database, but it appears not to be! QGIS is failing to recognize it as a spatial database. OGR supposedly supports reading geometries even when stored in a plain SQLite database, but maybe QGIS doesn't use OGR for SpatiaLite?  The SQLite database does have geometry_columns and spatial_ref_sys tables. Is there some way to convert it to a full SpatiaLite database? Rotate Geographic map Where do electrons in electricity come from? Where do the electrons come from when an electric generator is making electricity?  Is from the air?  Would a generator work in a vacuum?  Electrons have mass so where would they be pulled from if there is nothing? In the story I'm trying to recall, everybody on their thirteenth birthday (?) is assigned by some kind of brain analysis method a profession and given some kind of pill (?) that instantly (?) grants them the required knowledge and skills to start working immediately. Some professions are more sought after than others, especially in view of the olympic (?) games regularly held on a profession-by-profession basis.  The protagonist, however, is turned down from this system and dismissed with some general reason and has to work his way to adulthood the boring old way: studying from books. Eventually he rejects from his status as a "special" student and goes on the run, hiding from the teachers and envying the normal people.      Eventually, it turns out that the protagonist was actually smart enough that being spoonfed premade information was a waste. What he actually was assigned to was advancing the bundles of knowledge themselves, as well as being front line in the technological progress.  "Somebody has to write those textbooks! You can infuse knowledge about how to use today's technology, but you can't do that for tomorrow's - people that get assigned a profession become tied with their assigned technology and are only as relevant as that. If you want more, you must learn how things actually work, and there's no shortcut for that." (not an actual quote, but a specific passage as I remember it.)  The troubles the protagonists underwent were actually planned and necessary for him to acknowledge and accept his role in society.   This story was certainly longer than a couple pages, but it wasn't very long either. If it's a short story, it was probably written by Asimov, but I can't be sure. It rings me of Brave New World given the theme of government-issued population planning, but it certainly doesn't fit with anything else in the actual plot. Any idea? Node Package Manager got corrupted in some way, now it cannot be installed I ran into a problem today when I decided to use npm update -g in a nodejs app directory. This was a bad decision, because it caused me to run into a .   The solution is to reinstall nodejs and npm. Unfortunately when I go to install npm using sudo apt-get install npm it doesn't work.  The full error in the terminal is here:  Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that  some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies:  npm : Depends: nodejs but it is not going to be installed    Depends: node-abbrev (&gt;= 1.0.4) but it is not going to be installed    Depends: node-ansi but it is not going to be installed    Depends: node-archy but it is not going to be installed    Depends: node-block-stream but it is not going to be installed    Depends: node-fstream (&gt;= 0.1.22) but it is not going to be installed    Depends: node-fstream-ignore but it is not going to be installed    Depends: node-github-url-from-git but it is not going to be installed    Depends: node-glob (&gt;= 3.1.21) but it is not going to be installed    Depends: node-graceful-fs (&gt;= 2.0.0) but it is not going to be installed    Depends: node-inherits but it is not going to be installed    Depends: node-ini (&gt;= 1.1.0) but it is not going to be installed    Depends: node-lockfile but it is not going to be installed    Depends: node-lru-cache (&gt;= 2.3.0) but it is not going to be installed    Depends: node-minimatch (&gt;= 0.2.11) but it is not going to be installed    Depends: node-mkdirp (&gt;= 0.3.3) but it is not going to be installed    Depends: node-gyp (&gt;= 0.10.9) but it is not going to be installed    Depends: node-nopt (&gt;= 2.1.1) but it is not going to be installed    Depends: node-npmlog but it is not going to be installed    Depends: node-once but it is not going to be installed    Depends: node-osenv but it is not going to be installed    Depends: node-read but it is not going to be installed    Depends: node-read-package-json (&gt;= 1.1.0) but it is not going to be installed    Depends: node-request (&gt;= 2.25.0) but it is not going to be installed    Depends: node-retry but it is not going to be installed    Depends: node-rimraf (&gt;= 2.2.2) but it is not going to be installed    Depends: node-semver (&gt;= 2.1.0) but it is not going to be installed    Depends: node-sha but it is not going to be installed    Depends: node-slide but it is not going to be installed    Depends: node-tar (&gt;= 0.1.18) but it is not going to be installed    Depends: node-which but it is not going to be installed E: Unable to correct problems, you have held broken packages.   What can I do to get npm properly installed and running again?  Thanks. I called my lender last week. I am close to owning 20% of my home and want to get rid of PMI. They said I can only do it by remortgaging my house. Is that true? With the mortgage rates increasing, I will definitely lose some money by remortgaging the house.  Also, I know that I can request the PMI charge to stop if I own 20% of the value of the home, or it will stop automatically once I own 22% of the value. Is it possible that the lender meant I can't do it with 20% but it will be done at 22% automatically without the need to remortgage the house? In the definition of , I read the following text:     Many of the act's provisions were to sunset beginning December 31, 2005, approximately 4 years after its passage. In the months preceding the sunset date, supporters of the act pushed to make its sunsetting provisions permanent, while critics sought to revise various sections to enhance civil liberty protections. In July 2005, the U.S. Senate passed a reauthorization bill with substantial changes to several sections of the act, while the House reauthorization bill kept most of the act's original language. The two bills were then reconciled in a conference committee that was criticized by Senators from both the Republican and Democratic parties for ignoring civil liberty concerns.   What does sunset mean? In which cases can the word be used with a similar meaning? How do i convert a binary int into a string?