default-value

Why isn't this infinite recursion? How does default variable initialization work in VB.NET?

I just made an interesting mistake in my code: Dim endColumn As Integer = startColumn + endColumn - 1 The code was actually supposed to be: Dim endColumn As Integer = startColumn + numColumns - 1 The interesting thing is, I would think that this code should be recursive and loop indefinitely, as the initialization of endColumn sort...

Hash default value not being used

Today I tried the following snippets of code and I don't understand why I get different results between them. As far as I can understand they are the same. One uses the default value off Hash and the other snippet creates an empty array for the key before it'll be accessed. Anyone who understands what's going on? :) # Hash default if ...

SQL Design: representing a default value with overrides?

I need a sparse table which contains a set of "override" values for another table. I also need to specify the default value for the items overridden. For example, if the default value is 17, then foo,bar,baz will have the values 17,21,17: table "things" table "xvalue" name stuff name xval ---- ----- ---- ---- foo ... ...

Setting the initial value of a property when using DataContractSerializer

If I am serializing and later deserializing a class using DataContractSerializer how can I control the initial values of properties that were not serialized? Consider the Person class below. Its data contract is set to serialize the FirstName and LastName properties but not the IsNew property. I want IsNew to initialize to TRUE whether ...

jquery stop image slider when accordian menu is closed

http://jsbin.com/emoba5/3/edit click here to view demo Does anybody know how to make the image slider go blank if all menu items are closed? Our how to make it stop on the first image if there is only one image, i.e. posture 3 Im stumped?! ...

Is it bad practice to initialize a variable to a dummy value?

This question is a result of the answers to this question that I just asked. It was claimed that this code is "ugly" because it initializes a variable to a value that will never be read: String tempName = null; try{ tempName = buildFileName(); } catch(Exception e){ ... System.exit(1); } FILE_NAME = tempName; Is this indee...

Can a single argument constructor with a default value be subject to implicit type conversion

I understand the use of the explicit keyword to avoid the implicit type conversions that can occur with a single argument constructor, or with a constructor that has multiple arguments of which only the first does not have a default value. However, I was wondering, does a single argument constructor with a default value behave the same...

Change default properties for .resx files created with Visual Studio 2010

When creating a new .resx file anywhere in my solution, I would like the following properties to be other than the default: Copy to Output Directory: Copy if newer Custom Tool namespace: Booking.Resources Access Modifier: public Is there any way I can change the default Visual Studio behavior on creation of these files, so I don't ha...

How to use default arguments in php

I want to define a function doSomething(arg1, arg2) with default values to arg1=val and arg2=val When I write function doSomething($arg1="value1", $arg2="value2"){ // do something } Is it possible now to call doSomething with default arg1 and arg2="new_value2" ...

C++ How do I give a member variable in an abstract class a default value?

In the header, I'm defining bool isActive. In classes derived from this one, I would like to make isActive false by default. I tried doing this by adding AbstractClass::isActive = false; to the cpp file, but that causes the error "Expected constructor, destructor, or type conversion before '=' token." ...

Error: default parameter given for parameter 1

Here is my class definition: class MyClass { public: void test(int val = 0); } void MyClass::test(int val = 0) { // } When I try to compile this code I get the error: "default parameter given for parameter 1" It's just a simple function, I don't know what's wrong. I'm using Eclipse + MinGW. ...

defualt parameter values in arguments and inheritance

Hello there, Im having trouble with some Java, How do I give in default parameter values in java?. for example I have this in c++ DVD(int i, string t, int y, string d="Unknown"): Items(i,t,y),director(d){} and in Java I tried public Dvd(int i, String t,int y, String d="Unknown"){ super(i,t,y); director = d; } whi...

Is there a standard SQL Table design for overriding 'big picture' default values with lower level details?

Here's an example. Suppose we are trying to calculate a service charge. Say sales in the USA attract a 10 dollar charge, sales in the UK attract a 20 dollar charge So far it's easy - we are starting to imagine a table that lists charges by country. Now lets assume that Alaska and Hawaii are treated as special cases they are both 15 d...

How to properly generate nodes with default values in Web Service requests using JAX-WS and Weblogic 10.3?

Hi, I am trying to use a Web Service that defines a type with some mandatory fields having a default value: <complexType name="DocumentRegistrationRequest"> <sequence> <element name="title" type="string"> <annotation> <documentation>Title/subject of the document</documentation> </anno...

Display default text in combobox in Silverlight 4

I want to show the default text in the ComboBox as 'Select'. I also want to the bind the items in the ComboBox to the Collection. When the user selects any item from ComboBox the 'Select' text should not remain as an item in the ComboBox. How can I do it? Thanks. ...

django-admin formfield_for_* change default value per/depending on instance

Hi, I'm trying to change the default value of a foreignkey-formfield to set a Value of an other model depending on the logged in user. But I'm racking my brain on it... This: Changing ForeignKey’s defaults in admin site would an option to change the empty_label, but I need the default_value. #Now I tried the following without errors b...

SQL Server 2005 Create Table with Column Default value range

Trying to finish up some homework and ran into a issue for creating tables. How do you declare a column default for a range of numbers. Its reads: "Column Building (default to 1 but can be 1-10)" I can't seem to find ...or know where to look for this information. CREATE TABLE tblDepartment ( Department_ID int NOT NULL IDENTITY, Departm...

Delete default value of an input text on click

Hey, I have an input text : <input name="Email" type="text" id="Email" value="[email protected]" /> I want to put a default value like "What's your programming question ? be specific." in StackOverFlow, and when the user click on it the default value disapear. ...

Insert default value if input-text is deleted

Hi all I have the following piece of jQuery code: $(".SearchForm input:text").each(function(){ /* Sets the current value as the defaultvalue attribute */ if(allowedDefaults.indexOf($(this).val()) > 0 || $(this).val() == "") { $(this).attr("defaultvalue", $(this).val()); $(this).css("color","#9d9d9d")...

insert value of one col to another on inserting

hi, i want to insert value of one col to another on inserting new row in sql. how do i? there is any way to do this by default value(constraint)? ...