default

How can “default” values in overridden WinForm controls be prevented?

陌路散爱 提交于 2019-12-01 06:18:53
问题 I'm trying to learn and grasp what and how C# does things. I'm historically a Visual Foxpro (VFP) developer, and somewhat spoiled at the years of visual inheritance by creating my own baseline of user controls to be used application wide. In trying to learn the parallels in C#, I am stuck on something. Say I derive my own label control (control is subclass of label) defined with a font "Arial", 10 point. Then, on any form I add it to, the Designer will automatically pre-fill in some property

Initialize array in constructor without using default constructor or assignment

会有一股神秘感。 提交于 2019-12-01 06:11:25
Consider: struct A { A (int); A (const A &); }; struct B { A foo [2]; B (const A & x, const A & y) : foo {x, y} /* HERE IS THE PROBLEM */ {} }; I was expecting this to work since I'm using C++0x support in GCC4.3, which allegedly supports initialiser lists. No joy. I have a class A which has no default constructor. This is not negotiable. Assignment post-default is not an option. I am trying to create B which uses A. B::foo may not be std::vector. How can I initialise B::foo in B(...) , constructing its elements exactly once? At the moment, I am condidering replacing B with struct B { A foo_a;

Java 8新特性探究(二)深入解析默认方法

南楼画角 提交于 2019-12-01 04:51:57
上篇讲了 lambda表达式 的语法,但只是 JEP126 特性的一部分,另一部分就是默认方法(也称为虚拟扩展方法或防护方法) 什么是默认方法,为什么要有默认方法 简单说,就是接口可以有实现方法,而且不需要实现类去实现其方法。只需在方法名前面加个default关键字即可。 为什么要有这个特性?首先,之前的接口是个双刃剑,好处是面向抽象而不是面向具体编程,缺陷是,当需要修改接口时候,需要修改全部实现该接口的类,目前的java 8之前的集合框架没有foreach方法,通常能想到的解决办法是在JDK里给相关的接口添加新的方法及实现。然而,对于已经发布的版本,是没法在给接口添加新方法的同时不影响已有的实现。所以引进的默认方法。他们的目的是为了解决接口的修改与现有的实现不兼容的问题。 简单的例子 一个接口A,Clazz类实现了接口A。 public interface A { default void foo(){ System.out.println("Calling A.foo()"); } } public class Clazz implements A { public static void main(String[] args){ Clazz clazz = new Clazz(); clazz.foo();//调用A.foo() } } 代码是可以编译的

Can I insert a android:defaultValue trait for RingtonePreference, via XML?

拈花ヽ惹草 提交于 2019-12-01 03:08:53
问题 Is there a way to add a default value in a RingtonePreference, via XML? For example, here's what my preference.xml looks like. <RingtonePreference android:key="alarm" android:title="Alarm" android:name="Alarm" android:summary="Select an alarm" android:ringtoneType="alarm" android:showDefault="true" /> If possible, I'd like to set the RingtonePreference to the default ringtone, like this: <RingtonePreference android:key="alarm" android:title="Alarm" android:name="Alarm" android:summary="Select

MySQL - How to modify column default value?

折月煮酒 提交于 2019-12-01 02:45:14
问题 How do I change my column's default value from None to something else? For example, I want my dates to have a default value of 0000-00-00 if I don't specify one when I create the row. I understand this in phpMyAdmin, but I'm not sure how to do it via command prompt. I also understand how to do this when adding a column. But all of my columns are made and have data in some of them. ALTER TABLE table1 ADD COLUMN foo INT DEFAULT 0; From searching, I found this line, but I'm not sure if that's

Default value for comboBox

◇◆丶佛笑我妖孽 提交于 2019-12-01 01:57:06
Hi I try set default value for comboBox. XAML: <ComboBox Name="StatusCombo" Style="{StaticResource statusComboStyle}" SelectedValuePath="StatusMsg" SelectedValue="{Binding Path=SelectedStatus}"/> I use caliburn.Micro. I bind List<string, StatusItem> to ComboBox, it works good. Status item is simple class, here is it: public class StatusItem { public string StatusMsg { get; set; } public BitmapImage StatusImg { get; set; } } App.xaml I define empty string in app.xaml <System:String x:Key="empty"></System:String> statusComboStyle is here: <Style x:Key="statusComboStyle" TargetType="{x:Type

Forcing Default button on a gridview

大城市里の小女人 提交于 2019-12-01 00:44:38
I'm using gridview with templates to show and edit some information from a sql database. When I edit and change the data in that row and then click enter it automatically presses the highest on page button which uses submit to server set to true which means it'll try to delete instead of update. I've have tried setting a panel round the gridview and setting the panel's default button to the "updatebutton" but it won't allow that because it can't 'see' the buttons. I had a similar problem and I found a very simple workaround: Place a button below the GridView and make it invisible by CSS (i.e.

Namespace agnostic XPath query with element content

本秂侑毒 提交于 2019-11-30 21:15:50
The namespace agnostic syntax I've seen around is confusing me. Say I have: <root> <parent attribute="A">A<child>A</child></parent> <parent attribute="B">B<child>B</child></parent> </root> So far I see how: /root/parent/child/text() translates to: /*[local-name()='root']/*[local-name()='parent']/*[local-name()='child']/text() but i'm struggling with things like this: /root/parent[@attribute="A"]/child/text() or: /root/parent[text()="B"]/child/text() or: /root/parent[1]/child/text() How do these translate? Thanks, EDIT: One More :-) <root> <parent> <childName>serverName</childName> <childValue

Why when I insert a DateTime null I have “0001-01-01” in SQL Server?

有些话、适合烂在心里 提交于 2019-11-30 20:10:57
I try to insert the value null (DateTime) in my database for a field typed 'date' but I always get a '0001-01-01' . I don't understand, this field "allow nulls" and I don't know why I have this default value. I'm using C# asp .net with MVC (Entity Framework), this is my code : Budget_Synthesis newBS = new Budget_Synthesis { Budget_Code = newBudgetCode, Last_Modified_Date = null }; db.Budget_Synthesis.AddObject(newBS); Last_Modified_Date is typed System.DateTime? so I don't know why they change this 'null'. If I try to display the value on my application I get 01/01/0001 00:00:00 And 0001-01-01

What is a couchbase pool

坚强是说给别人听的谎言 提交于 2019-11-30 18:57:51
In couch base URL, e.g. server:port/pools/default what exactly a couch base pool is. Will it always be default or we can change it. There is some text written there http://www.couchbase.com/docs/couchbase-manual-1.8/couchbase-admin-restapi-key-concepts-resources.html but I cannot really get it 100%. Please anyone can explain. A long time ago the Couchbase engineers intended to build out a concept of having pools similar to zfs pools, but for a distributed database. The feature isn't dead, but just never got much attention compared to other database features that needed to be added. What ended