Exception in thread “main” java.util.NoSuchElementException

You close the second Scanner which closes the underlying InputStream, therefore the first Scanner can no longer read from the same InputStream and a NoSuchElementException results. The solution: For console apps, use a single Scanner to read from System.in. Aside: As stated already, be aware that Scanner#nextInt does not consume newline characters. Ensure that these are consumed before attempting to call nextLine again by using Scanner#newLine(). See: Do not create multiple buffered wrappers on … Read more

What is a spring service annotation? [duplicate]

@Service, @Controller, @Repository = {@Component + some more special functionality} Click the below link for more details What’s the difference between @Component, @Repository & @Service annotations in Spring? The @Component annotation marks a java class as a bean so the component-scanning mechanism of spring can pick it up and pull it into the application context. … Read more

YouTube Autoplay not working

It’s not working since April of 2018 because Google decided to give greater control of playback to users. You just need to add &mute=1 to your URL. Autoplay Policy Changes Update : Audio/Video Updates in Chrome 73 Google said : Now that Progressive Web Apps (PWAs) are available on all desktop platforms, we are extending the … Read more

400 Bad Request – request header or cookie too large

It’s just what the error says – Request Header Or Cookie Too Large. One of your headers is really big, and nginx is rejecting it. You’re on the right track with large_client_header_buffers. If you check the docs, you’ll find it’s only valid in http or server contexts. Bump it up to a server block and it will work. By the way, the … Read more

Google Chrome Uncaught (in promise) DOMException while playing AUDIO

You’re receiving an uncaught exception because you aren’t handling an error. Audio is an HTMLMediaElement object, and the play() method returns a promise. Therefore I recommend handling the error. One of two errors are possible: NotSupportedError This means that the audio source is not supported by the browser (probably due to audio format) NotAllowedError This is the one I … Read more

What exactly is the difference between “pass by reference” in C and in C++?

There are questions that already deal with the difference between passing by reference and passing by value. In essence, passing an argument by value to a function means that the function will have its own copy of the argument – its value is copied. Modifying that copy will not modify the original object. However, when passing by reference, … Read more