standards

GREATEST and LEAST in SQL standard

ぃ、小莉子 提交于 2019-12-21 13:01:53
问题 My understanding is that GREATEST() and LEAST() are not part of the SQL standard, but are very common. I'm wondering, is there a way to clone the functionality of GREATEST keeping within the SQL standard? SELECT id, GREATEST(1,2,3,4,5,6,7) AS number FROM table The fully query: SELECT SUBSTR(section,1,2) AS campus, AVG(GREATEST(maximum - enrolled, 0)) AS empty FROM sectionrun WHERE coursenumber = '105' AND subject = 'ENGL' GROUP BY campus 回答1: You can use the CASE expression: SELECT SUBSTR

Disable Compatibility View Through Code In IE?

霸气de小男生 提交于 2019-12-21 09:12:14
问题 I for some reason am calling a doctype preferably XHTML 1.0 Transitional, and for some reason every single time I open it in Internet Explorer I get... Browser Mode: IE9 Compat View Document Mode: IE7 Standards I'll even include what my doctype looks like with the beginning of my head tags: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> And yes, I do close <body> and

Details of what constitutes a constant expression in C?

徘徊边缘 提交于 2019-12-21 09:07:31
问题 C defines at least 3 levels of "constant expression": constant expression (unqualified) arithmetic constant expression integer constant expression 6.6 paragraph 3 reads: Constant expressions shall not contain assignment, increment, decrement, function-call, or comma operators, except when they are contained within a subexpression that is not evaluated. So does this mean 1,2 is not a constant expression? Paragraph 8 reads: An arithmetic constant expression shall have arithmetic type and shall

why STL header files have no extension?

房东的猫 提交于 2019-12-21 08:05:09
问题 I got this basic doubt. The STL header doesn't have .h extension. #include <vector> #include <map> Is there is any specific reason behind this? Anybody knows history behind this, please share. EDIT : @GMan found Michael Burr's answer which addresses this question. 回答1: The #include directive doesn't discriminate file types (it's just a glorified copy-paste operation) - no automatic adding of .h is happening. C++ standard header files are provided without the .h extension Sometimes backward

Should `unique_ptr< T const [] >` accept a `T*` constructor argument?

徘徊边缘 提交于 2019-12-21 07:43:17
问题 Code: #include <memory> using namespace std; struct T {}; T* foo() { return new T; } T const* bar() { return foo(); } int main() { unique_ptr< T const > p1( bar() ); // OK unique_ptr< T const [] > a1( bar() ); // OK unique_ptr< T const > p2( foo() ); // OK unique_ptr< T const [] > a2( foo() ); // ? this is line #15 } Example errors with Visual C++ 10.0 and MinGW g++ 4.4.1: [d:\dev\test] > cl foo.cpp foo.cpp foo.cpp(15) : error C2248: 'std::unique_ptr<_Ty>::unique_ptr' : cannot access private

Should `unique_ptr< T const [] >` accept a `T*` constructor argument?

余生颓废 提交于 2019-12-21 07:41:03
问题 Code: #include <memory> using namespace std; struct T {}; T* foo() { return new T; } T const* bar() { return foo(); } int main() { unique_ptr< T const > p1( bar() ); // OK unique_ptr< T const [] > a1( bar() ); // OK unique_ptr< T const > p2( foo() ); // OK unique_ptr< T const [] > a2( foo() ); // ? this is line #15 } Example errors with Visual C++ 10.0 and MinGW g++ 4.4.1: [d:\dev\test] > cl foo.cpp foo.cpp foo.cpp(15) : error C2248: 'std::unique_ptr<_Ty>::unique_ptr' : cannot access private

Why is taking the address of a destructor forbidden?

半世苍凉 提交于 2019-12-21 06:52:34
问题 C++ standard at 12.4.2 states that [...] The address of a destructor shall not be taken. [...] However, one can without any complaints by the compiler take the address of a wrapper around a class destructor, like this: struct Test { ~Test(){}; void destructor(){ this->~Test(); } }; void (Test::*d)() = &Test::destructor; So what's the rationale behind forbidding to take the address of a destructor directly? 回答1: Constructors and destructors are somewhat special. The compiler often uses

Why is taking the address of a destructor forbidden?

那年仲夏 提交于 2019-12-21 06:52:18
问题 C++ standard at 12.4.2 states that [...] The address of a destructor shall not be taken. [...] However, one can without any complaints by the compiler take the address of a wrapper around a class destructor, like this: struct Test { ~Test(){}; void destructor(){ this->~Test(); } }; void (Test::*d)() = &Test::destructor; So what's the rationale behind forbidding to take the address of a destructor directly? 回答1: Constructors and destructors are somewhat special. The compiler often uses

REST - Returning Created Object with Spring MVC

折月煮酒 提交于 2019-12-21 05:03:34
问题 I have a REST call that accepts a JSON object, lets say, a person. After I create this object (validated and saved to the database), I need to return the newly created JSON Object. I think the standard practice is to return 201 Accepted instead of returning the object immediately. But my application needs the newly created object immediately. I have a controller methods that takes a POST call, calls a service class, which in turn calls a DAO that uses Hibernate to create the object. Once it's

Buying the C++11 Standard (ISO/IEC 14882:2011) from an Authorized Body

假装没事ソ 提交于 2019-12-21 04:34:15
问题 I am contemplating on getting ISO/IEC 14882:2011 from an Authorized body in a legal way, not by downloading any pirated copy. I am confused by the fact that at ansi.org they charge only $30.00 whereas iso.org charges 238 Swiss Frank (=$240)! Since both ISO and ANSI are authorized bodies, should I ignore the pricing discrepancy? Please suggest. Thanks. 回答1: Yes, you can ignore the pricing discrepancy. Both are official sources. 回答2: You can get the current draft for free, legally. It is even