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 .
Related
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) :)
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.
Is there any tutorial or sample on how to create a local multiplayer in an XNA game(Windows)?
I often see tutorials for networking game but never on how to enter a second player. How to ask the second player to sign in, to use the same object but with different controller...
Thanks.
I've not come across any tutorials, but I can outline some basic ideas for you.
If all of your players will be identical:
Modify your 'player' objects constructor to have a parameter for some playerIndex. When checking for input inside the player class, use this index. That way, you can create a bunch of 'players' without needing to write individual classes for each. You can then write general-purpose code like:
if (inputManager.IsMoveRight(playerIndex))
{
// do some stuff etc.
}
This will require some modifications to your input management structure. You should be aiming to generalise the code you already have.
If each player will have completely different implementations:
You'll need to take advantage of polymorphism in this case. If each player should select their character in a menu screen, you'll need to have some attribute in the player class that holds their chosen character (Note: If each player should be a preset default, i.e player 1 is always mario, player 2 is always sonic, it would probably be best to subclass your player class for each player). This attribute could be moved up a layer and stored in a 'controller' class if you wanted.
Menu logic:
Handling player sign-ins is really best done before any levels are loaded. I'm going to assume that you don't need players to drop in/out during the game. Basic outline:
When the game is in a character selection screen (or just the main menus) check for input from all controllers. If a controller presses 'start', sign them in. This could involve simply adding a playerIndex to an array for example. Then, when the game loads, check the array for active players and spawn any that are found.
Character selection can be implemented in very much the same way, although you'd probably want a specific menu sign-in screen. Check for input from active players during the sign in screen and allow them to scroll through and select a character. Store the result somewhere (player or controller class for example).
Other things to consider:
Are getting input from the keyboard as well as gamepads? If this is the case, it might be easier to default the keyboard to player one, and only allow sign in/out from gamepads.
I mentioned this before, but you will need to generalise your input management to prevent a major case of spaghetti code. In order for any of this to work, you should not be checking previous/current controller states from directly within your player class. The MSDN Game State Management sample is worth examining as it uses a similar system.
This isn't a very comprehensive guide, but hopefully I've raised some points for you to consider.
What do you think about this programming practice:
- I need to execute one transaction at first form and after that to force some updates that are placed at another form (for each item that is shown at another form). I.e. it would be like show that form and click at some button. Because it is mandatory to execute these functionalities from second form, I thought to do it without showing second form. Is that good programming practice or you have some other recommendation?
Also, is it enough just to set property> Visible:=False before ShowModal for the second form or I need to do some other actions?
Well, it's unusual to have a form that you don't show. Normally you separate your business logic from the UI.
To answer your question, I don't think you need to call ShowModal at all. Just define a method on the form class and call that. Ultimately forms are just Delphi objects and you can use them as such. If you don't want to show them, don't call ShowModal or Show.
Second question first: Setting Visible := False is of no benefit because the point of all ShowXXX methods is to make the form visible. As David says, you could perform the actions without calling Show at all, provided of course your form doesn't rely on any OnActivate or OnShow code in order to do it's job properly.
As for whether this is a good idea, I say no!
As I've already pointed out there is a concern you have to watch out for. I.e. that currently (or even due to maintenance at some point in the future) your form relies on being visible to do its job properly.
Of course, you could work around that by letting the form flicker open, and be programatically closed. Clearly an aesthetically poor choice.
Not to mention the problems of getting it right. You'll end up writing a bunch of patch-work code to wrap the form so that it can do what you need to do, when you should rather do the following...
Correct Approach
Your form is currently doing at least 2 distinct things:
Visual UI control (call it A)
and "mandatory functionalities" (call it B)
It doesn't matter much whether B is doing validation rules, extra processing, or whatever.
B is a process that does not require user interaction.
Therefore, you need to:
Copy B into a non-UI location (either a simple unit with a custom object or a data module). Call it B*
Modify the form to call B* instead of using B.
Test that your form still behaves correctly.
Delete B
And now you can have your new form call B* instead.
The above approach will save you huge headaches in the future.
I want to be able to utilize the acts_as_state_machine transition methods which are auto-generated (e.g. event!).. but I don't want it to save right away. I'm updating the state as part of another set of operations, and so I don't want to be doing double saves.
Is there any way to trigger these event methods without a save right afterward?
By looking at acts_as_state_machine's code (line 65) I found that it is defining event-methods without a bang too. This will update the state internally in the object without storing it to the database. Hope that helps :-)