default-value

How do I determine if the value of a string variable changed in C#?

▼魔方 西西 提交于 2019-12-10 18:27:18
问题 I have something to do under a button click (add values to listbox) only if a particular string changes from its previous value. How do I manage this? Below is a sample of my code: private void button6_Click(object sender, EventArgs e) { string x = //some varying value I get from other parts of my program listBox1.Items.Clear(); listBox1.Items.Add(x + /*other things*/); } I can at times have same value for string x from previous value when clicking button6. In such cases I don't want listBox1

How to tell if a Map has a default value?

前提是你 提交于 2019-12-10 17:38:01
问题 Is there a way to check if a Map has a defined default value? What I would like is some equivalent of myMap.getOrElse(x, y) where if the key x is not in the map, if myMap has a default value, return that value else return y A contrived example of the issue: scala> def f(m: Map[String, String]) = m.getOrElse("hello", "world") f: (m: Map[String,String])String scala> val myMap = Map("a" -> "A").withDefaultValue("Z") myMap: scala.collection.immutable.Map[String,String] = Map(a -> A) scala> f

pdo prepared statement insert DEFAULT when the variable in BindParam is null

吃可爱长大的小学妹 提交于 2019-12-10 15:30:31
问题 I have this problem: I'm using PDO prepared statement.... I want to BIND a variable BUT if the variable is NULL it have to INSERT in MYSQL the DEFAULT VALUE of the field... I'm trying with IFNULL(:User_Login__Is_Active, DEFAULT), And I tried also: COALESCE(:User_Login__Is_Active, DEFAULT), Same error: PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; How can you do that? Look this example: $stmt = $this->pdo->prepare('INSERT INTO user

JOOQ ignoring database columns with default values

浪子不回头ぞ 提交于 2019-12-10 15:29:33
问题 It seems that JOOQ is completely ignoring the default values of database columns. Neither gets the ActiveRecord object updated nor does it skip this column on INSERT. Instead it tries to set it to NULL which fails on NOT NULL columns. Example: CREATE TABLE bug ( foo int, bar int not null default 42 ); BugRecord b = jooq.newRecord(BUG); b.setFoo(3); b.store(); assertNotNull(b.getBar()); // fails Record r = jooq.select().from(BUG).fetchOne(); assertEquals(new Integer(-1), r.getValue(BUG.BAR));

What is default font style of textarea in chrome? (text input vs textarea “size” of text)

孤人 提交于 2019-12-10 14:45:00
问题 What is default font style of textarea in chrome? What should to make it default look like? Purpose of my question is that I wanna make the text make same in input as in textarea. In text input is maybe too "bold" :P The question should be: What are default font properties applied on textarea? What would I wrote if I wanna look like as default? textarea { font-???: ???; etc. } 回答1: To answer your question directly, The default font property of a textarea is font-family: monospace While the

derived class as default argument g++

半腔热情 提交于 2019-12-10 13:24:03
问题 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 function 'int main()': test.cpp:25: error: default argument for parameter of type 'A<int>::base&' has type 'A<int>::derived' The basic idea (using derived class as default value for base

How do I get default values of optional parameters?

[亡魂溺海] 提交于 2019-12-10 11:28:59
问题 I have a constructor with optional parameters. I would like to have an expression to invoke that constructor without providing the optional arguments (I mean let the object be constructed with default values of the parameters). I read here An expression tree may not contain a call or invocation that uses optional arguments that this is not possible. I mean var ctorInfo = getIt; var f = Expression.Lambda<Func<T>>(Expression.New(ctorInfo)).Compile(); fails with System

Expandable listview default selection

柔情痞子 提交于 2019-12-10 10:40:02
问题 I have created a navigation drawer with an expandable listview inside it. I want the expandable listview to expand one of its groups and select one of its child by default when the activity opens up. The user may change the selection according to his requirement. Whatever I have created is not satisfying my requirement. The expandable list is allowing the user to select multiple options. The MainActivity : public class MainActivity extends Activity { DrawerLayout mDrawerLayout;

C++ pass pointer by reference and assign default value

杀马特。学长 韩版系。学妹 提交于 2019-12-10 04:21:30
问题 I would like to pass a pointer by reference to a function, such that i can actually change the address the passed pointer is pointing to and i'd like to assign this argument a default value. something like this: in the declaration void myFunc(SomeType* &var=NULL); and the definition: void MyClass::myFunc(SomeType* &var){ if(var!=NULL) (*var)=(*someOtherPointer); if(someCondition) var=NULL; } such that a callee can decide whether he wants to call the function with one argument or without

Default name with OpenFileDialog C#?

时光总嘲笑我的痴心妄想 提交于 2019-12-10 01:59:11
问题 I set the default file name is answer_XXXXXX.csv in OpenFileDialog. But it displays like this. The default name "answer_XXXXXX.csv" isn't displayed full. Then I click on File name combo box. It displays exactly. How can I fix it? 回答1: There is a small workaround for this. Have below line before calling ShowDialog() . openfiledialog.ShowHelp = true; Example: OpenFileDialog openfiledialog = new OpenFileDialog(); openfiledialog.ShowHelp = true; openfiledialog.FileName = "answer_XXXXXXX.csv";