These are chat archives for exceptionless/Discuss

9th
Feb 2016
Jamie Clarke
@jamie94bc
Feb 09 2016 10:45
@niemyjski any chance the settings base class in Exceptionless could become part of Foundatio? Seems like something most projects end up with!
Eric J. Smith
@ejsmith
Feb 09 2016 13:31
@jamie94bc yeah, we were talking about that the other day. The problem is that in .net core the configuration stuff they have is better. I kind of don't want to include things that will be covered by the framework. What are your thoughts?
Blake Niemyjski
@niemyjski
Feb 09 2016 15:29
:)]
dang
feel honored :D
Eric J. Smith
@ejsmith
Feb 09 2016 16:08
so what is the status of the issues that you ran into with them though?
did they just release anyway?
Blake Niemyjski
@niemyjski
Feb 09 2016 16:09
yeah
they have elasticcon with them next week
Eric J. Smith
@ejsmith
Feb 09 2016 16:09
LOL
Blake Niemyjski
@niemyjski
Feb 09 2016 16:09
they are going to meet up with me and continue when they get some time
they said the core functionality is working and they had to get it out
@inlineAsm found an issue with our clients: exceptionless/Exceptionless#190
        Target.Geo = latitude + "," + longitude;
looks like we have to do a to lower invariant
because it’s formatting them for eu strings
which blows up elastic search
        Target.Geo = latitude.ToString("G", CultureInfo.InvariantCulture) + "," + longitude.ToString("G", CultureInfo.InvariantCulture);
