Questions tagged [default]

Refers to an initial, most commonly used option, setting, or value that is automatically assigned to an application or device, outside of user intervention, with the intention of making it usable "out of the box".

A , in computer science, refers to a setting or a value automatically assigned to a software application, computer program or device, outside of user intervention. Such settings are also called presets, especially for electronic devices. Default values are generally intended to make a device (or control) usable "out of the box". A common setting, or at least a usable setting, is typically assigned.

tag should be used for questions regarding

  • Default features of programming languages (like default return type of C functions).
  • Default configuration of and Applications.

SOURCE

Wikipedia

3261 questions
551
votes
14 answers

Programmatic equivalent of default(Type)

I'm using reflection to loop through a Type's properties and set certain types to their default. Now, I could do a switch on the type and set the default(Type) explicitly, but I'd rather do it in one line. Is there a programmatic equivalent of…
tags2k
  • 70,860
  • 30
  • 74
  • 105
465
votes
7 answers

Why Is `Export Default Const` invalid?

I see that the following is fine: const Tab = connect( mapState, mapDispatch )( Tabs ); export default Tab; However, this is incorrect: export default const Tab = connect( mapState, mapDispatch )( Tabs ); Yet this is fine: export default Tab =…
Kayote
  • 10,838
  • 17
  • 67
  • 123
290
votes
14 answers

How to open in default browser in C#

I am designing a small C# application and there is a web browser in it. I currently have all of my defaults on my computer say google chrome is my default browser, yet when I click a link in my application to open in a new window, it opens internet…
Sean
  • 7,259
  • 14
  • 36
  • 46
281
votes
21 answers

Should switch statements always contain a default clause?

In one of my first code reviews (a while back), I was told that it's good practice to include a default clause in all switch statements. I recently remembered this advice but can't remember what the justification was. It sounds fairly odd to me…
tttppp
  • 6,333
  • 7
  • 29
  • 36
241
votes
5 answers

What does "default" mean after a class' function declaration?

I've seen default used next to function declarations in a class. What does it do? class C { C(const C&) = default; C(C&&) = default; C& operator=(const C&) & = default; C& operator=(C&&) & = default; virtual ~C() { } };
Paul Manta
  • 27,853
  • 27
  • 109
  • 192
224
votes
16 answers

How can I make Sublime Text the default editor for Git?

I have a problem setting Sublime Text 2 as the core.editor with git. I've read through every post I could find addressing the problem, but still nothing is working for me. I am running Windows. I have done: git config --global core.editor…
Spencer Moran
  • 2,320
  • 3
  • 13
  • 13
218
votes
4 answers

new DateTime() vs default(DateTime)

Is there a reason to choose one of these over the other? DateTime myDate = new DateTime(); or DateTime myDate = default(DateTime); Both of them are equal 1/1/0001 12:00:00 AM.
RJP
  • 3,696
  • 5
  • 25
  • 40
199
votes
14 answers

Using Default Arguments in a Function

I am confused about default values for PHP functions. Say I have a function like this: function foo($blah, $x = "some value", $y = "some other value") { // code here! } What if I want to use the default argument for $x and set a different…
renosis
  • 2,482
  • 2
  • 15
  • 20
186
votes
6 answers

Angularjs Template Default Value if Binding Null / Undefined (With Filter)

I have a template binding that displays a model attribute called 'date' which is a date, using Angular's date filter. {{gallery.date | date:'mediumDate'}} So far so good. However at the moment, if there is no value…
Undistraction
  • 38,727
  • 46
  • 165
  • 296
177
votes
7 answers

Reset CSS display property to default value

Is it possible to override the display property with its default value? For example if I have set it to none in one style, and I want to override it in a different with its default. Or is the only way to find out what the default of that element is…
Svish
  • 138,188
  • 158
  • 423
  • 589
173
votes
21 answers

How to change MySQL data directory?

Is it possible to change my default MySQL data directory to another path? Will I be able to access the databases from the old location?
MySQL DBA
  • 5,084
  • 18
  • 48
  • 69
169
votes
6 answers

Default value of a type at Runtime

For any given type i want to know its default value. In C#, there is a keyword called default for doing this like object obj = default(Decimal); but I have an instance of Type (called myType) and if I say this, object obj = default(myType); it…
viky
  • 16,233
  • 13
  • 65
  • 88
158
votes
7 answers

Why does the Scala compiler disallow overloaded methods with default arguments?

While there might be valid cases where such method overloadings could become ambiguous, why does the compiler disallow code which is neither ambiguous at compile time nor at run time? Example: // This fails: def foo(a: String)(b: Int = 42) = a +…
soc
  • 27,310
  • 18
  • 99
  • 209
131
votes
16 answers

How do I set default values for functions parameters in MATLAB?

Is it possible to have default arguments in MATLAB? For instance, here: function wave(a, b, n, k, T, f, flag, fTrue=inline('0')) I would like to have the true solution be an optional argument to the wave function. If it is possible, what is the…
Scott
  • 2,451
  • 5
  • 24
  • 25
130
votes
4 answers

Is a `=default` move constructor equivalent to a member-wise move constructor?

Is this struct Example { int a, b; Example(int mA, int mB) : a{mA}, b{mB} { } Example(const Example& mE) : a{mE.a}, b{mE.b} { } Example(Example&& mE) : a{move(mE.a)}, b{move(mE.b)} { } Example&…
Vittorio Romeo
  • 82,972
  • 25
  • 221
  • 369
1
2 3
99 100