Most Popular
1500 questions
2696
votes
42 answers
Make a div fill the height of the remaining screen space
I am working on a web application where I want the content to fill the height of the entire screen.
The page has a header, which contains a logo, and account information. This could be an arbitrary height. I want the content div to fill the rest of…
Vincent McNabb
- 33,327
- 7
- 31
- 53
2694
votes
73 answers
How can I get query string values in JavaScript?
Is there a plugin-less way of retrieving query string values via jQuery (or without)?
If so, how? If not, is there a plugin which can do so?
Subliminal Hash
- 13,614
- 20
- 73
- 104
2690
votes
32 answers
What does O(log n) mean exactly?
I am learning about Big O Notation running times and amortized times. I understand the notion of O(n) linear time, meaning that the size of the input affects the growth of the algorithm proportionally...and the same goes for, for example, quadratic…
Andreas Grech
- 105,982
- 98
- 297
- 360
2687
votes
42 answers
How can I update each dependency in package.json to the latest version?
I copied package.json from another project and now want to bump all of the dependencies to their latest versions since this is a fresh project and I don't mind fixing something if it breaks.
What's the easiest way to do this?
The best way I know is…
Raine Revere
- 30,985
- 5
- 40
- 52
2684
votes
33 answers
Scroll to an element with jQuery
I have this input element:
Then I have some other elements, like other tag's &
DiegoP.
- 45,177
- 34
- 89
- 107
2683
votes
31 answers
How do I determine whether an array contains a particular value in Java?
I have a String[] with values like so:
public static final String[] VALUES = new String[] {"AB","BC","CD","AE"};
Given String s, is there a good way of testing whether VALUES contains s?
Mike Sickler
- 33,662
- 21
- 64
- 90
2678
votes
16 answers
Check if a given key already exists in a dictionary
I wanted to test if a key exists in a dictionary before updating the value for the key.
I wrote the following code:
if 'key1' in dict.keys():
print "blah"
else:
print "boo"
I think this is not the best way to accomplish this task. Is there a…
Mohan Gulati
- 28,219
- 5
- 22
- 20
2674
votes
52 answers
Does a finally block always get executed in Java?
Considering this code, can I be absolutely sure that the finally block always executes, no matter what something() is?
try {
something();
return success;
}
catch (Exception e) {
return failure;
}
finally {
…
jonny five
- 27,200
- 3
- 20
- 11
2669
votes
29 answers
Can (a== 1 && a ==2 && a==3) ever evaluate to true?
Moderator note: Please resist the urge to edit the code or remove this notice. The pattern of whitespace may be part of the question and therefore should not be tampered with unnecessarily. If you are in the "whitespace is insignificant" camp, you…
Dimpu Aravind Buddha
- 9,505
- 4
- 17
- 23
2665
votes
33 answers
How to change the output color of echo in Linux
I am trying to print a text in the terminal using echo command.
I want to print the text in a red color. How can I do that?
satheesh.droid
- 29,947
- 10
- 34
- 34
2657
votes
36 answers
How do I check if a string contains a specific word?
Consider:
$a = 'How are you?';
if ($a contains 'are')
echo 'true';
Suppose I have the code above, what is the correct way to write the statement if ($a contains 'are')?
Charles Yeung
- 38,347
- 30
- 90
- 130
2657
votes
44 answers
How do you display code snippets in MS Word preserving format and syntax highlighting?
Does anyone know a way to display code in Microsoft Word documents that preserves coloring and formatting? Preferably, the method would also be unobtrusive and easy to update.
I have tried to include code as regular text which looks awful and gets…
Lawrence Barsanti
- 31,929
- 10
- 46
- 68
2650
votes
42 answers
Adding a table row in jQuery
I'm using jQuery to add an additional row to a table as the last row.
I have done it this way:
$('#myTable').append('my data more data ');
Are there limitations to what you can add to a table like this (such as inputs,…
Darryl Hein
- 142,451
- 95
- 218
- 261
2648
votes
22 answers
How do I call one constructor from another in Java?
Is it possible to call a constructor from another (within the same class, not from a subclass)? If yes how? And what could be the best way to call another constructor (if there are several ways to do it)?
ashokgelal
- 80,002
- 26
- 71
- 84
2647
votes
42 answers
How to make a div 100% height of the browser window
I have a layout with two columns - a left div and a right div.
The right div has a grey background-color, and I need it to expand vertically depending on the height of the user's browser window. Right now, the background-color ends at the last piece…
mike
- 26,535
- 3
- 16
- 4