Eric J. Smith
@ejsmith
Feb 09 2016 16:14
well we don’t want any formatting on the numbet
we just want the number
Blake Niemyjski
@niemyjski
Feb 09 2016 16:14
for lat and long you want the full thing
Eric J. Smith
@ejsmith
Feb 09 2016 16:14
so we need to specifiy the formatting
Blake Niemyjski
@niemyjski
Feb 09 2016 16:14
because you have minutes and seconds
invariant will give us what we want right
The invariant culture is culture-insensitive; it is associated with the English language but not with any country/region. You specify the invariant culture by name by using an empty string ("") in the call to a CultureInfo instantiation method. CultureInfo.InvariantCulture also retrieves an instance of the invariant culture.
Eric J. Smith
@ejsmith
Feb 09 2016 16:16
need to look and see what format we are wanting.
I think it’s just 22.3333,33.3545
Blake Niemyjski
@niemyjski
Feb 09 2016 16:16
yeah
I think invariant culture is what we want
Eric J. Smith
@ejsmith
Feb 09 2016 16:17
no, we want to control the formatting ourselves.
Blake Niemyjski
@niemyjski
Feb 09 2016 16:17
Target.Geo = latitude.ToString("G", CultureInfo.InvariantCulture) + "," + longitude.ToString("G", CultureInfo.InvariantCulture);
return this;
Eric J. Smith
@ejsmith
Feb 09 2016 16:17
culture is only used for controlling commas and other friendly formats
Blake Niemyjski
@niemyjski
Feb 09 2016 16:17
yes..
and we are saying convert this decimal to english based culture
with the periods
"The invariant culture is culture-insensitive; it is associated with the English language but not with any country/region"
// Use standard numeric format specifiers.
specifier = "G";
Console.WriteLine(value.ToString(specifier, CultureInfo.InvariantCulture));
// Displays: 16325.62
Eric J. Smith
@ejsmith
Feb 09 2016 16:20
b.ToString("#0.0000"
Eric J. Smith
@ejsmith
Feb 09 2016 16:21
probably something like that.
not sure how many decimals.
Blake Niemyjski
@niemyjski
Feb 09 2016 16:24
90.090.ToString("G", System.Globalization.CultureInfo.InvariantCulture)
"90.09"
think that’s what we want
Eric J. Smith
@ejsmith
Feb 09 2016 16:42
Why would we want that? We don’t wany any culture involved and we don’t want any friendly formatting.
we know exactly what format we want.
so you specify it.
Blake Niemyjski
@niemyjski
Feb 09 2016 16:43
G is general
and the other is generic english culture
Eric J. Smith
@ejsmith
Feb 09 2016 16:43
yes, general as in format it how you would for the general culture.
we don’t want them to format it for us.
we know the format.
be explicit
G is still for friendly display purposes.
Blake Niemyjski
@niemyjski
Feb 09 2016 16:44
[2/9/16, 10:43:54 AM] Greg Marzouka: dont think we have tests that use different locales
[2/9/16, 10:44:10 AM] Greg Marzouka: but we do CultureInfo.InvariantCulture
[2/9/16, 10:44:15 AM] Greg Marzouka: so i think that should fix it
that’s from the elastic guy
Eric J. Smith
@ejsmith
Feb 09 2016 16:45
dude, we don’t want culture involved in any way… we don’t want the format open to interpretation of how the system thinks it should be formatted… we know what format we want.
When you say G you are saying to use whatever format the system thinks is appropriate… and you say invariant culture so it goes to see what the friendly format for that culture is…
but we know exactly what format we want, so why would you leave it open to interpretation?
Blake Niemyjski
@niemyjski
Feb 09 2016 16:49
ok
Eric J. Smith
@ejsmith
Feb 09 2016 16:49
6 decimals is the max precision
that’s how theyy are parsing it which I don’t think is what we are doing
ok
Eric J. Smith
@ejsmith
Feb 09 2016 16:50
you just said the keyword there
parsing
we aren’t parsing… we have doubles
Blake Niemyjski
@niemyjski
Feb 09 2016 16:50
((decimal)-180.123456789).ToString("#0.000000")
"-180.123457"
public EventBuilder SetGeo(string coordinates) {
if (String.IsNullOrWhiteSpace(coordinates)) {
Target.Geo = null;
return this;
}
        if (coordinates.Contains(",") || coordinates.Contains(".") || coordinates.Contains(":"))
            Target.Geo = coordinates;
        else
yes, but I think we should steal there logic for this
well we allow ip address there sigh
Eric J. Smith
@ejsmith
Feb 09 2016 16:52
yes, if we are taking a string we should.
but the method you showed me takes doubles
Blake Niemyjski
@niemyjski
Feb 09 2016 16:53
    public EventBuilder SetGeo(string coordinates) {
        if (String.IsNullOrWhiteSpace(coordinates)) {
            Target.Geo = null;
            return this;
        }

        if (coordinates.Contains(",") || coordinates.Contains(".") || coordinates.Contains(":"))
            Target.Geo = coordinates;
        else
            throw new ArgumentException("Must be either lat,lon or an IP address.", "coordinates");

        return this;
    }

    /// <summary>
    /// Sets the event geo coordinates.
    /// </summary>
    /// <param name="latitude">The event latitude.</param>
    /// <param name="longitude">The event longitude.</param>
    public EventBuilder SetGeo(double latitude, double longitude) {
        if (latitude < -90.0 || latitude > 90.0)
            throw new ArgumentOutOfRangeException("latitude", "Must be a valid latitude value between -90.0 and 90.0.");
        if (longitude < -180.0 || longitude > 180.0)
            throw new ArgumentOutOfRangeException("longitude", "Must be a valid longitude value between -180.0 and 180.0.");

        Target.Geo = latitude.ToString("#0.000000") + "," + longitude.ToString("#0.000000");
        return this;
    }
Eric J. Smith
@ejsmith
Feb 09 2016 16:54
yes, on the string one we should probably use logic similar to theirs.
Blake Niemyjski
@niemyjski
Feb 09 2016 16:54
but we allow an ip.. even though we probably shouldn't
Eric J. Smith
@ejsmith
Feb 09 2016 16:54
yes, nothing wrong with ip…we can easily detect if it’s an IP
do the split on , and if it has 2 parts then parse them into decimals.
if not, leave it alone.
on the server side we probably need to validate it.
if we can’t turn it into a geo, then we should remove it.
so IP address does a lookup and turns it into a geo and if we can’t figure out what it is then we should remove it.
we probably don’t need to be doing any parsing on the client side.
we expect certain formats for the SetGeo method. Either IP or decimal lat,long
which is exactly the reason why on their parsing they tell it to ignore culture.
Blake Niemyjski
@niemyjski
Feb 09 2016 16:59
elastic/elasticsearch-net#1813
they told me to log an issue
Eric J. Smith
@ejsmith
Feb 09 2016 16:59
that’s fine… they shouldn’t blow up.
but we should prevent it too.
Blake Niemyjski
@niemyjski
Feb 09 2016 17:00
so you think what we are doing is good enough for the client?
I’d like a little better parsing client side
Eric J. Smith
@ejsmith
Feb 09 2016 17:00
ToString("#0.0#####")
we need to control the formatting of those decimals in our client.
otherwise you end up with commas in them
which is why we are breaking
Blake Niemyjski
@niemyjski
Feb 09 2016 17:01
why #### instead of 0000
Eric J. Smith
@ejsmith
Feb 09 2016 17:01
if they use a string, then they need to put it in a supported format.
because you don’t need to pad out the zeros
12.02 = 12.02 and not 12.002000
Blake Niemyjski
@niemyjski
Feb 09 2016 17:02
ok
learned a few things
Eric J. Smith
@ejsmith
Feb 09 2016 17:03
good :-)
Blake Niemyjski
@niemyjski
Feb 09 2016 17:07
so our clients are good and we dodn’t need to change the string checking at all
Eric J. Smith
@ejsmith
Feb 09 2016 17:07
yeah, leave the string one alone.
but update the double one
Eric J. Smith
@ejsmith
Feb 09 2016 17:13
on the server side we need to remove it if we can’t understand it.
Blake Niemyjski
@niemyjski
Feb 09 2016 17:13
    public override string ToString() {
        if (!Latitude.HasValue || !Longitude.HasValue)
            return null;

        return Latitude.GetValueOrDefault().ToString("#0.0#####") + "," + Longitude.GetValueOrDefault().ToString("#0.0#####");
    }
yeah
updated it
wonder why ToString() is marked as not null in .net
Screen Shot 2016-02-09 at 11.13.56 AM.png
since we are using our own format
I don’t think we have to do the number casting like they are
Frank Ebersoll
@frankebersoll
Feb 09 2016 17:29
i wouldn’t expect ToString to return null any time
Blake Niemyjski
@niemyjski
Feb 09 2016 17:30
really
it’s not a valid lat or long
Frank Ebersoll
@frankebersoll
Feb 09 2016 17:31
then i would rather expect „(Invalid coordinate)“ or throwing an InvalidOperationException
Blake Niemyjski
@niemyjski
Feb 09 2016 17:31
on a tostring call
no way
I could see the first case but not an exception
null is a valid string
Eric J. Smith
@ejsmith
Feb 09 2016 17:35
Yeah, I think we show in the UI that we weren’t able to parse the geo
Frank Ebersoll
@frankebersoll
Feb 09 2016 17:35
msdn recommends neither null nor an exception nor string.Empty
Eric J. Smith
@ejsmith
Feb 09 2016 17:35
the problem is where is that stored?
Frank Ebersoll
@frankebersoll
Feb 09 2016 17:36
The returned string should be friendly and readable by humans.
The returned string should uniquely identify the value of the object instance.
The returned string should be as short as possible so that it is suitable for display by a debugger.
Your ToString override should not return String.Empty or a null string.
Your ToString override should not throw an exception.
If the string representation of an instance is culture-sensitive or can be formatted in multiple ways, implement the IFormattable interface.
If the returned string includes sensitive information, you should first demand an appropriate permission. If the demand succeeds, you can return the sensitive information; otherwise, you should return a string that excludes the sensitive information.
Your ToString override should have no observable side effects to avoid complications in debugging. For example, a call to the ToString method should not change the value of instance fields.
If your type implements a parsing method (or Parse or TryParse method, a constructor, or some other static method that instantiates an instance of the type from a string), you should ensure that the string returned by the ToString method can be converted to an object instance.
Eric J. Smith
@ejsmith
Feb 09 2016 17:36
this is a value passed into geo which ES is going to try and parse as a geo coords and if it’s not valid then saving the document blows up.
Blake Niemyjski
@niemyjski
Feb 09 2016 17:39
@ejsmith
A latitude or longitude with 8 decimal places pinpoints a location to within 1 millimeter,( 1/16 inch).
you told me 6
Eric J. Smith
@ejsmith
Feb 09 2016 17:40
6 is down to a damn house.
that is what I saw
pretty sure that I am ok with house level precision
Blake Niemyjski
@niemyjski
Feb 09 2016 17:47
elastic/elasticsearch-net#1814
I want down to the meter :D
going to log all my fishing spots into exceptionless
we should be good but I’m going to keep an eye out for it
Blake Niemyjski
@niemyjski
Feb 09 2016 19:23
@ejsmith exceptionless/Exceptionless#189
Sander Rijken
@srijken
Feb 09 2016 20:41
not much point in have huge precision though. When I’m at work the IP address is resolved to somewhere 25 miles away
Blake Niemyjski
@niemyjski
Feb 09 2016 21:04
yeah
Benchmarking
@ejsmith was this that benchmark library we found https://github.com/PerfDotNet/BenchmarkDotNet
I can’t seem to find it
Eric J. Smith
@ejsmith
Feb 09 2016 21:07
I think so.
Blake Niemyjski
@niemyjski
Feb 09 2016 21:07
be nice for sander to use it for the gethashcode stuff
as we’d like to convert some other things over to use it over time
Eric J. Smith
@ejsmith
Feb 09 2016 21:07
check both of them out maybe and see which one works better.
what are you doing this on?
Blake Niemyjski
@niemyjski
Feb 09 2016 21:09
ok
Eric J. Smith
@ejsmith
Feb 09 2016 21:15
Just added some comments to the manual stacking plugin pull request
Blake Niemyjski
@niemyjski
Feb 09 2016 21:15
k
Sander Rijken
@srijken
Feb 09 2016 22:31
from the looks of it NBench looks like it has more features
Blake Niemyjski
@niemyjski
Feb 09 2016 23:56
Which one is updated more?
Either is fine :)