Most Popular
1500 questions
1125
votes
16 answers
Why would a JavaScript variable start with a dollar sign?
I quite often see JavaScript with variables that start with a dollar sign. When/why would you choose to prefix a variable in this way?
(I'm not asking about $('p.foo') syntax that you see in jQuery and others, but normal variables like $name and…

Ken
- 77,016
- 30
- 84
- 101
1124
votes
8 answers
What is the difference between old style and new style classes in Python?
What is the difference between old style and new style classes in Python? When should I use one or the other?

readonly
- 343,444
- 107
- 203
- 205
1124
votes
8 answers
Why use Redux over Facebook Flux?
I've read this answer, reducing boilerplate, looked at few GitHub examples and even tried redux a little bit (todo apps).
As I understand, official redux doc motivations provide pros comparing to traditional MVC architectures. BUT it doesn't…

VB_
- 45,112
- 42
- 145
- 293
1124
votes
10 answers
Adding HTML entities using CSS content
How do you use the CSS content property to add HTML entities?
Using something like this just prints to the screen instead of the non-breaking space:
.breadcrumbs a:before {
content: ' ';
}

nickf
- 537,072
- 198
- 649
- 721
1124
votes
50 answers
What is your most productive shortcut with Vim?
I've heard a lot about Vim, both pros and cons.
It really seems you should be (as a developer) faster with Vim than with any other editor.
I'm using Vim to do some basic stuff and I'm at best 10 times less productive with Vim.
The only two things…

Olivier Pons
- 15,363
- 26
- 117
- 213
1122
votes
33 answers
How do I get the current absolute URL in Ruby on Rails?
How can I get the current absolute URL in my Ruby on Rails view?
The request.request_uri only returns the relative URL.

Jakub Arnold
- 85,596
- 89
- 230
- 327
1121
votes
20 answers
Returning JSON from a PHP Script
I want to return JSON from a PHP script.
Do I just echo the result? Do I have to set the Content-Type header?

Scott Nicol
- 11,458
- 3
- 15
- 8
1121
votes
12 answers
How to "comment-out" (add comment) in a batch/cmd?
I have a batch file that runs several python scripts that do table modifications.
I want to have users comment out the 1-2 python scripts that they don't want to run, rather than removing them from the batch file (so the next user knows these…

user1397044
- 11,679
- 6
- 19
- 16
1120
votes
15 answers
When should I use CROSS APPLY over INNER JOIN?
What is the main purpose of using CROSS APPLY?
I have read (vaguely, through posts on the Internet) that cross apply can be more efficient when selecting over large data sets if you are partitioning. (Paging comes to mind)
I also know that CROSS…

Jeff Meatball Yang
- 37,839
- 27
- 91
- 125
1120
votes
17 answers
What does 'synchronized' mean?
I have some questions regarding the usage and significance of the synchronized keyword.
What is the significance of the synchronized keyword?
When should methods be synchronized?
What does it mean programmatically and logically?

Johanna
- 27,036
- 42
- 89
- 117
1119
votes
30 answers
How to download a file over HTTP?
I have a small utility that I use to download an MP3 file from a website on a schedule and then builds/updates a podcast XML file which I've added to iTunes.
The text processing that creates/updates the XML file is written in Python. However, I use…

Owen
- 22,247
- 13
- 42
- 47
1119
votes
31 answers
How can I access and process nested objects, arrays, or JSON?
I have a nested data structure containing objects and arrays. How can I extract the information, i.e. access a specific or multiple values (or keys)?
For example:
var data = {
code: 42,
items: [{
id: 1,
name: 'foo'
}, {
…

Felix Kling
- 795,719
- 175
- 1,089
- 1,143
1117
votes
17 answers
How do I use PHP to get the current year?
I want to put a copyright notice in the footer of a web site, but I think it's incredibly tacky for the year to be outdated.
How would I make the year update automatically with PHP

JD Graffam
- 11,275
- 2
- 18
- 6
1117
votes
11 answers
When should I use git pull --rebase?
I know of some people who use git pull --rebase by default and others who insist never to use it. I believe I understand the difference between merging and rebasing, but I'm trying to put this in the context of git pull. Is it just about not…

Jason Baker
- 192,085
- 135
- 376
- 510
1117
votes
24 answers
Get current directory or folder name (without the full path)
How could I retrieve the current working directory/folder name in a bash script, or even better, just a terminal command.
pwd gives the full path of the current working directory, e.g. /opt/local/bin but I only want bin.

Derek Dahmer
- 14,865
- 6
- 36
- 33