default

What for should I mark private variables as private if they already are?

拈花ヽ惹草 提交于 2019-12-30 07:09:06
问题 As far as I know, in C# all fields are private for default, if not marked otherwise. class Foo { private string bar; } class Foo { string bar; } I guess these two declarations are equal. So my question is: what for should I mark private variables as private if they already are private? 回答1: I've been on the fence for a while about this. I used to argue for leaving it implicit, but now I think I'm tipped over towards making it explicit. Reasons for leaving it implicit: It means there's a

SSRS date default with formula disables parameter

℡╲_俬逩灬. 提交于 2019-12-30 03:55:08
问题 When I set a default value formula for a date parameter in SSRS, such as: =CDate(”01/” & Month(Now) & “/” & Year(Now)) or even: =Now the date parameter control becomes disabled with nothing in it. Does anyone know what simple thing (I am sure) I am doing wrong? 回答1: After playing some more, I realized that the date controls became enabled when I picked a value from a preceding dropdown parameter that did not have a default. Apparently, controls after non-default parameters are disabled until

Function argument's default value equal to another argument [duplicate]

偶尔善良 提交于 2019-12-29 07:47:30
问题 This question already has answers here : Is there a way to set a default parameter equal to another parameter value? (4 answers) Closed 4 years ago . Is it possible to define a function argument's default value to another argument in the same function definition? Something like: def func(a, b=a): print a, b but that didn't work. 回答1: No. This is not possible. The Python interpreter thinks that you want to assign the default value of argument b to a global variable a when there isn't a global

Android Intent defaults - detect and clear

吃可爱长大的小学妹 提交于 2019-12-29 07:19:28
问题 Is there a way to detect that a phone has a default application chosen for an intent such as android.intent.action.SEND ? Is there a way to clear the default application via code? I'd like to give the user an option to remove the default or at least show a screen telling them how to do it manually, if I can detect it. 回答1: Take a look at PackageManager. With it, you can determine how an Intent will be handled with resolveActivity(intent). It looks like the method for clearing the preference

java Timezone setDefault effects

浪尽此生 提交于 2019-12-29 06:17:04
问题 following How to store date/time and timestamps in UTC time zone with JPA and Hibernate I want to set my application default time zone to UTC. My app runs on tomcat on a linux server along side some other apps. The server has other tomcat instances that run even more apps. Will Timezone.setDefault(tz) affect the other apps on the same tomcat instance? Will it affect other apps on other tomcat instances? Is it possible to set the timezone only for the app? I loosely remember something about

Java casting order

北战南征 提交于 2019-12-28 17:27:27
问题 Let's say I have the following setup class A { B foo(); } class C extends B { } // later A a = new A(); C theFoo = (C)a.foo(); We know a.foo() returns type B. When I do (C)a.foo() , is it Casting a to type C then attempting to call foo() on it? Calling foo() on a and casting the result to type C ? I'm finding it difficult to determine, and have always just played on the side of caution with extra parenthesis (which isn't a bad idea, for readability, but now I'm curious) This is in specific

How to set default encoding in Python (setdefaultencoding() function does not exist)? [duplicate]

半腔热情 提交于 2019-12-28 12:24:26
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Changing default encoding of python? I am reading dive in python and it mentions setting python's default encoding scheme in the XML parsing chapter. The setdefaultencoding is used in python-installed-dir/site-packages/pyanaconda/ sitecustomize.py import sys sys.setdefaultencoding('utf-8') But when I run the script, it raises: AttributeError: 'module' object has no attribute 'setdefaultencoding' How to set the

How do you drop a default value or similar constraint in T-SQL?

落爺英雄遲暮 提交于 2019-12-28 03:38:12
问题 I know the syntax: ALTER TABLE [TheTable] DROP CONSTRAINT [TheDefaultConstraint] but how to I drop the default constraint when I don't know its name? (That is, it was autogenerated at CREATE TABLE time.) 回答1: If you want to do this manually, you can use Management Studio to find it (under the Constraints node inside the table). To do it using SQL: If the constraints are default constraints, you can use sys.default_constraints to find it: SELECT OBJECT_NAME(parent_object_id) AS TableName, name

How to make a class-instance accept parameters?

烈酒焚心 提交于 2019-12-25 09:04:00
问题 I wonder if there is a way to make a class instance that accepts parameters and generate results according to this parameter. This is very common in VB.net built-in classes, but I wonder how to make it myself Dim myNumbers as new NUMBERS myNumbers.First = 1 myNumbers.Second = 2 Msgbox(myNumbers(1,2,3,4,5,5).max) In the above code myNumber is a class which accepts some numbers and return the max. 回答1: You can use Default properties in order to achieve that. If you don't want it to be Set -able

Integrate layouts with Devise

有些话、适合烂在心里 提交于 2019-12-25 01:39:14
问题 I'm using devise for user auth, however, I want the registration, login, and beta code enter pages to have a layout called 'beta' not the application (default) layout that the rest of the pages have. I normally just change the layout in the controller but there aren't controllers with Devise. Is this not possible and I just have to change the application layout and have a specific layout for all other pages? 回答1: There are controllers in devise and they are easy to customize. Just do the