RFC 2119 and use of "MAY" - rfc

I'm wondering about the scope of the interpratation of the RFC 2119's MAY word.
Let's take an example:
The yellow button of the system MAY be stop the process.
In this phrase, according to the definition of MAY, the yellow button of the system is optional. This mean we can have a system A which have this button, and also a system B which don't have it, and they both are covering the requirement of the phrase. Because this yellow button is optional.
But is it possible to respect the requirement of the phase with this third case:
The system C have a yellow button which start a music.
According to the RFC 2119's MAY word definition, do you think that the system C is following the requirement of the phrase?
Edit:
In other words, is it possible to respect this requirement:
The yellow button of the system MAY do foo.
...with a system C which have a yellow button that do bar (instead of foo)?

Short answer: "Yes".
RFC 2119:
MAY This word, or the adjective "OPTIONAL", mean that an item is truly optional. One vendor may choose to include the item because a
particular marketplace requires it or because the vendor feels that
it enhances the product while another vendor may omit the same item.
An implementation which does not include a particular option MUST be
prepared to interoperate with another implementation which does
include the option, though perhaps with reduced functionality. In the
same vein an implementation which does include a particular option
MUST be prepared to interoperate with another implementation which
does not include the option (except, of course, for the feature the
option provides.)
Note these three points:
1) "May" means "Optional" - the system can implement the yellow button, or not implement it. Either way: OK.
2) System A (which implements) the yellow button must be able to interoperate with System B (which doesn't).
3) Conversely, System B must be able to interoperate with System A.
Q: Make sense?

Related

Can Intellij IDEA (14 Ultimate) generate regex based TODO-comments?

A few years back i worked in a company where i could press CTRL+T and a TODO-comment was generated - say my ID to be identified by other developers was xy45 then the generated comment was:
//TODO (xy45):
Is something available from within Intellij 14 Ultimate or did they write their own plugin for it?
What i tried: Webreserach, Jetbrais documentations - it looks like its not possible out of the box (i however ask before i write a plugin for it) or masked by the various search results regarding the TODO-view (due to bad research skills of mine).
There is no built-in feature in IntelliJ IDEA to generate such comments, so it looks like they did write their own plugin.
Found something that works quite similar but is not boundable to a shortcut:
File -> Settings -> Live Templates
I guess the picture says enoth to allow customization (consult the Jetbrains documentation for more possibilities). E.g. browse to the Live Template section within the settings, add a new Live Template (small green cross, upper right corner in the above picture) and set the context where this Live Template is applicable.
Note: Once you defined the Live Template to be applicable within Java (...Change in the above image where the red exclamation marks are shown) context you can just type "t", "todo" and hit CTRL+Space (or the shortcut you defined for code completion).
I suggest to reconsider using that practice at all. Generally you should not include redundant information which is easily and more reliably accessible through your Version Control System (easily available in Idea directly in editor using Annotate feature). It is similiar to not using javadoc tag #author as the information provided with it is often outdated inaccurate and redundant. Additionaly, I don´t think author of TODO is that much valuable information. Person who will solve the issue will often be completly different person and the TODO should be well documented and descriptive anyway. When you find your own old TODO, which is poorly documented, you often don't remember all the required information even if you were the author.
However, instead of adding author's name, a good practice is to create a task in you issue management system and add identifier of this task to the description of the todo. This way you have all your todos in evidence at one place, you can add additional information to the task, track progress, assign it etc. My experience is that if you don´t use this, todos tend to stay in the code forever and after some time no one remembers clearly the details of the problem. Additionaly, author mentioned in the todo is often already gone working for a different company.
Annotated TODO with issue ID

Virtual Keyboard commands

I was just wondering what the difference between the virtual these keyboard commands is:
KEYEVENTF_EXTENDEDKEY and KEYEVENTF_KEYUP is.
Everywhere I have looked it just gives me a description based off integers and what not but I just want to know simply what each of them does.
You've tagged the question VB.NET, but these actually have nothing at all to do with VB.NET. They're constants defined in the Windows header files, for use with Win32 API functions.
As far as the difference, you can't tell much by looking at their values. The individual values are not particularly important, that's why the named identifiers are used. What's important is where they are used and what the documentation for those functions tells you that they mean.
The first one, KEYEVENTF_EXTENDEDKEY, is used with the KEYBDINPUT structure (which is used along with e.g. the SendInput function) to pass information about synthesized keyboard input. If this flag is used, it means that the scan code should be interpreted as an extended key. Technically, this means that the scan code is preceded by a prefix byte with the value 224 (&HE0 in hexadecimal notation).
The second one, KEYEVENTF_KEYUP, is another one of the flags available for use with this structure. It means that the key is being released (going up), rather than pressed (going down).
There is a general overview of keyboard input available here on MSDN. It explains in more detail what a virtual key code is, what an extended key is, etc.

