Most Popular
1500 questions
1517
votes
15 answers
How can I select an element by name with jQuery?
I have a table column I’m trying to expand and hide. jQuery seems to hide the elements when I select it by class but not by the element’s name.
For example:
$(".bold").hide(); // Selecting by class works.
$("tcol1").hide(); // Selecting by name…
T.T.T.
- 33,367
- 47
- 130
- 168
1515
votes
20 answers
Changing git commit message after push (given that no one pulled from remote)
I have made a git commit and subsequent push. I would like to change the commit message. If I understand correctly, this is not advisable because someone might have pulled from the remote repository before I make such changes. What if I know that no…
K_U
- 15,832
- 8
- 26
- 29
1515
votes
11 answers
How do I remove the passphrase for the SSH key without having to create a new key?
I set a passphrase when creating a new SSH key on my laptop. But, as I realise now, this is quite painful when you are trying to commit (Git and SVN) to a remote location over SSH many times in an hour.
One way I can think of is, delete my SSH keys…
btbytes
- 85
- 3
- 4
- 10
1514
votes
28 answers
How to check if a value exists in an array in Ruby
I have a value 'Dog' and an array ['Cat', 'Dog', 'Bird'].
How do I check if it exists in the array without looping through it? Is there a simple way of checking if the value exists, nothing more?
user211662
- 18,067
- 10
- 25
- 19
1512
votes
56 answers
How to compare arrays in JavaScript?
I'd like to compare two arrays... ideally, efficiently. Nothing fancy, just true if they are identical, and false if not. Not surprisingly, the comparison operator doesn't seem to work.
var a1 = [1,2,3];
var a2 = [1,2,3];
console.log(a1==a2); //…
Julian H. Lam
- 25,501
- 13
- 46
- 73
1512
votes
12 answers
Why don't self-closing script elements work?
What is the reason browsers do not correctly recognize:
Only this is recognized:
Does this break the concept of XHTML support?
Note: This statement…
dimarzionist
- 18,517
- 4
- 22
- 23
1508
votes
18 answers
How do I convert a float number to a whole number in JavaScript?
I'd like to convert a float to a whole number in JavaScript. Actually, I'd like to know how to do BOTH of the standard conversions: by truncating and by rounding. And efficiently, not via converting to a string and parsing.
mcherm
- 23,999
- 10
- 44
- 50
1507
votes
6 answers
Custom HTTP headers : naming conventions
Several of our users have asked us to include data relative to their account in the HTTP headers of requests we send them, or even responses they get from our API.
What is the general convention to add custom HTTP headers, in terms of naming,…
Julien Genestoux
- 31,046
- 20
- 66
- 93
1506
votes
37 answers
How can I center an absolutely positioned element in a div?
I want to place a div (with position:absolute;) element in the center of the window. But I'm having problems doing so, because the width is unknown.
I tried the following CSS code, but it needs to be adjusted because the width is responsive.
.center…
Ish
- 28,486
- 11
- 60
- 77
1505
votes
20 answers
Ignoring directories in Git repositories on Windows
How can I ignore directories or folders in Git using msysgit on Windows?
sf.
- 24,512
- 13
- 53
- 58
1505
votes
33 answers
What is the difference between a field and a property?
In C#, what makes a field different from a property, and when should a field be used instead of a property?
Anonymous
1505
votes
16 answers
What is the "right" JSON date format?
I've seen so many different standards for the JSON date format:
"\"\\/Date(1335205592410)\\/\"" .NET JavaScriptSerializer
"\"\\/Date(1335205592410-0500)\\/\"" .NET DataContractJsonSerializer
"2012-04-23T18:25:43.511Z" …
Kamyar Nazeri
- 25,786
- 15
- 50
- 87
1504
votes
3 answers
Why can't Python parse this JSON data?
I have this JSON in a file:
{
"maps": [
{
"id": "blabla",
"iscategorical": "0"
},
{
"id": "blabla",
"iscategorical": "0"
}
],
"masks": [
"id":…
michele
- 26,348
- 30
- 111
- 168
1504
votes
23 answers
Merge / convert multiple PDF files into one PDF
How could I merge / convert multiple PDF files into one large PDF file?
I tried the following, but the content of the target file was not as expected:
convert file1.pdf file2.pdf merged.pdf
I need a very simple/basic command line (CLI) solution.…
alcohol
- 22,596
- 4
- 23
- 21
1502
votes
16 answers
When are you supposed to use escape instead of encodeURI / encodeURIComponent?
When encoding a query string to be sent to a web server - when do you use escape() and when do you use encodeURI() or encodeURIComponent():
Use escape:
escape("% +&=");
OR
use encodeURI() /…
Adam
- 28,537
- 15
- 60
- 73