language-features

c# switch statement more limited than vb.net 'case' [closed]

假装没事ソ 提交于 2019-12-03 23:25:09
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 8 years ago . I was reading an interesting article here and it made an interesting point about the 'case' statement in vb.net vs the 'switch' statement in C#, which I've pasted below: The following Visual Basic Select Case statement can't be

Do these two C++ initializer syntaxes ever differ in semantics?

本秂侑毒 提交于 2019-12-03 20:07:15
问题 Assume that the following code is legal code that compiles properly, that T is a type name, and that x is the name of a variable. Syntax one: T a(x); Syntax two: T a = x; Do the exact semantics of these two expressions ever differ? If so, under what circumstances? If these two expressions ever do have different semantics I'm also really curious about which part of the standard talks about this. Also, if there is a special case when T is the name of a scalar type (aka, int , long , double ,

python ? (conditional/ternary) operator for assignments [duplicate]

泄露秘密 提交于 2019-12-03 18:43:57
问题 This question already has answers here : Does Python have a ternary conditional operator? (23 answers) Closed 5 years ago . C and many other languages have a conditional (aka ternary) operator. This allows you to make very terse choices between two values based on the truth of a condition, which makes expressions, including assignments, very concise. I miss this because I find that my code has lots of conditional assignments that take four lines in Python: if condition: var = something else:

How can I change a site's default language after creation (sharepoint 2010)?

天涯浪子 提交于 2019-12-03 15:25:41
after creating a site you can go to: Site Actions / Site Settings / Site Administration / Language Settings and select some alternate language(s) if you've got some language pack(s) installed, but the default one is fix and you can't cange it anymore. Is there a way or some settings.file where you can change the default language? OK, It's me again answering my own question(s)... http://sharepointchick.com/archive/2008/04/29/changing-the-language-of-an-existing-sharepoint-site.aspx It works so good this sql_way! After searching around for so long time I've finally found this soluion! done in a

If monkey patching is permitted in both Ruby and Python, why is it more controversial in Ruby?

我的未来我决定 提交于 2019-12-03 11:39:59
问题 In many discussions I have heard about Ruby in which people have expressed their reservations about the language, the issue of monkey patching comes up as one of their primary concerns. However, I rarely hear the same arguments made in the context of Python although it is also permitted in the Python language. Why this distinction? Does Python include different types of safeguards to minimize the risks of this feature? 回答1: As a Python programmer who has had a taste of Ruby (and likes it), I

Calling methods inside if() - C#

时光怂恿深爱的人放手 提交于 2019-12-03 10:51:00
I have a couple of methods that return a bool depending on their success, is there anything wrong with calling those methods inside of the IF() ? //&& makes sure that Method2() will only get called if Method1() returned true, use & to call both methods if(Method1() && Method2()) { // do stuff if both methods returned TRUE } Method2() doesn't need to fire if Method1() returns FALSE. Let me know there's any problem with the code above. thank you. EDIT: since there was nothing wrong with the code, I'll accept the most informative answer ... added the comment to solve the "newbie & &&" issue I'll

C1x: When will it land, what to expect?

廉价感情. 提交于 2019-12-03 10:21:45
C99 still isn't supported by many compilers, and much of the focus is now on C++, and its upcoming standard C++1x. I'm curious as to what C will "get" in its next standard, when it will get it, and how it will keep C competitive. C and C++ are known to feed on one another's improvements, will C be feeding on the C++1x standard? What can I look forward to in C's future? Jukka Suomela The ISO/IEC 9899:2011 standard , aka C11, was published in December 2011 . The latest draft is N1570 ; I'm not aware of any differences between it and the final standard. There's already a Technical Corrigendum

Auto translating website using Google Translate

[亡魂溺海] 提交于 2019-12-03 09:54:37
I need to find a way to translate a website to the appropriate language as the locale settings on a users machine. So in otherwords someone from Germany visits my site, his locale settings are GErman, nou the site displays in German, is this possible to do using Google Translate or are there other options available? I know that when I visit a site in another language using Google Chrome, it says "This site appears to be in [Drop Down With Languages]. Do you want Google to translate it?" They might have an api that can do that per page. However, if your site is at all professional, you should

Static methods added in interfaces in java 1.8 [closed]

夙愿已清 提交于 2019-12-03 09:14:33
As we know that in java 1.8 static methods are allowed in interfaces , I have seen some answers like static methods defined in interface from jdk 1 8 why did they need to do so but I am not satisfied. Furthermore I think it may cause problems like : public interface MyInterface{ public static void myMethod(); } class MyClass{ MyInterface.myMethod(); // since myMethod is static but a huge error is waiting for us here ? } But I still think there is a way out of this since this is added by professionals , so can anyone please explain how oracle solves this issue and what is the need to add this ?

Which languages support *recursive* function literals / anonymous functions?

假装没事ソ 提交于 2019-12-03 08:54:00
问题 It seems quite a few mainstream languages support function literals these days. They are also called anonymous functions, but I don't care if they have a name. The important thing is that a function literal is an expression which yields a function which hasn't already been defined elsewhere, so for example in C, &printf doesn't count. EDIT to add: if you have a genuine function literal expression <exp> , you should be able to pass it to a function f(<exp>) or immediately apply it to an