default

How can I use an optional array argument in a VBA procedure?

五迷三道 提交于 2019-11-28 03:23:05
问题 I've got a private procedure in a VBA script for MS Access: Private Sub drawLineDiagram(chartSpace As Variant, title As String, caption As String, x_val() As Variant, y_val() As Variant, Optional y_val2() As Variant = ????) As you see, I want to have an optional last parameter for an array of values. What kind of default parameter must I assign? If I do it with an optional integer value and assign it e.g. 0 it's all fine. If I do it with an array as shown above and assign an array, the line

Reset par to the default values at startup

核能气质少年 提交于 2019-11-28 03:14:49
Normally when I make my own plot functions, I make a construct : op <- par("mypar"=myvalue) on.exit(par(op)) which is the standard way of reverting the par to the previous values. Imagine you've been running some functions that did change some of the pars, and you need to reset to the default values at startup in R. What is the convenient way of doing so? Or in other words : how does one reaches the default values for par() ? Every time a new device is opened par() will reset, so another option is simply do dev.off() and continue. This is hacky, but: resetPar <- function() { dev.new() op <-

What is the C++/CLI equivalent to C#'s default(T)?

∥☆過路亽.° 提交于 2019-11-28 02:42:40
问题 I'm working with some C++/CLI code (new syntax) and am trying to declare a generic type and want to set a member variable to it's default. In C#: class Class<T> { T member = default(T); } What's the equivalent in CLI? generic<typename T> public ref class Class { public: Class() : member(default(T)) // <-- no worky { } private: T member; }; 回答1: Interestingly enough the syntax makes it looks like this: T() . It does require the addition of a copy constructor. generic<typename T> public ref

Can I set up a default method argument with class property in PHP?

限于喜欢 提交于 2019-11-28 02:42:09
问题 I'm using PHP 5.2.6. I want to have a default value for an argument in a method, but it seems I'm getting a bit too clever. The class property blnOverwrite is defaulted and settable elsewhere in the class. I have a method where I want to have it settable again, but not override the existing value. I get an error when I try this: public function place( $path, $overwrite = $this->blnOverwrite ) { ... } Must I do something like this? public function place( $path, $overwrite = NULL ) { if ( ! is

Setting Default NetBeans Options (-std=c99, -Wall) for C programs

穿精又带淫゛_ 提交于 2019-11-28 02:32:46
问题 I have NetBeans 6.9 installed and working fine on Ubuntu Linux 11.10. My goal is to set compiler options like -Wall and -std=c99 to be used by default. Currently, I have to right click on my project -> Properties -> C Compiler -> Warning Level to " More Warnings " and add -std=c99 to Additional Options . This is obviously a pain when creating many projects, and I'm sure there is a way to make all of this the default . I found this thread which relates closely to my question. However, the only

WPF button textwrap style

我的未来我决定 提交于 2019-11-28 02:24:59
问题 How do I change the default textwrapping style of a button in WPF? The obvious solution of: <Style x:Key="MyButtonStyle" TargetType="{x:Type Button}"> <Setter Property="TextWrapping" Value="Wrap"></Setter> </Style> doesn't work, because Textwrapping isn't a settable property here, apparently. If I try: <Style x:Key="MyButtonStyle" TargetType="{x:Type Button}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <TextBlock Text="{Binding}" Foreground=

Understanding how Lambda closure type has deleted default constructor

[亡魂溺海] 提交于 2019-11-28 01:48:00
问题 From 5.1.2 [19] The closure type associated with a lambda-expression has a deleted (8.4.3) default constructor and a deleted copy assignment operator. It has an implicitly-declared copy constructor (12.8) and may have an implicitlydeclared move constructor (12.8). [ Note: The copy/move constructor is implicitly defined in the same way as any other implicitly declared copy/move constructor would be implicitly defined. —end note ] I'm reading through C++ Primer 14.8.1 which explains lambda

Is it possible to extend a default method implementation of a trait in a struct?

你说的曾经没有我的故事 提交于 2019-11-27 22:59:22
In traditional object-oriented languages (e.g. Java), it is possible to "extend" the functionality of a method in an inherited class by calling the original method from the super class in the overridden version, for example: class A { public void method() { System.out.println("I am doing some serious stuff!"); } } class B extends A { @Override public void method() { super.method(); // here we call the original version System.out.println("And I'm doing something more!"); } } As you can see, in Java, I am able to call the original version from the super class using the super keyword. I was able

TimeZone.setDefault changes in JDK6

时光总嘲笑我的痴心妄想 提交于 2019-11-27 22:05:27
I just noticed that JDK 6 has a different approach to setting a default TimeZone than JDK5. Previously the new default would be stored in a thread-local variable. With JDK6 (I just reviewed 1.6.0.18) the implementation has changed, so that if the user can write to the "user.timezone" property, or if there is no SecurityManager installed, the timezone changes VM-wide! Otherwise a thread-local change occurs. Am I wrong? This seems to be quite a drastic change, and I couldn't find anything on the web about it. Here is the JDK6 code: private static boolean hasPermission() { boolean hasPermission =

Error setting a default null value for an annotation's field

老子叫甜甜 提交于 2019-11-27 20:57:54
Why am I getting an error "Attribute value must be constant". Isn't null constant??? @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface SomeInterface { Class<? extends Foo> bar() default null;// this doesn't compile } I don't know why, but the JLS is very clear: Discussion Note that null is not a legal element value for any element type. And the definition of a default element is: DefaultValue: default ElementValue Unfortunately I keep finding that the new language features (Enums and now Annotations) have very unhelpful compiler error messages when you don't meet