default-value

Cocoa Core Data: Setting default entity property values?

I know I can set default values either in the datamodel, or in the -awakeFromInsert method of the entity class. For example, to make a "date" property default to the current date: - (void) awakeFromInsert { NSDate *now = [NSDate date]; self.date = now; } How though can I make an "idNumber" property default to one greater than the prev...

How to alter the default value set to a column in a table in SQL?

How can you alter the default value set to a column in a table in SQL. I got an error from: ALTER TABLE tablename.tab ALTER COLUMN mess1 DEFAULT ('hi') What was the correct query? ...

drupal Webform select list empty first value

I need for my select lists to have a default option of an empty value, or "Select" with no value. I don't see any mention of how to do this in the documentation. // $Id: webform.module,v 1.196.2.47 2010/08/16 17:54:19 quicksketch Exp $ Thanks ...

Shortest way to assign a default value to a variable?

I have this right now to use a cookie value if exists otherwise use a default value: $default_carat_min = "0.25"; if($_COOKIE["diamond-search_caratMin"]) { $default_carat_min = $_COOKIE["diamond-search_caratMin"]; } I am going to have to do this with a lot of variables, and its going to get really cluttered/ugly. So I am trying to...

In Ruby on Rails, passing locals to a view, defaulting to true, won't work with ||=

if the code is do_more ||= true then when false is passed in, it becomes do_more = false || true and therefore will still be true. So this is one case where foo ||= default_value won't work? In this case it will need to be do_more = true if !defined? do_more ? ...

Ruby: Can lambda function parameters have default values?

I want to do something similar to this: def creator() return lambda { |arg1, arg2 = nil| puts arg1 if(arg2 != nil) puts arg2 end } end test = creator() test('lol') test('lol', 'rofl') I get a few syntax errors: test.rb:2: syntax error re...

How can i initialize some Dependency Injected instance?

Hi folks, I'm using StructureMap DI/IoC and I've got is a generic InMemory repository. Works great. I was wondering if it's possible to define the initial data which each repository holds, when it's requested? Now, the first reaction is to do this in the constructor of the class - but I'm using a Generic Repository .. so i don't know w...

user default column value in INSERT stored procedure

From my ASP.NET application I am calling an INSERT stored procedure, there is a default value for one of the columns in the table that the INSERT procedure places the data into. How do I specify that I want the default value to be used instead? (Or do I have to specify the actual default value in my parameters) SITUATIONAL TABLE: Colum...

Linq To Sql: handle NewID()

hey, im trying to add data to my sqlserver by using Linq To Sql, in the table, the data design to get NEWID() when new row is inserted, but the linq to sql ignore it and the cell in null, thanks! ...

What does the C++ compiler do when coming ambiguous default parameters?

What does the C++ compiler do when coming ambiguous default parameters? For example, let's say there was a function such as: function1(int a = 0, float b = 3.1); function2(int a, float b =1.1, int c = 0); Is the above considered ambiguous? If not, what does the compiler do (how is the function matched exactly) when calling something l...

ruby default argument idiom

What's the idiom in Ruby when you want to have a default argument to a function, but one that is dependent on another parameter / another variable? For example, in Python, an example is: def insort_right(a, x, lo=0, hi=None): if hi is None: hi = len(a) while lo < hi: mid = (lo+hi)//2 if x < a[mid]: hi = m...

ASP.NET-MVC: Do Database Default Values Break The Spirit of Unit Testing?

Related Question My Question: In the key of ASP.NET-MVC - Do Database Default Values Break The Spirit of Unit Testing? ...

Android CheckBoxPreference Default Value

I have the following XML code for my CheckBoxPreference: <CheckBoxPreference android:key="pref_boot_startup" android:title="Auto start" android:defaultValue="true" /> But when I retrieve the preference in code the value is false. sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this)...

LinqDataSource - is default insert parameter with dbnull value possible?

I need to do some simple (or so it seems) databinding and CRUD type operations on an ASP.Net page. I'm using a LinqDataSource connected with a FormView. The table that i'm trying to insert into has default contraints for these fields: [Created] [datetime] NOT NULL [CreatedBy] [nvarchar](50) NOT NULL [Modified] [datetime] NOT NULL [Modif...

SSRS 2005: Get default menu selection from a query or other parameter

I built a report with one parameter being a menu of names, and the default value being <ALL> Clients wanted the default to be the person logged in. I can easily get User!UserID the default for a text box, but if I change the menu from names to IDs, it will not pre-select it on the menu. Instead, it adds the "" thing to the top of the ...

DisplayName - 'User' + UserId - Best Way to Do This

I want to do something like SO does with DisplayName. When someone does not enter a DisplayName, I want to default this to 'User' + UserId. So the first user who signs up would get User1 - since UserId will be 1, the second User2 - since UserId will be 2, and so on. The easiest way I can think of doing this is using a trigger, but I...