Input[number] starting (not default) value - angularjs

I'm trying to accomplish something that is a bit out of the ordinary. I have a regular <input type="number"> field with a designated min and max value where the user can input a year. When initially hitting the up or down arrow on the input field, the value starts at the min attribute's value. What I'm trying to accomplish is to get it to start at the max attribute's value.
Are there any straight-forward ways to accomplish this using either HTML or AngularJS? I could write some javascript to do it, but I would prefer to avoid that. Note that I don't want to default the field to that value on load, only when interacting with the control.
Note that the min and max values are determined at run-time from a table, so they can vary.

Related

How do I access value of a selected <option> tag down 2 trees in a function?

PizzaBuilder1.js
Ingredients.js
Bases.js
PizzaBuilder2.js
PizzaBuilder3.js
I'll try to describe my issue in the least confusing way. So what I'm trying to achieve is create a function(pic4-PizzaBuilder2), where I compare the given key of this.state.ingredients.Bases (and other sub-objects, but that's not important for now) with value of selected option tag in Bases.js and when it matches, set the given value of that key to true. The hierarchy is like this: PizzaBuilder.js > Ingredients.js > Bases.js. I have already managed to match each option value with the key inside the object with the same name. However, what I'm still struggling with is how to access it in PizzaBuilder.js when the select option value I wanna compare it to is 2 trees down (see pic4-PizzaBuilder2, that is supposed to be const selectedOption, but I obviously still need to figure out how to access it). I'll be really grateful for any kind of advice.

Which event is triggered for auto populated Input Field?

I have an input field whose value is auto populated based on another Input feild. How to set that? Which event is used for auto populate?
My Input Field looks like this:
<Input
name="price"
ref="price"
initValue={this.state.projectPrice}
value={this.state.projectPrice}
rules={[
Rules.minValue(3,"message---")
]}
If I display in <p>{this.state.ProjectPrice}</p> I am getting the values,but I am unable to bind that with the Input Field. The input field should be auto-populated on change of another function.
Welcome to Stack Overflow,
If I am getting it right as you described, I have made this example.
What it does is read the changes from the first input, saves it's value in the state, and also populate a value for the second input, which is controlled by a value that depends on the changes from the first input and the only way to modify that value is by setting the value for the first input..
Don't hesitate if more clarifications are required.

Increasing custom variable field length piwik

I need to store an event data dump as a custom variable in piwik. But, what I realized is, piwik has a constraint that values of custom variables are set at a maximum of 200 characters in length.
Is there any way to change it? Or any workaround for the same?
Thanks
It is recommended to use Custom Dimentions instead of Custom Variables as the latter will be deprecated at some time in the future.
https://matomo.org/faq/general/faq_21117/
Unfortuntly Custom Dimentions also have a maximum length, but with 255 characters it is a bit longer.
Maybe at one point in the future it will be possible to save unlimited Custom Dimentions:
https://github.com/matomo-org/plugin-CustomDimensions/issues/79
https://github.com/matomo-org/matomo/issues/12348

Flink trigger on a custom window

I'm trying to evaluate Apache Flink for the use case we're currently running in production using custom code.
So let's say there's a stream of events each containing a specific attribute X which is a continuously increasing integer. That is a bunch of contiguous events have this attributes set to N, then the next batch has it set to N+1 etc.
I want to break the stream into windows of events with the same value of X and then do some computations on each separately.
So I define a GlobalWindow and a custom Trigger where in onElement method I check the attribute of any given element against the saved value of the current X (from state variable) and if they differ I conclude that we've accumulated all the events with X=CURRENT and it's time to do computation and increase the X value in the state.
The problem with this approach is that the element from the next logical batch (with X=CURRENT+1) has been already consumed but it's not a part of the previous batch.
Is there a way to put it back somehow into the stream so that it is properly accounted for the next batch?
Or maybe my approach is entirely wrong and there's an easier way to achieve what I need?
Thank you.
I think you are on a right track.
Trigger specifies when a window can be processed and results for a window can be emitted.
The WindowAssigner is the part which says to which window element will be assigned. So I would say you also need to provide a custom implementation of WindowAssigner that will assign same window to all elements with equal value of X.
A more idiomatic way to do this with Flink would be to use stream.keyBy(X).window(...). The keyBy(X) takes care of grouping elements by their particular value for X. You then apply any sort of window you like. In your case a SessionWindow may be a good choice. It will fire for each key after that key hasn't been seen for some configurable period of time.
This approach will be much more robust with regard to unordered data which you must always assume in a stream processing system.

Use disabled input to display data

To get a consistent look and feel of both input and output views I am trying to use an disabled input element to display model data/values.
The value is a calculated temperature value and has several decimal digits. Since that does not make sense from an engineer's point of view I want to limit the displayed decimal digits to a certain amount (let's say two digits, the displayed value does not need to be rounded).
Example:
calculated value: 123.123456
value to display: 123.12
I read around the Internet and found many suggestions using input's step attribute like
step=".01"
to limit the decimal digits. There seem to be many people doing it that way, but it does not work for me.
I think view and data model need to kept separated so adapting the model data (like converting the values to strings or using toFixed()) does not seem to be a nice solution. The view should be able to format the data itself, not changing the data model and should have reading access in this case only.
There is a filter for doing this when accessing model data through the {{ }} notation. But this does not seem to be applicable straight out of the way.
So, do you have any suggestions about limiting the decimal numbers?
For the sake of investigation and in order to provide a working sample code I created a Pen.

Resources