Most Popular

1500 questions
1985
votes
19 answers

What is the "N+1 selects problem" in ORM (Object-Relational Mapping)?

The "N+1 selects problem" is generally stated as a problem in Object-Relational mapping (ORM) discussions, and I understand that it has something to do with having to make a lot of database queries for something that seems simple in the object…
Lars A. Brekken
  • 22,325
  • 3
  • 24
  • 27
1985
votes
11 answers

Why is it string.join(list) instead of list.join(string)?

This has always confused me. It seems like this would be nicer: ["Hello", "world"].join("-") Than this: "-".join(["Hello", "world"]) Is there a specific reason it is like this?
Evan Fosmark
  • 94,395
  • 33
  • 103
  • 116
1985
votes
38 answers

Could not open a connection to your authentication agent

I am running into this error of: $ git push heroku master Warning: Permanently added the RSA host key for IP address '50.19.85.132' to the list of known hosts. ! Your key with fingerprint b7:fd:15:25:02:8e:5f:06:4f:1c:af:f3:f0:c3:c2:65 is not…
Danny Dai Smith
  • 19,885
  • 3
  • 11
  • 3
1983
votes
31 answers

How do I count the occurrences of a list item?

Given an item, how do I count its occurrences in a list in Python?
weakish
  • 26,641
  • 5
  • 47
  • 60
1981
votes
20 answers

How to stop tracking and ignore changes to a file in Git?

I have cloned a project that includes some .csproj files. I don't need/like my local csproj files being tracked by Git (or being brought up when creating a patch), but clearly they are needed in the project. I have added *.csproj to my LOCAL…
Joshua Ball
  • 22,372
  • 6
  • 25
  • 27
1980
votes
28 answers

Java inner class and static nested class

What is the main difference between an inner class and a static nested class in Java? Does design / implementation play a role in choosing one of these?
Omnipotent
  • 26,561
  • 12
  • 29
  • 33
1979
votes
18 answers

How do you stash an untracked file?

I have changes to a file, plus a new file, and would like to use git stash to put them away while I switch to another task. But git stash by itself stashes only the changes to the existing file; the new file remains in my working tree, cluttering…
skiphoppy
  • 90,534
  • 69
  • 171
  • 216
1979
votes
26 answers

How do you merge two Git repositories?

Consider the following scenario: I have developed a small experimental project A in its own Git repo. It has now matured, and I'd like A to be part of larger project B, which has its own big repository. I'd now like to add A as a subdirectory of…
static_rtti
  • 50,483
  • 45
  • 130
  • 185
1971
votes
5 answers

How to replace master branch in Git, entirely, from another branch?

I have two branches in my Git repository: master seotweaks (created originally from master) I created seotweaks with the intention of quickly merging it back into master. However, that was three months ago and the code in this branch is 13…
Jason
  • 21,365
  • 5
  • 28
  • 50
1970
votes
26 answers

How do I recursively grep all directories and subdirectories?

How do I recursively grep all directories and subdirectories? find . | xargs grep "texthere" *
wpiri
  • 19,857
  • 3
  • 16
  • 6
1970
votes
20 answers

How do I iterate over a range of numbers defined by variables in Bash?

How do I iterate over a range of numbers in Bash when the range is given by a variable? I know I can do this (called "sequence expression" in the Bash documentation): for i in {1..5}; do echo $i; done Which gives: 1 2 3 4 5 Yet, how…
eschercycle
  • 20,567
  • 4
  • 20
  • 12
1968
votes
26 answers

Does Java support default parameter values?

I came across some Java code that had the following structure: public MyParameterizedFunction(String param1, int param2) { this(param1, param2, false); } public MyParameterizedFunction(String param1, int param2, boolean param3) { //use all…
gnavi
  • 23,626
  • 7
  • 20
  • 11
1968
votes
24 answers

How do I check if a variable is an array in JavaScript?

How do I check if a variable is an array in JavaScript? if (variable.constructor == Array)
Andy McCluggage
  • 35,918
  • 18
  • 57
  • 68
1968
votes
22 answers

How do CSS triangles work?

There're plenty of different CSS shapes over at CSS Tricks - Shapes of CSS and I'm particularly puzzled with a triangle: #triangle-up { width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; …
Stanislav Shabalin
  • 18,468
  • 3
  • 16
  • 18