C# .cs file name and class name need to be matched?

依然范特西╮ 提交于 2019-12-08 14:36:04
问题 In Java the file name must be the public class name defined in that java file. Does C# has similar requirement? can I have a A.cs file which only defines a public Class B inside? thanks, 回答1: No, there is no similar requirement. Yes, you can do this. It is considered bad practice, however. Microsoft StyleCop will warn you if you do this, but everything will compile fine. 回答2: No, there is not a requirement that the filename matches a single public class being defined in the file. In fact, it

XORing “Hello World!” cuts off string

感情迁移 提交于 2019-12-08 14:36:03
问题 #include <stdio.h> #include <string.h> int main() { char greeting[]="\nHello World!\n"; int a; for(int i=0; i<strlen(greeting); i++) greeting[i]^=111; for(int i=0; i<strlen(greeting); i++) greeting[i]^=111; printf("%s\n",greeting); scanf("%d",&a); } Output: Hell Why does it cut everything after spotting a letter corresponding to the XOR key's number (in this case, ASCII 'w')? In mathematical logic, N^N=0 and 0^N=N , doesn't it? 回答1: Because 'o' is ASCII code 111, and XORing 111 with 111

SyntaxError: Generator expression must be parenthesized

狂风中的少年 提交于 2019-12-08 14:36:01
问题 I just installed django and after installing that I created a django project and was trying to run django server by command: python manage.py runserver After that I'am getting error as: SyntaxError: Generator expression must be parenthesized 回答1: TL; DR Update Django to the latest revision. This error is a known incompatibility related to Python issue #32012. Projects based on Django 1.11.16 and below will raise this exception when started with Python 3.7. A patch for this issue has been

Computational cost of trig functions [duplicate]

别等时光非礼了梦想. 提交于 2019-12-08 14:36:01
问题 This question already has answers here : Closed 9 years ago . Possible Duplicate: How do Trigonometric functions work? What actually goes into the computation of trig functions like Sin, Cos, Tan and Atan? I think I've found an optimization in my code where I can avoid using any of these functions and base the problem around slope instead of angles. So that means a couple division operations in place of the above trig functions. But I'd like to know more about what goes into those trig

How many passes over the code does gcc use?

落花浮王杯 提交于 2019-12-08 14:36:01
问题 Specifically for C and C++, how many passes are used by default? Does this number change depending on the level of optimization used? (it should) Can it be changed directly? I was searching for this information in http://gcc.gnu.org/, but googling using site:http://gcc.gnu.org/ did not yield anything. Any pointers to any documentation about this will also be helpful. By pass I meant a pass over the original representation of the source code only and not the multiple pass definition suggested

Syntax error or access violation: 1059 Identifier name is too long

六眼飞鱼酱① 提交于 2019-12-08 14:36:00
问题 I receive a MySQL error when I create a table: SQLSTATE[42000]: Syntax error or access violation: 1059 Identifier name 'FK_SALES_FLAT_CREDITMEMO_GRID_ARCHIVE_STORE_ID_CORE_STORE_STORE_ID' is too long How can the default Identifier name size be increased or how can I solve this otherwise? 回答1: Please take a look at http://dev.mysql.com/doc/refman/5.5/en/identifiers.html - you are limited to 64 chars to an identifier. 回答2: Provide your own shot name to key. $table->unique(['product_id',

How to pass observable value to @Input() Angular 4

放肆的年华 提交于 2019-12-08 14:35:59
问题 I am new to angular and I have the following situation which is I have a service getAnswers():Observable<AnswerBase<any>[]> and two components that are related to each other. online-quote dynamic-form online-quote component calls the service getAnswers():Observable<AnswerBase<any>[]> in its ngOnInit() method and the result of this, is passed to the component dynamic-form . To illustrate the situation this is the code of my two components: online-quote.component.html: <div> <app-dynamic-form

How to enable Version Control window in android studio

烂漫一生 提交于 2019-12-08 14:35:59
问题 For certain of my branches, I cannot get a version control window. So for example, if I go into branch develop , then the window shows; if I go into master it’s gone and there is nothing I can do to bring it back. I try to trick it by going from develop to master. But as soon as I get to master, it is gone again. The problem is relatively new (7 days). It didn’t use to be like that. Any ideas how I might fix it? I usually use the window for easy access to my log of commits 回答1: I got it

Arithmetic overflow on column sum in sql server

醉酒当歌 提交于 2019-12-08 14:35:58
问题 I'm trying to get a column total but when i run this query i get the following error. Any advice? SELECT SUM(Size) as total FROM AllDocs Where DirName LIKE 'sites/test/test%' ERROR: Msg 8115, Level 16, State 2, Line 1 Arithmetic overflow error converting expression to data type int. Warning: Null value is eliminated by an aggregate or other SET operation. 回答1: While all your sizes can fit into INT (up to 2^31 - 1 ), their SUM cannot. Cast them into BIGINT : SELECT SUM(CAST(Size AS BIGINT)) as

Java Regex include all letters of the alphabet except certain letters

醉酒当歌 提交于 2019-12-08 14:35:58
问题 What I need to do is to determine whether a word consists of letters except certain letters. For example I need to test whether a word consists of the letters from the English alphabet except letters: I, V and X. Currently I have this long regex for the simple task above: Pattern pattern = Pattern.compile("[ABCDEFGHJKLMNOPQRSTUWYZ]+"); Any of you know any shorthand way of excluding certain letters from a Java regex? Thanks. 回答1: You can use the && operator to create a compound character class

工具导航Map

JSON相关