Need a way to write custom metrics in my flink program - apache-flink

I need to know the way to implement custom metrics in my flink program.
Currently, I know we can create custom metrics with the help of RuntimeContext.
But in my aggregate() I do not have RuntimeContext. I am using window operator and applying aggregate() method on it. And I am passing AggregateFunction in aggregate() method.
So, Kindly guide me, how can I create custom metrics in my code?
Note: As we know we can not user RichAggregateFunction with aggregate() method

If your goal is to update a metric with every element, I think you'll have to implement a custom window operator in which you override the open and processElement methods.
It's not generally recommended to get involved in the operator internals, but sometimes it's the only way to get access to interfaces you need that are otherwise hidden.

Related

how to implement rules and events for form tracking in adobe Launch?

I am new to adobe Analytics. I am trying to track form errors that are occurring when the user submitting the form without filling the required fields.
So here what I did was, passed form values to list prop to capture the values. But I am not getting how to implement events to track against these values.
Can anyone please help me with how to implement rules and events in the adobe launch for tracking?
Yes, there are a few ways to do it.
The recommended way is to ask the Front-end team to send an error event that Launch can listen to. It can be done in a few ways. It's considered the best practice to install the adobeDataLayer extension: https://experienceleague.adobe.com/docs/launch/using/extensions-ref/adobe-extension/acdl/overview.html?lang=en
The extension provides ability to use a dataLayer very similar to GTM. Very comfortable.
The other way to do it is ask the devs to send a simple JS customEvent with error details in the detail property of the event.
Launch can natively listen to JS events and gives access to the event object.
Finally, the worst kind of implementation, that should be mostly considered as a hack, is the become visible trigger:
you're supposed to detect the actual error message with this trigger. I suggest not using it since the enters viewport listener is a bit heavy. And it also depends on the DOM structure since you'll have to provide the CSS selector for the error message.
This is not all, surely. You can build your own settimeout polling logic to look for the errors manually, or ask devs to send direct calls, but those are even worse solutions, so I'm not elaborating on them.

Return a view of an Activity that is not the Codename One main Activity

Inside a native interface, can I return as PeerComponent a View declared in an Activity that is not the main Activity used by Codename One? In other words, can I use a custom Activity?
My issue is that I have to use an Activity that implements an interface provided by the SDK that I’m trying to use.
Could you show me an example? Thank you
While that might be possible with some Android backflips I have a better idea that would also solve a lot of other similar use cases. Albeit this is a bit of a sledgehammer solution so it might be problematic in some cases.
For next weeks release we'll add the build hint: android.customActivity where you can define the full class name of your custom activity subclass. Your activity must derive from com.codename1.impl.android.CodenameOneActivity and the stub class will derive from that activity. This way you can implement and override any method you desire within the activity class.
The case where this would be a problem would be when two cn1libs choose to use this approach. Obviously only one can "win" so this isn't ideal. But this is a rare enough case that it shouldn't matter.

Change HP Fortify C rule priority

I was wondering if anyone had any information on how to change a priority on a rule in HP Fortify?
For example in C, the category "Uninitialized Variables" has the fortify priority order of LOW. I need to change to HIGH for auditing purposes. Is there any way to change a rule or do I need to create a new rule?
If I need to create a new rule, how would I make a rule that matches "Uninitialized Variables" and make it global for other users to use?
There's not really way for you to modify the existing rule pack. But that's okay. There's something much easier that I can suggest that does not involve trying to create or modify custom rules (which can get a very messy if you're not careful).
The easiest thing you can do is create a custom Folder Filter.
Open up your FPR in Audit Workbench. Select the correct Filter Set that you normally use.
Your chosen Filter Set will be home to
our new Visibility Filter. For example purposes I will use the Security Auditor View. Then select the Filters tab and click Create New Filter.
Use the values shown below, but feel free to adjust if needed, and then click Save:
At this point, you should be able to see the Uninitialized Variable findings in the High tab.
SPECIAL CONSIDERATIONS:
This change to the organization of your Fortify Findings right now, only is in effect for this one FPR. If you wish to have this filter rule exist in scan for other projects, then you will need to modify the default fortify filters be creating something called a custom Fortify Issue Template. Check your fortify documentation to get more information on this.
If you try to upload this to SSC (Software Security Center) where you might want to perform some reporting, then the default Issue Template that lives on SSC will be used to sort and organize your scan's issues, when generating reports. If you wish for your new custom Fortify Issue Template to be used for reporting and organization withing the web UI, then you will need to override the default Issue Template on the SSC server with your new custom Issue Template. Again, see your documentation for more information on this.
Finally, there is a way to potentially create a custom Fortify Control Flow rule (which will need to be used, together in combination, with a suppression rule) that will make it possible to essentially reassign the priority metadata for your particular issue, but this is quite difficult.

Call a java method using cassandra triggers

I know that java method can be called using database triggers in oracledb. I am new to cassandra and I want to get a similar functionality in cassandra. Would it be possible to call a specific methods using cassandra triggers or is there any way to achieve it? Any help is appreciated.
Yes, is possible, check CREATE TRIGGER for details.
Basically, when you will define the trigger you specify the class to load. This has to implement the ITrigger interface. You JAR files needs to be placed in the triggers folder on each node.

What is this type of multiple attribute filtering called? (see screenshot)

aws console uses this great filtering mechanism that lets users filter on multiple attributes. Does anyone know what this is called?
And if so, any implementations in Angular?
http://imgur.com/FEaaxxz
I had a very good experience with a framework called chosen to do this.

Resources