Tag: io

58 votes
9 answers
1.3K views
How to overlay one div over another div

I need assistance with overlaying one individual div over another individual div. My code looks like this: &

avatar
Dusty
0 1 0 9
asked 07 September, 2021
61 votes
30 answers
616 views
Maintain the aspect ratio of a div with CSS

I want to create a div that can change its width/height as the window's width changes. Are there any CSS

avatar
Lorenzo
0 1 0 9
asked 07 September, 2021
59 votes
30 answers
1.9K views
How can I center an absolutely positioned element in a div?

I need to place a div (with position:absolute;) element in the center of my window. But I am having problems d

avatar
Virgil
0 1 0 9
asked 07 September, 2021
51 votes
30 answers
2.7K views
Transitions on the CSS display property

I'm currently designing a CSS 'mega dropdown' menu - basically a regular CSS-only dropdown menu

avatar
Dorinda
0 1 0 9
asked 07 September, 2021
55 votes
30 answers
1.3K views
How can I transition height: 0; to height: auto; using CSS?

I am trying to make a <ul> slide down using CSS transitions. The <ul> starts off at height: 0;. O

avatar
Yolando
0 1 0 9
asked 07 September, 2021
50 votes
30 answers
604 views
How to disable text selection highlighting

For anchors that act like buttons (for example Questions, Tags, Users, etc. which are located on the top of th

avatar
Corey
0 1 0 9
asked 07 September, 2021
62 votes
16 answers
1.6K views
How do I reformat HTML code using Sublime Text 2?

I've got some poorly-formatted HTML code that I'd like to reformat. Is there a command that will aut

avatar
Sena
0 1 0 9
asked 07 September, 2021
51 votes
29 answers
2.2K views
Retrieve the position (X,Y) of an HTML element relative to the browser window

I want to know how to get the X and Y position of HTML elements such as img and div in JavaScript relative to

avatar
Carmelina
0 1 0 9
asked 07 September, 2021
60 votes
30 answers
685 views
How do I create a Java string from the contents of a file?

I've been using the idiom below for some time now. And it seems to be the most wide-spread, at least on t

avatar
Vi
0 1 0 9
asked 07 September, 2021
55 votes
30 answers
1.8K views
How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version

I am trying to use Notepad++ as my all-in-one tool edit, run, compile, etc. I have JRE installed, and I have

avatar
Trudy
0 1 0 9
asked 07 September, 2021
60 votes
30 answers
1.3K views
Why use getters and setters/accessors?

What's the advantage of using getters and setters - that only get and set - instead of simply using publi

avatar
Shantay
0 1 0 9
asked 07 September, 2021
51 votes
30 answers
705 views
Sort a Map<Key, Value> by values

I am relatively new to Java, and often find that I need to sort a Map<Key, Value> on the values. Since

avatar
Adolfo
0 1 0 9
asked 07 September, 2021
66 votes
11 answers
911 views
How to use java.net.URLConnection to fire and handle HTTP requests

Use of java.net.URLConnection is asked about pretty often here, and the Oracle tutorial is too concise about i

avatar
Vi
0 1 0 9
asked 07 September, 2021
63 votes
30 answers
1.7K views
How do you assert that a certain exception is thrown in JUnit 4 tests?

How can I use JUnit4 idiomatically to test that some code throws an exception? While I can certainly do somet

avatar
Hallie
0 1 0 9
asked 07 September, 2021
54 votes
29 answers
2.6K views
What&apos;s the difference between @Component, @Repository & @Service annotations in Spring?

Can @Component, @Repository and @Service annotations be used interchangeably in Spring or do they provide any

avatar
Tana
0 1 0 9
asked 07 September, 2021
53 votes
22 answers
1.2K views
What is reflection and why is it useful?

What is reflection, and why is it useful? I'm particularly interested in Java, but I assume the principle

avatar
Shanita
0 1 0 9
asked 07 September, 2021
53 votes
30 answers
890 views
How can I create an executable JAR with dependencies using Maven?

I want to package my project in a single executable JAR for distribution. How can I make a Maven project pack

avatar
Xavier
0 1 0 9
asked 07 September, 2021
63 votes
30 answers
2.2K views
Initialization of an ArrayList in one line

I wanted to create a list of options for testing purposes. At first, I did this: ArrayList<String> plac

avatar
Dorian
0 1 0 9
asked 07 September, 2021
52 votes
26 answers
719 views
What is a serialVersionUID and why should I use it?

Eclipse issues warnings when a serialVersionUID is missing. The serializable class Foo does not declare

avatar
Chaya
0 1 0 9
asked 07 September, 2021
52 votes
30 answers
2.6K views
How do I convert a String to an int in Java?

How can I convert a String to an int in Java? My String contains only numbers, and I want to return the numbe

avatar
Louetta
0 1 0 9
asked 07 September, 2021