standards-compliance

Strange error: cannot convert from 'int' to 'ios_base::openmode'

I am using g++ to compile some code. I wrote the following snippet: bool WriteAccess = true; string Name = "my_file.txt"; ofstream File; ios_base::open_mode Mode = std::ios_base::in | std::ios_base::binary; if(WriteAccess) Mode |= std::ios_base::out | std::ios_base::trunc; File.open(Name.data(), Mode); And I receive these errors... ...

C++0x is assignment of braced-init-list to an array correct?

n3092 (final draft) says, under 5.17/9 A braced-init-list may appear on the right-hand side of - an assignment to a scalar [...] - an assignment defined by a user-defined assignment operator [..] While in GCC 4.5.1-pre9999, I can compile this (using -std=c++0x, NOT -std=gnu++0x) #include <iostream> int main() { ...

What is the best way of embedding a java applet into my webpage?

I've been looking into putting a little Java application in my web page, but the more research I do, the more confused I become about how I should do it. Sun suggests many ways of doing it, but it looks suspiciously like it's from the Netscape era. So, should I use <applet>, as suggested by eclipse, <embed>, or <object>? And how should...

Can a destructor be recursive?

Is this program well-defined, and if not, why exactly? #include <iostream> #include <new> struct X { int cnt; X (int i) : cnt(i) {} ~X() { std::cout << "destructor called, cnt=" << cnt << std::endl; if ( cnt-- > 0 ) this->X::~X(); // explicit recursive call to dtor } }; int main(...

Standard defining json file extensions?

Is there a standard or specification which defines json file extensions? I've seen .json used - is this just a commonly accepted practice or is it a requirement of some standards body for json saved in file format? ...

Declaration of Methods should be Compatible with Parent Methods in PHP

Strict Standards: Declaration of childClass::customMethod() should be compatible with that of parentClass::customMethod() What are possible causes of this error in PHP? Where can I find information about what it means to be compatible? ...

Clean way to launch the web browser from shell script ?

In a bash script, I need to launch the user web browser. There seems to be many ways of doing this: $BROWSER xdg-open gnome-open on GNOME www-browser x-www-browser ... Is there a more-standard-than-the-others way to do this that would work on most platforms, or should I just go with something like this: #/usr/bin/env bash if [ -n $...

Does HttpUtility.UrlEncode match the spec for 'x-www-form-urlencoded'?

Per MSDN URLEncode converts characters as follows: Spaces ( ) are converted to plus signs (+). Non-alphanumeric characters are escaped to their hexadecimal representation. Which is similar, but not exactly the same as W3C application/x-www-form-urlencoded This is the default content type. Forms submitted with ...

JQuery HTML editor css standard compliant

I'd simply like not to have a JQuery based HTML editor that use <b>, <i>, <font> and all those deprecated tags. Can you help me please? ...

Strict ISO C Conformance Test

I am currently working on a C project that needs to be fairly portable among different building environments. The project targets POSIX-compliant systems on a hosted C environment. One way to achieve a good degree of portability is to code under conformance to a chosen standard, but it is difficult to determine whether a given translati...

Are tokens after #endif legal?

I currently do the following and the compiler (MSVC2008 / as well as 2010) doesn't complain about it but I'm not sure if it's a bad idea or not: #ifndef FOO_H_ #define FOO_H_ // note, FOO_H_ is not a comment: #endif FOO_H_ I used to always write it as #endif // FOO_H_ but I caught myself not doing that today and thought it was strang...

Valid characters for URI schemes?

I was thinking about Registering an Application to a URL Protocol and I'd like to know, what characters are allowed in a scheme? Some examples: h323 (has numbers) h323:[<user>@]<host>[:<port>][;<parameters>] z39.50r (has a . as well) z39.50r://<host>[:<port>]/<database>?<docid>[;esn=<elementset>][;rs=<recordsyntax>] paparazzi:ht...

Just noticed how completely Björked my website looks when rendered in IE. Ideas?

I use chrome and firefox. I love chrome and firefox. I just thought to check how my website looks in IE8 and the results are fucking horrific. I can't navigate, it doesn't render rotations properly and the whole thing is a clusterfuck. Does anyone have any ideas? My only thought at the moment is to do a complete redesign that will accom...

Is calling a function as default argument okay?

Background: When working with time, I wanted to pass "now" as an argument when it is known and ask the system if it is not yet known, so I passed it to an argument which as default calls the time-function. This seems to work with GCC (4.1.2) as illustrated in the following code (it looks a bit weird, but examples with time tend to be a b...

can the functors called from algorithms acting on a map accept pair<K, V> instead of value_type?

I tried to write a short function to invert an std::map<K, V> (I know about boost.bimap, this is for self-education), and found, to my surprise, that the code that GCC 4.4 accepted with -pedantic -ansi settings was rejected as const-incorrect by SunCC (5.8, from 2005). Since value_type is std::pair<const K, V>, SunCC insisted that I con...

GTK Widget object naming

I am writting a PyGTK application. I am using the glade interface designer for layouts. I want to know if there is any standard way of naming a Widget object. eg : For a button called "Configure" how should I name it ? eg : ConfigureBt, ButtonConfigure, ConfigureButton, etc I want the app to be accepted in the default ubuntu/debian/gn...

How important is standards-compliance?

Ok, this is a philosophical question, and I would like to hear different opinions. If it is not a secret or trouble, please provide your age, C++ knowledge (scale 0-100, your own opinion), and the amount of years you have been, let's say, closely related to C++. For a language like C++ the existence of a standard is a must. And good com...

Mark some Javascript blocks as "special"

For some complicated reason, I need to mark some Javascript as "special", like this: <script type="text/javascript" someattribute="special"> var special = "I'm special!"; </script> <script type="text/javascript" someattribute="special" src="special.js"> </script> Is it possible to do this in way that complies with XHTML standards? ...

Where can I find a downloadable prescription and OTC drugs database?

I am working on a project for (US based) online pharmacies and I am having a hard time finding a database of drugs grouped by layman categories. I downloaded FDA data from 'Drugs@FDA' and 'Facts@FDA'. It contains a wide list of approved medications but is not sorted/grouped by layman categories like you would find in online search libr...