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

3506 questions
157
votes
8 answers

What is the purpose of the default keyword in Java?

An interface in Java is similar to a class, but the body of an interface can include only abstract methods and final fields (constants). Recently, I saw a question, which looks like this interface AnInterface { public default void…
Ravi
  • 30,829
  • 42
  • 119
  • 173
136
votes
7 answers

How to set a Django model field's default value to a function call / callable (e.g., a date relative to the time of model object creation)

EDITED: How can I set a Django field's default to a function that gets evaluated each time a new model object gets created? I want to do something like the following, except that in this code, the code gets evaluated once and sets the default to the…
Rob Bednark
  • 25,981
  • 23
  • 80
  • 125
135
votes
17 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,551
  • 5
  • 25
  • 25
133
votes
9 answers

How to set True as default value for BooleanField on Django?

I'm using BooleanField in Django. By default, the checkbox generated by it is unchecked state. I want the state to be checked by default. How do I do that?
Bin Chen
  • 61,507
  • 53
  • 142
  • 183
130
votes
6 answers

Android Preferences: How to load the default values when the user hasn't used the preferences-screen?

I am using a PreferenceActivity to let the user set some values. I am feeding it the xml file with the defined preferences. I have set all the android:defaultValue="" for them. When I start my application, I need the preferences, or if they are not…
Peterdk
  • 15,625
  • 20
  • 101
  • 140
114
votes
15 answers

What is default color for text in textview?

I set the color to red , and after that I want to set the color again back to default, but I do not know what is default color, does anyone knows ?
Lukap
  • 31,523
  • 64
  • 157
  • 244
113
votes
2 answers

How to change the default font size in ggplot2

I'd like to know if it is possible to change some default parameters of ggplot2 graphics, like font size for instance, for a whole R session. The idea is to avoid setting them for each plot.
jeannot
  • 1,255
  • 2
  • 9
  • 6
110
votes
9 answers

Setting default value for Foreign Key attribute in Django

What is the best way to set a default value for a foreign key field in a model? Suppose I have two models, Student and Exam with student having exam_taken as foreign key. How would I ideally set a default value for it? Here's a log of my…
Primal Pappachan
  • 25,857
  • 22
  • 67
  • 84
110
votes
6 answers

Set default value for DateTime in optional parameter

How can I set default value for DateTime in optional parameter? public SomeClassInit(Guid docId, DateTime addedOn = DateTime.Now???) { //Init codes here }
Sadegh
  • 4,181
  • 9
  • 45
  • 78
107
votes
6 answers

Is there a reasonable approach to "default" type parameters in C# Generics?

In C++ templates, one can specify that a certain type parameter is a default. I.e. unless explicitly specified, it will use type T. Can this be done or approximated in C#? I'm looking for something like: public class MyTemplate
el2iot2
  • 6,428
  • 7
  • 38
  • 51
104
votes
5 answers

map default values

std::map mapy; ++mapy[5]; Is it safe to assume that mapy[5] will always be 1? I mean, will mapy[5] always get the default value of 0 before '++', even if not explicitly declared, as in my code?
Bill Kotsias
  • 3,258
  • 6
  • 33
  • 60
104
votes
1 answer

Declaring a default constraint when creating a table

I am creating a new table in Microsoft SQL server 2000 by writing the code instead of using the GUI, I am trying to learn how to do it "the manual way". This is the code I am actually using, and it works fine: CREATE TABLE "attachments" ( …
Albireo
  • 10,977
  • 13
  • 62
  • 96
95
votes
6 answers

Set MacVim default font

How do I set the default font for MacVim? I have tried adding the following line set guifont = Monaco:h12 to either of the following…
Kit
  • 30,365
  • 39
  • 105
  • 149
90
votes
7 answers

Error setting a default null value for an annotation's field

Why am I getting an error "Attribute value must be constant". Isn't null constant??? @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface SomeInterface { Class bar() default null;// this doesn't…
ripper234
  • 222,824
  • 274
  • 634
  • 905
89
votes
6 answers

How to set the default font for a WPF application?

I want to be able to define a font family for my WPF application. Preferably using a resource dictionary as a theme referenced from App.xaml. I've tried creating a Style as follows: