Eiffel: Unknown identifier on attached check into require statement - design-by-contract

require
valid_item: attached item as l_i and then l_i.valid_for_insert or l_i.valid_for_update
why do I have an unknown identifier here with l_i??!!!

Try with
valid_item: attached item as l_i and then (l_i.valid_for_insert or l_i.valid_for_update)
Note you can also do
item_set: attached item as l_i
valid_item: l_i.valid_for_insert or l_i.valid_for_update
you can reuse the object test local variable l_i from a previous precondition.

Related

Jmeter extraction and using on If Controller

Is there's a way I can simulate this scenario, Example If there's a value extracted it will execute "TC1" Request, but If I extracted blank value it will execute "TC2".
The easiest method which provides maximum flexibility is using Switch Controller
As per documentation:
If the switch value is out of range, it will run the zeroth element, which therefore acts as the default for the numeric case. It also runs the zeroth element if the value is the empty string.
If the value is non-numeric (and non-empty), then the Switch Controller looks for the element with the same name (case is significant). If none of the names match, then the element named "default" (case not significant) is selected. If there is no default, then no element is selected, and the controller will not run anything.
So given the following Test Plan structure:
Switch Controller, switch value - your extracted variable
Simple Controller with an arbitrary name
TC2 sampler(s) as child(ren) of the Switch Controller
Simple Controller with name default
TC1 sampler(s) as chidr(ren) of the Switch Controller
Demo:
More information: Running JMeter Samplers with Defined Percentage Probability

Deeplab v2 error: undefined layer "IMAGE_SEG_DATA"

As I tried to run "run_pascal.sh" in deeplapv2, I got the following error:
Unknown enumeration value of "IMAGE_SEG_DATA" for field "type".
I found a solution stating that I should change the type of the layer from "IMAGE_SEG_DATA" to "ImageSegData", but the solution didn't work.
Finally, I found the definition of this layer in "image_seg_data_layer.cpp". However, this layer isn't defined in the "caffe.proto".
I traced back to the "caffe.proto" of deeplab v1 and there is actually an enumeration value named IMAGE_SEG_DATA.
Please show me how to fix this problem!

Fluent bind not working as expected

Suppose I am binding using
bs.Bind(y)
.For(v => v.Visibility)
.To("Failures['TaxPercent'].Length")
.WithConversion("Visibility")
.WithFallback(false);
Where Failures is a dictionary which would contain the property name (e.g. TaxPercent) if, and only if, the property fails validation.
Therefore Failure['TaxPercent'] returns the validation failure message (e.g value missing).
I want to have an expandable textview in Android which is visible only when the error is detected. I used the above code and it is not working. The fallback value does not trigger when Failure['TaxPercent'] does not exist in the dictionary.
How do I get an expandable/collapsible textview based on the validation result using a dictionary in the viewmodel??? I would really like to use a dictionary because that would save me from creating IsErrorVisible for each property.
Oddly enough, using a dictionary works for retrieving the error message though, but not for visibility! In other words, this is working great
bs.Bind(y)
.For(v => v.Text)
.To("Failures['TaxPercent']");
Also, any reason why I cannot concatenate the binding, meaning can I do this???
bs.Bind(y)
.For(v => v.Text)
.To("Failures['TaxPercent']")
.For(v => v.Visibility)
.To("Failures['TaxPercent'].Length")
.WithConversion("Visibility")
.WithFallback(false);
EDIT
The error msg in the log is
MvxBind:Error:168.86 Problem seen during binding execution for binding Visibility for Failures['TaxPercent'].Length - problem ArgumentException: The value passed in must be an enum base or an underlying type for an enum, such as an Int32.
If the dictionary doesn't contain an entry for 'TaxPercent' then the expression Failures['TaxPercent'].Length will not evaluate (an exception will be throw) so UnsetValue will be used.
In the case of UnsetValue, the ValueConverter will not be called, and the Fallback will be used. This is the same pattern as in Wpf - http://msdn.microsoft.com/en-us/library/system.windows.dependencyproperty.unsetvalue(v=vs.110).aspx
For your particular situation, it looks like you could either:
change the Fallback to the correct value for the platform instead of to a boolean value (the question didn't specify which platform(s) you are using)
create a new Visibility ValueConverter that takes Failures as its binding source and 'TaxPercent' as its parameter
remove the .Length from your binding expression - just test on the existence of the entry.
you could switch to free text binding expressions - then you could do more complicated binding statements, including nested bindings, multiple value converters, multiple fallback values, ...
For this particular case, I would just drop the .Length
For "any reason why I cannot concatenate", that won't work as the return type of Bind is a single Fluent binding entry - not a Fluent binding set.

What does 'passing a reference by value' mean?

https://stackoverflow.com/a/6044657/1165790
I was under the impression that there are two ways one can assign/call things:
1) by value (the actual bit encoding of a type is assigned/sent to a variable/function and 2) by reference (the memory address of the data's location is assigned/sent to a variable/function.
What exactly is passing a 'reference by value'?
What it means is that you pass the reference (essentially a pointer abstraction) the same way you would pass any other primitive: by value.
Passed by Value Passed by reference
--------------- -------------------
Integer Object
Reference Object that the reference points to
Because references are passed by value, you get the same behavior as you would with
anything else that is passed by value; namely, that the function to which you're passing the reference uses a copy of the reference, and not the actual reference.
So if you change the reference within the function, the original reference outside the function does not change.
This is wordplay. A reference is the memory address, or, strictly speaking, an abstraction that has all the attributes of a memory address. So to pass a reference by value is just what you said: the bits of the address are passed to the callee. In the more general way of speaking that most computer language texts use, this is exactly the same as saying the object is passed by reference.

ComboBox(evt.target) - What does that mean?

Reading up on ComboBox component → Link
The last code example has this line request.url = ComboBox(evt.target).selectedItem.data;
What does ComboBox(evt.target) mean? Type casting? Why would you type cast?
For curiosity reasons, I replaced the last line of changeHandler() with it too: ComboBox(evt.target).selectedIndex = -1;. It works. Does it make the handler function more flexible, since I'm not referencing aCb instance?
you are casting the trigger of the event as a ComboBox. You do this to explictly say that this variable is of this type. You don't have to most of the times but when you do you get these advantages
When you are checking what the type is
You get all of the methods in the type Class (In this case Combo Box) as autocomplete options in your IDE
Will throw an error if evt.target is not of type ComboBox after all
Also is a visual indicator of what variable it is. Very helpful when revisiting code