default-value

Reflecting constructors with default values in C#4.0

I've just started using C#4.0(RC) and come up with this problem: class Class1 { public Class1() { } } class Class2 { public Class2(string param1) { } } class Class3 { public Class3(string param1 = "default") { } } Type[] types = new Type[] { typeof(Class1), typeof(Class2), typeof(Class3) }; // Problem starts here, main-method for(int ...

Default value of an Objective-C struct and how to test

I'm trying to test if a property has been set yet. I know that with objects that I've got: CGRect ppGoalFrame; LocalPlaySetup *localPlaySetup; and I can test if (localPlaySetup == nil) but if I attempt to test the CGRect with == nil or == NULL if (ppGoalFrame == nil) I get invalid operands to binary == (have 'CGRect' and 'void...

Objective C Default parameters?

Possible Duplicates: Optional arguments in Objective-C 2.0? Objective-C Default Argument Value I'm writing a C function in Objective C. I want a default value for my last parameter. I've tried: foo(int a, int b, int c = 0); but that's C++ I've also tried foo(int a, int b, int c) { ... } foo(int a, int b) { foo(a, ...

Java NullPointerException. Why?

I am new to Java. I just read that class variables in Java have default value. I tried the following program and was expecting to get the output as 0, which is the default value on an integer, but I get the NullPointerException. What am I missing? class Test{ static Integer iVar; public static void main(String...args) { ...

Preparing a MySQL INSERT/UPDATE statement with DEFAULT values

Quoting MySQL INSERT manual - same goes for UPDATE: Use the keyword DEFAULT to set a column explicitly to its default value. This makes it easier to write INSERT statements that assign values to all but a few columns, because it enables you to avoid writing an incomplete VALUES list that does not include a value for each column in t...

Default value for file path in function gives SyntaxError. Work around?

for this, import os.path def f(data_file_path=os.path.join(os.getcwd(),'temp'),type): ... return data I get this, SyntaxError: non-default argument follows default argument Is there a way to make this work or do I have to define a variable such as, rawdata_path = os.path.join(os.getcwd(),'temp') and then plug that into ...

rails override default getter for a relationship (belongs_to)

So I know how to override the default getters for attributes of an ActiveRecord object using def custom_getter return self[:custom_getter] || some_default_value end I'm trying to achieve the same thing however for a belongs to association. For instance. class Foo < AR belongs_to :bar def bar return self[:bar] || Bar.last ...

Default type-parametrized function literal class parameter

Is this an intended behavior or is it a bug? Consider the following trait (be it a class, doesn't matter): trait P[T] { class Inner(val f: T => Unit = _ => println("nope")) } This is what I would have expected: scala> val p = new P[Int] { | val inner = new Inner | } p: java.lang.Object with P[Int]{def inner: this.In...

JQuery ajax call default timeout value

I got a bug report that I can't duplicate, but ajax-call timeout is the current best guess. So I'm trying to find out the default value for timeout of a jQuery $.ajax() call. Anybody have an idea? Couldn't find it in jQuery documentation. Thanks in advance, Marcus ...

how to use a parameterized function for the Default Binding of a Sql Server column

I have a table that catalogs selected files from multiple sources. I want to record whether a file is a duplicate of a previously cataloged file at the time the new file is cataloged. I have a column in my table (“primary_duplicate”) to record each entry as ‘P’ (primary) or ‘D’ (duplicate). I would like to provide a Default Binding for...

error: default argument given for parameter 1

I'm getting this error message with the code below: class Money { public: Money(float amount, int moneyType); string asString(bool shortVersion=true); private: float amount; int moneyType; }; First I thought that default parameters are not allowed as a first parameter in C++ but it is allowed. ...

Html.RadioButton group defaulting to 0

Hi A default value of 0 is creeping into a Surveys app I am developing, for no reason that I can see. The problem is as follows: I have a group of Html.RadioButtons that represent the possible values a user can choose to answer a survey question (1 == Not at all, 2 == A little, 3 == A lot). I have used a tinyint datatype, that does n...

Give WPF design mode default objects

In my application I have <Rectangle.Margin> <MultiBinding Converter="{StaticResource XYPosToThicknessConverter}"> <Binding Path="XPos"/> <Binding Path="YPos"/> </MultiBinding> </Rectangle.Margin> The Data Context is set during runtime. The application works, but the design window in VS does not show a previ...

How to provide default argument as this object?

I would like to have declaration like this: void Date::get_days_name(const Date& = this) which I would understand that if no argument is provided use this object as an argument. For some reason in VS I'm getting err msg: 'Error 1 error C2355: 'this' : can only be referenced inside non-static member ' Any idea what I'm doing w...

Using NHibernate to insert/update using a SQL server-side DEFAULT value

Several of our database tables contain LastModifiedDate columns. We would like these to stay synchronized based on a single time-source. Our best time-source, in this case, is the SQL Server itself since there is only one database server but multiple application servers which could potentially be off sync. I would like to be able to use...

MATLAB: Print text in input field

Using MATLAB, I have this code: value = input('>> Enter a value: '); and basically, I want a "default" value to the right of the colon (sortof like this) >> Enter a value: 12 where "12" is editable such that the user could [backspace] [backspace] and change the value to, say, "20" or something. Is there any (easy) way to do this...

How to get rid of jquery accordion "Default:first child"?

By default first child is shown always in jquery accordion .... How to get rid of active default value which is active on document.ready function such that none of the child shows up...... I am using $(document).ready(function() { $(".selector").accordion({ active: \\ how to set active none here }); }); Any suggestion... ...

Can I set the default value of a custom list column to be a new Guid?

I tried setting the defaultvalue property of the field to Guid.NewGuid() but every item created has the same guid so I guess the Guid.NewGuid() is being stored as the default rather than being run each time. Is the only way to achieve this to add an event handler to the list for OnAdded? ...

wpf DependencyProperty Not accepting default value for short

Hi, I was trying to use tis depencency property in my code but it gives me error says that Default value type does not match type of property 'MyProperty'.But short should accept 0 as default value.Ans also if i try to give null as default value it works..even if its a non nullabel type.How come this happens.. public short MyProperty ...

derived class as default argument g++

Please take a look at this code: template<class T> class A { class base { }; class derived : public A<T>::base { }; public: int f(typename A<T>::base& arg = typename A<T>::derived()) { return 0; } }; int main() { A<int> a; a.f(); return 0; } Compiling generates the following error message in g++: test.cpp: In func...