Firebase Custom Parameters with the Firebase Event - c#

I integrated Firebase for Unity, it worked well; but I have problems understanding custom parameters.
I am using Firebase' s level_up event(it is not related but works for my purpose) and I added custom parameters to it like:
Parameter(string levelfailedornot, int currentlevel)
So a parameter for level_up event looks like this:
Parameter("fail", 151)
I thought I could see which level failed how many times, which level is easier than others etc. The problem is that I can see this custom parameters with values in the "last 30 minutes activities"("fail 151 - 32 times reported" "success 3 - 3 times reported" etc.) at firebase analytics console but I can' t see them other than that panel. How can I achieve this? I added custom parameters reporting to the level_up event but they show only how many times "fail" or "success" reported.

Looks like you are logging events only in the debug/test mode.
For events to appear and stay in Firebase Dashboard, ensure all these steps mentioned in the Get Started guide for Unity are followed in same order.
Since currentLevel is int type parameter it is reported as int and levelfailedornot is String parameter reports "fail" or "pass". The screen for event would display all the parameters in view cards along with values received from various devices using your app.

The last 30 minutes activities are updated early, but it takes 6-7 hours before they are added to the long time analysis.
Also, the numeric parameters are only visible as Average and Sum, which are not helpful in your case. If you want to count custom parameter events, it has to be Text type.

Related

Reading specific message from EventHub

I am wanting to read a specific message from an EventHub.
I'm using the EventHubConsumerClient and the ReadEventsFromPartitionAsync using a partitionId, and Offset I have.
client.ReadEventsFromPartitionAsync(partitionId, EventPosition.FromOffset(offset), cancellationSource.Token);
The issue I have is, that despite the Offset and Partition ID being correct, I'm not getting the messages I expect back.
Context
I working on something to validate that messages are being properly processed in a distributed system.
Source Event Hub -> Processor Function -> Destination Event Hubs.
I read both ends (hubs) and validate messages arrive where they should, if they don't, look up the message from the Source Event Hub, (by partitionId and offset matching against a message ID).
It is the messages I'm looking up that don't appear to have message IDs or offset IDs I expect.
UPDATE:
I was mistaken in my recall of the defaults for EventPosition and referenced docs for the wrong SDK package below. By default, EventPosition.FromOffset is inclusive. (src)
The creation pattern in the question would include the event at the provided offset. If you're not seeing the event returned, then the offset would seem to be incorrect.
Original Answer (incorrect):
The EventPosition that you're building is non-inclusive and will not include the event at that offset, but rather start at the next available event. Using the following overload should target the event that you're looking for:
EventPosition.FromOffset(offset, true)
It looks as if the summary in the docs doesn't do a great job of calling attention to the default; I'll take a follow-up to make that more clear.
The issue was due to the incorrect offsets being provided from the AZ Function binding metadata.
Using a batch of one - correct.
Using a batch of more than one, completely wrong offsets, sequences etc.
Updated the eventhubs package (preview..) and it works fine :/

Trouble referencing labels with Active Reports

Ok, so to start off, this is my first time working with C#, and the top it off I am attempting to work with it in a report editor for MYOBs AEPM software, which doesn't exactly give me a lot of info or flexibility. What I have been able to work out is that it uses some version of Data Dynamics Active Reports, but not sure which one. I also cannot seem to figure out what naming they have used for much of the report. Anyway, back to the main issue.
I am needing to add some calculations to the report that the visual editor wont allow me to do(it is restricted to Count, Sum, Min, Max, Avg, Var, so not really helpful). Now the calculations are pretty simple(One is a total x .7, and the other being the result of the first x 74 but this value might be changed in the future). Figured the best way would be to just have 2 text boxes with a value in each of them of "0", and then just once the main report is pretty much done run the calculations and replace the values of the two text boxes. So I made the text boxes in the appropriate section and labelled them CalcTotal1 and CalcTotal2.
Now in the editor it allows me to select the object and an event to trigger it, so selected ReportFooter as the object and AfterPrint as the event. I then just put in a line to chance the CalcTotal1 value and tried to generate the report resulting in the following error:
Error Message: Report Script Compile Error on line 8 Error = The name 'CalcTotal1' does not exist in the current context
public void ReportFooter_AfterPrint()
{
CalcTotal1.Text = "Hello";
}
I have tried looking at the documentation for Active Reports but I am not having much luck, so any ideas would be incredibly welcome.
just add "this" word in the code like
this.CalcTotal1.Test = "Hello";
http://helpcentral.componentone.com/nethelp/AR8Help/AR8_HelpOnlineEN/Scripts.html provides some more tips.
The MYOB AE PM feature referred to is called Smart Reports.
I was able to replicate the error and consequently resolved the problem by using the following syntax:
((TextBox)rpt.Sections["Detail"].Controls["TextBox2"]).Text= "$2000.00";
eg:
public void Detail_AfterPrint()
{
((TextBox)rpt.Sections["Detail"].Controls["TextBox2"]).Text= "$2000.00";
}

Get visible lines in Scintilla.NET component

