Most Popular

1500 questions
1677
votes
47 answers

What is a monad?

Having briefly looked at Haskell recently, what would be a brief, succinct, practical explanation as to what a monad essentially is? I have found most explanations I've come across to be fairly inaccessible and lacking in practical detail.
ljs
  • 37,275
  • 36
  • 106
  • 124
1677
votes
41 answers

Use different Python version with virtualenv

How do I create a virtual environment for a specified version of Python?
Ulf
  • 17,492
  • 5
  • 19
  • 13
1675
votes
34 answers

How do I profile a Python script?

Project Euler and other coding contests often have a maximum time to run or people boast of how fast their particular solution runs. With Python, sometimes the approaches are somewhat kludgey - i.e., adding timing code to __main__. What is a good…
Chris Lawlor
  • 47,306
  • 11
  • 48
  • 68
1675
votes
23 answers

Event binding on dynamically created elements?

I have a bit of code where I am looping through all the select boxes on a page and binding a .hover event to them to do a bit of twiddling with their width on mouse on/off. This happens on page ready and works just fine. The problem I have is that…
Eli
  • 97,462
  • 20
  • 76
  • 81
1675
votes
21 answers

What is the difference between varchar and nvarchar?

Is it just that nvarchar supports multibyte characters? If that is the case, is there really any point, other than storage concerns, to using varchars?
stimms
  • 42,945
  • 30
  • 96
  • 149
1672
votes
21 answers

How do I install pip on macOS or OS X?

I spent most of the day yesterday searching for a clear answer for installing pip (package manager for Python). I can't find a good solution. How do I install it?
The System
  • 16,761
  • 3
  • 13
  • 3
1668
votes
34 answers

How do I force a favicon refresh?

I have a Grails application running locally using its own tomcat and I have just changed the favicon for a new one. Problem is that I can not see it in any browser. The old favicon shows up or I get no favicon at all, but not my new one. I do not…
Simon
  • 78,655
  • 25
  • 88
  • 118
1668
votes
12 answers

Relative imports for the billionth time

I've been here: http://www.python.org/dev/peps/pep-0328/ http://docs.python.org/2/tutorial/modules.html#packages Python packages: relative imports python relative import example code does not work Relative imports in python 2.5 Relative imports in…
user1881400
1667
votes
20 answers

How can I get the ID of an element using jQuery?

Why doesn't the above work, and how should I do this?
fearofawhackplanet
  • 52,166
  • 53
  • 160
  • 253
1666
votes
22 answers

What is the best algorithm for overriding GetHashCode?

In .NET, the GetHashCode method is used in a lot of places throughout the .NET base class libraries. Implementing it properly is especially important to find items quickly in a collection or when determining equality. Is there a standard algorithm…
bitbonk
  • 48,890
  • 37
  • 186
  • 278
1665
votes
7 answers

Why does changing 0.1f to 0 slow down performance by 10x?

Why does this bit of code, const float x[16] = { 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6}; const float z[16] = {1.123, 1.234, 1.345, 156.467, 1.578,…
GlassFish
  • 14,851
  • 3
  • 17
  • 22
1663
votes
37 answers

Android 8: Cleartext HTTP traffic not permitted

I had reports from users with Android 8 that my app (that uses back-end feed) does not show content. After investigation I found following Exception happening on Android 8: 08-29 12:03:11.246 11285-11285/ E/: [12:03:11.245, main]: Exception:…
david.s
  • 16,880
  • 3
  • 13
  • 11
1661
votes
28 answers

Get size of all tables in database

I have inherited a fairly large SQL Server database. It seems to take up more space than I would expect, given the data it contains. Is there an easy way to determine how much space on disk each table is consuming?
Eric
  • 18,512
  • 4
  • 29
  • 34
1659
votes
19 answers

What is the purpose of the var keyword and when should I use it (or omit it)?

NOTE: This question was asked from the viewpoint of ECMAScript version 3 or 5. The answers might become outdated with the introduction of new features in the release of ECMAScript 6. What exactly is the function of the var keyword in JavaScript,…
Alex
  • 75,813
  • 86
  • 255
  • 348
1659
votes
5 answers

Warning: push.default is unset; its implicit value is changing in Git 2.0

I've been using Git for a while now and have recently downloaded an update only to find this warning message come up when I try to push. warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To…
Marko
  • 71,361
  • 28
  • 124
  • 158