• map (unregistered)

    There wasn't any use for this frist at all.

  • Andrew (unregistered)

    If comment words <= 10 Reject frist else words/2 <= 20 Insert "If there's no use let someone else be frist then! " else frist!

  • map (unregistered)

    Even the spambot agrees!

  • davesol (unregistered)

    At least the code had comments

  • cheong (nodebb)

    Maybe he want something like this but used wrong formula?

    return (pow(pow(location.horizontalAccuracy, 2) + pow(location.verticalAccuracy, 2), 0.5) <= 10);

  • M (unregistered)

    If you've got multiple sources of position-related information, you shouldn't throw away a source of data just because the error bars are large. You should use a Kalman filter or something similar, appropriately tweaked to properly handle a data source vanishing entirely (e.g., GPS in a building with thick walls.)

  • Pierre Lebeaupin (unregistered)

    Goddammit let me grab a machine gun. At least apps like, say, Pokemon Go have a good reason to drain our battery so much, but here… you'd think QA would notice something. Rhaaaaa!

  • Dan (unregistered) in reply to cheong

    I can never fathom why people would use exponential functions when they don't have to. cheong / nodebb: Why not return location.horizontalAccuracylocation.horizontalAccuracy + location.verticalAccuracylocation.verticalAccuracy <= 100;

    Maybe I'm crazy for coming from a high-performance background where we didn't make unnecessary exponent calls for no reason, but I can never understand people who would continuously calculate linear distance with 3 exponential function calls.

  • Helix (nodebb)

    "Hikari was working on an augmented reality game for a very specific problem domain. In this use case, GPS was going to be unreliable."

    So a specialist dating app?

  • Cardboard (unregistered)

    This was pokemon go wasn't it.

  • cheong (nodebb) in reply to Dan

    Just to show the formula he ought to be trying to use. Taking the pow(,0.5) away will make it look less obvious.

    Never thought I would need to do optimization on here. :shrug:

  • jerzyszczur (unregistered) in reply to cheong

    If you're aiming for readability, write a separate function for that:

    inline bool isWithinRadius(int x, int y, int radius) { return xx + yy <= radius*radius; }

    And then:

    […] return isWithinRadius(location.horizontalAccuracy, location.verticalAccuracy, 10); […]

  • John (unregistered)

    I would make a metric that returns 1 at best accuracy and >1 otherwise. Then make it clear when this metric

    var accuracy = min(vert/3, horiz/5);
    if( accuracy > 2.0) // Check against a safety factor of 2.0
    {
    }
    
  • Ex-lurker (unregistered) in reply to Dan

    You're failing at math. You're right about doing away with the outermost pow() while swapping 100 in the comparison but by taking the other two pow() away you messed up the calculation.

  • Tim! (unregistered) in reply to Ex-lurker

    Nah, the comment system just ate the multiplication operator.

  • Ron Fox (google)

    It's only a game.

  • dkf (nodebb)

    TRWTF is Objective-C, amirite?

  • thosrtanner (unregistered)

    Staring hard at the first comment and I can only see one typo in that.

  • Daniel (unregistered) in reply to M

    Wow, I actually learnt something from the Comment section!

  • Scarlet_Manuka (nodebb)

    The article seems to be making a great deal of fuss about trying to understand what is actually a pretty simple and clear line of code.

    Yes, it's taking an average; adding two things together and then dividing by two is how you do that when you have two things. Lower is better, so it's quite reasonable to set a threshold value for what you consider to be good enough. There's not much wrong with this in itself; as others have said, the sum of squares would be a better measure, but if all you want is a rough idea of "signal or no signal", then this is probably adequate.

    It's even reasonable that they kept the GPS polling code around since they were contemplating using it for minor fixups. The only WTFs are that they polled the GPS so frequently, and that they didn't disable the GPS polling until they had code that made use of it. Oh, and the mismatch between "10" in the comment and "20" in the code, but that's trivial.

  • masonwheeler (github)
    • (BOOL)_locationIsAccurate:(CLLocation *)location

    What language is this?!?

  • Omego2K (unregistered) in reply to masonwheeler

    Objective C

  • Thou (unregistered)

    Well at least the comments "helped" Steve figure out the problem. Imagine there were no comments, he would be left wondering what is going on.

  • Anonymouse (unregistered)

    TRWTF is that horizontalAccuracy and verticalAccuracy are high when location is highly inaccurate.

  • Nigger (unregistered)

    Nigger

  • canon helpline (unregistered)

    Hey! Nice post. We provide Canon Customer Service.

    if you want any solution related to Canon than visit here: Canon Helpline Number

Leave a comment on “O User, Where Art Thou?”

Log In or post as a guest

Replying to comment #:

« Return to Article