How can I get the first visible (top) and last visible (bottom) lines number for Scintilla component in C#? For example, if I scroll the text and I am able to see lines 5-41 (no folding, it is the number of lines which are shown by the component at the moment; the rest, you have to scroll to them), how do I get those numbers programatically?
If you ever want to find out how to do something with Scintilla, your first stop should always be the core Scintilla Documentation. It is comprehensive, and usually kept fully up to date.
The correct way to do what you want is to use the SCI_GETFIRSTVISIBLELINE message to get the first line, and then use the SCI_LINESONSCREEN message to calculate the last line.
There are probably Scintilla.NET wrapper methods for those messages. But the Scintilla.NET documentation seems very poor, and doesn't provide a complete description of its API - although I suppose you could always use the SendMessageDirect method (which is documented) to send the messages directly if you can't guess what the wrapper method is called.
For ScintillaNET 2 it would be:
scintilla.Lines.FirstVisibleIndex
scintilla.Lines.VisibleCount
In ScintillaNET 3 names were refactored to be more like core scintilla:
scintilla.FirstVisibleLine
scintilla.LinesOnScreen

Change DataGridViewCell user input handling behavior

I have a winform app with a TimeSpan column that displays the hours/minutes part of a date. When the user enters text it is converted to a TimeSpan using TimeSpan.TryParse(). This works as expected when the user input is "11:00" in setting a value of 11 hours. The problem is that if the use enters "1100" it is parsed as 1100 days which is not what I want, nor is simply saying "bad input" in the `CellValidating event satisfactory behavior.
The users input is provided in the readonly property DataGridViewCellValidatingEventArgs.FormattedValue so I can't change the value being passed through the call chain. DataGridViewTextBoxCell.EditedFormattedValue is also read only and I can't find any other event or property that lets override the default behavior.
This is very frustrating. I can write a many stepped fall through validater that can handle multiple user input formats and get the intended value from each; but unless I throw away all the strongly typed data binding that the framework offers and instead create a shim object that stores all values as strings there doesn't seem to be any way to do so.
Somehow among the 10 billion events in the DataGridView I managed to overlook CellParsing. Overriding it lets me do what I need to do.

How to implement Stack Overflow's "are you a human" feature?

On this site if you do too many clicks or post comments too fast or something like that you get redirected to the "are you a human" screen. Does anybody know how to do something similar?
It's almost certainly a heuristic that tries to "guess" that a user is some form of automated process, rather than a person, for example:
More than "x" requests to do the same thing in a row
More than "x" actions in a "y" period of time
Ordinarily the "x" and "y" values would be formulated to be ones that it would be unlikely for a "real person" to do, like:
Editing the same answer 5 times in a row
Downvoting 10 questions within 1 minute
Once you've got your set of rules, you can then implement some code that checks them at the start of each request, be it in a method that's called in Page_Load, something in your masterpage, something in the asp.net pipeline, that's the easy bit! ;)
Here is a very nice Captcha Control for asp.net that first of all you need
http://www.codeproject.com/KB/custom-controls/CaptchaControl.aspx
Then you can use it together with this idea that try to find the dos attacks
http://weblogs.asp.net/omarzabir/archive/2007/10/16/prevent-denial-of-service-dos-attacks-in-your-web-application.aspx
be ware of a bug in this code in line if( context.Request.Browser.Crawler ) return false;, its must return true, or totally remove it for sure.
and make it your compination for the clicks, or submits.
If a user make too many clicks on a period of time, or many submits, then you simple open the capthaControl, and if the clicks are by far too many, then triger the dos attact. This way you have 2 solution in one, Dos attact prevent, with captcha at the same time.
I have made somthing similar my self, but I have change the source code of both, a lot to feet my needs.
One more interesting link for a different code for the dos attack.
http://madskristensen.net/post/Block-DoS-attacks-easily-in-ASPNET.aspx
Hope this help you.
At a guess...
Write a HTTP handler that records requests and store them in session.
When a new request comes in, check to see how many requests are stored (and expire old ones).
If the amount of requests in the past few minutes exceeds a given threshold, redirect the user.
If you're doing this in ASP.NET webforms, you could do this check on the site master page, ( or write a IHttpHandler).
If you're using an MVC framework, you could write a base controller that does this check for every action.
With rails, you could write a before_request filter.
With asp.net MVC, you could write a [ActionFilterAttribute] attribute
You should have a session to track the user activity.
In session you can have counter for commenting and posting like:
(pseudo code instead of C#, sorry :)
if (post_event) {
posts_during_1_minute_interval++;
if (time_now-reference_time > 1_minute) {
reference_time = time_now;
posts_during_1_minute_interval=0;
}
}
...
if (posts_during_1_minute_interval > 10) redirect("/are-you-human.htm");
where on are-you-human.htm page you can have recaptcha, as they have here on StcakOverflow.com
see also:https://blog.stackoverflow.com/2009/07/are-you-a-human-being/
just check how many hit / minutes you get from a specific ip or session or whatever and decide what are your preferred threshold and your good to go
I'd also check the user agent header of the request - if it doesn't look like a popular browser (or is empty) then throw the "are you a human?" page.

Categories

Resources