Most Popular

1500 questions
1656
votes
6 answers

Why do Python classes inherit object?

Why does the following class declaration inherit from object? class MyClass(object): ...
tjvr
  • 17,431
  • 6
  • 25
  • 26
1655
votes
24 answers

You have not concluded your merge (MERGE_HEAD exists)

I made a branch called 'f' and did a checkout to master. When I tried the git pull command I got this message: You have not concluded your merge (MERGE_HEAD exists). Please, commit your changes before you can merge. When I try the git status, it…
Ankit Suri
  • 16,490
  • 3
  • 16
  • 19
1653
votes
15 answers

How to fully delete a git repository created with init?

I created a git repository with git init. I'd like to delete it entirely and init a new one.
user105813
  • 17,059
  • 4
  • 21
  • 17
1649
votes
8 answers

vs

In order to define charset for HTML5 Doctype, which notation should I use? Short: Long:
CuriousMind
  • 33,537
  • 28
  • 98
  • 137
1649
votes
15 answers

Why is it important to override GetHashCode when Equals method is overridden?

Given the following class public class Foo { public int FooId { get; set; } public string FooName { get; set; } public override bool Equals(object obj) { Foo fooItem = obj as Foo; if (fooItem == null) { …
David Basarab
  • 72,212
  • 42
  • 129
  • 156
1647
votes
41 answers

Calculate relative time in C#

Given a specific DateTime value, how do I display relative time, like: 2 hours ago 3 days ago a month ago
Jeff Atwood
  • 63,320
  • 48
  • 150
  • 153
1646
votes
49 answers

How can I vertically center a div element for all browsers using CSS?

I want to center a div vertically with CSS. I don't want tables or JavaScript, but only pure CSS. I found some solutions, but all of them are missing Internet Explorer 6 support.
Div to be aligned vertically
How can I…
Burak Erdem
  • 19,630
  • 7
  • 36
  • 56
1643
votes
24 answers

Creating a div element in jQuery

How do I create a div element in jQuery?
useranon
  • 29,318
  • 31
  • 98
  • 146
1643
votes
8 answers

JavaScript set object key by variable

I am building some objects in JavaScript and pushing those objects into an array, I am storing the key I want to use in a variable then creating my objects like so: var key = "happyCount"; myArray.push( { key : someValueArray } ); but when I try to…
Hunter McMillen
  • 59,865
  • 24
  • 119
  • 170
1642
votes
14 answers

What are rvalues, lvalues, xvalues, glvalues, and prvalues?

In C++03, an expression is either an rvalue or an lvalue. In C++11, the two value categories have become five: rvalue lvalue xvalue glvalue prvalue What are these new categories of expressions, and why are they needed? How do these new categories…
James McNellis
  • 348,265
  • 75
  • 913
  • 977
1640
votes
10 answers

What does __all__ mean in Python?

I see __all__ in __init__.py files. What does it do?
varikin
  • 16,849
  • 3
  • 20
  • 19
1640
votes
38 answers

Changing image size in Markdown

I just got started with Markdown. I love it, but there is one thing bugging me: How can I change the size of an image using Markdown? The documentation only gives the following suggestion for an image: ![drawing](drawing.jpg) If it is possible I…
cantdutchthis
  • 31,949
  • 17
  • 74
  • 114
1637
votes
12 answers

Create a branch in Git from another branch

I have two branches: master and dev I want to create a "feature branch" from the dev branch. Currently on the branch dev, I do: git checkout -b myfeature dev ... (some work) git commit -am "blablabla" git push origin myfeature But, after…
revohsalf
  • 16,443
  • 3
  • 15
  • 4
1636
votes
15 answers

Why does Java have transient fields?

Why does Java have transient fields?
Animesh
  • 16,648
  • 3
  • 18
  • 8
1634
votes
20 answers

How do I reverse a string in Python?

There is no built in reverse function for Python's str object. What is the best way of implementing this method? If supplying a very concise answer, please elaborate on its efficiency. For example, whether the str object is converted to a different…
oneself
  • 38,641
  • 34
  • 96
  • 120