Is there a way to retain all events and just add or delete events as desired in StreamInsight? In Esper there is a method called keepall() witch can be applied on a window. This method keeps all incoming events and you can have different queries for inserting events in the window or deleting them.
I tried using Hopping, Snaphot, Tumbling and Count Window in StreamInsight, but none of them has the above mentioned functionality.
Thanks.
You should be able to do something like you are asking about with a window using a User-Defined Operator. Here's a link to the MSDN documentation: http://msdn.microsoft.com/en-us/library/ee842720(v=sql.111).aspx
If you want to interact with the events in a procedural way without a window then take a look at User-Defined Stream Operators. The docs for that are here: http://msdn.microsoft.com/en-us/library/hh290514(v=sql.111).aspx
With more detail about what you are trying to accomplish, I can give you a better answer.
Related
I've got a page where a DataTemplate is being used to bind to the model for that content, e.g.:
<DataTemplate x:DataType="models:MyDataType">
... content ...
</DataTemplate>
In that content, I need to be able to bind a Click event. I need that click event to exist in the view model that is set as the page's DataContext:
<Page.DataContext>
<vm:MyViewModel x:Name="ViewModel">
</Page.DataContext>
but I'm really struggling with getting it to compile. Every approach I try results in the compilation error "Object reference not set to an instance of an object".
I know I can't use x:Bind because that will bind to the DataTemplate's DataContext, so I've been trying to use Binding and, based on other SO answers I've read, it seems like the answer should be:
Click="{Binding DataContext.Button_Click, ElementName=Page}"
where Page is defined as the x:Name for the Page. I've tried removing DataContext. I've tried adding ViewModel.
What am I misunderstanding? Is it not possible to do what I want to do? I've tried using code-behind instead but I'm using Template 10 and that pushes almost everything onto the view model, which makes it harder for me to access things like the navigation service from code-behind.
tl;dr; use Messaging.
#justinXL is right, 'ElementName' can work. But is it best?
The problem you are trying to solve has already been solved with messaging. Most MVVM implementations include a messaging solution. Prism uses PubSubEvents; MVVM Light has its own messenger. There are others, too.
The idea is that an outside class, typically described as a message aggregator, is responsible for statelessly receiving and multicasting messages. This means you need to have a reference to the aggregator but not a reference to the sender. It’s beautiful.
For example
A common use case might be a mail client and how the data template of a message in the list would include a trash/delete button. When you click that button, what should be called? With messaging, you handle the button_press in the model and send/publish a message (one that passes the item).
The hosting view-model has subscribed to the aggregator and is listening for a specific message, the Delete message that we just sent. Upon receipt, it removes it from the list and begins the process to delete it from cache/database, or whatever – including prompting the user with “Are you sure?”
This means all your data binding in your data template is local, and does NOT extend outside its local scope. Why does this matter? Because if you use Element Binding to reach the hosting page, it means you cannot 1) move this template to a resource dictionary or 2) reuse this template.
There are two other reasons.
you cannot use compiled x:Bind to do this because it already limits use of this painful binding approach – this matters because a data template is typically in a list, and performance should always be prioritized, and
It adds considerable complexity.
Complexity?
I am a big fan of sophisticated solutions. I think they are rare and are the trademark of truly smart developers. I love looking at such code/solutions. Complex is not the same as sophisticated. When it comes to complexity, I am not a fan. Data binding is already difficult to wrap your head around; multi-sourcing your data binding across scope boundaries is pure complexity.
That’s what I think.
Your binding expression is correct, except it won't work with a Button_Click event handler. You will need an ICommand defined in your page's ViewModel.
Since you are using Template10, you should be able to create a DelegateCommand called ClickCommand like this
private DelegateCommand<MyDataType> _clickCommand;
public DelegateCommand<MyDataType> ClickCommand
{
get
{
_clickCommand = _clickCommand ?? new DelegateCommand<<MyDataType>>((model) =>
{
// put your logic here.
});
return _clickCommand;
}
}
And the binding will be updated to
<Button Command="{Binding DataContext.ClickCommand, ElementName=Page}" CommandParameter="{x:Bind}" />
Note I have also added a CommandParameter binding to the button as you might want to know which MyDataType instance is associated with the clicked button.
I am using mix panel and want to track that how long user spent time in some page. I know that this can be achieved by Mixpanel.sharedInstance().timeEvent(eventName) and to stop tracking time of that event code is Mixpanel.sharedInstance().track(eventName) , now mix p panel suggest that pass as many properties as possible in just one mix panel call. I want to do that when user leaves a page and I stop taking that duration event at that time I use method Mixpanel.sharedInstance().track(eventName) , so I want to pass properties also in that event , is it good approach to pass properties with stop duration tracking event? Will that work as expected? Or I need to track properties separately? Suggest me some way.
I got solution for this, Mixpanel.sharedInstance().track(name, properties: arrProperties) handles both stop tracking duration of page and also track properties .
I am using xCP Designer 2.0 and I'm trying to create multiple objects at once. Say I receive the number 20 as input and need to create 20 of these objects with an increasing integer attribute from 1-20.
Is it possible to achieve this with a stateless process? How exactly?
You have at least 2 options:
write an custom Java code an execute in inside Call Java Service activity
create specific process flow to achieve it
If you decide for first, you can check how to integrate your custom (Java) code to the xCPDesigner via self paced tutorial which you can download from this link. You find useful things on this link too.
If you choose second approach, do it this way:
Add process variable like here
Model a stateless process like on the picture
Define loop_count++ activity like on the picture
Note that loop_count++ activity is of type Set Process Data.
Additionally, you need to set trigger tab on Join activity like in a picture:
You will know what to do in Create activity. ;)
EDIT: I just saw I overlooked you stated that you set 20 when initiating stateless process. Logic is the same, you just use Substract function in loop_count++ activity (you can consider changing activity name too) :)
I'm trying to implement a join operator that takes a list of Streams and outputs a single stream. The problem is the output order is not the same as the input order. StreamController.add is asynchronous, so if I do
sc1.add(1)
sc2.add(2)
sc2.add(3)
sc2.add(4)
sc1.add(5)
...
the order in which the respective stream ondata callbacks get invoked is something like 1,2,5,3,4 which is basically an interleaving of sc1 and sc2. This ordering is pretty consistent across executions, which leads me to believe the implementation is doing round robin dispatch on a single thread. (this is on dart VM)
If the ordering is already scrambled by the time the ondata callback is called in my join implementation, I can't implement this join correctly. Does anyone have good ideas on how to implement this?
I believe that you are using some recent version of the SDK.
sync flag was introduced for SteamController constructors since v0.5.11, and it controls this behavior (see docs here and here). By default it is set to false, which means that listeners are called asynchronously, i.e. some time after the add call has finished:
If sync is false, no guarantees are given with regard to when multiple
listeners get the events, except that each listener will get all
events in the correct order. If two events are sent on an async
controller with two listeners, one of the listeners may get both
events before the other listener gets any
If you don't own the controllers, then I am not sure if there is much you can do.
add is only synchronous if the StreamController is created with the named parameter sync and value true.
http://api.dartlang.org/docs/releases/latest/dart_async/StreamController.html#StreamController
This is probably a very "dumb" question for whoever knows VirtualShellTools but I only started using it and couldn't find my answer in the demos' code. Please note that I'm also unfamiliar with virtualtreeview.
I use a VirtualExplorerTreeview to display a directory structure, linked with a VirtualExplorerListview to display a certain type of files in the selected directory as well as specific informations about them
I've been able to point them at the right place, link them as I wanted, filter everything in the listview, and looking at the demos I have a pretty good idea about how to add my own columns and draw it to display my custom data.
My issue lies with the Treeview: I would like to sort the directories displayed in the order I want; specifically, I want "My Docs" and other folder to appears first, then drives, then removable media. Looking in the TNamespace property I found how to distinguish them (Directory and Removable properties), but I don't know how to implement my own sort/what event I need. I tried CompareNode but that doesn't even seem to be called.
If you want to do everything yourself, then set toUserSort in the TVirtualExplorerTree.TreeOptions.VETMiscOptions property. That causes the control to just use the DoCompare method inherited from the virtual tree view, and that should call the OnCompareNodes event handler.
A better way is to provide a custom TShellSortHelper. Make a descendant of that class and override whichever methods you need. Create an instance of that class and assign it to the tree's SortHelper property. (The tree takes ownership of the helper; free the old one, but not the new one.) If the items are being sorted on a column that that class doesn't know how to compare, then handle the tree's OnCustomColumnCompare event.
To help you figure out exactly which methods you need to override or events you need to handle, set a breakpoint in TCustomVirtualExplorerTree.DoCompare and step through to see what gets called in various situations.