specifications

Max name length of variable or method in Java

孤者浪人 提交于 2019-11-27 21:48:48
Is there a max length for class/method/variable names in Java? the JLS doesn't seem to mention that. I know very long names are problematic anyway from code readability and maintainability perspective, but just out of curiosity is there a limitation (I guess class names might be limited by the file system maximal file name limitation). If I'm not mistaken, the limit is not in the language itself but in the classfile format, which limits names to 64k, so for all practical intents and purposes identifier length is not a problem. Specifically, this is the definition of a constant string in the

Can beforeunload/unload be used to send XmlHttpRequests reliably

倾然丶 夕夏残阳落幕 提交于 2019-11-27 20:32:09
问题 recently, I had the urgent requirement to give my server a notice, that a specific page of my webapp is about to get closed. " Easy peasy " I thought, beforeunload is available for quite a while. The HTML5 "thing" even refreshed the spec (that was what I thought...) about it, in the way that we had the option to return a string value from a beforeunload event handler and stuff, which gives an user the option to intercept. See the MDN page about onbeforeunload However, as it turned out, there

Default width/height of an IFrame

旧城冷巷雨未停 提交于 2019-11-27 20:02:19
Is there any spec specifying the default width/height of an IFrame? Browsers I tested (FF, IE, Chrome) seem to use 300x150px but I couldn't find any spec on this. Should I ever come in the situation, can I rely on these values or should I always set width/height explicitly? I found the answer on the dev-tech-layout mailing list -- it's part of the CSS spec. The default ratio is 2:1 . The default width of 300px is defined in the last paragraph of the CSS spec, section on the width of inline replaced elements . Otherwise, if 'width' has a computed value of 'auto', but none of the conditions

enum.values() - is an order of returned enums deterministic

陌路散爱 提交于 2019-11-27 19:15:31
问题 I have a enum SOME_ENUM : public enum SOME_ENUM { EN_ONE, EN_TWO, EN_THREE; } Will SOME_ENUM.values() always return the enums in the order of enum declarations: EN_ONE, EN_TWO, EN_THREE ? Is it a rule or it is not guaranteed to be not changed in the next JDK releases? 回答1: The Java language specification uses this explicit language: @return an array containing the constants of this enum type, in the order they're declared [Source] So, yes, they will be returned in declaration order. It's

HTML: table of forms?

我们两清 提交于 2019-11-27 18:38:10
问题 I frequently find myself wanting to make a table of forms -- a bunch of rows, each row being a separate form with its own fields and submit button. For instance, here's an example pet shop application -- imagine this is a checkout screen which gives you the option to update the quantities and attributes of the pets you've selected and save your changes before checking out: Pet Quantity Color Variety Update snake 4 black rattle update puppy 3 pink dalmatian update I would love to be able to do

Any reason to write the “private” keyword in C#?

亡梦爱人 提交于 2019-11-27 18:26:10
As far as I know, private is the default everywhere in C# (meaning that if I don't write public , protected , internal , etc. it will be private by default). (Please correct me if I am wrong.) So, what's the reason to write that keyword, or why does it even exist for members? For example, when an event handler is auto-generated it looks like this: private void RatTrap_MouseEnter(object sender, CheeseEventArgs e) { } But why does it even write private if that's implied and default? Just so that novice developers (who don't know it's the C# default) know that it's private? Or is there a

Chunking WebSocket Transmission

房东的猫 提交于 2019-11-27 17:42:03
since I'm using WebSocket connections on more regular bases, I was interested in how things work under the hood. So I digged into the endless spec documents for a while, but so far I couldn't really find anything about chunking the transmission stream itself . The WebSocket protocol calls it data frames (which describes the pure data stream, so its also called non-control frames ). As far as I understood the spec, there is no defined max-length and no defined MTU (maximum transfer unit) value, that in turn means a single WebSocket data-frame may contain, by spec(!), an infinite amount of data

Access to method pointer to protected method?

十年热恋 提交于 2019-11-27 15:04:06
This code: class B { protected: void Foo(){} } class D : public B { public: void Baz() { Foo(); } void Bar() { printf("%x\n", &B::Foo); } } gives this error: t.cpp: In member function 'void D::Bar()': Line 3: error: 'void B::Foo()' is protected Why can I call a protected method but not take its address? Is there a way to mark something fully accessible from derived classes rather than only accessible from derived classes and in relation to said derived class? BTW: This looks related but what I'm looking for a reference to where this is called out in the spec or the like (and hopefully that

Vulkan: What is the point of sType in vk*CreateInfo structs?

倖福魔咒の 提交于 2019-11-27 14:20:13
In all of the create info structs ( vk*CreateInfo ) in the new Vulkan API, there is ALWAYS a .sType member. Why is this there if the value can only be one thing? Also the Vulkan specification is very explicit that you can only use vk*CreateInfo structs as parameters for their corresponding vkCreate* function. It seems a little redundant. I can see that if the driver was passing this struct straight to the GPU, you might need to have it (I did notice it is always the first member). But this seems like a really bad idea for the app to do it because if the driver did it, apps would be much less

Order of execution of parameters guarantees in Java?

吃可爱长大的小学妹 提交于 2019-11-27 13:24:05
Given the following function call in C : fooFunc( barFunc(), bazFunc() ); The order of execution of barFunc and BazFunc is not specified, so barFunc() may be called before bazFunc() or bazFunc() before barFunc() in C . Does Java specify an order of execution of function argument expressions or like C is that unspecified? Michael Easter From the Java Language Specification (on Expressions): 15.7.4 Argument Lists are Evaluated Left-to-Right In a method or constructor invocation or class instance creation expression, argument expressions may appear within the parentheses, separated by commas.