Apple codes used in Applescript-able applications

I read some examples of code necessary to make an application Applescript-able, but I still don't understand if the Apple codes used to identify a command, a class, a property can be any value I want (with the exception of the code for the application class), and if they must be registered in some site.
Is there a list of codes with a particular meaning for Applescript?
This is what you want: AppleScript Terminology and Apple Event Codes. More can be found in this Apple document.
Four-letter codes consisting solely of lower-case letters are reserved to Apple. Otherwise you're perfectly free to choose one.
You don't have to register them, as far as I know.
Choose your own. They must be unique. There is no way to know if they are unique, but they must be.
Love it.

How to implement an NSTextView that performs on-the-fly markup to RTF conversions

I'm trying to build an NSTextView that can take "marked up" input that is automatically translated into beautiful RTF-style text while the user types.
The idea is to let the user enter text in "plain text" format, but to "beautify" it on the spot, e.g.
H1 A quick list:
* first item
* second item
would be translated into a first line with a header font, followed by a bulleted list.
I have found plenty of potential ways of doing this, but the Text System is incredibly complicated (with reason) and I don't want to start "cooking my own" if there is already something suitable built-in. BTW I would be happy with a Snow Leopard only API.
The first thing I thought of was "data detectors", but I can't find a public API for doing this.
Having reached the end of the road with that, I turned to the new "Text Input Sources API". This does all kinds of things, but the "data-driven input methods" section of the WWDC 2006 presentation "Take Charge of the Text Input" seems interesting in my context. Beyond that single presentation slide however nothing seems to exist anywhere, so it's a bit of a dead end again.
Finally, I had a look at the NSSpellChecker class which is also supposed to offer completion features and automatic corrections.. but I'm not sure how this could be re-purposed for my requirements either.
At the moment, I'm tempted to just re-parse the entire NSTextStorage manually and make the changes myself when the user stops typing.. but I'm sure there are cleverer heads around this forum..
Any advice or pointers in the right direction would be greatly appreciated.
Neither data detectors nor the spell checker are appropriate for this task. Assuming you're just looking for a way to pass the input to a parser/formatter you already have, interfacing with the text system isn't too difficult. You're on the right track with handling the editing to NSTextStorage.
Along those lines, there's no need to re-parse the entire thing when the user stops. The text system sends you the modified range and gives you the opportunity to act on those changes (and even reject them out of hand). Since all changes funnel through this (typing, pasting, dropping...), this is the point where you want to intercede.
Because you're dealing with headings and bulleted lists, I'd get the enclosing paragraph of the modified range. This gives you a nice, round unit of work that is easily discovered and perfectly fits what you're trying to accomplish.
Good luck!

Asynch GUI updates in Smalltalk

I wondered if anybody could help me with a technique to address the following problem in Smalltalk. Specifically Cincoms Visualworks.
I would like to code a simple GUI that has three fields and processes them as follows:
The first field inputs a number (5 say).
The second field simply displays twice the first field (so it displays 10 in this example)
Now, the interesting bit... the third field displays a value from a completely different class (let's call it class X). However, the value must be displayed on the GUI whenever that value in the class X changes - it mustn't wait for a key press from an update button. The value in class X could be sourced from (say) the workspace.
I though I could do this via aspect adaptors but I can’t seem to get the 'third field value' to update asynchronously.
Any techniques, hints or tips will be most warmly welcomed - (especially code snippets!!).
Thanks
Kevin
I've sorted this myself. After trying the dependency mechanism (works fine - but simply not needed), looking at announcements (thanks James at Cincom - personal communication) I found that all I needed to do was to simply create a method and send it a message with a parameter (my value) that method then simply updated the value holder (i.e. the aspect of the GUI field) with the "value:" message. The more I look into Smalltalk the more I like it!