Difference between Fallback and Default - comments

Is there a difference between these two or are they synonyms ?
Example: If x not in data --> use (default/fallback) value

Related

What is a selective parameter in escape codes in ISO/IEC 6429:1992?

According to ECMA-48/5th
8.1
Types of control functions
...
f) (Pn...): Control sequence with any number of numeric parameters
g) (Ps): Control sequence with a single selective parameter
...
i) (Ps...): Control sequence with any number of selective parameters
And for example set mode function is defined this way with Ps... paramters:
8.3.125
SM - SET MODE
Notation: (Ps...)
Representation: CSI Ps... 06/08
No parameter default value.
SM causes the modes of the receiving device to be set as specified by the parameter values:
1 GUARDED AREA TRANSFER MODE (GATM)
2 KEYBOARD ACTION MODE (KAM)
3 CONTROL REPRESENTATION MODE (CRM)
...
I wanted to test this function with xterm, but in xterm set mode function is defined differently (link):
Pm Any number of single numeric parameters, separated by ;
character(s). Individual values for the parameters are listed with
Ps .
....
CSI Pm h Set Mode (SM).
Ps = 2 ⇒ Keyboard Action Mode (KAM).
Ps = 4 ⇒ Insert Mode (IRM).
Ps = 1 2 ⇒ Send/receive (SRM).
Ps = 2 0 ⇒ Automatic Newline (LNM).
Could anyone explain what selective parameter is and the difference between selective parameters (Ps...) and any number numeric parameters (Pn...) in ISO 6429?
Numbers in ECMA-48 are generally one of two types:
something that lets an application select a feature from a list of options (e.g., selecting underlining or normal text from the list of graphic renditions), or
something that lets an application specify the value of something (e.g., the number of rows by which to move the cursor)
That's been part of ECMA-48 since the mid/late-1970s. Not everyone on the committee understood that. Take a look at this page, and search for "BSR X3.64" to see an example of the state of confusion by committee members on ECMA-48.

Filter integer list in Thymeleaf

I am learning about Thymeleaf in Spring, and I am struggling with list fitlering.
The official Tutorial: Using Thymeleaf does not talk about collection filtering and projection, but I found out that Thymeleaf on Spring uses the Spring Expression Language.
This guide states the following:
The syntax of the selection (filtering) operator is : ${collection.?[property == value]}
The syntax of the projection (mapping) operator is : ${collection.![property]}
This is fine if I have a list of objects, for example a list of persons. Then I can perform things like that:
Selection (filtering): e.g., ${persons.?[age >= 18]} selects all persons of at least 18 years
Projection (mapping): e.g., ${persons.![name]} selects the name of every person
Question:
What if I do not have a list of objects (such as a list of persons) but a list of numbers or list of Strings? How can I perform selection (filtering) then? Things like numbers.?[>10] does not work.
After some more search, I found the answer in the Spring Expression Language documentation.
In 10.5.11 Variables the documentation states the #this and #root variables.
The variable #this is always defined and refers to the current evaluation object (against which unqualified references are resolved).
So, assuming I have a list numbers filled with integers, ${numbers.?[#this >= 10]} creates a new list that contains all numbers that are at least 10.

Why are kCIAttribute(Max|Min) and kCIAttributeSlider(Max|Min) sometimes different values

In CoreImage a CIFilter has both a set of Max/Min values and a set of SliderMax/Min values.
The documentation for the Max/Min says "The maximum/minimum value for a filter parameter" and the SliderMax/Min says "The maximum/minimum value, specified as a floating-point value, to use for a slider that controls input values for a filter parameter."
I'm wondering why these might be different values, as they are, for example, for the inputAngle parameter of CIHueAdjust, where max/min are 0/0 but sliderMax/Min is 3.14/-3.14?
And also what is the use of having the max/min values at 0/0 like they are for most of the filters?
I would wager that a value of 0 means there is no max/min, that any value representable by the datatype is valid for the filter.
As for why there's a separate slider value, it's because what you present to the user is often different than what's accepted. For example, the CIHueAdjust may accept any value for the actual adjustment, but a slider presented to the user has no reason to go outside the range of -3.14..3.14 (because anything outside this range is equivalent to a value inside the range).

Proper way to get possibly through Cocoa Bindings the last element of a relationship in Core Data

I have a managed-object X with a relationship to a list of [1:N) Y objects. (X and Y objects are stored using Core Data)
I would like to find the proper (and more convenient) way to obtain the latest inserted Y object. The "name" attribute of this Y object should be shown in the graphic possibly through Cocoa Bindings.
I know that all Ys are inserted into a NSSet, so there is no defined order. However, each Y has a "timestamp" attribute, so when I say "the latest inserted Y object" I actually mean "the Y with the latest timestamp".
Any help will be appreciated: I searched all the documentation but have not found anything that could help me.
In The KVC Programming Guide's Collection Operators section, the description for #max says
The #max operator compares the values of the property specified by the key path to the right of the operator and returns the maximum value found. The maximum value is determined using the compare: method of the objects at the specified key path. The compared property objects must support comparison with each other. If the value of the right side of the key path is nil, it is ignored.
The following example returns the maximum value of the date values (date of the latest transaction) for the Transaction objects in transactions:
NSDate *latestDate = [transactions valueForKeyPath: "#max.date"];
The latestDate value (formatted) is Jul 15, 2010.

Use size constraint with Integer in Grails

The reference doc says that the size constraint:
Uses a Groovy range to restrict the size of a collection or number or
the length of a String.
When I put a size constraint on an integer, I get a warning
Property [prop] of domain class TheClass has type
[java.lang.Integer] and doesn't support constraint [size]. This
constraint will not be checked during validation.
Is the doc wrong?
I know I could use range but it would generally be easier to be able to specify the amount of digits in the number rather than the actual value (like a social security number must have 7 digits or whatever it is, rather than making a range of 1000000 - 9999999).
If you want the number of digits, make sure it's positive and has a certain length:
myInteger( validator: {
return it > 0 && (it.toString.length) == 7
})
I found the answer whilst searching JIRA: http://jira.codehaus.org/browse/GRAILS-947. The doc is wrong.
We don't need minSize, maxSize and size constraints for numeric fields
anymore since this functionality is on min, max and range constraints
respective. So we marking these constraints (for numeric fields only)
as deprecated in 0.5 and will remove it in 0.6.
Looks like it's up to the custom validator.
You can also use max to constrain an integer like myIntProp(max:9999999)
As you pointed out in your Jira link, I think the correct answer for this is to use the range constraint for Integers.
I think this is a simple as replacing size with range.

Resources